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 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 28 | #include "wmi_unified_api.h" |
| 29 | #include "wmi.h" |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 30 | #include "wmi_version.h" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 31 | #include "wmi_unified_priv.h" |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 32 | #include "wmi_version_whitelist.h" |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 33 | #include <wlan_defs.h> |
| 34 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 35 | #ifdef CONVERGED_P2P_ENABLE |
| 36 | #include "wlan_p2p_public_struct.h" |
| 37 | #endif |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 38 | #ifdef WLAN_PMO_ENABLE |
| 39 | #include "wlan_pmo_hw_filter_public_struct.h" |
| 40 | #endif |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 41 | #include <wlan_utility.h> |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 42 | #ifdef WLAN_SUPPORT_GREEN_AP |
| 43 | #include "wlan_green_ap_api.h" |
| 44 | #endif |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 45 | |
Naveen Rawat | 4f1e2ac | 2017-12-14 13:24:31 -0800 | [diff] [blame] | 46 | #ifdef WLAN_FEATURE_NAN_CONVERGENCE |
| 47 | #include "nan_public_structs.h" |
| 48 | #endif |
| 49 | |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 50 | /* copy_vdev_create_pdev_id() - copy pdev from host params to target command |
| 51 | * buffer. |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 52 | * @wmi_handle: pointer to wmi_handle |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 53 | * @cmd: pointer target vdev create command buffer |
| 54 | * @param: pointer host params for vdev create |
| 55 | * |
| 56 | * Return: None |
| 57 | */ |
| 58 | #ifdef CONFIG_MCL |
| 59 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 60 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 61 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 62 | struct vdev_create_params *param) |
| 63 | { |
| 64 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 65 | } |
| 66 | #else |
| 67 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 68 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 69 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 70 | struct vdev_create_params *param) |
| 71 | { |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 72 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 73 | param->pdev_id); |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 74 | } |
| 75 | #endif |
| 76 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 77 | /** |
| 78 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 79 | * @wmi_handle: wmi handle |
| 80 | * @param: pointer to hold vdev create parameter |
| 81 | * @macaddr: vdev mac address |
| 82 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 83 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 84 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 85 | 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] | 86 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 87 | struct vdev_create_params *param) |
| 88 | { |
| 89 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 90 | wmi_buf_t buf; |
| 91 | int32_t len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 92 | QDF_STATUS ret; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 93 | int num_bands = 2; |
| 94 | uint8_t *buf_ptr; |
| 95 | wmi_vdev_txrx_streams *txrx_streams; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 96 | |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 97 | len += (num_bands * sizeof(*txrx_streams) + WMI_TLV_HDR_SIZE); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 98 | buf = wmi_buf_alloc(wmi_handle, len); |
| 99 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 100 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 101 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 102 | } |
| 103 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 104 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 105 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 106 | WMITLV_GET_STRUCT_TLVLEN |
| 107 | (wmi_vdev_create_cmd_fixed_param)); |
| 108 | cmd->vdev_id = param->if_id; |
| 109 | cmd->vdev_type = param->type; |
| 110 | cmd->vdev_subtype = param->subtype; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 111 | cmd->num_cfg_txrx_streams = num_bands; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 112 | copy_vdev_create_pdev_id(wmi_handle, cmd, param); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 113 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Neil Zhao | 98ec4c4 | 2017-08-10 11:51:33 -0700 | [diff] [blame] | 114 | WMI_LOGD("%s: ID = %d[pdev:%d] VAP Addr = %02x:%02x:%02x:%02x:%02x:%02x", |
| 115 | __func__, param->if_id, cmd->pdev_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 116 | macaddr[0], macaddr[1], macaddr[2], |
| 117 | macaddr[3], macaddr[4], macaddr[5]); |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 118 | buf_ptr = (uint8_t *)cmd + sizeof(*cmd); |
| 119 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 120 | (num_bands * sizeof(wmi_vdev_txrx_streams))); |
| 121 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 122 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 123 | 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] | 124 | param->type, param->subtype, |
| 125 | param->nss_2g, param->nss_5g); |
| 126 | txrx_streams = (wmi_vdev_txrx_streams *)buf_ptr; |
| 127 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_2G; |
| 128 | txrx_streams->supported_tx_streams = param->nss_2g; |
| 129 | txrx_streams->supported_rx_streams = param->nss_2g; |
| 130 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 131 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 132 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
| 133 | |
| 134 | txrx_streams++; |
| 135 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_5G; |
| 136 | txrx_streams->supported_tx_streams = param->nss_5g; |
| 137 | txrx_streams->supported_rx_streams = param->nss_5g; |
| 138 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 139 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 140 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 141 | 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] | 142 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 143 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 144 | wmi_buf_free(buf); |
| 145 | } |
| 146 | |
| 147 | return ret; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 152 | * @wmi_handle: wmi handle |
| 153 | * @if_id: vdev id |
| 154 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 155 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 156 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 157 | 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] | 158 | uint8_t if_id) |
| 159 | { |
| 160 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 161 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 162 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 163 | |
| 164 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 165 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 166 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 167 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 171 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 172 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 173 | WMITLV_GET_STRUCT_TLVLEN |
| 174 | (wmi_vdev_delete_cmd_fixed_param)); |
| 175 | cmd->vdev_id = if_id; |
| 176 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 177 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 178 | WMI_VDEV_DELETE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 179 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 180 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 181 | wmi_buf_free(buf); |
| 182 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 183 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 184 | |
| 185 | return ret; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 190 | * @wmi: wmi handle |
| 191 | * @vdev_id: vdev id |
| 192 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 193 | * Return: QDF_STATUS_SUCCESS for success or erro code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 194 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 195 | static QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 196 | uint8_t vdev_id) |
| 197 | { |
| 198 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 199 | wmi_buf_t buf; |
| 200 | int32_t len = sizeof(*cmd); |
| 201 | |
| 202 | buf = wmi_buf_alloc(wmi, len); |
| 203 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 204 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 205 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 206 | } |
| 207 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 208 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 209 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 210 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 211 | cmd->vdev_id = vdev_id; |
| 212 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 213 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 214 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 215 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 216 | } |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 217 | WMI_LOGD("%s:vdev id = %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 218 | |
| 219 | return 0; |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 224 | * @wmi: wmi handle |
| 225 | * @vdev_id: vdev id |
| 226 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 227 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 228 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 229 | 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] | 230 | { |
| 231 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 232 | wmi_buf_t buf; |
| 233 | int32_t len = sizeof(*cmd); |
| 234 | |
| 235 | buf = wmi_buf_alloc(wmi, len); |
| 236 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 237 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 238 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 239 | } |
| 240 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 241 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 242 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 243 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 244 | cmd->vdev_id = vdev_id; |
| 245 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 246 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 247 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 248 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 249 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 250 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 251 | |
| 252 | return 0; |
| 253 | } |
| 254 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 255 | #ifdef CONFIG_MCL |
| 256 | static inline void copy_channel_info( |
| 257 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 258 | wmi_channel *chan, |
| 259 | struct vdev_start_params *req) |
| 260 | { |
| 261 | chan->mhz = req->chan_freq; |
| 262 | |
| 263 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 264 | |
| 265 | chan->band_center_freq1 = req->band_center_freq1; |
| 266 | chan->band_center_freq2 = req->band_center_freq2; |
| 267 | |
| 268 | if (req->is_half_rate) |
| 269 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 270 | else if (req->is_quarter_rate) |
| 271 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 272 | |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 273 | if (req->is_dfs && req->flag_dfs) { |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 274 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 275 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 276 | } |
| 277 | |
| 278 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 279 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 280 | |
| 281 | } |
| 282 | #else |
| 283 | static inline void copy_channel_info( |
| 284 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 285 | wmi_channel *chan, |
| 286 | struct vdev_start_params *req) |
| 287 | { |
| 288 | chan->mhz = req->channel.mhz; |
| 289 | |
| 290 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 291 | |
| 292 | chan->band_center_freq1 = req->channel.cfreq1; |
| 293 | chan->band_center_freq2 = req->channel.cfreq2; |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 294 | WMI_LOGI("%s: req->channel.phy_mode: %d ", req->channel.phy_mode); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 295 | |
| 296 | if (req->channel.half_rate) |
| 297 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 298 | else if (req->channel.quarter_rate) |
| 299 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 300 | |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 301 | WMI_LOGI("%s: req->channel.dfs_set: %d ", req->channel.dfs_set); |
| 302 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 303 | if (req->channel.dfs_set) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 304 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 305 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 306 | } |
| 307 | |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 308 | if (req->channel.dfs_set_cfreq2) |
| 309 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS_CFREQ2); |
| 310 | |
Kai Chen | 4710d46 | 2017-12-15 14:06:06 -0800 | [diff] [blame] | 311 | /* According to firmware both reg power and max tx power |
| 312 | * on set channel power is used and set it to max reg |
| 313 | * power from regulatory. |
| 314 | */ |
| 315 | WMI_SET_CHANNEL_MIN_POWER(chan, req->channel.minpower); |
| 316 | WMI_SET_CHANNEL_MAX_POWER(chan, req->channel.maxpower); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 317 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
Kai Chen | 4710d46 | 2017-12-15 14:06:06 -0800 | [diff] [blame] | 318 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, req->channel.antennamax); |
| 319 | WMI_SET_CHANNEL_REG_CLASSID(chan, req->channel.reg_class_id); |
| 320 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxregpower); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 321 | |
| 322 | } |
| 323 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 324 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 325 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 326 | * @wmi_handle: wmi handle |
| 327 | * @req: vdev start params |
| 328 | * |
| 329 | * Return: QDF status |
| 330 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 331 | 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] | 332 | struct vdev_start_params *req) |
| 333 | { |
| 334 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 335 | wmi_buf_t buf; |
| 336 | wmi_channel *chan; |
| 337 | int32_t len, ret; |
| 338 | uint8_t *buf_ptr; |
| 339 | |
| 340 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 341 | buf = wmi_buf_alloc(wmi_handle, len); |
| 342 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 343 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 344 | return QDF_STATUS_E_NOMEM; |
| 345 | } |
| 346 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 347 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 348 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 349 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 350 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 351 | WMITLV_GET_STRUCT_TLVLEN |
| 352 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 353 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 354 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 355 | cmd->vdev_id = req->vdev_id; |
| 356 | |
| 357 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 358 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 359 | |
| 360 | cmd->beacon_interval = req->beacon_intval; |
| 361 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 362 | |
Jiachao Wu | b89e3bf | 2017-08-23 15:27:11 +0800 | [diff] [blame] | 363 | cmd->bcn_tx_rate = req->bcn_tx_rate_code; |
| 364 | if (req->bcn_tx_rate_code) |
| 365 | cmd->flags |= WMI_UNIFIED_VDEV_START_BCN_TX_RATE_PRESENT; |
| 366 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 367 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 368 | cmd->beacon_interval = req->beacon_intval; |
| 369 | cmd->dtim_period = req->dtim_period; |
| 370 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 371 | /* Copy the SSID */ |
| 372 | if (req->ssid.length) { |
| 373 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 374 | cmd->ssid.ssid_len = req->ssid.length; |
| 375 | else |
| 376 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 377 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 378 | cmd->ssid.ssid_len); |
| 379 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 380 | |
| 381 | if (req->hidden_ssid) |
| 382 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 383 | |
| 384 | if (req->pmf_enabled) |
| 385 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 386 | } |
| 387 | |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 388 | cmd->flags |= WMI_UNIFIED_VDEV_START_LDPC_RX_ENABLED; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 389 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 390 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 391 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 392 | cmd->cac_duration_ms = req->cac_duration_ms; |
| 393 | cmd->regdomain = req->regdomain; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 394 | cmd->he_ops = req->he_ops; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 395 | |
| 396 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 397 | sizeof(wmi_channel)); |
| 398 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 399 | cmd->num_noa_descriptors * |
| 400 | sizeof(wmi_p2p_noa_descriptor)); |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 401 | 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] | 402 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 403 | "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] | 404 | "Tx SS %d, Rx SS %d, ldpc_rx: %d, cac %d, regd %d, HE ops: %d" |
| 405 | "req->dis_hw_ack: %d ", __func__, req->vdev_id, |
| 406 | chan->mhz, req->chan_mode, chan->info, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 407 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 408 | chan->band_center_freq1, chan->band_center_freq2, |
| 409 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 410 | req->preferred_tx_streams, req->preferred_rx_streams, |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 411 | req->ldpc_rx_enabled, req->cac_duration_ms, |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 412 | req->regdomain, req->he_ops, |
| 413 | req->dis_hw_ack); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 414 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 415 | if (req->is_restart) |
| 416 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 417 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 418 | else |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 419 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 420 | WMI_VDEV_START_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 421 | if (ret) { |
| 422 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 423 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 424 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 425 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 426 | |
| 427 | return QDF_STATUS_SUCCESS; |
| 428 | } |
| 429 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 430 | /** |
| 431 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 432 | * @wmi_handle: wmi handle |
| 433 | * @restart_params: vdev restart params |
| 434 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 435 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 436 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 437 | 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] | 438 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 439 | { |
| 440 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 441 | wmi_buf_t buf; |
| 442 | wmi_channel *chan; |
| 443 | int32_t len; |
| 444 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 445 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 446 | |
| 447 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 448 | buf = wmi_buf_alloc(wmi_handle, len); |
| 449 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 450 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 451 | return QDF_STATUS_E_NOMEM; |
| 452 | } |
| 453 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 454 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 455 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 456 | |
| 457 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 458 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 459 | WMITLV_GET_STRUCT_TLVLEN |
| 460 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 461 | |
| 462 | WMITLV_SET_HDR(&chan->tlv_header, |
| 463 | WMITLV_TAG_STRUC_wmi_channel, |
| 464 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 465 | |
| 466 | cmd->vdev_id = restart_params->session_id; |
| 467 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 468 | qdf_mem_copy(cmd->ssid.ssid, |
| 469 | restart_params->ssid, |
| 470 | cmd->ssid.ssid_len); |
| 471 | cmd->flags = restart_params->flags; |
| 472 | cmd->requestor_id = restart_params->requestor_id; |
| 473 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 474 | |
| 475 | chan->mhz = restart_params->mhz; |
| 476 | chan->band_center_freq1 = |
| 477 | restart_params->band_center_freq1; |
| 478 | chan->band_center_freq2 = |
| 479 | restart_params->band_center_freq2; |
| 480 | chan->info = restart_params->info; |
| 481 | chan->reg_info_1 = restart_params->reg_info_1; |
| 482 | chan->reg_info_2 = restart_params->reg_info_2; |
| 483 | |
| 484 | cmd->num_noa_descriptors = 0; |
| 485 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 486 | sizeof(wmi_channel)); |
| 487 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 488 | cmd->num_noa_descriptors * |
| 489 | sizeof(wmi_p2p_noa_descriptor)); |
| 490 | |
| 491 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 492 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 493 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 494 | wmi_buf_free(buf); |
| 495 | return QDF_STATUS_E_FAILURE; |
| 496 | } |
| 497 | return QDF_STATUS_SUCCESS; |
| 498 | } |
| 499 | |
| 500 | |
| 501 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 502 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 503 | * @wmi: wmi handle |
| 504 | * @peer_addr: peer mac address |
| 505 | * @param: pointer to hold peer flush tid parameter |
| 506 | * |
| 507 | * Return: 0 for sucess or error code |
| 508 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 509 | 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] | 510 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 511 | struct peer_flush_params *param) |
| 512 | { |
| 513 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 514 | wmi_buf_t buf; |
| 515 | int32_t len = sizeof(*cmd); |
| 516 | |
| 517 | buf = wmi_buf_alloc(wmi, len); |
| 518 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 519 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 520 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 521 | } |
| 522 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 523 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 524 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 525 | WMITLV_GET_STRUCT_TLVLEN |
| 526 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 527 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 528 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 529 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 530 | 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] | 531 | peer_addr, param->vdev_id, |
| 532 | param->peer_tid_bitmap); |
| 533 | 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] | 534 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 535 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 536 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 537 | } |
| 538 | |
| 539 | return 0; |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 544 | * @wmi: wmi handle |
| 545 | * @peer_addr: peer mac addr |
| 546 | * @vdev_id: vdev id |
| 547 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 548 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 549 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 550 | static QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 551 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 552 | uint8_t vdev_id) |
| 553 | { |
| 554 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 555 | wmi_buf_t buf; |
| 556 | int32_t len = sizeof(*cmd); |
| 557 | buf = wmi_buf_alloc(wmi, len); |
| 558 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 559 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 560 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 561 | } |
| 562 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 563 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 564 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 565 | WMITLV_GET_STRUCT_TLVLEN |
| 566 | (wmi_peer_delete_cmd_fixed_param)); |
| 567 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 568 | cmd->vdev_id = vdev_id; |
| 569 | |
Orhan K AKYILDIZ | c8d1c4b | 2017-01-10 14:32:18 -0800 | [diff] [blame] | 570 | WMI_LOGD("%s: peer_addr %pM vdev_id %d", __func__, peer_addr, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 571 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 572 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 573 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 574 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 575 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 576 | |
| 577 | return 0; |
| 578 | } |
| 579 | |
| 580 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 581 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 582 | * to target id. |
| 583 | * @targ_paramid: Target parameter id to hold the result. |
| 584 | * @peer_param_id: host param id. |
| 585 | * |
| 586 | * Return: QDF_STATUS_SUCCESS for success |
| 587 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
| 588 | */ |
| 589 | #ifdef CONFIG_MCL |
| 590 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 591 | uint32_t *targ_paramid, |
| 592 | uint32_t peer_param_id) |
| 593 | { |
| 594 | *targ_paramid = peer_param_id; |
| 595 | return QDF_STATUS_SUCCESS; |
| 596 | } |
| 597 | #else |
| 598 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 599 | uint32_t *targ_paramid, |
| 600 | uint32_t peer_param_id) |
| 601 | { |
| 602 | switch (peer_param_id) { |
| 603 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 604 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 605 | break; |
| 606 | case WMI_HOST_PEER_AMPDU: |
| 607 | *targ_paramid = WMI_PEER_AMPDU; |
| 608 | break; |
| 609 | case WMI_HOST_PEER_AUTHORIZE: |
| 610 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 611 | break; |
| 612 | case WMI_HOST_PEER_CHWIDTH: |
| 613 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 614 | break; |
| 615 | case WMI_HOST_PEER_NSS: |
| 616 | *targ_paramid = WMI_PEER_NSS; |
| 617 | break; |
| 618 | case WMI_HOST_PEER_USE_4ADDR: |
| 619 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 620 | break; |
| 621 | case WMI_HOST_PEER_MEMBERSHIP: |
| 622 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 623 | break; |
| 624 | case WMI_HOST_PEER_USERPOS: |
| 625 | *targ_paramid = WMI_PEER_USERPOS; |
| 626 | break; |
| 627 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 628 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 629 | break; |
| 630 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 631 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 632 | break; |
| 633 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 634 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 635 | break; |
| 636 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 637 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 638 | break; |
| 639 | case WMI_HOST_PEER_PHYMODE: |
| 640 | *targ_paramid = WMI_PEER_PHYMODE; |
| 641 | break; |
| 642 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 643 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 644 | break; |
| 645 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 646 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 647 | break; |
| 648 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 649 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 650 | break; |
| 651 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 652 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 653 | break; |
| 654 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 655 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 656 | break; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 657 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 658 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 659 | break; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 660 | case WMI_HOST_PEER_NSS_VHT160: |
| 661 | *targ_paramid = WMI_PEER_NSS_VHT160; |
| 662 | break; |
| 663 | case WMI_HOST_PEER_NSS_VHT80_80: |
| 664 | *targ_paramid = WMI_PEER_NSS_VHT80_80; |
| 665 | break; |
Venkateswara Swamy Bandaru | 65745ba | 2018-01-09 15:52:37 +0530 | [diff] [blame] | 666 | case WMI_HOST_PEER_PARAM_SU_TXBF_SOUNDING_INTERVAL: |
| 667 | *targ_paramid = WMI_PEER_PARAM_SU_TXBF_SOUNDING_INTERVAL; |
| 668 | break; |
| 669 | case WMI_HOST_PEER_PARAM_MU_TXBF_SOUNDING_INTERVAL: |
| 670 | *targ_paramid = WMI_PEER_PARAM_MU_TXBF_SOUNDING_INTERVAL; |
| 671 | break; |
| 672 | case WMI_HOST_PEER_PARAM_TXBF_SOUNDING_ENABLE: |
| 673 | *targ_paramid = WMI_PEER_PARAM_TXBF_SOUNDING_ENABLE; |
| 674 | break; |
Venkateswara Swamy Bandaru | 094bc7a | 2018-01-09 15:56:56 +0530 | [diff] [blame] | 675 | case WMI_HOST_PEER_PARAM_MU_ENABLE: |
| 676 | *targ_paramid = WMI_PEER_PARAM_MU_ENABLE; |
| 677 | break; |
| 678 | case WMI_HOST_PEER_PARAM_OFDMA_ENABLE: |
| 679 | *targ_paramid = WMI_PEER_PARAM_OFDMA_ENABLE; |
| 680 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 681 | default: |
| 682 | return QDF_STATUS_E_NOSUPPORT; |
| 683 | } |
| 684 | |
| 685 | return QDF_STATUS_SUCCESS; |
| 686 | } |
| 687 | #endif |
| 688 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 689 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 690 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 691 | * @peer_addr: peer mac address |
| 692 | * @param : pointer to hold peer set parameter |
| 693 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 694 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 695 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 696 | static QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 697 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 698 | struct peer_set_params *param) |
| 699 | { |
| 700 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 701 | wmi_buf_t buf; |
| 702 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 703 | uint32_t param_id; |
| 704 | |
| 705 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 706 | param->param_id) != QDF_STATUS_SUCCESS) |
| 707 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 708 | |
| 709 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 710 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 711 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 712 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 713 | } |
| 714 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 715 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 716 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 717 | WMITLV_GET_STRUCT_TLVLEN |
| 718 | (wmi_peer_set_param_cmd_fixed_param)); |
| 719 | cmd->vdev_id = param->vdev_id; |
| 720 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 721 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 722 | cmd->param_value = param->param_value; |
| 723 | err = wmi_unified_cmd_send(wmi, buf, |
| 724 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 725 | WMI_PEER_SET_PARAM_CMDID); |
| 726 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 727 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 728 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 729 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 730 | } |
| 731 | |
| 732 | return 0; |
| 733 | } |
| 734 | |
| 735 | /** |
| 736 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 737 | * @wmi: wmi handle |
| 738 | * @bssid: bssid |
| 739 | * @vdev_up_params: pointer to hold vdev up parameter |
| 740 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 741 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 742 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 743 | static QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 744 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 745 | struct vdev_up_params *params) |
| 746 | { |
| 747 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 748 | wmi_buf_t buf; |
| 749 | int32_t len = sizeof(*cmd); |
| 750 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 751 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 752 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 753 | params->vdev_id, params->assoc_id, bssid); |
| 754 | buf = wmi_buf_alloc(wmi, len); |
| 755 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 756 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 757 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 758 | } |
| 759 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 760 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 761 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 762 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 763 | cmd->vdev_id = params->vdev_id; |
| 764 | cmd->vdev_assoc_id = params->assoc_id; |
| 765 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 766 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 767 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 768 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 769 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 770 | } |
| 771 | |
| 772 | return 0; |
| 773 | } |
| 774 | |
| 775 | /** |
| 776 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 777 | * @wmi: wmi handle |
| 778 | * @peer_addr: peer mac address |
| 779 | * @peer_type: peer type |
| 780 | * @vdev_id: vdev id |
| 781 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 782 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 783 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 784 | static QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 785 | struct peer_create_params *param) |
| 786 | { |
| 787 | wmi_peer_create_cmd_fixed_param *cmd; |
| 788 | wmi_buf_t buf; |
| 789 | int32_t len = sizeof(*cmd); |
| 790 | |
| 791 | buf = wmi_buf_alloc(wmi, len); |
| 792 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 793 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 794 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 795 | } |
| 796 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 797 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 798 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 799 | WMITLV_GET_STRUCT_TLVLEN |
| 800 | (wmi_peer_create_cmd_fixed_param)); |
| 801 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 802 | cmd->peer_type = param->peer_type; |
| 803 | cmd->vdev_id = param->vdev_id; |
| 804 | |
| 805 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 806 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 807 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 808 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 809 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 810 | 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] | 811 | param->vdev_id); |
| 812 | |
| 813 | return 0; |
| 814 | } |
| 815 | |
| 816 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 817 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 818 | * command to fw |
| 819 | * @wmi: wmi handle |
| 820 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 821 | * |
| 822 | * Return: 0 for success or error code |
| 823 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 824 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 825 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 826 | struct rx_reorder_queue_setup_params *param) |
| 827 | { |
| 828 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 829 | wmi_buf_t buf; |
| 830 | int32_t len = sizeof(*cmd); |
| 831 | |
| 832 | buf = wmi_buf_alloc(wmi, len); |
| 833 | if (!buf) { |
| 834 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 835 | return QDF_STATUS_E_NOMEM; |
| 836 | } |
| 837 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 838 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 839 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 840 | WMITLV_GET_STRUCT_TLVLEN |
| 841 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 842 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 843 | cmd->vdev_id = param->vdev_id; |
| 844 | cmd->tid = param->tid; |
| 845 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 846 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 847 | cmd->queue_no = param->queue_no; |
| 848 | |
| 849 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 850 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 851 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 852 | __func__); |
| 853 | qdf_nbuf_free(buf); |
| 854 | return QDF_STATUS_E_FAILURE; |
| 855 | } |
| 856 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 857 | param->peer_macaddr, param->vdev_id, param->tid); |
| 858 | |
| 859 | return QDF_STATUS_SUCCESS; |
| 860 | } |
| 861 | |
| 862 | /** |
| 863 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 864 | * command to fw |
| 865 | * @wmi: wmi handle |
| 866 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 867 | * |
| 868 | * Return: 0 for success or error code |
| 869 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 870 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 871 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 872 | struct rx_reorder_queue_remove_params *param) |
| 873 | { |
| 874 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 875 | wmi_buf_t buf; |
| 876 | int32_t len = sizeof(*cmd); |
| 877 | |
| 878 | buf = wmi_buf_alloc(wmi, len); |
| 879 | if (!buf) { |
| 880 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 881 | return QDF_STATUS_E_NOMEM; |
| 882 | } |
| 883 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 884 | wmi_buf_data(buf); |
| 885 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 886 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 887 | WMITLV_GET_STRUCT_TLVLEN |
| 888 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 889 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 890 | cmd->vdev_id = param->vdev_id; |
| 891 | cmd->tid_mask = param->peer_tid_bitmap; |
| 892 | |
| 893 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 894 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 895 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 896 | __func__); |
| 897 | qdf_nbuf_free(buf); |
| 898 | return QDF_STATUS_E_FAILURE; |
| 899 | } |
| 900 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 901 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 902 | |
| 903 | return QDF_STATUS_SUCCESS; |
| 904 | } |
| 905 | |
| 906 | /** |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 907 | * send_peer_add_wds_entry_cmd_tlv() - send peer add command to fw |
| 908 | * @wmi_handle: wmi handle |
| 909 | * @param: pointer holding peer details |
| 910 | * |
| 911 | * Return: 0 for success or error code |
| 912 | */ |
| 913 | static QDF_STATUS send_peer_add_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 914 | struct peer_add_wds_entry_params *param) |
| 915 | { |
| 916 | wmi_peer_add_wds_entry_cmd_fixed_param *cmd; |
| 917 | wmi_buf_t buf; |
| 918 | int len = sizeof(*cmd); |
| 919 | |
| 920 | buf = wmi_buf_alloc(wmi_handle, len); |
| 921 | if (!buf) { |
| 922 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 923 | return QDF_STATUS_E_FAILURE; |
| 924 | } |
| 925 | cmd = (wmi_peer_add_wds_entry_cmd_fixed_param *) wmi_buf_data(buf); |
| 926 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 927 | WMITLV_TAG_STRUC_wmi_peer_add_wds_entry_cmd_fixed_param, |
| 928 | WMITLV_GET_STRUCT_TLVLEN |
| 929 | (wmi_peer_add_wds_entry_cmd_fixed_param)); |
| 930 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 931 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
Kris Muthusamy | c2e5471 | 2018-01-17 19:08:08 -0800 | [diff] [blame] | 932 | cmd->flags = (param->flags & WMI_HOST_WDS_FLAG_STATIC) ? WMI_WDS_FLAG_STATIC : 0; |
| 933 | cmd->vdev_id = param->vdev_id; |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 934 | |
| 935 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 936 | WMI_PEER_ADD_WDS_ENTRY_CMDID); |
| 937 | } |
| 938 | |
| 939 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 940 | * send_peer_del_wds_entry_cmd_tlv() - send peer delete command to fw |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 941 | * @wmi_handle: wmi handle |
| 942 | * @param: pointer holding peer details |
| 943 | * |
| 944 | * Return: 0 for success or error code |
| 945 | */ |
| 946 | static QDF_STATUS send_peer_del_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 947 | struct peer_del_wds_entry_params *param) |
| 948 | { |
| 949 | wmi_peer_remove_wds_entry_cmd_fixed_param *cmd; |
| 950 | wmi_buf_t buf; |
| 951 | int len = sizeof(*cmd); |
| 952 | |
| 953 | buf = wmi_buf_alloc(wmi_handle, len); |
| 954 | if (!buf) { |
| 955 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 956 | return QDF_STATUS_E_NOMEM; |
| 957 | } |
| 958 | cmd = (wmi_peer_remove_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 959 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 960 | WMITLV_TAG_STRUC_wmi_peer_remove_wds_entry_cmd_fixed_param, |
| 961 | WMITLV_GET_STRUCT_TLVLEN |
| 962 | (wmi_peer_remove_wds_entry_cmd_fixed_param)); |
| 963 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
Kris Muthusamy | c2e5471 | 2018-01-17 19:08:08 -0800 | [diff] [blame] | 964 | cmd->vdev_id = param->vdev_id; |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 965 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 966 | WMI_PEER_REMOVE_WDS_ENTRY_CMDID); |
| 967 | } |
| 968 | |
| 969 | /** |
| 970 | * send_peer_update_wds_entry_cmd_non_tlv() - send peer update command to fw |
| 971 | * @wmi_handle: wmi handle |
| 972 | * @param: pointer holding peer details |
| 973 | * |
| 974 | * Return: 0 for success or error code |
| 975 | */ |
| 976 | static QDF_STATUS send_peer_update_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 977 | struct peer_update_wds_entry_params *param) |
| 978 | { |
| 979 | wmi_peer_update_wds_entry_cmd_fixed_param *cmd; |
| 980 | wmi_buf_t buf; |
| 981 | int len = sizeof(*cmd); |
| 982 | |
| 983 | buf = wmi_buf_alloc(wmi_handle, len); |
| 984 | if (!buf) { |
| 985 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 986 | return QDF_STATUS_E_NOMEM; |
| 987 | } |
| 988 | |
| 989 | /* wmi_buf_alloc returns zeroed command buffer */ |
| 990 | cmd = (wmi_peer_update_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 991 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 992 | WMITLV_TAG_STRUC_wmi_peer_update_wds_entry_cmd_fixed_param, |
| 993 | WMITLV_GET_STRUCT_TLVLEN |
| 994 | (wmi_peer_update_wds_entry_cmd_fixed_param)); |
Kris Muthusamy | c2e5471 | 2018-01-17 19:08:08 -0800 | [diff] [blame] | 995 | cmd->flags = (param->flags & WMI_HOST_WDS_FLAG_STATIC) ? WMI_WDS_FLAG_STATIC : 0; |
| 996 | cmd->vdev_id = param->vdev_id; |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 997 | if (param->wds_macaddr) |
| 998 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->wds_macaddr, |
| 999 | &cmd->wds_macaddr); |
| 1000 | if (param->peer_macaddr) |
| 1001 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, |
| 1002 | &cmd->peer_macaddr); |
| 1003 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1004 | WMI_PEER_UPDATE_WDS_ENTRY_CMDID); |
| 1005 | } |
| 1006 | |
Shaakir Mohamed | 75208c3 | 2018-02-15 14:30:21 -0800 | [diff] [blame] | 1007 | /** |
| 1008 | * send_pdev_get_tpc_config_cmd_tlv() - send get tpc config command to fw |
| 1009 | * @wmi_handle: wmi handle |
| 1010 | * @param: pointer to get tpc config params |
| 1011 | * |
| 1012 | * Return: 0 for success or error code |
| 1013 | */ |
| 1014 | static QDF_STATUS |
| 1015 | send_pdev_get_tpc_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 1016 | uint32_t param) |
| 1017 | { |
| 1018 | wmi_pdev_get_tpc_config_cmd_fixed_param *cmd; |
| 1019 | wmi_buf_t buf; |
| 1020 | int32_t len = sizeof(wmi_pdev_get_tpc_config_cmd_fixed_param); |
| 1021 | |
| 1022 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1023 | if (!buf) { |
| 1024 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 1025 | return QDF_STATUS_E_NOMEM; |
| 1026 | } |
| 1027 | cmd = (wmi_pdev_get_tpc_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 1028 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1029 | WMITLV_TAG_STRUC_wmi_pdev_get_tpc_config_cmd_fixed_param, |
| 1030 | WMITLV_GET_STRUCT_TLVLEN |
| 1031 | (wmi_pdev_get_tpc_config_cmd_fixed_param)); |
| 1032 | |
| 1033 | cmd->param = param; |
| 1034 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1035 | WMI_PDEV_GET_TPC_CONFIG_CMDID)) { |
| 1036 | WMI_LOGE("Send pdev get tpc config cmd failed"); |
| 1037 | wmi_buf_free(buf); |
| 1038 | return QDF_STATUS_E_FAILURE; |
| 1039 | |
| 1040 | } |
| 1041 | WMI_LOGD("%s:send success", __func__); |
| 1042 | |
| 1043 | return QDF_STATUS_SUCCESS; |
| 1044 | } |
| 1045 | |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 1046 | #ifdef WLAN_SUPPORT_GREEN_AP |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 1047 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1048 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 1049 | * @wmi_handle: wmi handle |
| 1050 | * @value: value |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 1051 | * @pdev_id: pdev id to have radio context |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1052 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1053 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1054 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1055 | 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] | 1056 | uint32_t value, uint8_t pdev_id) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1057 | { |
| 1058 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 1059 | wmi_buf_t buf; |
| 1060 | int32_t len = sizeof(*cmd); |
| 1061 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1062 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1063 | |
| 1064 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1065 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1066 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1067 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1068 | } |
| 1069 | |
| 1070 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1071 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1072 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 1073 | WMITLV_GET_STRUCT_TLVLEN |
| 1074 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 1075 | 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] | 1076 | cmd->enable = value; |
| 1077 | |
| 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) |
| 1123 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 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 | |
| 1160 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 1161 | (chunk_len + sizeof(segHdrInfo) + |
| 1162 | WMI_TLV_HDR_SIZE), |
| 1163 | WMI_PDEV_UTF_CMDID); |
| 1164 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1165 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1166 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1167 | wmi_buf_free(buf); |
| 1168 | break; |
| 1169 | } |
| 1170 | |
| 1171 | param->len -= chunk_len; |
| 1172 | bufpos += chunk_len; |
| 1173 | } |
| 1174 | |
| 1175 | msgref++; |
| 1176 | |
| 1177 | return ret; |
| 1178 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1179 | #ifdef CONFIG_MCL |
| 1180 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1181 | uint32_t host_param) |
| 1182 | { |
| 1183 | return host_param; |
| 1184 | } |
| 1185 | #else |
| 1186 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1187 | uint32_t host_param) |
| 1188 | { |
| 1189 | if (host_param < wmi_pdev_param_max) |
| 1190 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1191 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1192 | return WMI_UNAVAILABLE_PARAM; |
| 1193 | } |
| 1194 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1195 | /** |
| 1196 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 1197 | * @wmi_handle: wmi handle |
| 1198 | * @param: pointer to pdev parameter |
| 1199 | * @mac_id: radio context |
| 1200 | * |
| 1201 | * Return: 0 on success, errno on failure |
| 1202 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1203 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1204 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 1205 | struct pdev_params *param, |
| 1206 | uint8_t mac_id) |
| 1207 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1208 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1209 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 1210 | wmi_buf_t buf; |
| 1211 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1212 | uint32_t pdev_param; |
| 1213 | |
| 1214 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 1215 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1216 | WMI_LOGW("%s: Unavailable param %d\n", |
| 1217 | __func__, param->param_id); |
| 1218 | return QDF_STATUS_E_INVAL; |
| 1219 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1220 | |
| 1221 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1222 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1223 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1224 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1225 | } |
| 1226 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1227 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1228 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 1229 | WMITLV_GET_STRUCT_TLVLEN |
| 1230 | (wmi_pdev_set_param_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1231 | 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] | 1232 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1233 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1234 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1235 | param->param_value); |
| 1236 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1237 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1238 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1239 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1240 | wmi_buf_free(buf); |
| 1241 | } |
| 1242 | return ret; |
| 1243 | } |
| 1244 | |
| 1245 | /** |
| 1246 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1247 | * @param wmi_handle : handle to WMI. |
| 1248 | * @param param : pointer to hold suspend parameter |
| 1249 | * @mac_id: radio context |
| 1250 | * |
| 1251 | * Return 0 on success and -ve on failure. |
| 1252 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1253 | static QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1254 | struct suspend_params *param, |
| 1255 | uint8_t mac_id) |
| 1256 | { |
| 1257 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1258 | wmi_buf_t wmibuf; |
| 1259 | uint32_t len = sizeof(*cmd); |
| 1260 | int32_t ret; |
| 1261 | |
| 1262 | /* |
| 1263 | * send the comand to Target to ignore the |
| 1264 | * PCIE reset so as to ensure that Host and target |
| 1265 | * states are in sync |
| 1266 | */ |
| 1267 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1268 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1269 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1270 | |
| 1271 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1272 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1273 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1274 | WMITLV_GET_STRUCT_TLVLEN |
| 1275 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1276 | if (param->disable_target_intr) |
| 1277 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1278 | else |
| 1279 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
Kiran Venkatappa | 330179c | 2017-06-13 20:44:54 +0530 | [diff] [blame] | 1280 | |
| 1281 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
| 1282 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1283 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1284 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1285 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1286 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1287 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1288 | } |
| 1289 | |
| 1290 | return ret; |
| 1291 | } |
| 1292 | |
| 1293 | /** |
| 1294 | * send_resume_cmd_tlv() - WMI resume function |
| 1295 | * @param wmi_handle : handle to WMI. |
| 1296 | * @mac_id: radio context |
| 1297 | * |
| 1298 | * Return: 0 on success and -ve on failure. |
| 1299 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1300 | static QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1301 | uint8_t mac_id) |
| 1302 | { |
| 1303 | wmi_buf_t wmibuf; |
| 1304 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1305 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1306 | |
| 1307 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1308 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1309 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1310 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1311 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1312 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1313 | WMITLV_GET_STRUCT_TLVLEN |
| 1314 | (wmi_pdev_resume_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1315 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1316 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1317 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1318 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1319 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1320 | wmi_buf_free(wmibuf); |
| 1321 | } |
| 1322 | |
| 1323 | return ret; |
| 1324 | } |
| 1325 | |
Will Huang | 422ac9a | 2017-11-17 13:19:16 +0800 | [diff] [blame] | 1326 | #ifdef FEATURE_WLAN_D0WOW |
| 1327 | /** |
| 1328 | * send_d0wow_enable_cmd_tlv() - WMI d0 wow enable function |
| 1329 | * @param wmi_handle: handle to WMI. |
| 1330 | * @mac_id: radio context |
| 1331 | * |
| 1332 | * Return: 0 on success and error code on failure. |
| 1333 | */ |
| 1334 | static QDF_STATUS send_d0wow_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1335 | uint8_t mac_id) |
| 1336 | { |
| 1337 | wmi_d0_wow_enable_disable_cmd_fixed_param *cmd; |
| 1338 | wmi_buf_t buf; |
| 1339 | int32_t len; |
| 1340 | QDF_STATUS status; |
| 1341 | |
| 1342 | len = sizeof(wmi_d0_wow_enable_disable_cmd_fixed_param); |
| 1343 | |
| 1344 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1345 | if (!buf) { |
| 1346 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1347 | return QDF_STATUS_E_NOMEM; |
| 1348 | } |
| 1349 | cmd = (wmi_d0_wow_enable_disable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1350 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1351 | WMITLV_TAG_STRUC_wmi_d0_wow_enable_disable_cmd_fixed_param, |
| 1352 | WMITLV_GET_STRUCT_TLVLEN |
| 1353 | (wmi_d0_wow_enable_disable_cmd_fixed_param)); |
| 1354 | |
| 1355 | cmd->enable = true; |
| 1356 | |
| 1357 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1358 | WMI_D0_WOW_ENABLE_DISABLE_CMDID); |
| 1359 | if (QDF_IS_STATUS_ERROR(status)) |
| 1360 | wmi_buf_free(buf); |
| 1361 | |
| 1362 | return status; |
| 1363 | } |
| 1364 | |
| 1365 | /** |
| 1366 | * send_d0wow_disable_cmd_tlv() - WMI d0 wow disable function |
| 1367 | * @param wmi_handle: handle to WMI. |
| 1368 | * @mac_id: radio context |
| 1369 | * |
| 1370 | * Return: 0 on success and error code on failure. |
| 1371 | */ |
| 1372 | static QDF_STATUS send_d0wow_disable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1373 | uint8_t mac_id) |
| 1374 | { |
| 1375 | wmi_d0_wow_enable_disable_cmd_fixed_param *cmd; |
| 1376 | wmi_buf_t buf; |
| 1377 | int32_t len; |
| 1378 | QDF_STATUS status; |
| 1379 | |
| 1380 | len = sizeof(wmi_d0_wow_enable_disable_cmd_fixed_param); |
| 1381 | |
| 1382 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1383 | if (!buf) { |
| 1384 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1385 | return QDF_STATUS_E_NOMEM; |
| 1386 | } |
| 1387 | cmd = (wmi_d0_wow_enable_disable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1388 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1389 | WMITLV_TAG_STRUC_wmi_d0_wow_enable_disable_cmd_fixed_param, |
| 1390 | WMITLV_GET_STRUCT_TLVLEN |
| 1391 | (wmi_d0_wow_enable_disable_cmd_fixed_param)); |
| 1392 | |
| 1393 | cmd->enable = false; |
| 1394 | |
| 1395 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1396 | WMI_D0_WOW_ENABLE_DISABLE_CMDID); |
| 1397 | if (QDF_IS_STATUS_ERROR(status)) |
| 1398 | wmi_buf_free(buf); |
| 1399 | |
| 1400 | return status; |
| 1401 | } |
| 1402 | #endif |
| 1403 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1404 | /** |
| 1405 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1406 | * @param wmi_handle : handle to WMI. |
| 1407 | * @param param : pointer to hold wow enable parameter |
| 1408 | * @mac_id: radio context |
| 1409 | * |
| 1410 | * Return: 0 on success and -ve on failure. |
| 1411 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1412 | 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] | 1413 | struct wow_cmd_params *param, |
| 1414 | uint8_t mac_id) |
| 1415 | { |
| 1416 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1417 | wmi_buf_t buf; |
| 1418 | int32_t len; |
| 1419 | int32_t ret; |
| 1420 | |
| 1421 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1422 | |
| 1423 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1424 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1425 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1426 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1427 | } |
| 1428 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1429 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1430 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1431 | WMITLV_GET_STRUCT_TLVLEN |
| 1432 | (wmi_wow_enable_cmd_fixed_param)); |
| 1433 | cmd->enable = param->enable; |
| 1434 | if (param->can_suspend_link) |
| 1435 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1436 | else |
| 1437 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1438 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1439 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1440 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1441 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1442 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1443 | |
| 1444 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1445 | WMI_WOW_ENABLE_CMDID); |
| 1446 | if (ret) |
| 1447 | wmi_buf_free(buf); |
| 1448 | |
| 1449 | return ret; |
| 1450 | } |
| 1451 | |
| 1452 | /** |
| 1453 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1454 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1455 | * @peer_addr: peer mac address |
| 1456 | * @param: pointer to ap_ps parameter structure |
| 1457 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1458 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1459 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1460 | 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] | 1461 | uint8_t *peer_addr, |
| 1462 | struct ap_ps_params *param) |
| 1463 | { |
| 1464 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1465 | wmi_buf_t buf; |
| 1466 | int32_t err; |
| 1467 | |
| 1468 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1469 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1470 | 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] | 1471 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1472 | } |
| 1473 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1474 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1475 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1476 | WMITLV_GET_STRUCT_TLVLEN |
| 1477 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1478 | cmd->vdev_id = param->vdev_id; |
| 1479 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1480 | cmd->param = param->param; |
| 1481 | cmd->value = param->value; |
| 1482 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1483 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1484 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1485 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1486 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1487 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1488 | } |
| 1489 | |
| 1490 | return 0; |
| 1491 | } |
| 1492 | |
| 1493 | /** |
| 1494 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1495 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1496 | * @peer_addr: peer mac address |
| 1497 | * @param: pointer to sta_ps parameter structure |
| 1498 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1499 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1500 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1501 | 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] | 1502 | struct sta_ps_params *param) |
| 1503 | { |
| 1504 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1505 | wmi_buf_t buf; |
| 1506 | int32_t len = sizeof(*cmd); |
| 1507 | |
| 1508 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1509 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1510 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1511 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1512 | } |
| 1513 | |
| 1514 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1515 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1516 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1517 | WMITLV_GET_STRUCT_TLVLEN |
| 1518 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1519 | cmd->vdev_id = param->vdev_id; |
| 1520 | cmd->param = param->param; |
| 1521 | cmd->value = param->value; |
| 1522 | |
| 1523 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1524 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1525 | 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] | 1526 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1527 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1528 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1529 | } |
| 1530 | |
| 1531 | return 0; |
| 1532 | } |
| 1533 | |
| 1534 | /** |
| 1535 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1536 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1537 | * @param: ponirt to crash inject paramter structure |
| 1538 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1539 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1540 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1541 | 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] | 1542 | struct crash_inject *param) |
| 1543 | { |
| 1544 | int32_t ret = 0; |
| 1545 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1546 | uint16_t len = sizeof(*cmd); |
| 1547 | wmi_buf_t buf; |
| 1548 | |
| 1549 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1550 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1551 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1552 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1553 | } |
| 1554 | |
| 1555 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1556 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1557 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1558 | WMITLV_GET_STRUCT_TLVLEN |
| 1559 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1560 | cmd->type = param->type; |
| 1561 | cmd->delay_time_ms = param->delay_time_ms; |
| 1562 | |
| 1563 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1564 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1565 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1566 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1567 | __func__, ret); |
| 1568 | wmi_buf_free(buf); |
| 1569 | } |
| 1570 | |
| 1571 | return ret; |
| 1572 | } |
| 1573 | |
| 1574 | /** |
| 1575 | * send_dbglog_cmd_tlv() - set debug log level |
| 1576 | * @param wmi_handle : handle to WMI. |
| 1577 | * @param param : pointer to hold dbglog level parameter |
| 1578 | * |
| 1579 | * Return: 0 on success and -ve on failure. |
| 1580 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1581 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1582 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1583 | struct dbglog_params *dbglog_param) |
| 1584 | { |
| 1585 | wmi_buf_t buf; |
| 1586 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1587 | QDF_STATUS status; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1588 | int32_t i; |
| 1589 | int32_t len; |
| 1590 | int8_t *buf_ptr; |
| 1591 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1592 | |
Alok Kumar | 240afea | 2017-08-30 14:45:34 +0530 | [diff] [blame] | 1593 | ASSERT(dbglog_param->bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1594 | |
| 1595 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1596 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1597 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1598 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1599 | if (buf == NULL) |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1600 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1601 | |
| 1602 | configmsg = |
| 1603 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1604 | buf_ptr = (int8_t *) configmsg; |
| 1605 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1606 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1607 | WMITLV_GET_STRUCT_TLVLEN |
| 1608 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1609 | configmsg->dbg_log_param = dbglog_param->param; |
| 1610 | configmsg->value = dbglog_param->val; |
| 1611 | /* Filling in the data part of second tlv -- should |
| 1612 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1613 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1614 | sizeof |
| 1615 | (wmi_debug_log_config_cmd_fixed_param) |
| 1616 | + WMI_TLV_HDR_SIZE); |
| 1617 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1618 | WMITLV_TAG_ARRAY_UINT32, |
| 1619 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1620 | if (dbglog_param->module_id_bitmap) { |
| 1621 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1622 | module_id_bitmap_array[i] = |
| 1623 | dbglog_param->module_id_bitmap[i]; |
| 1624 | } |
| 1625 | } |
| 1626 | |
| 1627 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1628 | len, WMI_DBGLOG_CFG_CMDID); |
| 1629 | |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1630 | if (status != QDF_STATUS_SUCCESS) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1631 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1632 | |
| 1633 | return status; |
| 1634 | } |
| 1635 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1636 | #ifdef CONFIG_MCL |
| 1637 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1638 | uint32_t host_param) |
| 1639 | { |
| 1640 | return host_param; |
| 1641 | } |
| 1642 | #else |
| 1643 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1644 | uint32_t host_param) |
| 1645 | { |
| 1646 | if (host_param < wmi_vdev_param_max) |
| 1647 | return wmi_handle->vdev_param[host_param]; |
| 1648 | |
| 1649 | return WMI_UNAVAILABLE_PARAM; |
| 1650 | } |
| 1651 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1652 | /** |
| 1653 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1654 | * @param wmi_handle : handle to WMI. |
| 1655 | * @param macaddr : MAC address |
| 1656 | * @param param : pointer to hold vdev set parameter |
| 1657 | * |
| 1658 | * Return: 0 on success and -ve on failure. |
| 1659 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1660 | 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] | 1661 | struct vdev_set_params *param) |
| 1662 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1663 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1664 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1665 | wmi_buf_t buf; |
| 1666 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1667 | uint32_t vdev_param; |
| 1668 | |
| 1669 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1670 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1671 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1672 | param->param_id); |
| 1673 | return QDF_STATUS_E_INVAL; |
| 1674 | |
| 1675 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1676 | |
| 1677 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1678 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1679 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1680 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1681 | } |
| 1682 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1683 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1684 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1685 | WMITLV_GET_STRUCT_TLVLEN |
| 1686 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1687 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1688 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1689 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1690 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1691 | param->if_id, param->param_id, param->param_value); |
| 1692 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1693 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1694 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1695 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1696 | wmi_buf_free(buf); |
| 1697 | } |
| 1698 | |
| 1699 | return ret; |
| 1700 | } |
| 1701 | |
| 1702 | /** |
| 1703 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1704 | * @param wmi_handle : handle to WMI. |
| 1705 | * @param macaddr : MAC address |
| 1706 | * @param param : pointer to hold stats request parameter |
| 1707 | * |
| 1708 | * Return: 0 on success and -ve on failure. |
| 1709 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1710 | 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] | 1711 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1712 | struct stats_request_params *param) |
| 1713 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1714 | int32_t ret; |
| 1715 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1716 | wmi_buf_t buf; |
| 1717 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1718 | |
| 1719 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1720 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1721 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1722 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1723 | } |
| 1724 | |
| 1725 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1726 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1727 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1728 | WMITLV_GET_STRUCT_TLVLEN |
| 1729 | (wmi_request_stats_cmd_fixed_param)); |
| 1730 | cmd->stats_id = param->stats_id; |
| 1731 | cmd->vdev_id = param->vdev_id; |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 1732 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 1733 | param->pdev_id); |
| 1734 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
Kabilan Kannan | 3e2b221 | 2017-12-21 00:52:10 -0800 | [diff] [blame] | 1735 | |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 1736 | WMI_LOGD("STATS REQ STATS_ID:%d VDEV_ID:%d PDEV_ID:%d-->", |
| 1737 | cmd->stats_id, cmd->vdev_id, cmd->pdev_id); |
Kabilan Kannan | 3e2b221 | 2017-12-21 00:52:10 -0800 | [diff] [blame] | 1738 | |
| 1739 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1740 | WMI_REQUEST_STATS_CMDID); |
| 1741 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1742 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1743 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1744 | wmi_buf_free(buf); |
| 1745 | } |
| 1746 | |
| 1747 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1748 | } |
| 1749 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1750 | #ifdef CONFIG_WIN |
| 1751 | /** |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1752 | * 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] | 1753 | * @param wmi_handle : handle to WMI. |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1754 | * @param PKTLOG_EVENT : packet log event |
| 1755 | * @mac_id: mac id to have radio context |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1756 | * |
| 1757 | * Return: 0 on success and -ve on failure. |
| 1758 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1759 | 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] | 1760 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT, uint8_t mac_id) |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1761 | { |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1762 | int32_t ret; |
| 1763 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 1764 | wmi_buf_t buf; |
| 1765 | uint16_t len = sizeof(wmi_pdev_pktlog_enable_cmd_fixed_param); |
| 1766 | |
| 1767 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1768 | if (!buf) { |
| 1769 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1770 | return -QDF_STATUS_E_NOMEM; |
| 1771 | } |
| 1772 | |
| 1773 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1774 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1775 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 1776 | WMITLV_GET_STRUCT_TLVLEN |
| 1777 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 1778 | cmd->evlist = PKTLOG_EVENT; |
| 1779 | cmd->pdev_id = mac_id; |
| 1780 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1781 | WMI_PDEV_PKTLOG_ENABLE_CMDID); |
| 1782 | if (ret) { |
| 1783 | WMI_LOGE("Failed to send pktlog enable cmd to FW =%d", ret); |
| 1784 | wmi_buf_free(buf); |
| 1785 | } |
| 1786 | |
| 1787 | return ret; |
| 1788 | } |
| 1789 | |
| 1790 | /** |
| 1791 | * send_packet_log_disable_cmd_tlv() - Send WMI command to disable packet-log |
| 1792 | * @param wmi_handle : handle to WMI. |
| 1793 | * @mac_id: mac id to have radio context |
| 1794 | * |
| 1795 | * Return: 0 on success and -ve on failure. |
| 1796 | */ |
| 1797 | 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] | 1798 | uint8_t mac_id) |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1799 | { |
| 1800 | int32_t ret; |
| 1801 | wmi_pdev_pktlog_disable_cmd_fixed_param *cmd; |
| 1802 | wmi_buf_t buf; |
| 1803 | uint16_t len = sizeof(wmi_pdev_pktlog_disable_cmd_fixed_param); |
| 1804 | |
| 1805 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1806 | if (!buf) { |
| 1807 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1808 | return -QDF_STATUS_E_NOMEM; |
| 1809 | } |
| 1810 | |
| 1811 | cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1812 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1813 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 1814 | WMITLV_GET_STRUCT_TLVLEN |
| 1815 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
| 1816 | cmd->pdev_id = mac_id; |
| 1817 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1818 | WMI_PDEV_PKTLOG_DISABLE_CMDID); |
| 1819 | if (ret) { |
| 1820 | WMI_LOGE("Failed to send pktlog disable cmd to FW =%d", ret); |
| 1821 | wmi_buf_free(buf); |
| 1822 | } |
| 1823 | |
| 1824 | return ret; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1825 | } |
| 1826 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1827 | /** |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1828 | * send_packet_log_enable_cmd_tlv() - Send WMI command to enable |
| 1829 | * packet-log |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1830 | * @param wmi_handle : handle to WMI. |
| 1831 | * @param macaddr : MAC address |
| 1832 | * @param param : pointer to hold stats request parameter |
| 1833 | * |
| 1834 | * Return: 0 on success and -ve on failure. |
| 1835 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1836 | 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] | 1837 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1838 | struct packet_enable_params *param) |
| 1839 | { |
| 1840 | return 0; |
| 1841 | } |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1842 | /** |
| 1843 | * send_packet_log_disable_cmd_tlv() - Send WMI command to disable |
| 1844 | * packet-log |
| 1845 | * @param wmi_handle : handle to WMI. |
| 1846 | * @mac_id: mac id to have radio context |
| 1847 | * |
| 1848 | * Return: 0 on success and -ve on failure. |
| 1849 | */ |
| 1850 | static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1851 | uint8_t mac_id) |
| 1852 | { |
| 1853 | return 0; |
| 1854 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1855 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1856 | |
gaurank kathpalia | cdfb445 | 2018-02-21 18:58:29 +0530 | [diff] [blame] | 1857 | #define WMI_FW_TIME_STAMP_LOW_MASK 0xffffffff |
| 1858 | /** |
| 1859 | * send_time_stamp_sync_cmd_tlv() - Send WMI command to |
| 1860 | * sync time between bwtween host and firmware |
| 1861 | * @param wmi_handle : handle to WMI. |
| 1862 | * |
| 1863 | * Return: None |
| 1864 | */ |
| 1865 | static void send_time_stamp_sync_cmd_tlv(wmi_unified_t wmi_handle) |
| 1866 | { |
| 1867 | wmi_buf_t buf; |
| 1868 | A_STATUS status = A_OK; |
| 1869 | WMI_DBGLOG_TIME_STAMP_SYNC_CMD_fixed_param *time_stamp; |
| 1870 | int32_t len; |
| 1871 | qdf_time_t time_ms; |
| 1872 | |
| 1873 | len = sizeof(*time_stamp); |
| 1874 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1875 | |
| 1876 | if (!buf) { |
| 1877 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
| 1878 | return; |
| 1879 | } |
| 1880 | time_stamp = |
| 1881 | (WMI_DBGLOG_TIME_STAMP_SYNC_CMD_fixed_param *) |
| 1882 | (wmi_buf_data(buf)); |
| 1883 | WMITLV_SET_HDR(&time_stamp->tlv_header, |
| 1884 | WMITLV_TAG_STRUC_wmi_dbglog_time_stamp_sync_cmd_fixed_param, |
| 1885 | WMITLV_GET_STRUCT_TLVLEN( |
| 1886 | WMI_DBGLOG_TIME_STAMP_SYNC_CMD_fixed_param)); |
| 1887 | |
| 1888 | time_ms = qdf_get_time_of_the_day_ms(); |
| 1889 | time_stamp->mode = WMI_TIME_STAMP_SYNC_MODE_MS; |
| 1890 | time_stamp->time_stamp_low = time_ms & |
| 1891 | WMI_FW_TIME_STAMP_LOW_MASK; |
| 1892 | /* |
| 1893 | * Send time_stamp_high 0 as the time converted from HR:MIN:SEC:MS to ms |
| 1894 | * wont exceed 27 bit |
| 1895 | */ |
| 1896 | time_stamp->time_stamp_high = 0; |
| 1897 | WMI_LOGD(FL("WMA --> DBGLOG_TIME_STAMP_SYNC_CMDID mode %d time_stamp low %d high %d"), |
| 1898 | time_stamp->mode, time_stamp->time_stamp_low, |
| 1899 | time_stamp->time_stamp_high); |
| 1900 | |
| 1901 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1902 | len, WMI_DBGLOG_TIME_STAMP_SYNC_CMDID); |
| 1903 | if (status) { |
| 1904 | WMI_LOGE("Failed to send WMI_DBGLOG_TIME_STAMP_SYNC_CMDID command"); |
| 1905 | wmi_buf_free(buf); |
| 1906 | } |
| 1907 | |
| 1908 | } |
| 1909 | |
Subrat Mishra | d7c7a56 | 2017-09-27 14:41:20 +0530 | [diff] [blame] | 1910 | #ifdef WLAN_SUPPORT_FILS |
| 1911 | /** |
| 1912 | * extract_swfda_vdev_id_tlv() - extract swfda vdev id from event |
| 1913 | * @wmi_handle: wmi handle |
| 1914 | * @evt_buf: pointer to event buffer |
| 1915 | * @vdev_id: pointer to hold vdev id |
| 1916 | * |
| 1917 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_INVAL on failure |
| 1918 | */ |
| 1919 | static QDF_STATUS |
| 1920 | extract_swfda_vdev_id_tlv(wmi_unified_t wmi_handle, |
| 1921 | void *evt_buf, uint32_t *vdev_id) |
| 1922 | { |
| 1923 | WMI_HOST_SWFDA_EVENTID_param_tlvs *param_buf; |
| 1924 | wmi_host_swfda_event_fixed_param *swfda_event; |
| 1925 | |
| 1926 | param_buf = (WMI_HOST_SWFDA_EVENTID_param_tlvs *)evt_buf; |
| 1927 | if (!param_buf) { |
| 1928 | WMI_LOGE("Invalid swfda event buffer"); |
| 1929 | return QDF_STATUS_E_INVAL; |
| 1930 | } |
| 1931 | swfda_event = param_buf->fixed_param; |
| 1932 | *vdev_id = swfda_event->vdev_id; |
| 1933 | |
| 1934 | return QDF_STATUS_SUCCESS; |
| 1935 | } |
| 1936 | |
| 1937 | /** |
| 1938 | * send_vdev_fils_enable_cmd_tlv() - enable/Disable FD Frame command to fw |
| 1939 | * @wmi_handle: wmi handle |
| 1940 | * @param: pointer to hold FILS discovery enable param |
| 1941 | * |
| 1942 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE on failure |
| 1943 | */ |
| 1944 | static QDF_STATUS |
| 1945 | send_vdev_fils_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1946 | struct config_fils_params *param) |
| 1947 | { |
| 1948 | wmi_enable_fils_cmd_fixed_param *cmd; |
| 1949 | wmi_buf_t buf; |
| 1950 | QDF_STATUS status; |
| 1951 | uint32_t len = sizeof(wmi_enable_fils_cmd_fixed_param); |
| 1952 | |
| 1953 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1954 | if (!buf) { |
| 1955 | WMI_LOGE("%s : wmi_buf_alloc failed\n", __func__); |
| 1956 | return QDF_STATUS_E_NOMEM; |
| 1957 | } |
| 1958 | cmd = (wmi_enable_fils_cmd_fixed_param *)wmi_buf_data(buf); |
| 1959 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1960 | WMITLV_TAG_STRUC_wmi_enable_fils_cmd_fixed_param, |
| 1961 | WMITLV_GET_STRUCT_TLVLEN( |
| 1962 | wmi_enable_fils_cmd_fixed_param)); |
| 1963 | cmd->vdev_id = param->vdev_id; |
| 1964 | cmd->fd_period = param->fd_period; |
| 1965 | WMI_LOGI("Setting FD period to %d vdev id : %d\n", |
| 1966 | param->fd_period, param->vdev_id); |
| 1967 | |
| 1968 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1969 | WMI_ENABLE_FILS_CMDID); |
| 1970 | if (status != QDF_STATUS_SUCCESS) { |
| 1971 | wmi_buf_free(buf); |
| 1972 | return QDF_STATUS_E_FAILURE; |
| 1973 | } |
| 1974 | |
| 1975 | return QDF_STATUS_SUCCESS; |
| 1976 | } |
| 1977 | |
| 1978 | /** |
| 1979 | * send_fils_discovery_send_cmd_tlv() - WMI FILS Discovery send function |
| 1980 | * @wmi_handle: wmi handle |
| 1981 | * @param: pointer to hold FD send cmd parameter |
| 1982 | * |
| 1983 | * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_NOMEM on failure. |
| 1984 | */ |
| 1985 | static QDF_STATUS |
| 1986 | send_fils_discovery_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1987 | struct fd_params *param) |
| 1988 | { |
| 1989 | QDF_STATUS ret; |
| 1990 | wmi_fd_send_from_host_cmd_fixed_param *cmd; |
| 1991 | wmi_buf_t wmi_buf; |
| 1992 | qdf_dma_addr_t dma_addr; |
| 1993 | |
| 1994 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1995 | if (!wmi_buf) { |
| 1996 | WMI_LOGE("%s : wmi_buf_alloc failed\n", __func__); |
| 1997 | return QDF_STATUS_E_NOMEM; |
| 1998 | } |
| 1999 | cmd = (wmi_fd_send_from_host_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 2000 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2001 | WMITLV_TAG_STRUC_wmi_fd_send_from_host_cmd_fixed_param, |
| 2002 | WMITLV_GET_STRUCT_TLVLEN( |
| 2003 | wmi_fd_send_from_host_cmd_fixed_param)); |
| 2004 | cmd->vdev_id = param->vdev_id; |
| 2005 | cmd->data_len = qdf_nbuf_len(param->wbuf); |
| 2006 | dma_addr = qdf_nbuf_get_frag_paddr(param->wbuf, 0); |
| 2007 | qdf_dmaaddr_to_32s(dma_addr, &cmd->frag_ptr_lo, &cmd->frag_ptr_hi); |
| 2008 | cmd->frame_ctrl = param->frame_ctrl; |
| 2009 | |
| 2010 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 2011 | WMI_PDEV_SEND_FD_CMDID); |
| 2012 | if (ret != QDF_STATUS_SUCCESS) { |
| 2013 | WMI_LOGE("%s: Failed to send fils discovery frame: %d", |
| 2014 | __func__, ret); |
| 2015 | wmi_buf_free(wmi_buf); |
| 2016 | } |
| 2017 | |
| 2018 | return ret; |
| 2019 | } |
| 2020 | #endif /* WLAN_SUPPORT_FILS */ |
| 2021 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2022 | static QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2023 | struct beacon_params *param) |
| 2024 | { |
Kiran Venkatappa | 9d59bd6 | 2017-04-21 14:42:32 +0530 | [diff] [blame] | 2025 | QDF_STATUS ret; |
| 2026 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 2027 | wmi_buf_t wmi_buf; |
| 2028 | qdf_dma_addr_t dma_addr; |
| 2029 | uint32_t dtim_flag = 0; |
| 2030 | |
| 2031 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2032 | if (!wmi_buf) { |
| 2033 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 2034 | return QDF_STATUS_E_NOMEM; |
| 2035 | } |
| 2036 | if (param->is_dtim_count_zero) { |
| 2037 | dtim_flag |= WMI_BCN_SEND_DTIM_ZERO; |
| 2038 | if (param->is_bitctl_reqd) { |
| 2039 | /* deliver CAB traffic in next DTIM beacon */ |
| 2040 | dtim_flag |= WMI_BCN_SEND_DTIM_BITCTL_SET; |
| 2041 | } |
| 2042 | } |
| 2043 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2044 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2045 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 2046 | WMITLV_GET_STRUCT_TLVLEN |
| 2047 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 2048 | cmd->vdev_id = param->vdev_id; |
| 2049 | cmd->data_len = qdf_nbuf_len(param->wbuf); |
| 2050 | cmd->frame_ctrl = param->frame_ctrl; |
| 2051 | cmd->dtim_flag = dtim_flag; |
| 2052 | dma_addr = qdf_nbuf_get_frag_paddr(param->wbuf, 0); |
| 2053 | cmd->frag_ptr_lo = qdf_get_lower_32_bits(dma_addr); |
| 2054 | #if defined(HTT_PADDR64) |
| 2055 | cmd->frag_ptr_hi = qdf_get_upper_32_bits(dma_addr) & 0x1F; |
| 2056 | #endif |
| 2057 | cmd->bcn_antenna = param->bcn_txant; |
| 2058 | |
| 2059 | ret = wmi_unified_cmd_send(wmi_handle, |
| 2060 | wmi_buf, sizeof(*cmd), WMI_PDEV_SEND_BCN_CMDID); |
| 2061 | if (ret != QDF_STATUS_SUCCESS) { |
| 2062 | WMI_LOGE("%s: Failed to send bcn: %d", __func__, ret); |
| 2063 | wmi_buf_free(wmi_buf); |
| 2064 | } |
| 2065 | |
| 2066 | return ret; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2067 | } |
| 2068 | |
| 2069 | /** |
| 2070 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 2071 | * @param wmi_handle : handle to WMI. |
| 2072 | * @param param : pointer to hold beacon send cmd parameter |
| 2073 | * |
| 2074 | * Return: 0 on success and -ve on failure. |
| 2075 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2076 | 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] | 2077 | struct beacon_tmpl_params *param) |
| 2078 | { |
| 2079 | int32_t ret; |
| 2080 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 2081 | wmi_bcn_prb_info *bcn_prb_info; |
| 2082 | wmi_buf_t wmi_buf; |
| 2083 | uint8_t *buf_ptr; |
| 2084 | uint32_t wmi_buf_len; |
| 2085 | |
| 2086 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 2087 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 2088 | param->tmpl_len_aligned; |
| 2089 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 2090 | if (!wmi_buf) { |
| 2091 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 2092 | return QDF_STATUS_E_NOMEM; |
| 2093 | } |
| 2094 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2095 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 2096 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2097 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 2098 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 2099 | cmd->vdev_id = param->vdev_id; |
| 2100 | cmd->tim_ie_offset = param->tim_ie_offset; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 2101 | cmd->csa_switch_count_offset = param->csa_switch_count_offset; |
| 2102 | cmd->ext_csa_switch_count_offset = param->ext_csa_switch_count_offset; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2103 | cmd->buf_len = param->tmpl_len; |
| 2104 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 2105 | |
| 2106 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 2107 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 2108 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 2109 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 2110 | bcn_prb_info->caps = 0; |
| 2111 | bcn_prb_info->erp = 0; |
| 2112 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 2113 | |
| 2114 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 2115 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2116 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 2117 | |
| 2118 | ret = wmi_unified_cmd_send(wmi_handle, |
| 2119 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 2120 | if (ret) { |
| 2121 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 2122 | wmi_buf_free(wmi_buf); |
| 2123 | } |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 2124 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2125 | return 0; |
| 2126 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2127 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2128 | #ifdef CONFIG_MCL |
| 2129 | static inline void copy_peer_flags_tlv( |
| 2130 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 2131 | struct peer_assoc_params *param) |
| 2132 | { |
| 2133 | cmd->peer_flags = param->peer_flags; |
| 2134 | } |
| 2135 | #else |
| 2136 | static inline void copy_peer_flags_tlv( |
| 2137 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 2138 | struct peer_assoc_params *param) |
| 2139 | { |
| 2140 | /* |
| 2141 | * The target only needs a subset of the flags maintained in the host. |
| 2142 | * Just populate those flags and send it down |
| 2143 | */ |
| 2144 | cmd->peer_flags = 0; |
| 2145 | |
| 2146 | /* |
| 2147 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 2148 | */ |
| 2149 | if (param->is_wme_set) { |
| 2150 | |
| 2151 | if (param->qos_flag) |
| 2152 | cmd->peer_flags |= WMI_PEER_QOS; |
| 2153 | if (param->apsd_flag) |
| 2154 | cmd->peer_flags |= WMI_PEER_APSD; |
| 2155 | if (param->ht_flag) |
| 2156 | cmd->peer_flags |= WMI_PEER_HT; |
| 2157 | if (param->bw_40) |
| 2158 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 2159 | if (param->bw_80) |
| 2160 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 2161 | if (param->bw_160) |
| 2162 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 2163 | |
| 2164 | /* Typically if STBC is enabled for VHT it should be enabled |
| 2165 | * for HT as well |
| 2166 | **/ |
| 2167 | if (param->stbc_flag) |
| 2168 | cmd->peer_flags |= WMI_PEER_STBC; |
| 2169 | |
| 2170 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 2171 | * for HT as well |
| 2172 | **/ |
| 2173 | if (param->ldpc_flag) |
| 2174 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 2175 | |
| 2176 | if (param->static_mimops_flag) |
| 2177 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 2178 | if (param->dynamic_mimops_flag) |
| 2179 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 2180 | if (param->spatial_mux_flag) |
| 2181 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 2182 | if (param->vht_flag) |
| 2183 | cmd->peer_flags |= WMI_PEER_VHT; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 2184 | if (param->he_flag) |
| 2185 | cmd->peer_flags |= WMI_PEER_HE; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2186 | } |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 2187 | |
Gurumoorthi Gnanasambandhan | d18a061 | 2017-07-03 16:14:55 +0530 | [diff] [blame] | 2188 | if (param->is_pmf_enabled) |
| 2189 | cmd->peer_flags |= WMI_PEER_PMF; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2190 | /* |
| 2191 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 2192 | * (during re-association). |
| 2193 | * Authorization will be done for these modes on key installation. |
| 2194 | */ |
| 2195 | if (param->auth_flag) |
| 2196 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 2197 | if (param->need_ptk_4_way) |
| 2198 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 2199 | else |
| 2200 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 2201 | if (param->need_gtk_2_way) |
| 2202 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 2203 | /* safe mode bypass the 4-way handshake */ |
| 2204 | if (param->safe_mode_enabled) |
| 2205 | cmd->peer_flags &= |
| 2206 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 2207 | /* Disable AMSDU for station transmit, if user configures it */ |
| 2208 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 2209 | * it |
| 2210 | * if (param->amsdu_disable) Add after FW support |
| 2211 | **/ |
| 2212 | |
| 2213 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 2214 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 2215 | * iwpriv |
| 2216 | **/ |
| 2217 | if (param->peer_ht_rates.num_rates == 0) |
| 2218 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 2219 | } |
| 2220 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 2221 | |
| 2222 | #ifdef CONFIG_MCL |
| 2223 | static inline void copy_peer_mac_addr_tlv( |
| 2224 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 2225 | struct peer_assoc_params *param) |
| 2226 | { |
| 2227 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 2228 | sizeof(param->peer_macaddr)); |
| 2229 | } |
| 2230 | #else |
| 2231 | static inline void copy_peer_mac_addr_tlv( |
| 2232 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 2233 | struct peer_assoc_params *param) |
| 2234 | { |
| 2235 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 2236 | } |
| 2237 | #endif |
| 2238 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2239 | /** |
| 2240 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 2241 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2242 | * @param param : pointer to peer assoc parameter |
| 2243 | * |
| 2244 | * Return: 0 on success and -ve on failure. |
| 2245 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2246 | 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] | 2247 | struct peer_assoc_params *param) |
| 2248 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2249 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 2250 | wmi_vht_rate_set *mcs; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2251 | wmi_he_rate_set *he_mcs; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2252 | wmi_buf_t buf; |
| 2253 | int32_t len; |
| 2254 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2255 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2256 | uint32_t peer_legacy_rates_align; |
| 2257 | uint32_t peer_ht_rates_align; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2258 | int32_t i; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2259 | |
| 2260 | |
| 2261 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 2262 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2263 | |
| 2264 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2265 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
| 2266 | WMI_TLV_HDR_SIZE + |
| 2267 | (peer_ht_rates_align * sizeof(uint8_t)) + |
| 2268 | sizeof(wmi_vht_rate_set) + |
| 2269 | (sizeof(wmi_he_rate_set) * param->peer_he_mcs_count |
| 2270 | + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2271 | |
| 2272 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2273 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2274 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2275 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2276 | } |
| 2277 | |
| 2278 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2279 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 2280 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2281 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 2282 | WMITLV_GET_STRUCT_TLVLEN |
| 2283 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2284 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2285 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 2286 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2287 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 2288 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 2289 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2290 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 2291 | copy_peer_mac_addr_tlv(cmd, param); |
| 2292 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2293 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 2294 | cmd->peer_caps = param->peer_caps; |
| 2295 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 2296 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 2297 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 2298 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2299 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 2300 | cmd->peer_phymode = param->peer_phymode; |
| 2301 | |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 2302 | /* Update 11ax capabilities */ |
| 2303 | cmd->peer_he_cap_info = param->peer_he_cap_macinfo; |
| 2304 | cmd->peer_he_ops = param->peer_he_ops; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 2305 | qdf_mem_copy(&cmd->peer_he_cap_phy, ¶m->peer_he_cap_phyinfo, |
| 2306 | sizeof(param->peer_he_cap_phyinfo)); |
| 2307 | qdf_mem_copy(&cmd->peer_ppet, ¶m->peer_ppet, |
| 2308 | sizeof(param->peer_ppet)); |
| 2309 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2310 | /* Update peer legacy rate information */ |
| 2311 | buf_ptr += sizeof(*cmd); |
| 2312 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2313 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2314 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2315 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2316 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2317 | param->peer_legacy_rates.num_rates); |
| 2318 | |
| 2319 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 2320 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2321 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2322 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2323 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2324 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2325 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2326 | param->peer_ht_rates.num_rates); |
| 2327 | |
| 2328 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 2329 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2330 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 2331 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 2332 | |
| 2333 | cmd->peer_nss = param->peer_nss; |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2334 | |
| 2335 | /* Update bandwidth-NSS mapping */ |
| 2336 | cmd->peer_bw_rxnss_override = 0; |
| 2337 | cmd->peer_bw_rxnss_override |= param->peer_bw_rxnss_override; |
| 2338 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2339 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 2340 | if (param->vht_capable) { |
| 2341 | mcs->rx_max_rate = param->rx_max_rate; |
| 2342 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 2343 | mcs->tx_max_rate = param->tx_max_rate; |
| 2344 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 2345 | } |
| 2346 | |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2347 | /* HE Rates */ |
| 2348 | cmd->peer_he_mcs = param->peer_he_mcs_count; |
| 2349 | buf_ptr += sizeof(wmi_vht_rate_set); |
| 2350 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2351 | (param->peer_he_mcs_count * sizeof(wmi_he_rate_set))); |
| 2352 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2353 | |
| 2354 | /* Loop through the HE rate set */ |
| 2355 | for (i = 0; i < param->peer_he_mcs_count; i++) { |
| 2356 | he_mcs = (wmi_he_rate_set *) buf_ptr; |
| 2357 | WMITLV_SET_HDR(he_mcs, WMITLV_TAG_STRUC_wmi_he_rate_set, |
| 2358 | WMITLV_GET_STRUCT_TLVLEN(wmi_he_rate_set)); |
| 2359 | |
| 2360 | he_mcs->rx_mcs_set = param->peer_he_rx_mcs_set[i]; |
| 2361 | he_mcs->tx_mcs_set = param->peer_he_tx_mcs_set[i]; |
| 2362 | WMI_LOGD("%s:HE idx %d RxMCSmap %x TxMCSmap %x ", __func__, |
| 2363 | i, he_mcs->rx_mcs_set, he_mcs->tx_mcs_set); |
| 2364 | buf_ptr += sizeof(wmi_he_rate_set); |
| 2365 | } |
| 2366 | |
| 2367 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2368 | 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] | 2369 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 2370 | "nss %d phymode %d peer_mpdu_density %d " |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2371 | "cmd->peer_vht_caps %x " |
| 2372 | "HE cap_info %x ops %x " |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2373 | "HE phy %x %x %x " |
| 2374 | "peer_bw_rxnss_override %x", __func__, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2375 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 2376 | cmd->peer_rate_caps, cmd->peer_caps, |
| 2377 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 2378 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 2379 | cmd->peer_mpdu_density, |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2380 | cmd->peer_vht_caps, cmd->peer_he_cap_info, |
| 2381 | cmd->peer_he_ops, cmd->peer_he_cap_phy[0], |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2382 | cmd->peer_he_cap_phy[1], cmd->peer_he_cap_phy[2], |
| 2383 | cmd->peer_bw_rxnss_override); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2384 | |
| 2385 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2386 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2387 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2388 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2389 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2390 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2391 | } |
| 2392 | |
| 2393 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2394 | } |
| 2395 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2396 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 2397 | */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2398 | static inline void copy_scan_event_cntrl_flags( |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2399 | wmi_start_scan_cmd_fixed_param * cmd, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2400 | struct scan_req_params *param) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2401 | { |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2402 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2403 | /* Scan events subscription */ |
| 2404 | if (param->scan_ev_started) |
| 2405 | cmd->notify_scan_events |= WMI_SCAN_EVENT_STARTED; |
| 2406 | if (param->scan_ev_completed) |
| 2407 | cmd->notify_scan_events |= WMI_SCAN_EVENT_COMPLETED; |
| 2408 | if (param->scan_ev_bss_chan) |
| 2409 | cmd->notify_scan_events |= WMI_SCAN_EVENT_BSS_CHANNEL; |
| 2410 | if (param->scan_ev_foreign_chan) |
| 2411 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL; |
| 2412 | if (param->scan_ev_dequeued) |
| 2413 | cmd->notify_scan_events |= WMI_SCAN_EVENT_DEQUEUED; |
| 2414 | if (param->scan_ev_preempted) |
| 2415 | cmd->notify_scan_events |= WMI_SCAN_EVENT_PREEMPTED; |
| 2416 | if (param->scan_ev_start_failed) |
| 2417 | cmd->notify_scan_events |= WMI_SCAN_EVENT_START_FAILED; |
| 2418 | if (param->scan_ev_restarted) |
| 2419 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESTARTED; |
| 2420 | if (param->scan_ev_foreign_chn_exit) |
| 2421 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 2422 | if (param->scan_ev_suspended) |
| 2423 | cmd->notify_scan_events |= WMI_SCAN_EVENT_SUSPENDED; |
| 2424 | if (param->scan_ev_resumed) |
| 2425 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESUMED; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2426 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2427 | /** Set scan control flags */ |
| 2428 | cmd->scan_ctrl_flags = 0; |
| 2429 | if (param->scan_f_passive) |
| 2430 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; |
| 2431 | if (param->scan_f_strict_passive_pch) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2432 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2433 | if (param->scan_f_promisc_mode) |
| 2434 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROMISCOUS; |
| 2435 | if (param->scan_f_capture_phy_err) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2436 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2437 | if (param->scan_f_half_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2438 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2439 | if (param->scan_f_quarter_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2440 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2441 | if (param->scan_f_cck_rates) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2442 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2443 | if (param->scan_f_ofdm_rates) |
| 2444 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 2445 | if (param->scan_f_chan_stat_evnt) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2446 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2447 | if (param->scan_f_filter_prb_req) |
| 2448 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; |
| 2449 | if (param->scan_f_bcast_probe) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2450 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2451 | if (param->scan_f_offchan_mgmt_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2452 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2453 | if (param->scan_f_offchan_data_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2454 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2455 | if (param->scan_f_force_active_dfs_chn) |
| 2456 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_FORCE_ACTIVE_ON_DFS; |
| 2457 | if (param->scan_f_add_tpc_ie_in_probe) |
| 2458 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_TPC_IE_IN_PROBE_REQ; |
| 2459 | if (param->scan_f_add_ds_ie_in_probe) |
| 2460 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
| 2461 | if (param->scan_f_add_spoofed_mac_in_probe) |
| 2462 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; |
| 2463 | if (param->scan_f_add_rand_seq_in_probe) |
| 2464 | cmd->scan_ctrl_flags |= WMI_SCAN_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 2465 | if (param->scan_f_en_ie_whitelist_in_probe) |
| 2466 | cmd->scan_ctrl_flags |= |
| 2467 | WMI_SCAN_ENABLE_IE_WHTELIST_IN_PROBE_REQ; |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2468 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2469 | /* for adaptive scan mode using 3 bits (21 - 23 bits) */ |
| 2470 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 2471 | param->adaptive_dwell_time_mode); |
| 2472 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2473 | |
| 2474 | /* scan_copy_ie_buffer() - Copy scan ie_data */ |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2475 | static inline void scan_copy_ie_buffer(uint8_t *buf_ptr, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2476 | struct scan_req_params *params) |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2477 | { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2478 | qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len); |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2479 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2480 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2481 | /* |
| 2482 | * get_pdev_wmi_handle() - Helper func to derive pdev wmi handle from vdev_id |
| 2483 | * @param wmi_handle : Handle to WMI |
| 2484 | * @param vdev_id : vdev identifier |
| 2485 | * |
| 2486 | * Return : void * |
| 2487 | */ |
| 2488 | static inline void *get_pdev_wmi_handle(wmi_unified_t wmi_handle, uint8_t vdev_id) |
| 2489 | { |
| 2490 | struct wlan_objmgr_vdev *vdev = NULL; |
| 2491 | struct wlan_objmgr_pdev *pdev = NULL; |
| 2492 | uint8_t pdev_id = 0; |
| 2493 | |
| 2494 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc( |
| 2495 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 2496 | vdev_id, WLAN_SCAN_ID); |
| 2497 | if (vdev) { |
| 2498 | wlan_objmgr_vdev_release_ref(vdev, WLAN_SCAN_ID); |
| 2499 | pdev = wlan_vdev_get_pdev(vdev); |
| 2500 | if (pdev) |
| 2501 | pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); |
| 2502 | else { |
| 2503 | qdf_print("%s : Invalid PDEV, forcing pdev_id to 0\n", __func__); |
| 2504 | } |
| 2505 | } else { |
| 2506 | qdf_print("%s : Invalid VDEV, forcing pdev_id to 0\n", __func__); |
| 2507 | } |
| 2508 | |
| 2509 | return wmi_unified_get_pdev_handle(wmi_handle->soc, pdev_id); |
| 2510 | } |
| 2511 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2512 | /** |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2513 | * wmi_copy_scan_random_mac() - To copy scan randomization attrs to wmi buffer |
| 2514 | * @mac: random mac addr |
| 2515 | * @mask: random mac mask |
| 2516 | * @mac_addr: wmi random mac |
| 2517 | * @mac_mask: wmi random mac mask |
| 2518 | * |
| 2519 | * Return None. |
| 2520 | */ |
| 2521 | static inline |
| 2522 | void wmi_copy_scan_random_mac(uint8_t *mac, uint8_t *mask, |
| 2523 | wmi_mac_addr *mac_addr, wmi_mac_addr *mac_mask) |
| 2524 | { |
| 2525 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mac, mac_addr); |
| 2526 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mask, mac_mask); |
| 2527 | } |
| 2528 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2529 | /* |
| 2530 | * wmi_fill_vendor_oui() - fill vendor OUIs |
| 2531 | * @buf_ptr: pointer to wmi tlv buffer |
| 2532 | * @num_vendor_oui: number of vendor OUIs to be filled |
| 2533 | * @param_voui: pointer to OUI buffer |
| 2534 | * |
| 2535 | * This function populates the wmi tlv buffer when vendor specific OUIs are |
| 2536 | * present. |
| 2537 | * |
| 2538 | * Return: None |
| 2539 | */ |
| 2540 | static inline |
| 2541 | void wmi_fill_vendor_oui(uint8_t *buf_ptr, uint32_t num_vendor_oui, |
| 2542 | uint32_t *pvoui) |
| 2543 | { |
| 2544 | wmi_vendor_oui *voui = NULL; |
| 2545 | uint32_t i; |
| 2546 | |
| 2547 | voui = (wmi_vendor_oui *)buf_ptr; |
| 2548 | |
| 2549 | for (i = 0; i < num_vendor_oui; i++) { |
| 2550 | WMITLV_SET_HDR(&voui[i].tlv_header, |
| 2551 | WMITLV_TAG_STRUC_wmi_vendor_oui, |
| 2552 | WMITLV_GET_STRUCT_TLVLEN(wmi_vendor_oui)); |
| 2553 | voui[i].oui_type_subtype = pvoui[i]; |
| 2554 | } |
| 2555 | } |
| 2556 | |
| 2557 | /* |
| 2558 | * wmi_fill_ie_whitelist_attrs() - fill IE whitelist attrs |
| 2559 | * @ie_bitmap: output pointer to ie bit map in cmd |
| 2560 | * @num_vendor_oui: output pointer to num vendor OUIs |
| 2561 | * @ie_whitelist: input parameter |
| 2562 | * |
| 2563 | * This function populates the IE whitelist attrs of scan, pno and |
| 2564 | * scan oui commands for ie_whitelist parameter. |
| 2565 | * |
| 2566 | * Return: None |
| 2567 | */ |
| 2568 | static inline |
| 2569 | void wmi_fill_ie_whitelist_attrs(uint32_t *ie_bitmap, |
| 2570 | uint32_t *num_vendor_oui, |
| 2571 | struct probe_req_whitelist_attr *ie_whitelist) |
| 2572 | { |
| 2573 | uint32_t i = 0; |
| 2574 | |
| 2575 | for (i = 0; i < PROBE_REQ_BITMAP_LEN; i++) |
| 2576 | ie_bitmap[i] = ie_whitelist->ie_bitmap[i]; |
| 2577 | |
| 2578 | *num_vendor_oui = ie_whitelist->num_vendor_oui; |
| 2579 | } |
| 2580 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2581 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2582 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 2583 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2584 | * @param param : pointer to hold scan start cmd parameter |
| 2585 | * |
| 2586 | * Return: 0 on success and -ve on failure. |
| 2587 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2588 | 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] | 2589 | struct scan_req_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2590 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2591 | int32_t ret = 0; |
| 2592 | int32_t i; |
| 2593 | wmi_buf_t wmi_buf; |
| 2594 | wmi_start_scan_cmd_fixed_param *cmd; |
| 2595 | uint8_t *buf_ptr; |
| 2596 | uint32_t *tmp_ptr; |
| 2597 | wmi_ssid *ssid = NULL; |
| 2598 | wmi_mac_addr *bssid; |
| 2599 | int len = sizeof(*cmd); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2600 | uint8_t extraie_len_with_pad = 0; |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2601 | uint8_t phymode_roundup = 0; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2602 | struct probe_req_whitelist_attr *ie_whitelist = ¶ms->ie_whitelist; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2603 | |
| 2604 | /* Length TLV placeholder for array of uint32_t */ |
| 2605 | len += WMI_TLV_HDR_SIZE; |
| 2606 | /* calculate the length of buffer required */ |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2607 | if (params->chan_list.num_chan) |
| 2608 | len += params->chan_list.num_chan * sizeof(uint32_t); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2609 | |
| 2610 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 2611 | len += WMI_TLV_HDR_SIZE; |
| 2612 | if (params->num_ssids) |
| 2613 | len += params->num_ssids * sizeof(wmi_ssid); |
| 2614 | |
| 2615 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 2616 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2617 | if (params->num_bssid) |
| 2618 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2619 | |
| 2620 | /* Length TLV placeholder for array of bytes */ |
| 2621 | len += WMI_TLV_HDR_SIZE; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2622 | if (params->extraie.len) |
| 2623 | extraie_len_with_pad = |
| 2624 | roundup(params->extraie.len, sizeof(uint32_t)); |
wadesong | 94c7ce6 | 2018-01-22 15:03:12 +0800 | [diff] [blame] | 2625 | len += extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2626 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2627 | len += WMI_TLV_HDR_SIZE; /* Length of TLV for array of wmi_vendor_oui */ |
| 2628 | if (ie_whitelist->num_vendor_oui) |
| 2629 | len += ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 2630 | |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2631 | len += WMI_TLV_HDR_SIZE; /* Length of TLV for array of scan phymode */ |
| 2632 | if (params->scan_f_wide_band) |
| 2633 | phymode_roundup = |
| 2634 | qdf_roundup(params->chan_list.num_chan * sizeof(uint8_t), |
| 2635 | sizeof(uint32_t)); |
| 2636 | len += phymode_roundup; |
| 2637 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2638 | /* Allocate the memory */ |
| 2639 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2640 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2641 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2642 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2643 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2644 | } |
| 2645 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2646 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 2647 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2648 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 2649 | WMITLV_GET_STRUCT_TLVLEN |
| 2650 | (wmi_start_scan_cmd_fixed_param)); |
| 2651 | |
| 2652 | cmd->scan_id = params->scan_id; |
| 2653 | cmd->scan_req_id = params->scan_req_id; |
| 2654 | cmd->vdev_id = params->vdev_id; |
| 2655 | cmd->scan_priority = params->scan_priority; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2656 | |
| 2657 | copy_scan_event_cntrl_flags(cmd, params); |
| 2658 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2659 | cmd->dwell_time_active = params->dwell_time_active; |
| 2660 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 2661 | cmd->min_rest_time = params->min_rest_time; |
| 2662 | cmd->max_rest_time = params->max_rest_time; |
| 2663 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 2664 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 2665 | cmd->idle_time = params->idle_time; |
| 2666 | cmd->max_scan_time = params->max_scan_time; |
| 2667 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2668 | cmd->burst_duration = params->burst_duration; |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2669 | cmd->num_chan = params->chan_list.num_chan; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2670 | cmd->num_bssid = params->num_bssid; |
| 2671 | cmd->num_ssids = params->num_ssids; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2672 | cmd->ie_len = params->extraie.len; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2673 | cmd->n_probes = params->n_probes; |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 2674 | cmd->scan_ctrl_flags_ext = params->scan_ctrl_flags_ext; |
| 2675 | |
| 2676 | WMI_LOGD("scan_ctrl_flags_ext = %x", cmd->scan_ctrl_flags_ext); |
| 2677 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2678 | if (params->scan_random.randomize) |
| 2679 | wmi_copy_scan_random_mac(params->scan_random.mac_addr, |
| 2680 | params->scan_random.mac_mask, |
| 2681 | &cmd->mac_addr, |
| 2682 | &cmd->mac_mask); |
| 2683 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2684 | if (ie_whitelist->white_list) |
| 2685 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 2686 | &cmd->num_vendor_oui, |
| 2687 | ie_whitelist); |
| 2688 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2689 | buf_ptr += sizeof(*cmd); |
| 2690 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2691 | for (i = 0; i < params->chan_list.num_chan; ++i) |
| 2692 | tmp_ptr[i] = params->chan_list.chan[i].freq; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2693 | |
| 2694 | WMITLV_SET_HDR(buf_ptr, |
| 2695 | WMITLV_TAG_ARRAY_UINT32, |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2696 | (params->chan_list.num_chan * sizeof(uint32_t))); |
| 2697 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2698 | (params->chan_list.num_chan * sizeof(uint32_t)); |
| 2699 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2700 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2701 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2702 | goto error; |
| 2703 | } |
| 2704 | |
| 2705 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2706 | (params->num_ssids * sizeof(wmi_ssid))); |
| 2707 | |
| 2708 | if (params->num_ssids) { |
| 2709 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2710 | for (i = 0; i < params->num_ssids; ++i) { |
| 2711 | ssid->ssid_len = params->ssid[i].length; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2712 | qdf_mem_copy(ssid->ssid, params->ssid[i].ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2713 | params->ssid[i].length); |
| 2714 | ssid++; |
| 2715 | } |
| 2716 | } |
| 2717 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 2718 | |
| 2719 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2720 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 2721 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2722 | |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2723 | if (params->num_bssid) { |
| 2724 | for (i = 0; i < params->num_bssid; ++i) { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2725 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 2726 | ¶ms->bssid_list[i].bytes[0], bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2727 | bssid++; |
| 2728 | } |
| 2729 | } |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2730 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2731 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2732 | (params->num_bssid * sizeof(wmi_mac_addr)); |
| 2733 | |
| 2734 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, extraie_len_with_pad); |
| 2735 | if (params->extraie.len) |
| 2736 | scan_copy_ie_buffer(buf_ptr + WMI_TLV_HDR_SIZE, |
| 2737 | params); |
| 2738 | |
| 2739 | buf_ptr += WMI_TLV_HDR_SIZE + extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2740 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2741 | /* probe req ie whitelisting */ |
| 2742 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2743 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 2744 | |
| 2745 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2746 | |
| 2747 | if (cmd->num_vendor_oui) { |
| 2748 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 2749 | ie_whitelist->voui); |
| 2750 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 2751 | } |
| 2752 | |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 2753 | /* Add phy mode TLV if it's a wide band scan */ |
| 2754 | if (params->scan_f_wide_band) { |
| 2755 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, phymode_roundup); |
| 2756 | buf_ptr = (uint8_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2757 | for (i = 0; i < params->chan_list.num_chan; ++i) |
| 2758 | buf_ptr[i] = |
| 2759 | WMI_SCAN_CHAN_SET_MODE(params->chan_list.chan[i].phymode); |
| 2760 | buf_ptr += phymode_roundup; |
| 2761 | } else { |
| 2762 | /* Add ZERO legth phy mode TLV */ |
| 2763 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, 0); |
| 2764 | } |
| 2765 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2766 | ret = wmi_unified_cmd_send( |
| 2767 | get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2768 | len, WMI_START_SCAN_CMDID); |
| 2769 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2770 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2771 | wmi_buf_free(wmi_buf); |
| 2772 | } |
| 2773 | return ret; |
| 2774 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2775 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2776 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2777 | } |
| 2778 | |
| 2779 | /** |
| 2780 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 2781 | * @param wmi_handle : handle to WMI. |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2782 | * @param param : pointer to hold scan cancel cmd parameter |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2783 | * |
| 2784 | * Return: 0 on success and -ve on failure. |
| 2785 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2786 | 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] | 2787 | struct scan_cancel_param *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2788 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2789 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2790 | int ret; |
| 2791 | int len = sizeof(*cmd); |
| 2792 | wmi_buf_t wmi_buf; |
| 2793 | |
| 2794 | /* Allocate the memory */ |
| 2795 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2796 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2797 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2798 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2799 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2800 | goto error; |
| 2801 | } |
| 2802 | |
| 2803 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2804 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2805 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2806 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2807 | cmd->vdev_id = param->vdev_id; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2808 | cmd->requestor = param->requester; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2809 | cmd->scan_id = param->scan_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2810 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2811 | param->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2812 | /* stop the scan with the corresponding scan_id */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2813 | if (param->req_type == WLAN_SCAN_CANCEL_PDEV_ALL) { |
| 2814 | /* Cancelling all scans */ |
| 2815 | cmd->req_type = WMI_SCAN_STOP_ALL; |
| 2816 | } else if (param->req_type == WLAN_SCAN_CANCEL_VDEV_ALL) { |
| 2817 | /* Cancelling VAP scans */ |
| 2818 | cmd->req_type = WMI_SCN_STOP_VAP_ALL; |
| 2819 | } else if (param->req_type == WLAN_SCAN_CANCEL_SINGLE) { |
| 2820 | /* Cancelling specific scan */ |
| 2821 | cmd->req_type = WMI_SCAN_STOP_ONE; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2822 | } else { |
| 2823 | WMI_LOGE("%s: Invalid Command : ", __func__); |
| 2824 | wmi_buf_free(wmi_buf); |
| 2825 | return QDF_STATUS_E_INVAL; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2826 | } |
| 2827 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2828 | ret = wmi_unified_cmd_send(get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2829 | len, WMI_STOP_SCAN_CMDID); |
| 2830 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2831 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2832 | wmi_buf_free(wmi_buf); |
| 2833 | } |
| 2834 | |
| 2835 | error: |
| 2836 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2837 | } |
| 2838 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2839 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2840 | /** |
| 2841 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2842 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2843 | * @param param : pointer to hold scan channel list parameter |
| 2844 | * |
| 2845 | * Return: 0 on success and -ve on failure. |
| 2846 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2847 | 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] | 2848 | struct scan_chan_list_params *chan_list) |
| 2849 | { |
| 2850 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2851 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2852 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2853 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2854 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2855 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2856 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2857 | |
| 2858 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2859 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2860 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2861 | WMI_LOGE("Failed to allocate memory"); |
| 2862 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2863 | goto end; |
| 2864 | } |
| 2865 | |
| 2866 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2867 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2868 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2869 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2870 | WMITLV_GET_STRUCT_TLVLEN |
| 2871 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2872 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2873 | 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] | 2874 | |
| 2875 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2876 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2877 | WMITLV_TAG_ARRAY_STRUC, |
| 2878 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2879 | chan_info = (wmi_channel_param *) |
| 2880 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2881 | tchan_info = chan_list->chan_info; |
| 2882 | |
| 2883 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2884 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2885 | WMITLV_TAG_STRUC_wmi_channel, |
| 2886 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2887 | chan_info->mhz = tchan_info->mhz; |
| 2888 | chan_info->band_center_freq1 = |
| 2889 | tchan_info->band_center_freq1; |
| 2890 | chan_info->band_center_freq2 = |
| 2891 | tchan_info->band_center_freq2; |
| 2892 | chan_info->info = tchan_info->info; |
| 2893 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2894 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2895 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2896 | |
| 2897 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2898 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2899 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2900 | tchan_info++; |
| 2901 | chan_info++; |
| 2902 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2903 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2904 | chan_list->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2905 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2906 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 2907 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2908 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2909 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2910 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2911 | wmi_buf_free(buf); |
| 2912 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2913 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2914 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2915 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2916 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2917 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2918 | 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] | 2919 | struct scan_chan_list_params *chan_list) |
| 2920 | { |
| 2921 | wmi_buf_t buf; |
| 2922 | QDF_STATUS qdf_status; |
| 2923 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2924 | int i; |
| 2925 | uint8_t *buf_ptr; |
| 2926 | wmi_channel *chan_info; |
| 2927 | struct channel_param *tchan_info; |
| 2928 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2929 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2930 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2931 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2932 | if (!buf) { |
| 2933 | WMI_LOGE("Failed to allocate memory"); |
| 2934 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2935 | goto end; |
| 2936 | } |
| 2937 | |
| 2938 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2939 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2940 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2941 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2942 | WMITLV_GET_STRUCT_TLVLEN |
| 2943 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2944 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2945 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2946 | |
Om Prakash Tripathi | cd851c6 | 2017-12-15 17:29:55 +0530 | [diff] [blame] | 2947 | if (chan_list->append) |
| 2948 | cmd->flags |= APPEND_TO_EXISTING_CHAN_LIST; |
| 2949 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2950 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2951 | chan_list->pdev_id); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2952 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2953 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2954 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2955 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2956 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2957 | tchan_info = &(chan_list->ch_param[0]); |
| 2958 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2959 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2960 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2961 | WMITLV_TAG_STRUC_wmi_channel, |
| 2962 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2963 | chan_info->mhz = tchan_info->mhz; |
| 2964 | chan_info->band_center_freq1 = |
| 2965 | tchan_info->cfreq1; |
| 2966 | chan_info->band_center_freq2 = |
| 2967 | tchan_info->cfreq2; |
| 2968 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2969 | if (tchan_info->is_chan_passive) |
| 2970 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2971 | WMI_CHAN_FLAG_PASSIVE); |
| 2972 | |
| 2973 | if (tchan_info->allow_vht) |
| 2974 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2975 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2976 | else if (tchan_info->allow_ht) |
| 2977 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2978 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2979 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2980 | tchan_info->phy_mode); |
| 2981 | |
| 2982 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2983 | * after FW support |
| 2984 | */ |
| 2985 | |
| 2986 | /* also fill in power information */ |
| 2987 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2988 | tchan_info->minpower); |
| 2989 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2990 | tchan_info->maxpower); |
| 2991 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2992 | tchan_info->maxregpower); |
| 2993 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2994 | tchan_info->antennamax); |
| 2995 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2996 | tchan_info->reg_class_id); |
Kai Chen | 4710d46 | 2017-12-15 14:06:06 -0800 | [diff] [blame] | 2997 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 2998 | tchan_info->maxregpower); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2999 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 3000 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 3001 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 3002 | tchan_info++; |
| 3003 | chan_info++; |
| 3004 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 3005 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 3006 | chan_list->pdev_id); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 3007 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 3008 | qdf_status = wmi_unified_cmd_send( |
| 3009 | wmi_handle, |
| 3010 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 3011 | |
| 3012 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 3013 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 3014 | wmi_buf_free(buf); |
| 3015 | } |
| 3016 | |
| 3017 | end: |
| 3018 | return qdf_status; |
| 3019 | } |
| 3020 | #endif |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3021 | |
| 3022 | /** |
| 3023 | * populate_tx_send_params - Populate TX param TLV for mgmt and offchan tx |
| 3024 | * |
| 3025 | * @bufp: Pointer to buffer |
| 3026 | * @param: Pointer to tx param |
| 3027 | * |
| 3028 | * Return: QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure |
| 3029 | */ |
| 3030 | static inline QDF_STATUS populate_tx_send_params(uint8_t *bufp, |
| 3031 | struct tx_send_params param) |
| 3032 | { |
| 3033 | wmi_tx_send_params *tx_param; |
| 3034 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 3035 | |
| 3036 | if (!bufp) { |
| 3037 | status = QDF_STATUS_E_FAILURE; |
| 3038 | return status; |
| 3039 | } |
| 3040 | tx_param = (wmi_tx_send_params *)bufp; |
| 3041 | WMITLV_SET_HDR(&tx_param->tlv_header, |
| 3042 | WMITLV_TAG_STRUC_wmi_tx_send_params, |
| 3043 | WMITLV_GET_STRUCT_TLVLEN(wmi_tx_send_params)); |
| 3044 | WMI_TX_SEND_PARAM_PWR_SET(tx_param->tx_param_dword0, param.pwr); |
| 3045 | WMI_TX_SEND_PARAM_MCS_MASK_SET(tx_param->tx_param_dword0, |
| 3046 | param.mcs_mask); |
| 3047 | WMI_TX_SEND_PARAM_NSS_MASK_SET(tx_param->tx_param_dword0, |
| 3048 | param.nss_mask); |
| 3049 | WMI_TX_SEND_PARAM_RETRY_LIMIT_SET(tx_param->tx_param_dword0, |
| 3050 | param.retry_limit); |
| 3051 | WMI_TX_SEND_PARAM_CHAIN_MASK_SET(tx_param->tx_param_dword1, |
| 3052 | param.chain_mask); |
| 3053 | WMI_TX_SEND_PARAM_BW_MASK_SET(tx_param->tx_param_dword1, |
| 3054 | param.bw_mask); |
| 3055 | WMI_TX_SEND_PARAM_PREAMBLE_SET(tx_param->tx_param_dword1, |
| 3056 | param.preamble_type); |
| 3057 | WMI_TX_SEND_PARAM_FRAME_TYPE_SET(tx_param->tx_param_dword1, |
| 3058 | param.frame_type); |
| 3059 | |
| 3060 | return status; |
| 3061 | } |
| 3062 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 3063 | /** |
| 3064 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 3065 | * @wmi_handle : handle to WMI. |
| 3066 | * @param : pointer to hold mgmt cmd parameter |
| 3067 | * |
| 3068 | * Return: 0 on success and -ve on failure. |
| 3069 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3070 | static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 3071 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 3072 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3073 | wmi_buf_t buf; |
| 3074 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 3075 | int32_t cmd_len; |
| 3076 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3077 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3078 | uint8_t *bufp; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3079 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3080 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 3081 | mgmt_tx_dl_frm_len; |
| 3082 | |
| 3083 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3084 | WMI_TLV_HDR_SIZE + |
| 3085 | roundup(bufp_len, sizeof(uint32_t)); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3086 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3087 | 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] | 3088 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3089 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 3090 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3091 | } |
| 3092 | |
| 3093 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 3094 | bufp = (uint8_t *) cmd; |
| 3095 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3096 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 3097 | WMITLV_GET_STRUCT_TLVLEN |
| 3098 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 3099 | |
| 3100 | cmd->vdev_id = param->vdev_id; |
| 3101 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 3102 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3103 | cmd->chanfreq = param->chanfreq; |
| 3104 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 3105 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 3106 | sizeof(uint32_t))); |
| 3107 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3108 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
Himanshu Agarwal | e3d1374 | 2017-04-04 12:36:33 +0530 | [diff] [blame] | 3109 | |
| 3110 | status = qdf_nbuf_map_single(qdf_ctx, param->tx_frame, |
| 3111 | QDF_DMA_TO_DEVICE); |
| 3112 | if (status != QDF_STATUS_SUCCESS) { |
| 3113 | WMI_LOGE("%s: wmi buf map failed", __func__); |
| 3114 | goto err1; |
| 3115 | } |
| 3116 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3117 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3118 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
Orhan K AKYILDIZ | 271641f | 2017-01-29 15:17:12 -0800 | [diff] [blame] | 3119 | #if defined(HTT_PADDR64) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3120 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 3121 | #endif |
| 3122 | cmd->frame_len = param->frm_len; |
| 3123 | cmd->buf_len = bufp_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3124 | cmd->tx_params_valid = param->tx_params_valid; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3125 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 3126 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 3127 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 3128 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3129 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 3130 | if (param->tx_params_valid) { |
| 3131 | status = populate_tx_send_params(bufp, param->tx_param); |
| 3132 | if (status != QDF_STATUS_SUCCESS) { |
| 3133 | WMI_LOGE("%s: Populate TX send params failed", |
| 3134 | __func__); |
| 3135 | goto err1; |
| 3136 | } |
| 3137 | cmd_len += sizeof(wmi_tx_send_params); |
| 3138 | } |
| 3139 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3140 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3141 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3142 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3143 | goto err1; |
| 3144 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3145 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3146 | |
| 3147 | err1: |
| 3148 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3149 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3150 | } |
| 3151 | |
| 3152 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3153 | * send_offchan_data_tx_send_cmd_tlv() - Send off-chan tx data |
| 3154 | * @wmi_handle : handle to WMI. |
| 3155 | * @param : pointer to offchan data tx cmd parameter |
| 3156 | * |
| 3157 | * Return: QDF_STATUS_SUCCESS on success and error on failure. |
| 3158 | */ |
| 3159 | static QDF_STATUS send_offchan_data_tx_cmd_tlv(wmi_unified_t wmi_handle, |
| 3160 | struct wmi_offchan_data_tx_params *param) |
| 3161 | { |
| 3162 | wmi_buf_t buf; |
| 3163 | wmi_offchan_data_tx_send_cmd_fixed_param *cmd; |
| 3164 | int32_t cmd_len; |
| 3165 | uint64_t dma_addr; |
| 3166 | void *qdf_ctx = param->qdf_ctx; |
| 3167 | uint8_t *bufp; |
| 3168 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? |
| 3169 | param->frm_len : mgmt_tx_dl_frm_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3170 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3171 | |
| 3172 | cmd_len = sizeof(wmi_offchan_data_tx_send_cmd_fixed_param) + |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3173 | WMI_TLV_HDR_SIZE + |
| 3174 | roundup(bufp_len, sizeof(uint32_t)); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3175 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3176 | 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] | 3177 | if (!buf) { |
| 3178 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 3179 | return QDF_STATUS_E_NOMEM; |
| 3180 | } |
| 3181 | |
| 3182 | cmd = (wmi_offchan_data_tx_send_cmd_fixed_param *) wmi_buf_data(buf); |
| 3183 | bufp = (uint8_t *) cmd; |
| 3184 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3185 | WMITLV_TAG_STRUC_wmi_offchan_data_tx_send_cmd_fixed_param, |
| 3186 | WMITLV_GET_STRUCT_TLVLEN |
| 3187 | (wmi_offchan_data_tx_send_cmd_fixed_param)); |
| 3188 | |
| 3189 | cmd->vdev_id = param->vdev_id; |
| 3190 | |
| 3191 | cmd->desc_id = param->desc_id; |
| 3192 | cmd->chanfreq = param->chanfreq; |
| 3193 | bufp += sizeof(wmi_offchan_data_tx_send_cmd_fixed_param); |
| 3194 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 3195 | sizeof(uint32_t))); |
| 3196 | bufp += WMI_TLV_HDR_SIZE; |
| 3197 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 3198 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 3199 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
| 3200 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 3201 | #if defined(HTT_PADDR64) |
| 3202 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 3203 | #endif |
| 3204 | cmd->frame_len = param->frm_len; |
| 3205 | cmd->buf_len = bufp_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3206 | cmd->tx_params_valid = param->tx_params_valid; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3207 | |
| 3208 | wmi_mgmt_cmd_record(wmi_handle, WMI_OFFCHAN_DATA_TX_SEND_CMDID, |
| 3209 | bufp, cmd->vdev_id, cmd->chanfreq); |
| 3210 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3211 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 3212 | if (param->tx_params_valid) { |
| 3213 | status = populate_tx_send_params(bufp, param->tx_param); |
| 3214 | if (status != QDF_STATUS_SUCCESS) { |
| 3215 | WMI_LOGE("%s: Populate TX send params failed", |
| 3216 | __func__); |
| 3217 | goto err1; |
| 3218 | } |
| 3219 | cmd_len += sizeof(wmi_tx_send_params); |
| 3220 | } |
| 3221 | |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3222 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3223 | WMI_OFFCHAN_DATA_TX_SEND_CMDID)) { |
| 3224 | WMI_LOGE("%s: Failed to offchan data Tx", __func__); |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3225 | goto err1; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3226 | } |
| 3227 | |
| 3228 | return QDF_STATUS_SUCCESS; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 3229 | |
| 3230 | err1: |
| 3231 | wmi_buf_free(buf); |
| 3232 | return QDF_STATUS_E_FAILURE; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 3233 | } |
| 3234 | |
| 3235 | /** |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3236 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 3237 | * @wmi_handle: wmi handle |
| 3238 | * @param_value: parameter value |
| 3239 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3240 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3241 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3242 | 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] | 3243 | uint32_t param_value) |
| 3244 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3245 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3246 | wmi_modem_power_state_cmd_param *cmd; |
| 3247 | wmi_buf_t buf; |
| 3248 | uint16_t len = sizeof(*cmd); |
| 3249 | |
| 3250 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3251 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3252 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3253 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3254 | } |
| 3255 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 3256 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3257 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 3258 | WMITLV_GET_STRUCT_TLVLEN |
| 3259 | (wmi_modem_power_state_cmd_param)); |
| 3260 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3261 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3262 | param_value); |
| 3263 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3264 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3265 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3266 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3267 | wmi_buf_free(buf); |
| 3268 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3269 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3270 | return ret; |
| 3271 | } |
| 3272 | |
| 3273 | /** |
| 3274 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 3275 | * @wmi_handle: wmi handle |
| 3276 | * @vdev_id: vdev id |
| 3277 | * @val: value |
| 3278 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3279 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3280 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3281 | 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] | 3282 | uint32_t vdev_id, uint8_t val) |
| 3283 | { |
| 3284 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 3285 | wmi_buf_t buf; |
| 3286 | int32_t len = sizeof(*cmd); |
| 3287 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3288 | 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] | 3289 | |
| 3290 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3291 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3292 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3293 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3294 | } |
| 3295 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 3296 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3297 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 3298 | WMITLV_GET_STRUCT_TLVLEN |
| 3299 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 3300 | cmd->vdev_id = vdev_id; |
| 3301 | if (val) |
| 3302 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 3303 | else |
| 3304 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 3305 | |
| 3306 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3307 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3308 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3309 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3310 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3311 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3312 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 3313 | return 0; |
| 3314 | } |
| 3315 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3316 | /** |
| 3317 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 3318 | * @wmi_handle: wmi handle |
| 3319 | * @vdev_id: vdev id |
| 3320 | * @value: value |
| 3321 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3322 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3323 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3324 | 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] | 3325 | uint8_t vdev_id, int value) |
| 3326 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3327 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3328 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 3329 | wmi_buf_t buf; |
| 3330 | uint16_t len = sizeof(*cmd); |
| 3331 | |
| 3332 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3333 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3334 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3335 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3336 | } |
| 3337 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 3338 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3339 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 3340 | WMITLV_GET_STRUCT_TLVLEN |
| 3341 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 3342 | |
| 3343 | cmd->vdev_id = vdev_id; |
| 3344 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 3345 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 3346 | * to SM power save values defined in the specification. |
| 3347 | * Make sure to send the right mapping. |
| 3348 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3349 | switch (value) { |
| 3350 | case 0: |
| 3351 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 3352 | break; |
| 3353 | case 1: |
| 3354 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 3355 | break; |
| 3356 | case 2: |
| 3357 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 3358 | break; |
| 3359 | case 3: |
| 3360 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 3361 | break; |
| 3362 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3363 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 3364 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3365 | } |
| 3366 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3367 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3368 | |
| 3369 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3370 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3371 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3372 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3373 | wmi_buf_free(buf); |
| 3374 | } |
| 3375 | |
| 3376 | return ret; |
| 3377 | } |
| 3378 | |
| 3379 | /** |
| 3380 | * send_set_smps_params_cmd_tlv() - set smps params |
| 3381 | * @wmi_handle: wmi handle |
| 3382 | * @vdev_id: vdev id |
| 3383 | * @value: value |
| 3384 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3385 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3386 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3387 | 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] | 3388 | int value) |
| 3389 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3390 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3391 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 3392 | wmi_buf_t buf; |
| 3393 | uint16_t len = sizeof(*cmd); |
| 3394 | |
| 3395 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3396 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3397 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3398 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3399 | } |
| 3400 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 3401 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3402 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 3403 | WMITLV_GET_STRUCT_TLVLEN |
| 3404 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 3405 | |
| 3406 | cmd->vdev_id = vdev_id; |
| 3407 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 3408 | cmd->param = |
| 3409 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 3410 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3411 | 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] | 3412 | cmd->param); |
| 3413 | |
| 3414 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3415 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3416 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3417 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3418 | wmi_buf_free(buf); |
| 3419 | } |
| 3420 | |
| 3421 | return ret; |
| 3422 | } |
| 3423 | |
| 3424 | /** |
| 3425 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 3426 | * @wmi_handle: wmi handle |
| 3427 | * @noa: p2p power save parameters |
| 3428 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3429 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3430 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3431 | static QDF_STATUS send_set_p2pgo_noa_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3432 | struct p2p_ps_params *noa) |
| 3433 | { |
| 3434 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 3435 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 3436 | wmi_buf_t buf; |
| 3437 | uint8_t *buf_ptr; |
| 3438 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3439 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3440 | uint32_t duration; |
| 3441 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3442 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3443 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 3444 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3445 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3446 | WMI_LOGE("Failed to allocate memory"); |
| 3447 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3448 | goto end; |
| 3449 | } |
| 3450 | |
| 3451 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3452 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 3453 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3454 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 3455 | WMITLV_GET_STRUCT_TLVLEN |
| 3456 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 3457 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 3458 | cmd->vdev_id = noa->session_id; |
| 3459 | cmd->enable = (duration) ? true : false; |
| 3460 | cmd->num_noa = 1; |
| 3461 | |
| 3462 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 3463 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 3464 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 3465 | sizeof |
| 3466 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 3467 | + WMI_TLV_HDR_SIZE); |
| 3468 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 3469 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 3470 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 3471 | noa_discriptor->type_count = noa->count; |
| 3472 | noa_discriptor->duration = duration; |
| 3473 | noa_discriptor->interval = noa->interval; |
| 3474 | noa_discriptor->start_time = 0; |
| 3475 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3476 | WMI_LOGI("SET P2P GO NOA:vdev_id:%d count:%d duration:%d interval:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3477 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 3478 | noa->interval); |
| 3479 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3480 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3481 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3482 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3483 | wmi_buf_free(buf); |
| 3484 | } |
| 3485 | |
| 3486 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3487 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3488 | return status; |
| 3489 | } |
| 3490 | |
| 3491 | |
| 3492 | /** |
| 3493 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 3494 | * @wmi_handle: wmi handle |
| 3495 | * @noa: p2p opp power save parameters |
| 3496 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3497 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3498 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3499 | static QDF_STATUS send_set_p2pgo_oppps_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3500 | struct p2p_ps_params *oppps) |
| 3501 | { |
| 3502 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 3503 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3504 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3505 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3506 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3507 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3508 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3509 | WMI_LOGE("Failed to allocate memory"); |
| 3510 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3511 | goto end; |
| 3512 | } |
| 3513 | |
| 3514 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 3515 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3516 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 3517 | WMITLV_GET_STRUCT_TLVLEN |
| 3518 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 3519 | cmd->vdev_id = oppps->session_id; |
| 3520 | if (oppps->ctwindow) |
| 3521 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 3522 | |
| 3523 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3524 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3525 | cmd->vdev_id, oppps->ctwindow); |
| 3526 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 3527 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3528 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3529 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3530 | wmi_buf_free(buf); |
| 3531 | } |
| 3532 | |
| 3533 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3534 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3535 | return status; |
| 3536 | } |
| 3537 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 3538 | #ifdef CONVERGED_P2P_ENABLE |
| 3539 | /** |
| 3540 | * send_p2p_lo_start_cmd_tlv() - send p2p lo start request to fw |
| 3541 | * @wmi_handle: wmi handle |
| 3542 | * @param: p2p listen offload start parameters |
| 3543 | * |
| 3544 | * Return: QDF status |
| 3545 | */ |
| 3546 | static QDF_STATUS send_p2p_lo_start_cmd_tlv(wmi_unified_t wmi_handle, |
| 3547 | struct p2p_lo_start *param) |
| 3548 | { |
| 3549 | wmi_buf_t buf; |
| 3550 | wmi_p2p_lo_start_cmd_fixed_param *cmd; |
| 3551 | int32_t len = sizeof(*cmd); |
| 3552 | uint8_t *buf_ptr; |
| 3553 | QDF_STATUS status; |
| 3554 | int device_types_len_aligned; |
| 3555 | int probe_resp_len_aligned; |
| 3556 | |
| 3557 | if (!param) { |
| 3558 | WMI_LOGE("lo start param is null"); |
| 3559 | return QDF_STATUS_E_INVAL; |
| 3560 | } |
| 3561 | |
| 3562 | WMI_LOGD("%s: vdev_id:%d", __func__, param->vdev_id); |
| 3563 | |
| 3564 | device_types_len_aligned = |
| 3565 | qdf_roundup(param->dev_types_len, |
| 3566 | sizeof(A_UINT32)); |
| 3567 | probe_resp_len_aligned = |
| 3568 | qdf_roundup(param->probe_resp_len, |
| 3569 | sizeof(A_UINT32)); |
| 3570 | |
| 3571 | len += 2 * WMI_TLV_HDR_SIZE + device_types_len_aligned + |
| 3572 | probe_resp_len_aligned; |
| 3573 | |
| 3574 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3575 | if (!buf) { |
| 3576 | WMI_LOGE("%s: Failed to allocate memory for p2p lo start", |
| 3577 | __func__); |
| 3578 | return QDF_STATUS_E_NOMEM; |
| 3579 | } |
| 3580 | |
| 3581 | cmd = (wmi_p2p_lo_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 3582 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3583 | |
| 3584 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3585 | WMITLV_TAG_STRUC_wmi_p2p_lo_start_cmd_fixed_param, |
| 3586 | WMITLV_GET_STRUCT_TLVLEN( |
| 3587 | wmi_p2p_lo_start_cmd_fixed_param)); |
| 3588 | |
| 3589 | cmd->vdev_id = param->vdev_id; |
| 3590 | cmd->ctl_flags = param->ctl_flags; |
| 3591 | cmd->channel = param->freq; |
| 3592 | cmd->period = param->period; |
| 3593 | cmd->interval = param->interval; |
| 3594 | cmd->count = param->count; |
| 3595 | cmd->device_types_len = param->dev_types_len; |
| 3596 | cmd->prob_resp_len = param->probe_resp_len; |
| 3597 | |
| 3598 | buf_ptr += sizeof(wmi_p2p_lo_start_cmd_fixed_param); |
| 3599 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3600 | device_types_len_aligned); |
| 3601 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3602 | qdf_mem_copy(buf_ptr, param->device_types, |
| 3603 | param->dev_types_len); |
| 3604 | |
| 3605 | buf_ptr += device_types_len_aligned; |
| 3606 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3607 | probe_resp_len_aligned); |
| 3608 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3609 | qdf_mem_copy(buf_ptr, param->probe_resp_tmplt, |
| 3610 | param->probe_resp_len); |
| 3611 | |
| 3612 | WMI_LOGD("%s: Sending WMI_P2P_LO_START command, channel=%d, period=%d, interval=%d, count=%d", __func__, |
| 3613 | cmd->channel, cmd->period, cmd->interval, cmd->count); |
| 3614 | |
| 3615 | status = wmi_unified_cmd_send(wmi_handle, |
| 3616 | buf, len, |
| 3617 | WMI_P2P_LISTEN_OFFLOAD_START_CMDID); |
| 3618 | if (status != QDF_STATUS_SUCCESS) { |
| 3619 | WMI_LOGE("%s: Failed to send p2p lo start: %d", |
| 3620 | __func__, status); |
| 3621 | wmi_buf_free(buf); |
| 3622 | return status; |
| 3623 | } |
| 3624 | |
| 3625 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_START", __func__); |
| 3626 | |
| 3627 | return QDF_STATUS_SUCCESS; |
| 3628 | } |
| 3629 | |
| 3630 | /** |
| 3631 | * send_p2p_lo_stop_cmd_tlv() - send p2p lo stop request to fw |
| 3632 | * @wmi_handle: wmi handle |
| 3633 | * @param: p2p listen offload stop parameters |
| 3634 | * |
| 3635 | * Return: QDF status |
| 3636 | */ |
| 3637 | static QDF_STATUS send_p2p_lo_stop_cmd_tlv(wmi_unified_t wmi_handle, |
| 3638 | uint8_t vdev_id) |
| 3639 | { |
| 3640 | wmi_buf_t buf; |
| 3641 | wmi_p2p_lo_stop_cmd_fixed_param *cmd; |
| 3642 | int32_t len; |
| 3643 | QDF_STATUS status; |
| 3644 | |
| 3645 | WMI_LOGD("%s: vdev_id:%d", __func__, vdev_id); |
| 3646 | |
| 3647 | len = sizeof(*cmd); |
| 3648 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3649 | if (!buf) { |
| 3650 | qdf_print("%s: Failed to allocate memory for p2p lo stop", |
| 3651 | __func__); |
| 3652 | return QDF_STATUS_E_NOMEM; |
| 3653 | } |
| 3654 | cmd = (wmi_p2p_lo_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 3655 | |
| 3656 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3657 | WMITLV_TAG_STRUC_wmi_p2p_lo_stop_cmd_fixed_param, |
| 3658 | WMITLV_GET_STRUCT_TLVLEN( |
| 3659 | wmi_p2p_lo_stop_cmd_fixed_param)); |
| 3660 | |
| 3661 | cmd->vdev_id = vdev_id; |
| 3662 | |
| 3663 | WMI_LOGD("%s: Sending WMI_P2P_LO_STOP command", __func__); |
| 3664 | |
| 3665 | status = wmi_unified_cmd_send(wmi_handle, |
| 3666 | buf, len, |
| 3667 | WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID); |
| 3668 | if (status != QDF_STATUS_SUCCESS) { |
| 3669 | WMI_LOGE("%s: Failed to send p2p lo stop: %d", |
| 3670 | __func__, status); |
| 3671 | wmi_buf_free(buf); |
| 3672 | return status; |
| 3673 | } |
| 3674 | |
| 3675 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_STOP", __func__); |
| 3676 | |
| 3677 | return QDF_STATUS_SUCCESS; |
| 3678 | } |
| 3679 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 3680 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3681 | /** |
| 3682 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 3683 | * @wmi_handle: wmi handle |
| 3684 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3685 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3686 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3687 | 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] | 3688 | { |
| 3689 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 3690 | wmi_buf_t wmi_buf; |
| 3691 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 3692 | uint8_t *buf_ptr; |
| 3693 | |
| 3694 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3695 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 3696 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3697 | } |
| 3698 | |
| 3699 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 3700 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3701 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3702 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3703 | } |
| 3704 | |
| 3705 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3706 | |
| 3707 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 3708 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3709 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 3710 | WMITLV_GET_STRUCT_TLVLEN |
| 3711 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 3712 | |
| 3713 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 3714 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3715 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3716 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3717 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3718 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3719 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3720 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3721 | } |
| 3722 | |
| 3723 | /** |
| 3724 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 3725 | * @wmi_handle: wmi handle |
| 3726 | * @vdevid: vdev id |
| 3727 | * @peer_addr: peer mac address |
| 3728 | * @auto_triggerparam: auto trigger parameters |
| 3729 | * @num_ac: number of access category |
| 3730 | * |
| 3731 | * This function sets the trigger |
| 3732 | * uapsd params such as service interval, delay interval |
| 3733 | * and suspend interval which will be used by the firmware |
| 3734 | * to send trigger frames periodically when there is no |
| 3735 | * traffic on the transmit side. |
| 3736 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3737 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3738 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3739 | 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] | 3740 | struct sta_uapsd_trig_params *param) |
| 3741 | { |
| 3742 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3743 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3744 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 3745 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 3746 | uint32_t i; |
| 3747 | wmi_buf_t buf; |
| 3748 | uint8_t *buf_ptr; |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3749 | struct sta_uapsd_params *uapsd_param; |
| 3750 | wmi_sta_uapsd_auto_trig_param *trig_param; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3751 | |
| 3752 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 3753 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3754 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3755 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3756 | } |
| 3757 | |
| 3758 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3759 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 3760 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3761 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 3762 | WMITLV_GET_STRUCT_TLVLEN |
| 3763 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 3764 | cmd->vdev_id = param->vdevid; |
| 3765 | cmd->num_ac = param->num_ac; |
| 3766 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 3767 | |
| 3768 | /* TLV indicating array of structures to follow */ |
| 3769 | buf_ptr += sizeof(*cmd); |
| 3770 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 3771 | |
| 3772 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3773 | |
| 3774 | /* |
| 3775 | * Update tag and length for uapsd auto trigger params (this will take |
| 3776 | * care of updating tag and length if it is not pre-filled by caller). |
| 3777 | */ |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3778 | uapsd_param = (struct sta_uapsd_params *)param->auto_triggerparam; |
| 3779 | trig_param = (wmi_sta_uapsd_auto_trig_param *)buf_ptr; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3780 | for (i = 0; i < param->num_ac; i++) { |
| 3781 | WMITLV_SET_HDR((buf_ptr + |
| 3782 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 3783 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 3784 | WMITLV_GET_STRUCT_TLVLEN |
| 3785 | (wmi_sta_uapsd_auto_trig_param)); |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3786 | trig_param->wmm_ac = uapsd_param->wmm_ac; |
| 3787 | trig_param->user_priority = uapsd_param->user_priority; |
| 3788 | trig_param->service_interval = uapsd_param->service_interval; |
| 3789 | trig_param->suspend_interval = uapsd_param->suspend_interval; |
| 3790 | trig_param->delay_interval = uapsd_param->delay_interval; |
| 3791 | trig_param++; |
| 3792 | uapsd_param++; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3793 | } |
| 3794 | |
| 3795 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3796 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3797 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3798 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3799 | wmi_buf_free(buf); |
| 3800 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3801 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3802 | return ret; |
| 3803 | } |
| 3804 | |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 3805 | #ifdef WLAN_FEATURE_DSRC |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3806 | /** |
| 3807 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 3808 | * @wmi_handle: pointer to the wmi handle |
| 3809 | * @utc: pointer to the UTC time struct |
| 3810 | * |
| 3811 | * Return: 0 on succes |
| 3812 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3813 | static QDF_STATUS send_ocb_set_utc_time_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3814 | struct ocb_utc_param *utc) |
| 3815 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3816 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3817 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 3818 | uint8_t *buf_ptr; |
| 3819 | uint32_t len, i; |
| 3820 | wmi_buf_t buf; |
| 3821 | |
| 3822 | len = sizeof(*cmd); |
| 3823 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3824 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3825 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3826 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3827 | } |
| 3828 | |
| 3829 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3830 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 3831 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3832 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 3833 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 3834 | cmd->vdev_id = utc->vdev_id; |
| 3835 | |
| 3836 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 3837 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 3838 | |
| 3839 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 3840 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 3841 | |
| 3842 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3843 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3844 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3845 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3846 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3847 | } |
| 3848 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3849 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3850 | } |
| 3851 | |
| 3852 | /** |
| 3853 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 3854 | * frames on a channel |
| 3855 | * @wmi_handle: pointer to the wmi handle |
| 3856 | * @timing_advert: pointer to the timing advertisement struct |
| 3857 | * |
| 3858 | * Return: 0 on succes |
| 3859 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3860 | static QDF_STATUS send_ocb_start_timing_advert_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3861 | struct ocb_timing_advert_param *timing_advert) |
| 3862 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3863 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3864 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 3865 | uint8_t *buf_ptr; |
| 3866 | uint32_t len, len_template; |
| 3867 | wmi_buf_t buf; |
| 3868 | |
| 3869 | len = sizeof(*cmd) + |
| 3870 | WMI_TLV_HDR_SIZE; |
| 3871 | |
| 3872 | len_template = timing_advert->template_length; |
| 3873 | /* Add padding to the template if needed */ |
| 3874 | if (len_template % 4 != 0) |
| 3875 | len_template += 4 - (len_template % 4); |
| 3876 | len += len_template; |
| 3877 | |
| 3878 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3879 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3880 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3881 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3882 | } |
| 3883 | |
| 3884 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3885 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3886 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3887 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 3888 | WMITLV_GET_STRUCT_TLVLEN( |
| 3889 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 3890 | cmd->vdev_id = timing_advert->vdev_id; |
| 3891 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 3892 | cmd->channel_freq = timing_advert->chan_freq; |
| 3893 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 3894 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 3895 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 3896 | buf_ptr += sizeof(*cmd); |
| 3897 | |
| 3898 | /* Add the timing advert template */ |
| 3899 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3900 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3901 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3902 | (uint8_t *)timing_advert->template_value, |
| 3903 | timing_advert->template_length); |
| 3904 | |
| 3905 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3906 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3907 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3908 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3909 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3910 | } |
| 3911 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3912 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3913 | } |
| 3914 | |
| 3915 | /** |
| 3916 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 3917 | * on a channel |
| 3918 | * @wmi_handle: pointer to the wmi handle |
| 3919 | * @timing_advert: pointer to the timing advertisement struct |
| 3920 | * |
| 3921 | * Return: 0 on succes |
| 3922 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3923 | static QDF_STATUS send_ocb_stop_timing_advert_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3924 | struct ocb_timing_advert_param *timing_advert) |
| 3925 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3926 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3927 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 3928 | uint8_t *buf_ptr; |
| 3929 | uint32_t len; |
| 3930 | wmi_buf_t buf; |
| 3931 | |
| 3932 | len = sizeof(*cmd); |
| 3933 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3934 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3935 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3936 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3937 | } |
| 3938 | |
| 3939 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3940 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3941 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3942 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 3943 | WMITLV_GET_STRUCT_TLVLEN( |
| 3944 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 3945 | cmd->vdev_id = timing_advert->vdev_id; |
| 3946 | cmd->channel_freq = timing_advert->chan_freq; |
| 3947 | |
| 3948 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3949 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3950 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3951 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3952 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3953 | } |
| 3954 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3955 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3956 | } |
| 3957 | |
| 3958 | /** |
| 3959 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 3960 | * @wmi_handle: pointer to the wmi handle |
| 3961 | * @request: pointer to the request |
| 3962 | * |
| 3963 | * Return: 0 on succes |
| 3964 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3965 | static QDF_STATUS send_ocb_get_tsf_timer_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3966 | uint8_t vdev_id) |
| 3967 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3968 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3969 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 3970 | uint8_t *buf_ptr; |
| 3971 | wmi_buf_t buf; |
| 3972 | int32_t len; |
| 3973 | |
| 3974 | len = sizeof(*cmd); |
| 3975 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3976 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3977 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3978 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3979 | } |
| 3980 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3981 | |
| 3982 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3983 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3984 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3985 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 3986 | WMITLV_GET_STRUCT_TLVLEN( |
| 3987 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 3988 | cmd->vdev_id = vdev_id; |
| 3989 | |
| 3990 | /* Send the WMI command */ |
| 3991 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3992 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 3993 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3994 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3995 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3996 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3997 | } |
| 3998 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3999 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4000 | } |
| 4001 | |
| 4002 | /** |
| 4003 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 4004 | * @wmi_handle: pointer to the wmi handle |
| 4005 | * @get_stats_param: pointer to the dcc stats |
| 4006 | * |
| 4007 | * Return: 0 on succes |
| 4008 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4009 | static QDF_STATUS send_dcc_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 4010 | struct ocb_dcc_get_stats_param *get_stats_param) |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4011 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4012 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4013 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 4014 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 4015 | wmi_buf_t buf; |
| 4016 | uint8_t *buf_ptr; |
| 4017 | uint32_t len; |
| 4018 | uint32_t i; |
| 4019 | |
| 4020 | /* Validate the input */ |
| 4021 | if (get_stats_param->request_array_len != |
| 4022 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4023 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4024 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4025 | } |
| 4026 | |
| 4027 | /* Allocate memory for the WMI command */ |
| 4028 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 4029 | get_stats_param->request_array_len; |
| 4030 | |
| 4031 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4032 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4033 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 4034 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4035 | } |
| 4036 | |
| 4037 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4038 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4039 | |
| 4040 | /* Populate the WMI command */ |
| 4041 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 4042 | buf_ptr += sizeof(*cmd); |
| 4043 | |
| 4044 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4045 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 4046 | WMITLV_GET_STRUCT_TLVLEN( |
| 4047 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 4048 | cmd->vdev_id = get_stats_param->vdev_id; |
| 4049 | cmd->num_channels = get_stats_param->channel_count; |
| 4050 | |
| 4051 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4052 | get_stats_param->request_array_len); |
| 4053 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4054 | |
| 4055 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4056 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4057 | get_stats_param->request_array_len); |
| 4058 | for (i = 0; i < cmd->num_channels; i++) |
| 4059 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 4060 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 4061 | WMITLV_GET_STRUCT_TLVLEN( |
| 4062 | wmi_dcc_channel_stats_request)); |
| 4063 | |
| 4064 | /* Send the WMI command */ |
| 4065 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4066 | WMI_DCC_GET_STATS_CMDID); |
| 4067 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4068 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4069 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4070 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4071 | } |
| 4072 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4073 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4074 | } |
| 4075 | |
| 4076 | /** |
| 4077 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 4078 | * @wmi_handle: pointer to the wmi handle |
| 4079 | * @vdev_id: vdev id |
| 4080 | * @dcc_stats_bitmap: dcc status bitmap |
| 4081 | * |
| 4082 | * Return: 0 on succes |
| 4083 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4084 | static QDF_STATUS send_dcc_clear_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4085 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 4086 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4087 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4088 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 4089 | wmi_buf_t buf; |
| 4090 | uint8_t *buf_ptr; |
| 4091 | uint32_t len; |
| 4092 | |
| 4093 | /* Allocate memory for the WMI command */ |
| 4094 | len = sizeof(*cmd); |
| 4095 | |
| 4096 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4097 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4098 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4099 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4100 | } |
| 4101 | |
| 4102 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4103 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4104 | |
| 4105 | /* Populate the WMI command */ |
| 4106 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 4107 | |
| 4108 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4109 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 4110 | WMITLV_GET_STRUCT_TLVLEN( |
| 4111 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 4112 | cmd->vdev_id = vdev_id; |
| 4113 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 4114 | |
| 4115 | /* Send the WMI command */ |
| 4116 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4117 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4118 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4119 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4120 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4121 | } |
| 4122 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4123 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4124 | } |
| 4125 | |
| 4126 | /** |
| 4127 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 4128 | * @wmi_handle: pointer to the wmi handle |
| 4129 | * @update_ndl_param: pointer to the request parameters |
| 4130 | * |
| 4131 | * Return: 0 on success |
| 4132 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4133 | static QDF_STATUS send_dcc_update_ndl_cmd_tlv(wmi_unified_t wmi_handle, |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 4134 | struct ocb_dcc_update_ndl_param *update_ndl_param) |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4135 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4136 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4137 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 4138 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 4139 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 4140 | uint32_t active_state_count; |
| 4141 | wmi_buf_t buf; |
| 4142 | uint8_t *buf_ptr; |
| 4143 | uint32_t len; |
| 4144 | uint32_t i; |
| 4145 | |
| 4146 | /* validate the input */ |
| 4147 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 4148 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4149 | WMI_LOGE(FL("Invalid parameter")); |
| 4150 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4151 | } |
| 4152 | active_state_count = 0; |
| 4153 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 4154 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 4155 | active_state_count += |
| 4156 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 4157 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 4158 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4159 | WMI_LOGE(FL("Invalid parameter")); |
| 4160 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4161 | } |
| 4162 | |
| 4163 | /* Allocate memory for the WMI command */ |
| 4164 | len = sizeof(*cmd) + |
| 4165 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 4166 | WMI_TLV_HDR_SIZE + |
| 4167 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 4168 | |
| 4169 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4170 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4171 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4172 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4173 | } |
| 4174 | |
| 4175 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4176 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4177 | |
| 4178 | /* Populate the WMI command */ |
| 4179 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 4180 | buf_ptr += sizeof(*cmd); |
| 4181 | |
| 4182 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4183 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 4184 | WMITLV_GET_STRUCT_TLVLEN( |
| 4185 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 4186 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 4187 | cmd->num_channel = update_ndl_param->channel_count; |
| 4188 | |
| 4189 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4190 | update_ndl_param->dcc_ndl_chan_list_len); |
| 4191 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4192 | |
| 4193 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4194 | qdf_mem_copy(ndl_chan_array, update_ndl_param->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4195 | update_ndl_param->dcc_ndl_chan_list_len); |
| 4196 | for (i = 0; i < cmd->num_channel; i++) |
| 4197 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 4198 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 4199 | WMITLV_GET_STRUCT_TLVLEN( |
| 4200 | wmi_dcc_ndl_chan)); |
| 4201 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 4202 | |
| 4203 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4204 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 4205 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4206 | |
| 4207 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4208 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4209 | update_ndl_param->dcc_ndl_active_state_list, |
| 4210 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 4211 | for (i = 0; i < active_state_count; i++) { |
| 4212 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 4213 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 4214 | WMITLV_GET_STRUCT_TLVLEN( |
| 4215 | wmi_dcc_ndl_active_state_config)); |
| 4216 | } |
| 4217 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 4218 | |
| 4219 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4220 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4221 | WMI_DCC_UPDATE_NDL_CMDID); |
| 4222 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4223 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4224 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4225 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4226 | } |
| 4227 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4228 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4229 | } |
| 4230 | |
| 4231 | /** |
| 4232 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 4233 | * @wmi_handle: pointer to the wmi handle |
| 4234 | * @config: the OCB configuration |
| 4235 | * |
| 4236 | * Return: 0 on success |
| 4237 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4238 | static QDF_STATUS send_ocb_set_config_cmd_tlv(wmi_unified_t wmi_handle, |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 4239 | struct ocb_config *config) |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4240 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4241 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4242 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 4243 | wmi_channel *chan; |
| 4244 | wmi_ocb_channel *ocb_chan; |
| 4245 | wmi_qos_parameter *qos_param; |
| 4246 | wmi_dcc_ndl_chan *ndl_chan; |
| 4247 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 4248 | wmi_ocb_schedule_element *sched_elem; |
| 4249 | uint8_t *buf_ptr; |
| 4250 | wmi_buf_t buf; |
| 4251 | int32_t len; |
| 4252 | int32_t i, j, active_state_count; |
| 4253 | |
| 4254 | /* |
| 4255 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 4256 | * states. Validate dcc_ndl_active_state_list_len. |
| 4257 | */ |
| 4258 | active_state_count = 0; |
| 4259 | if (config->dcc_ndl_chan_list_len) { |
| 4260 | if (!config->dcc_ndl_chan_list || |
| 4261 | config->dcc_ndl_chan_list_len != |
| 4262 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4263 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4264 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4265 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4266 | } |
| 4267 | |
| 4268 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 4269 | i < config->channel_count; ++i, ++ndl_chan) |
| 4270 | active_state_count += |
| 4271 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 4272 | |
| 4273 | if (active_state_count) { |
| 4274 | if (!config->dcc_ndl_active_state_list || |
| 4275 | config->dcc_ndl_active_state_list_len != |
| 4276 | active_state_count * |
| 4277 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4278 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4279 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4280 | } |
| 4281 | } |
| 4282 | } |
| 4283 | |
| 4284 | len = sizeof(*cmd) + |
| 4285 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 4286 | sizeof(wmi_channel) + |
| 4287 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 4288 | sizeof(wmi_ocb_channel) + |
| 4289 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 4290 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 4291 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 4292 | WMI_TLV_HDR_SIZE + active_state_count * |
| 4293 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 4294 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 4295 | sizeof(wmi_ocb_schedule_element); |
| 4296 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4297 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4298 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4299 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4300 | } |
| 4301 | |
| 4302 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 4303 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 4304 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4305 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 4306 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 4307 | cmd->vdev_id = config->vdev_id; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4308 | cmd->channel_count = config->channel_count; |
| 4309 | cmd->schedule_size = config->schedule_size; |
| 4310 | cmd->flags = config->flags; |
| 4311 | buf_ptr += sizeof(*cmd); |
| 4312 | |
| 4313 | /* Add the wmi_channel info */ |
| 4314 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4315 | config->channel_count*sizeof(wmi_channel)); |
| 4316 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4317 | for (i = 0; i < config->channel_count; i++) { |
| 4318 | chan = (wmi_channel *)buf_ptr; |
| 4319 | WMITLV_SET_HDR(&chan->tlv_header, |
| 4320 | WMITLV_TAG_STRUC_wmi_channel, |
| 4321 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 4322 | chan->mhz = config->channels[i].chan_freq; |
| 4323 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 4324 | chan->band_center_freq2 = 0; |
| 4325 | chan->info = 0; |
| 4326 | |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 4327 | WMI_SET_CHANNEL_MODE(chan, config->channels[i].ch_mode); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4328 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 4329 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 4330 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 4331 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 4332 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 4333 | config->channels[i].antenna_max); |
| 4334 | |
| 4335 | if (config->channels[i].bandwidth < 10) |
| 4336 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 4337 | else if (config->channels[i].bandwidth < 20) |
| 4338 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 4339 | buf_ptr += sizeof(*chan); |
| 4340 | } |
| 4341 | |
| 4342 | /* Add the wmi_ocb_channel info */ |
| 4343 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4344 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 4345 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4346 | for (i = 0; i < config->channel_count; i++) { |
| 4347 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 4348 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 4349 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 4350 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 4351 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 4352 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 4353 | config->channels[i].mac_address.bytes, |
| 4354 | &ocb_chan->mac_address); |
| 4355 | buf_ptr += sizeof(*ocb_chan); |
| 4356 | } |
| 4357 | |
| 4358 | /* Add the wmi_qos_parameter info */ |
| 4359 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4360 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 4361 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4362 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 4363 | for (i = 0; i < config->channel_count; i++) { |
| 4364 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 4365 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 4366 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 4367 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 4368 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 4369 | qos_param->aifsn = |
| 4370 | config->channels[i].qos_params[j].aifsn; |
| 4371 | qos_param->cwmin = |
| 4372 | config->channels[i].qos_params[j].cwmin; |
| 4373 | qos_param->cwmax = |
| 4374 | config->channels[i].qos_params[j].cwmax; |
| 4375 | buf_ptr += sizeof(*qos_param); |
| 4376 | } |
| 4377 | } |
| 4378 | |
| 4379 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 4380 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4381 | config->dcc_ndl_chan_list_len); |
| 4382 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4383 | if (config->dcc_ndl_chan_list_len) { |
| 4384 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4385 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4386 | config->dcc_ndl_chan_list_len); |
| 4387 | for (i = 0; i < config->channel_count; i++) |
| 4388 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 4389 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 4390 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 4391 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 4392 | } |
| 4393 | |
| 4394 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 4395 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 4396 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 4397 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4398 | if (active_state_count) { |
| 4399 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4400 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4401 | config->dcc_ndl_active_state_list, |
| 4402 | active_state_count * sizeof(*ndl_active_config)); |
| 4403 | for (i = 0; i < active_state_count; ++i) |
| 4404 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 4405 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 4406 | WMITLV_GET_STRUCT_TLVLEN( |
| 4407 | wmi_dcc_ndl_active_state_config)); |
| 4408 | buf_ptr += active_state_count * |
| 4409 | sizeof(*ndl_active_config); |
| 4410 | } |
| 4411 | |
| 4412 | /* Add the wmi_ocb_schedule_element info */ |
| 4413 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4414 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 4415 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4416 | for (i = 0; i < config->schedule_size; i++) { |
| 4417 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 4418 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 4419 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 4420 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 4421 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 4422 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 4423 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 4424 | buf_ptr += sizeof(*sched_elem); |
| 4425 | } |
| 4426 | |
| 4427 | |
| 4428 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4429 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4430 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4431 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4432 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4433 | } |
| 4434 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4435 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4436 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4437 | |
| 4438 | /** |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 4439 | * extract_ocb_channel_config_resp_tlv() - extract ocb channel config resp |
| 4440 | * @wmi_handle: wmi handle |
| 4441 | * @evt_buf: wmi event buffer |
| 4442 | * @status: status buffer |
| 4443 | * |
| 4444 | * Return: QDF_STATUS_SUCCESS on success |
| 4445 | */ |
| 4446 | static QDF_STATUS extract_ocb_channel_config_resp_tlv(wmi_unified_t wmi_handle, |
| 4447 | void *evt_buf, |
| 4448 | uint32_t *status) |
| 4449 | { |
| 4450 | WMI_OCB_SET_CONFIG_RESP_EVENTID_param_tlvs *param_tlvs; |
| 4451 | wmi_ocb_set_config_resp_event_fixed_param *fix_param; |
| 4452 | |
| 4453 | param_tlvs = evt_buf; |
| 4454 | fix_param = param_tlvs->fixed_param; |
| 4455 | |
| 4456 | *status = fix_param->status; |
| 4457 | return QDF_STATUS_SUCCESS; |
| 4458 | } |
| 4459 | |
| 4460 | /** |
| 4461 | * extract_ocb_tsf_timer_tlv() - extract TSF timer from event buffer |
| 4462 | * @wmi_handle: wmi handle |
| 4463 | * @evt_buf: wmi event buffer |
| 4464 | * @resp: response buffer |
| 4465 | * |
| 4466 | * Return: QDF_STATUS_SUCCESS on success |
| 4467 | */ |
| 4468 | static QDF_STATUS extract_ocb_tsf_timer_tlv(wmi_unified_t wmi_handle, |
| 4469 | void *evt_buf, struct ocb_get_tsf_timer_response *resp) |
| 4470 | { |
| 4471 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID_param_tlvs *param_tlvs; |
| 4472 | wmi_ocb_get_tsf_timer_resp_event_fixed_param *fix_param; |
| 4473 | |
| 4474 | param_tlvs = evt_buf; |
| 4475 | fix_param = param_tlvs->fixed_param; |
| 4476 | resp->vdev_id = fix_param->vdev_id; |
| 4477 | resp->timer_high = fix_param->tsf_timer_high; |
| 4478 | resp->timer_low = fix_param->tsf_timer_low; |
| 4479 | |
| 4480 | return QDF_STATUS_SUCCESS; |
| 4481 | } |
| 4482 | |
| 4483 | /** |
| 4484 | * extract_ocb_ndl_resp_tlv() - extract TSF timer from event buffer |
| 4485 | * @wmi_handle: wmi handle |
| 4486 | * @evt_buf: wmi event buffer |
| 4487 | * @resp: response buffer |
| 4488 | * |
| 4489 | * Return: QDF_STATUS_SUCCESS on success |
| 4490 | */ |
| 4491 | static QDF_STATUS extract_ocb_ndl_resp_tlv(wmi_unified_t wmi_handle, |
| 4492 | void *evt_buf, struct ocb_dcc_update_ndl_response *resp) |
| 4493 | { |
| 4494 | WMI_DCC_UPDATE_NDL_RESP_EVENTID_param_tlvs *param_tlvs; |
| 4495 | wmi_dcc_update_ndl_resp_event_fixed_param *fix_param; |
| 4496 | |
| 4497 | param_tlvs = evt_buf; |
| 4498 | fix_param = param_tlvs->fixed_param; |
| 4499 | resp->vdev_id = fix_param->vdev_id; |
| 4500 | resp->status = fix_param->status; |
| 4501 | return QDF_STATUS_SUCCESS; |
| 4502 | } |
| 4503 | |
| 4504 | /** |
| 4505 | * extract_ocb_dcc_stats_tlv() - extract DCC stats from event buffer |
| 4506 | * @wmi_handle: wmi handle |
| 4507 | * @evt_buf: wmi event buffer |
| 4508 | * @resp: response buffer |
| 4509 | * |
| 4510 | * Since length of stats is variable, buffer for DCC stats will be allocated |
| 4511 | * in this function. The caller must free the buffer. |
| 4512 | * |
| 4513 | * Return: QDF_STATUS_SUCCESS on success |
| 4514 | */ |
| 4515 | static QDF_STATUS extract_ocb_dcc_stats_tlv(wmi_unified_t wmi_handle, |
| 4516 | void *evt_buf, struct ocb_dcc_get_stats_response **resp) |
| 4517 | { |
| 4518 | struct ocb_dcc_get_stats_response *response; |
| 4519 | WMI_DCC_GET_STATS_RESP_EVENTID_param_tlvs *param_tlvs; |
| 4520 | wmi_dcc_get_stats_resp_event_fixed_param *fix_param; |
| 4521 | |
| 4522 | param_tlvs = (WMI_DCC_GET_STATS_RESP_EVENTID_param_tlvs *)evt_buf; |
| 4523 | fix_param = param_tlvs->fixed_param; |
| 4524 | |
| 4525 | /* Allocate and populate the response */ |
| 4526 | if (fix_param->num_channels > ((WMI_SVC_MSG_MAX_SIZE - |
| 4527 | sizeof(*fix_param)) / sizeof(wmi_dcc_ndl_stats_per_channel))) { |
| 4528 | WMI_LOGE("%s: too many channels:%d", __func__, |
| 4529 | fix_param->num_channels); |
| 4530 | QDF_ASSERT(0); |
| 4531 | *resp = NULL; |
| 4532 | return QDF_STATUS_E_INVAL; |
| 4533 | } |
| 4534 | response = qdf_mem_malloc(sizeof(*response) + fix_param->num_channels * |
| 4535 | sizeof(wmi_dcc_ndl_stats_per_channel)); |
| 4536 | *resp = response; |
| 4537 | if (!response) |
| 4538 | return QDF_STATUS_E_NOMEM; |
| 4539 | |
| 4540 | response->vdev_id = fix_param->vdev_id; |
| 4541 | response->num_channels = fix_param->num_channels; |
| 4542 | response->channel_stats_array_len = |
| 4543 | fix_param->num_channels * |
| 4544 | sizeof(wmi_dcc_ndl_stats_per_channel); |
| 4545 | response->channel_stats_array = ((uint8_t *)response) + |
| 4546 | sizeof(*response); |
| 4547 | qdf_mem_copy(response->channel_stats_array, |
| 4548 | param_tlvs->stats_per_channel_list, |
| 4549 | response->channel_stats_array_len); |
| 4550 | |
| 4551 | return QDF_STATUS_SUCCESS; |
| 4552 | } |
| 4553 | #endif |
| 4554 | |
| 4555 | /** |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4556 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 4557 | * @wmi_handle: wmi handle |
| 4558 | * @mcc_adaptive_scheduler: enable/disable |
| 4559 | * |
| 4560 | * This function enable/disable mcc adaptive scheduler in fw. |
| 4561 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4562 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4563 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4564 | static QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 4565 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 4566 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4567 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4568 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4569 | wmi_buf_t buf = 0; |
| 4570 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 4571 | uint16_t len = |
| 4572 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 4573 | |
| 4574 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4575 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4576 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 4577 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4578 | } |
| 4579 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 4580 | wmi_buf_data(buf); |
| 4581 | |
| 4582 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4583 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 4584 | WMITLV_GET_STRUCT_TLVLEN |
| 4585 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 4586 | cmd->enable = mcc_adaptive_scheduler; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 4587 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4588 | |
| 4589 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4590 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4591 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4592 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4593 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4594 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4595 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4596 | |
| 4597 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4598 | } |
| 4599 | |
| 4600 | /** |
| 4601 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 4602 | * @wmi: wmi handle |
| 4603 | * @mcc_channel: mcc channel |
| 4604 | * @mcc_channel_time_latency: MCC channel time latency. |
| 4605 | * |
| 4606 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 4607 | * channel of it and channel number. The info is provided run time using |
| 4608 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 4609 | * |
| 4610 | * Return: CDF status |
| 4611 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4612 | static QDF_STATUS send_set_mcc_channel_time_latency_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4613 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 4614 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4615 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4616 | wmi_buf_t buf = 0; |
| 4617 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 4618 | uint16_t len = 0; |
| 4619 | uint8_t *buf_ptr = NULL; |
| 4620 | wmi_resmgr_chan_latency chan_latency; |
| 4621 | /* Note: we only support MCC time latency for a single channel */ |
| 4622 | uint32_t num_channels = 1; |
| 4623 | uint32_t chan1_freq = mcc_channel_freq; |
| 4624 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 4625 | |
| 4626 | |
| 4627 | /* If 0ms latency is provided, then FW will set to a default. |
| 4628 | * Otherwise, latency must be at least 30ms. |
| 4629 | */ |
| 4630 | if ((latency_chan1 > 0) && |
| 4631 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4632 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4633 | "Minimum is 30ms (or 0 to use default value by " |
| 4634 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4635 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4636 | } |
| 4637 | |
| 4638 | /* Set WMI CMD for channel time latency here */ |
| 4639 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 4640 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 4641 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 4642 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4643 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4644 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 4645 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4646 | } |
| 4647 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4648 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 4649 | wmi_buf_data(buf); |
| 4650 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 4651 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 4652 | WMITLV_GET_STRUCT_TLVLEN |
| 4653 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 4654 | cmdTL->num_chans = num_channels; |
| 4655 | /* Update channel time latency information for home channel(s) */ |
| 4656 | buf_ptr += sizeof(*cmdTL); |
| 4657 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4658 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 4659 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4660 | chan_latency.chan_mhz = chan1_freq; |
| 4661 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4662 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4663 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4664 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4665 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4666 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4667 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4668 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4669 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4670 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4671 | |
| 4672 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4673 | } |
| 4674 | |
| 4675 | /** |
| 4676 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 4677 | * @wmi: wmi handle |
| 4678 | * @adapter_1_chan_number: adapter 1 channel number |
| 4679 | * @adapter_1_quota: adapter 1 quota |
| 4680 | * @adapter_2_chan_number: adapter 2 channel number |
| 4681 | * |
| 4682 | * Return: CDF status |
| 4683 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4684 | static QDF_STATUS send_set_mcc_channel_time_quota_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4685 | uint32_t adapter_1_chan_freq, |
| 4686 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 4687 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4688 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4689 | wmi_buf_t buf = 0; |
| 4690 | uint16_t len = 0; |
| 4691 | uint8_t *buf_ptr = NULL; |
| 4692 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 4693 | wmi_resmgr_chan_time_quota chan_quota; |
| 4694 | uint32_t quota_chan1 = adapter_1_quota; |
| 4695 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 4696 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 4697 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 4698 | uint32_t num_channels = 2; |
| 4699 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 4700 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 4701 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4702 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4703 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 4704 | chan1_freq, quota_chan1, chan2_freq, |
| 4705 | quota_chan2); |
| 4706 | |
| 4707 | /* |
| 4708 | * Perform sanity check on time quota values provided. |
| 4709 | */ |
| 4710 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 4711 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4712 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4713 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4714 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4715 | } |
| 4716 | /* Set WMI CMD for channel time quota here */ |
| 4717 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 4718 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 4719 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 4720 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4721 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4722 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 4723 | QDF_ASSERT(0); |
| 4724 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4725 | } |
| 4726 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4727 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 4728 | wmi_buf_data(buf); |
| 4729 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 4730 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 4731 | WMITLV_GET_STRUCT_TLVLEN |
| 4732 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 4733 | cmdTQ->num_chans = num_channels; |
| 4734 | |
| 4735 | /* Update channel time quota information for home channel(s) */ |
| 4736 | buf_ptr += sizeof(*cmdTQ); |
| 4737 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4738 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 4739 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4740 | chan_quota.chan_mhz = chan1_freq; |
| 4741 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4742 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4743 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 4744 | buf_ptr += sizeof(chan_quota); |
| 4745 | chan_quota.chan_mhz = chan2_freq; |
| 4746 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4747 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4748 | |
| 4749 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4750 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4751 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4752 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4753 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4754 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4755 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4756 | |
| 4757 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4758 | } |
| 4759 | |
| 4760 | /** |
| 4761 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 4762 | * @wmi_handle: Pointer to wmi handle |
| 4763 | * @thermal_info: Thermal command information |
| 4764 | * |
| 4765 | * This function sends the thermal management command |
| 4766 | * to the firmware |
| 4767 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4768 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4769 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4770 | 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] | 4771 | struct thermal_cmd_params *thermal_info) |
| 4772 | { |
| 4773 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 4774 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4775 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4776 | uint32_t len = 0; |
| 4777 | |
| 4778 | len = sizeof(*cmd); |
| 4779 | |
| 4780 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4781 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4782 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4783 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4784 | } |
| 4785 | |
| 4786 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 4787 | |
| 4788 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4789 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 4790 | WMITLV_GET_STRUCT_TLVLEN |
| 4791 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 4792 | |
| 4793 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 4794 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 4795 | cmd->enable = thermal_info->thermal_enable; |
| 4796 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4797 | 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] | 4798 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 4799 | |
| 4800 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4801 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4802 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4803 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4804 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4805 | } |
| 4806 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4807 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4808 | } |
| 4809 | |
| 4810 | |
| 4811 | /** |
| 4812 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4813 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4814 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 4815 | * |
| 4816 | * This function sends down the LRO configuration parameters to |
| 4817 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 4818 | * seed values for the toeplitz hash generation |
| 4819 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4820 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4821 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4822 | 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] | 4823 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 4824 | { |
| 4825 | wmi_lro_info_cmd_fixed_param *cmd; |
| 4826 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4827 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4828 | |
| 4829 | |
| 4830 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4831 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4832 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4833 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4834 | } |
| 4835 | |
| 4836 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 4837 | |
| 4838 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4839 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 4840 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 4841 | |
| 4842 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 4843 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 4844 | wmi_lro_cmd->tcp_flag); |
| 4845 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 4846 | wmi_lro_cmd->tcp_flag_mask); |
| 4847 | cmd->toeplitz_hash_ipv4_0_3 = |
| 4848 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 4849 | cmd->toeplitz_hash_ipv4_4_7 = |
| 4850 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 4851 | cmd->toeplitz_hash_ipv4_8_11 = |
| 4852 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 4853 | cmd->toeplitz_hash_ipv4_12_15 = |
| 4854 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 4855 | cmd->toeplitz_hash_ipv4_16 = |
| 4856 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 4857 | |
| 4858 | cmd->toeplitz_hash_ipv6_0_3 = |
| 4859 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 4860 | cmd->toeplitz_hash_ipv6_4_7 = |
| 4861 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 4862 | cmd->toeplitz_hash_ipv6_8_11 = |
| 4863 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 4864 | cmd->toeplitz_hash_ipv6_12_15 = |
| 4865 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 4866 | cmd->toeplitz_hash_ipv6_16_19 = |
| 4867 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 4868 | cmd->toeplitz_hash_ipv6_20_23 = |
| 4869 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 4870 | cmd->toeplitz_hash_ipv6_24_27 = |
| 4871 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 4872 | cmd->toeplitz_hash_ipv6_28_31 = |
| 4873 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 4874 | cmd->toeplitz_hash_ipv6_32_35 = |
| 4875 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 4876 | cmd->toeplitz_hash_ipv6_36_39 = |
| 4877 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 4878 | cmd->toeplitz_hash_ipv6_40 = |
| 4879 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 4880 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4881 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4882 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 4883 | |
| 4884 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4885 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4886 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4887 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4888 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4889 | } |
| 4890 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4891 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4892 | } |
| 4893 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4894 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4895 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 4896 | * @wmi_handle: Pointer to wmi handle |
| 4897 | * @rate_report_params: Pointer to peer rate report parameters |
| 4898 | * |
| 4899 | * |
| 4900 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 4901 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4902 | 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] | 4903 | struct wmi_peer_rate_report_params *rate_report_params) |
| 4904 | { |
| 4905 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 4906 | wmi_buf_t buf = NULL; |
| 4907 | QDF_STATUS status = 0; |
| 4908 | uint32_t len = 0; |
| 4909 | uint32_t i, j; |
| 4910 | |
| 4911 | len = sizeof(*cmd); |
| 4912 | |
| 4913 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4914 | if (!buf) { |
| 4915 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 4916 | return QDF_STATUS_E_FAILURE; |
| 4917 | } |
| 4918 | |
| 4919 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 4920 | wmi_buf_data(buf); |
| 4921 | |
| 4922 | WMITLV_SET_HDR( |
| 4923 | &cmd->tlv_header, |
| 4924 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 4925 | WMITLV_GET_STRUCT_TLVLEN( |
| 4926 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 4927 | |
| 4928 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 4929 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 4930 | cmd->report_timer_period = rate_report_params->timer_period; |
| 4931 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 4932 | cmd->cond_per_phy[i].val_cond_flags = |
| 4933 | rate_report_params->report_per_phy[i].cond_flags; |
| 4934 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 4935 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 4936 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 4937 | rate_report_params->report_per_phy[i].delta.percent; |
| 4938 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 4939 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 4940 | rate_report_params->report_per_phy[i]. |
| 4941 | report_rate_threshold[j]; |
| 4942 | } |
| 4943 | } |
| 4944 | |
| 4945 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 4946 | cmd->enable_rate_report, |
| 4947 | cmd->report_backoff_time, cmd->report_timer_period); |
| 4948 | |
| 4949 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4950 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 4951 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4952 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4953 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 4954 | __func__); |
| 4955 | } |
| 4956 | return status; |
| 4957 | } |
| 4958 | |
| 4959 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4960 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 4961 | * @wmi_handle: wmi handle |
| 4962 | * @param: bcn ll cmd parameter |
| 4963 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4964 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4965 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4966 | 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] | 4967 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 4968 | { |
| 4969 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 4970 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4971 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4972 | |
| 4973 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4974 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4975 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4976 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4977 | } |
| 4978 | |
| 4979 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 4980 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4981 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 4982 | WMITLV_GET_STRUCT_TLVLEN |
| 4983 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 4984 | cmd->vdev_id = param->vdev_id; |
| 4985 | cmd->data_len = param->data_len; |
| 4986 | cmd->frame_ctrl = param->frame_ctrl; |
| 4987 | cmd->frag_ptr = param->frag_ptr; |
| 4988 | cmd->dtim_flag = param->dtim_flag; |
| 4989 | |
| 4990 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 4991 | WMI_PDEV_SEND_BCN_CMDID); |
| 4992 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4993 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4994 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4995 | wmi_buf_free(wmi_buf); |
| 4996 | } |
| 4997 | |
| 4998 | return ret; |
| 4999 | } |
| 5000 | |
| 5001 | /** |
| 5002 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 5003 | * @wmi_handle: wmi handle |
| 5004 | * @vdev_id: vdev id |
| 5005 | * @max_retries: max retries |
| 5006 | * @retry_interval: retry interval |
| 5007 | * This function sets sta query related parameters in fw. |
| 5008 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5009 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5010 | */ |
| 5011 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5012 | static QDF_STATUS send_set_sta_sa_query_param_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5013 | uint8_t vdev_id, uint32_t max_retries, |
| 5014 | uint32_t retry_interval) |
| 5015 | { |
| 5016 | wmi_buf_t buf; |
| 5017 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 5018 | int len; |
| 5019 | |
| 5020 | len = sizeof(*cmd); |
| 5021 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5022 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5023 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 5024 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5025 | } |
| 5026 | |
| 5027 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 5028 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5029 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 5030 | WMITLV_GET_STRUCT_TLVLEN |
| 5031 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 5032 | |
| 5033 | |
| 5034 | cmd->vdev_id = vdev_id; |
| 5035 | cmd->sa_query_max_retry_count = max_retries; |
| 5036 | cmd->sa_query_retry_interval = retry_interval; |
| 5037 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5038 | WMI_LOGD(FL("STA sa query: vdev_id:%d interval:%u retry count:%d"), |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5039 | vdev_id, retry_interval, max_retries); |
| 5040 | |
| 5041 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5042 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5043 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5044 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5045 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5046 | } |
| 5047 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5048 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5049 | return 0; |
| 5050 | } |
| 5051 | |
| 5052 | /** |
| 5053 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 5054 | * @wmi_handle: wmi handle |
| 5055 | * @params: sta keep alive parameter |
| 5056 | * |
| 5057 | * This function sets keep alive related parameters in fw. |
| 5058 | * |
| 5059 | * Return: CDF status |
| 5060 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5061 | static QDF_STATUS send_set_sta_keep_alive_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5062 | struct sta_params *params) |
| 5063 | { |
| 5064 | wmi_buf_t buf; |
| 5065 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 5066 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 5067 | uint8_t *buf_ptr; |
| 5068 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5069 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5070 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5071 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5072 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5073 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 5074 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5075 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5076 | WMI_LOGE("wmi_buf_alloc failed"); |
| 5077 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5078 | } |
| 5079 | |
| 5080 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 5081 | buf_ptr = (uint8_t *) cmd; |
| 5082 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5083 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 5084 | WMITLV_GET_STRUCT_TLVLEN |
| 5085 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 5086 | cmd->interval = params->timeperiod; |
| 5087 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 5088 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5089 | WMI_LOGD("Keep Alive: vdev_id:%d interval:%u method:%d", params->vdev_id, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5090 | params->timeperiod, params->method); |
| 5091 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 5092 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 5093 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 5094 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 5095 | |
c_manjee | 2772b9c | 2017-01-23 15:14:13 +0530 | [diff] [blame] | 5096 | if ((params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) || |
| 5097 | (params->method == |
| 5098 | WMI_STA_KEEPALIVE_METHOD_GRATUITOUS_ARP_REQUEST)) { |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5099 | if ((NULL == params->hostv4addr) || |
| 5100 | (NULL == params->destv4addr) || |
| 5101 | (NULL == params->destmac)) { |
Jeff Johnson | 58fd0c6 | 2017-09-18 10:05:06 -0700 | [diff] [blame] | 5102 | WMI_LOGE("%s: received null pointer, hostv4addr:%pK " |
| 5103 | "destv4addr:%pK destmac:%pK ", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5104 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5105 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5106 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5107 | } |
c_manjee | 2772b9c | 2017-01-23 15:14:13 +0530 | [diff] [blame] | 5108 | cmd->method = params->method; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5109 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5110 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5111 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5112 | WMI_IPV4_ADDR_LEN); |
| 5113 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 5114 | } else { |
| 5115 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 5116 | } |
| 5117 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5118 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5119 | WMI_STA_KEEPALIVE_CMDID); |
| 5120 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5121 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5122 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5123 | } |
| 5124 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5125 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5126 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5127 | } |
| 5128 | |
| 5129 | /** |
| 5130 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 5131 | * @wmi_handle: wmi handle |
| 5132 | * @if_id: vdev id |
| 5133 | * @gtx_info: GTX config params |
| 5134 | * |
| 5135 | * This function set GTX related params in firmware. |
| 5136 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5137 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5138 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5139 | static QDF_STATUS send_vdev_set_gtx_cfg_cmd_tlv(wmi_unified_t wmi_handle, uint32_t if_id, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5140 | struct wmi_gtx_config *gtx_info) |
| 5141 | { |
| 5142 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 5143 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5144 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5145 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5146 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5147 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5148 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5149 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5150 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5151 | } |
| 5152 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 5153 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5154 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 5155 | WMITLV_GET_STRUCT_TLVLEN |
| 5156 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 5157 | cmd->vdev_id = if_id; |
| 5158 | |
| 5159 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 5160 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 5161 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 5162 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 5163 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 5164 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 5165 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 5166 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 5167 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5168 | WMI_LOGD("Setting vdev%d GTX values:htmcs 0x%x, vhtmcs 0x%x, usermask 0x%x, \ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5169 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 5170 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 5171 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 5172 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 5173 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5174 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5175 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5176 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 5177 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 5178 | wmi_buf_free(buf); |
| 5179 | } |
| 5180 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5181 | } |
| 5182 | |
| 5183 | /** |
| 5184 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 5185 | * @wmi_handle: wmi handle |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 5186 | * @vdev_id: vdev id. |
| 5187 | * @wmm_vparams: edca parameters |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5188 | * |
| 5189 | * This function updates EDCA parameters to the target |
| 5190 | * |
| 5191 | * Return: CDF Status |
| 5192 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5193 | static QDF_STATUS send_process_update_edca_param_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5194 | uint8_t vdev_id, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 5195 | struct wmi_host_wme_vparams wmm_vparams[WMI_MAX_NUM_AC]) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5196 | { |
| 5197 | uint8_t *buf_ptr; |
| 5198 | wmi_buf_t buf; |
| 5199 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 5200 | wmi_wmm_vparams *wmm_param; |
| 5201 | struct wmi_host_wme_vparams *twmm_param; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5202 | int len = sizeof(*cmd); |
| 5203 | int ac; |
| 5204 | |
| 5205 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5206 | |
| 5207 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5208 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5209 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5210 | } |
| 5211 | |
| 5212 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5213 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 5214 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5215 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 5216 | WMITLV_GET_STRUCT_TLVLEN |
| 5217 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 5218 | cmd->vdev_id = vdev_id; |
| 5219 | |
| 5220 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 5221 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 5222 | twmm_param = (struct wmi_host_wme_vparams *) (&wmm_vparams[ac]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5223 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 5224 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 5225 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 5226 | wmm_param->cwmin = twmm_param->cwmin; |
| 5227 | wmm_param->cwmax = twmm_param->cwmax; |
| 5228 | wmm_param->aifs = twmm_param->aifs; |
| 5229 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 5230 | wmm_param->acm = twmm_param->acm; |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 5231 | wmm_param->no_ack = twmm_param->noackpolicy; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5232 | } |
| 5233 | |
| 5234 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5235 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 5236 | goto fail; |
| 5237 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5238 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5239 | |
| 5240 | fail: |
| 5241 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5242 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 5243 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5244 | } |
| 5245 | |
| 5246 | /** |
| 5247 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 5248 | * @wmi_handle: wmi handle |
| 5249 | * @vdev_id: vdev id |
| 5250 | * @probe_rsp_info: probe response info |
| 5251 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5252 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5253 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5254 | 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] | 5255 | uint8_t vdev_id, |
Krunal Soni | 8942686 | 2017-11-14 15:42:48 -0800 | [diff] [blame] | 5256 | struct wmi_probe_resp_params *probe_rsp_info) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5257 | { |
| 5258 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 5259 | wmi_bcn_prb_info *bcn_prb_info; |
| 5260 | wmi_buf_t wmi_buf; |
| 5261 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 5262 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5263 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5264 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5265 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5266 | |
Krunal Soni | 8942686 | 2017-11-14 15:42:48 -0800 | [diff] [blame] | 5267 | tmpl_len = probe_rsp_info->prb_rsp_template_len; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5268 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 5269 | |
| 5270 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 5271 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 5272 | tmpl_len_aligned; |
| 5273 | |
| 5274 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5275 | 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] | 5276 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5277 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5278 | } |
| 5279 | |
| 5280 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 5281 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5282 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5283 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5284 | } |
| 5285 | |
| 5286 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5287 | |
| 5288 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 5289 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5290 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 5291 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 5292 | cmd->vdev_id = vdev_id; |
| 5293 | cmd->buf_len = tmpl_len; |
| 5294 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 5295 | |
| 5296 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 5297 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 5298 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 5299 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 5300 | bcn_prb_info->caps = 0; |
| 5301 | bcn_prb_info->erp = 0; |
| 5302 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 5303 | |
| 5304 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 5305 | buf_ptr += WMI_TLV_HDR_SIZE; |
Krunal Soni | 8942686 | 2017-11-14 15:42:48 -0800 | [diff] [blame] | 5306 | 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] | 5307 | |
| 5308 | ret = wmi_unified_cmd_send(wmi_handle, |
| 5309 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5310 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5311 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5312 | wmi_buf_free(wmi_buf); |
| 5313 | } |
| 5314 | |
| 5315 | return ret; |
| 5316 | } |
| 5317 | |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 5318 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5319 | #define WPI_IV_LEN 16 |
| 5320 | |
| 5321 | /** |
| 5322 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 5323 | * |
| 5324 | * @dest_tx: destination address of tsc key counter |
| 5325 | * @src_tx: source address of tsc key counter |
| 5326 | * @dest_rx: destination address of rsc key counter |
| 5327 | * @src_rx: source address of rsc key counter |
| 5328 | * |
| 5329 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 5330 | * |
| 5331 | * Return: None |
| 5332 | * |
| 5333 | */ |
| 5334 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 5335 | uint8_t *dest_rx, uint8_t *src_rx) |
| 5336 | { |
| 5337 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 5338 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 5339 | } |
| 5340 | #else |
| 5341 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 5342 | uint8_t *dest_rx, uint8_t *src_rx) |
| 5343 | { |
| 5344 | return; |
| 5345 | } |
| 5346 | #endif |
| 5347 | |
| 5348 | /** |
| 5349 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 5350 | * @wmi_handle: wmi handle |
| 5351 | * @key_params: key parameters |
| 5352 | * |
| 5353 | * This function fills structure from information |
| 5354 | * passed in key_params. |
| 5355 | * |
| 5356 | * Return: QDF_STATUS_SUCCESS - success |
| 5357 | * QDF_STATUS_E_FAILURE - failure |
| 5358 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 5359 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5360 | 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] | 5361 | struct set_key_params *key_params) |
| 5362 | { |
| 5363 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 5364 | wmi_buf_t buf; |
| 5365 | uint8_t *buf_ptr; |
| 5366 | uint32_t len; |
| 5367 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5368 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5369 | |
| 5370 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 5371 | WMI_TLV_HDR_SIZE; |
| 5372 | |
| 5373 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5374 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5375 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5376 | return QDF_STATUS_E_NOMEM; |
| 5377 | } |
| 5378 | |
| 5379 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5380 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 5381 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5382 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 5383 | WMITLV_GET_STRUCT_TLVLEN |
| 5384 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 5385 | cmd->vdev_id = key_params->vdev_id; |
| 5386 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 5387 | |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 5388 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5389 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 5390 | cmd->key_flags |= key_params->key_flags; |
| 5391 | cmd->key_cipher = key_params->key_cipher; |
| 5392 | if ((key_params->key_txmic_len) && |
| 5393 | (key_params->key_rxmic_len)) { |
| 5394 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 5395 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 5396 | } |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 5397 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5398 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 5399 | key_params->tx_iv, |
| 5400 | cmd->wpi_key_rsc_counter, |
| 5401 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5402 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5403 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 5404 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5405 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 5406 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5407 | qdf_mem_copy((void *)key_data, |
| 5408 | (const void *)key_params->key_data, key_params->key_len); |
Krunal Soni | 3a0fd85 | 2017-10-24 23:33:05 -0700 | [diff] [blame] | 5409 | if (key_params->key_rsc_counter) |
| 5410 | qdf_mem_copy(&cmd->key_rsc_counter, key_params->key_rsc_counter, |
| 5411 | sizeof(wmi_key_seq_counter)); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5412 | cmd->key_len = key_params->key_len; |
| 5413 | |
| 5414 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5415 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5416 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5417 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5418 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5419 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5420 | } |
| 5421 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5422 | /** |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 5423 | * send_sar_limit_cmd_tlv() - send sar limit cmd to fw |
| 5424 | * @wmi_handle: wmi handle |
| 5425 | * @params: sar limit params |
| 5426 | * |
| 5427 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 5428 | */ |
| 5429 | static QDF_STATUS send_sar_limit_cmd_tlv(wmi_unified_t wmi_handle, |
| 5430 | struct sar_limit_cmd_params *sar_limit_params) |
| 5431 | { |
| 5432 | wmi_buf_t buf; |
| 5433 | QDF_STATUS qdf_status; |
| 5434 | wmi_sar_limits_cmd_fixed_param *cmd; |
| 5435 | int i; |
| 5436 | uint8_t *buf_ptr; |
| 5437 | wmi_sar_limit_cmd_row *wmi_sar_rows_list; |
| 5438 | struct sar_limit_cmd_row *sar_rows_list; |
| 5439 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 5440 | |
| 5441 | len += sizeof(wmi_sar_limit_cmd_row) * sar_limit_params->num_limit_rows; |
| 5442 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5443 | if (!buf) { |
| 5444 | WMI_LOGE("Failed to allocate memory"); |
| 5445 | qdf_status = QDF_STATUS_E_NOMEM; |
| 5446 | goto end; |
| 5447 | } |
| 5448 | |
| 5449 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5450 | cmd = (wmi_sar_limits_cmd_fixed_param *) buf_ptr; |
| 5451 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5452 | WMITLV_TAG_STRUC_wmi_sar_limits_cmd_fixed_param, |
| 5453 | WMITLV_GET_STRUCT_TLVLEN |
| 5454 | (wmi_sar_limits_cmd_fixed_param)); |
| 5455 | cmd->sar_enable = sar_limit_params->sar_enable; |
| 5456 | cmd->commit_limits = sar_limit_params->commit_limits; |
| 5457 | cmd->num_limit_rows = sar_limit_params->num_limit_rows; |
| 5458 | |
| 5459 | WMI_LOGD("no of sar rows = %d, len = %d", |
| 5460 | sar_limit_params->num_limit_rows, len); |
| 5461 | buf_ptr += sizeof(*cmd); |
| 5462 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5463 | sizeof(wmi_sar_limit_cmd_row) * |
| 5464 | sar_limit_params->num_limit_rows); |
| 5465 | if (cmd->num_limit_rows == 0) |
| 5466 | goto send_sar_limits; |
| 5467 | |
| 5468 | wmi_sar_rows_list = (wmi_sar_limit_cmd_row *) |
| 5469 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5470 | sar_rows_list = sar_limit_params->sar_limit_row_list; |
| 5471 | |
| 5472 | for (i = 0; i < sar_limit_params->num_limit_rows; i++) { |
| 5473 | WMITLV_SET_HDR(&wmi_sar_rows_list->tlv_header, |
| 5474 | WMITLV_TAG_STRUC_wmi_sar_limit_cmd_row, |
| 5475 | WMITLV_GET_STRUCT_TLVLEN(wmi_sar_limit_cmd_row)); |
| 5476 | wmi_sar_rows_list->band_id = sar_rows_list->band_id; |
| 5477 | wmi_sar_rows_list->chain_id = sar_rows_list->chain_id; |
| 5478 | wmi_sar_rows_list->mod_id = sar_rows_list->mod_id; |
| 5479 | wmi_sar_rows_list->limit_value = sar_rows_list->limit_value; |
| 5480 | wmi_sar_rows_list->validity_bitmap = |
| 5481 | sar_rows_list->validity_bitmap; |
| 5482 | WMI_LOGD("row %d, band_id = %d, chain_id = %d, mod_id = %d, limit_value = %d, validity_bitmap = %d", |
| 5483 | i, wmi_sar_rows_list->band_id, |
| 5484 | wmi_sar_rows_list->chain_id, |
| 5485 | wmi_sar_rows_list->mod_id, |
| 5486 | wmi_sar_rows_list->limit_value, |
| 5487 | wmi_sar_rows_list->validity_bitmap); |
| 5488 | sar_rows_list++; |
| 5489 | wmi_sar_rows_list++; |
| 5490 | } |
| 5491 | send_sar_limits: |
| 5492 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5493 | WMI_SAR_LIMITS_CMDID); |
| 5494 | |
| 5495 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 5496 | WMI_LOGE("Failed to send WMI_SAR_LIMITS_CMDID"); |
| 5497 | wmi_buf_free(buf); |
| 5498 | } |
| 5499 | |
| 5500 | end: |
| 5501 | return qdf_status; |
| 5502 | } |
| 5503 | |
Jeff Johnson | 4783f90 | 2017-12-14 15:50:16 -0800 | [diff] [blame] | 5504 | static QDF_STATUS get_sar_limit_cmd_tlv(wmi_unified_t wmi_handle) |
| 5505 | { |
| 5506 | wmi_sar_get_limits_cmd_fixed_param *cmd; |
| 5507 | wmi_buf_t wmi_buf; |
| 5508 | uint32_t len; |
| 5509 | QDF_STATUS status; |
| 5510 | |
| 5511 | WMI_LOGD(FL("Enter")); |
| 5512 | |
| 5513 | len = sizeof(*cmd); |
| 5514 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5515 | if (!wmi_buf) { |
| 5516 | WMI_LOGP(FL("failed to allocate memory for msg")); |
| 5517 | return QDF_STATUS_E_NOMEM; |
| 5518 | } |
| 5519 | |
| 5520 | cmd = (wmi_sar_get_limits_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 5521 | |
| 5522 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5523 | WMITLV_TAG_STRUC_wmi_sar_get_limits_cmd_fixed_param, |
| 5524 | WMITLV_GET_STRUCT_TLVLEN |
| 5525 | (wmi_sar_get_limits_cmd_fixed_param)); |
| 5526 | |
| 5527 | cmd->reserved = 0; |
| 5528 | |
| 5529 | status = wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5530 | WMI_SAR_GET_LIMITS_CMDID); |
| 5531 | if (QDF_IS_STATUS_ERROR(status)) { |
| 5532 | WMI_LOGE(FL("Failed to send get SAR limit cmd: %d"), status); |
| 5533 | wmi_buf_free(wmi_buf); |
| 5534 | } |
| 5535 | |
| 5536 | WMI_LOGD(FL("Exit")); |
| 5537 | |
| 5538 | return status; |
| 5539 | } |
| 5540 | |
| 5541 | static QDF_STATUS extract_sar_limit_event_tlv(wmi_unified_t wmi_handle, |
| 5542 | uint8_t *evt_buf, |
| 5543 | struct sar_limit_event *event) |
| 5544 | { |
| 5545 | wmi_sar_get_limits_event_fixed_param *fixed_param; |
| 5546 | WMI_SAR_GET_LIMITS_EVENTID_param_tlvs *param_buf; |
| 5547 | wmi_sar_get_limit_event_row *row_in; |
| 5548 | struct sar_limit_event_row *row_out; |
| 5549 | uint32_t row; |
| 5550 | |
| 5551 | if (!evt_buf) { |
| 5552 | WMI_LOGE(FL("input event is NULL")); |
| 5553 | return QDF_STATUS_E_INVAL; |
| 5554 | } |
| 5555 | if (!event) { |
| 5556 | WMI_LOGE(FL("output event is NULL")); |
| 5557 | return QDF_STATUS_E_INVAL; |
| 5558 | } |
| 5559 | |
| 5560 | param_buf = (WMI_SAR_GET_LIMITS_EVENTID_param_tlvs *)evt_buf; |
| 5561 | |
| 5562 | fixed_param = param_buf->fixed_param; |
| 5563 | if (!fixed_param) { |
| 5564 | WMI_LOGE(FL("Invalid fixed param")); |
| 5565 | return QDF_STATUS_E_INVAL; |
| 5566 | } |
| 5567 | |
| 5568 | event->sar_enable = fixed_param->sar_enable; |
| 5569 | event->num_limit_rows = fixed_param->num_limit_rows; |
| 5570 | |
| 5571 | if (event->num_limit_rows > MAX_SAR_LIMIT_ROWS_SUPPORTED) { |
| 5572 | QDF_ASSERT(0); |
| 5573 | WMI_LOGE(FL("Num rows %d exceeds max of %d"), |
| 5574 | event->num_limit_rows, |
| 5575 | MAX_SAR_LIMIT_ROWS_SUPPORTED); |
| 5576 | event->num_limit_rows = MAX_SAR_LIMIT_ROWS_SUPPORTED; |
| 5577 | } |
| 5578 | |
| 5579 | row_in = param_buf->sar_get_limits; |
| 5580 | row_out = &event->sar_limit_row[0]; |
| 5581 | for (row = 0; row < event->num_limit_rows; row++) { |
| 5582 | row_out->band_id = row_in->band_id; |
| 5583 | row_out->chain_id = row_in->chain_id; |
| 5584 | row_out->mod_id = row_in->mod_id; |
| 5585 | row_out->limit_value = row_in->limit_value; |
| 5586 | row_out++; |
| 5587 | row_in++; |
| 5588 | } |
| 5589 | |
| 5590 | return QDF_STATUS_SUCCESS; |
| 5591 | } |
| 5592 | |
Nachiket Kukade | ab4cbc2 | 2017-12-15 12:36:58 +0530 | [diff] [blame] | 5593 | #ifdef WLAN_FEATURE_DISA |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 5594 | /** |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5595 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 5596 | * @wmi_handle: wmi handle |
| 5597 | * @params: encrypt/decrypt params |
| 5598 | * |
| 5599 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 5600 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5601 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5602 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
Nachiket Kukade | 03e7ab2 | 2017-12-20 17:28:29 +0530 | [diff] [blame] | 5603 | struct disa_encrypt_decrypt_req_params *encrypt_decrypt_params) |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5604 | { |
| 5605 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 5606 | wmi_buf_t wmi_buf; |
| 5607 | uint8_t *buf_ptr; |
| 5608 | QDF_STATUS ret; |
| 5609 | uint32_t len; |
| 5610 | |
| 5611 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 5612 | |
| 5613 | len = sizeof(*cmd) + |
| 5614 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 5615 | WMI_TLV_HDR_SIZE; |
| 5616 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5617 | if (!wmi_buf) { |
| 5618 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 5619 | __func__); |
| 5620 | return QDF_STATUS_E_NOMEM; |
| 5621 | } |
| 5622 | |
| 5623 | buf_ptr = wmi_buf_data(wmi_buf); |
| 5624 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 5625 | |
| 5626 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5627 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 5628 | WMITLV_GET_STRUCT_TLVLEN( |
| 5629 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 5630 | |
| 5631 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 5632 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 5633 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 5634 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 5635 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 5636 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 5637 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 5638 | |
| 5639 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 5640 | encrypt_decrypt_params->key_len); |
| 5641 | |
| 5642 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 5643 | MAX_MAC_HEADER_LEN); |
| 5644 | |
| 5645 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 5646 | |
| 5647 | if (cmd->data_len) { |
| 5648 | buf_ptr += sizeof(*cmd); |
| 5649 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5650 | roundup(encrypt_decrypt_params->data_len, |
| 5651 | sizeof(A_UINT32))); |
| 5652 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5653 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 5654 | encrypt_decrypt_params->data_len); |
| 5655 | } |
| 5656 | |
| 5657 | /* This conversion is to facilitate data to FW in little endian */ |
| 5658 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 5659 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 5660 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 5661 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 5662 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 5663 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 5664 | |
| 5665 | ret = wmi_unified_cmd_send(wmi_handle, |
| 5666 | wmi_buf, len, |
| 5667 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 5668 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 5669 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 5670 | wmi_buf_free(wmi_buf); |
| 5671 | } |
| 5672 | |
| 5673 | return ret; |
| 5674 | } |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5675 | |
Nachiket Kukade | 03e7ab2 | 2017-12-20 17:28:29 +0530 | [diff] [blame] | 5676 | /** |
| 5677 | * extract_encrypt_decrypt_resp_event_tlv() - extract encrypt decrypt resp |
| 5678 | * params from event |
| 5679 | * @wmi_handle: wmi handle |
| 5680 | * @evt_buf: pointer to event buffer |
| 5681 | * @resp: Pointer to hold resp parameters |
| 5682 | * |
| 5683 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 5684 | */ |
| 5685 | static |
| 5686 | QDF_STATUS extract_encrypt_decrypt_resp_event_tlv(wmi_unified_t wmi_handle, |
| 5687 | void *evt_buf, struct disa_encrypt_decrypt_resp_params *resp) |
| 5688 | { |
| 5689 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID_param_tlvs *param_buf; |
| 5690 | wmi_vdev_encrypt_decrypt_data_resp_event_fixed_param *data_event; |
| 5691 | |
| 5692 | param_buf = evt_buf; |
| 5693 | if (!param_buf) { |
| 5694 | WMI_LOGE("encrypt decrypt resp evt_buf is NULL"); |
| 5695 | return QDF_STATUS_E_INVAL; |
| 5696 | } |
| 5697 | |
| 5698 | data_event = param_buf->fixed_param; |
| 5699 | |
| 5700 | resp->vdev_id = data_event->vdev_id; |
| 5701 | resp->status = data_event->status; |
| 5702 | |
| 5703 | if (data_event->data_length > param_buf->num_enc80211_frame) { |
| 5704 | WMI_LOGE("FW msg data_len %d more than TLV hdr %d", |
| 5705 | data_event->data_length, |
| 5706 | param_buf->num_enc80211_frame); |
| 5707 | return QDF_STATUS_E_INVAL; |
| 5708 | } |
| 5709 | |
| 5710 | resp->data_len = data_event->data_length; |
| 5711 | |
| 5712 | if (resp->data_len) |
| 5713 | resp->data = (uint8_t *)param_buf->enc80211_frame; |
| 5714 | |
| 5715 | return QDF_STATUS_SUCCESS; |
| 5716 | } |
| 5717 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5718 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5719 | /** |
| 5720 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 5721 | * @wmi_handle: wmi handle |
| 5722 | * @vdev_id: vdev id |
| 5723 | * @p2p_ie: p2p IE |
| 5724 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5725 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5726 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5727 | static QDF_STATUS send_p2p_go_set_beacon_ie_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5728 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 5729 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5730 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5731 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 5732 | wmi_buf_t wmi_buf; |
| 5733 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 5734 | uint8_t *buf_ptr; |
| 5735 | |
| 5736 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 5737 | |
| 5738 | /* More than one P2P IE may be included in a single frame. |
| 5739 | If multiple P2P IEs are present, the complete P2P attribute |
| 5740 | data consists of the concatenation of the P2P Attribute |
| 5741 | fields of the P2P IEs. The P2P Attributes field of each |
| 5742 | P2P IE may be any length up to the maximum (251 octets). |
| 5743 | In this case host sends one P2P IE to firmware so the length |
| 5744 | should not exceed more than 251 bytes |
| 5745 | */ |
| 5746 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5747 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5748 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5749 | } |
| 5750 | |
| 5751 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 5752 | |
| 5753 | wmi_buf_len = |
| 5754 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 5755 | WMI_TLV_HDR_SIZE; |
| 5756 | |
| 5757 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 5758 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5759 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5760 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5761 | } |
| 5762 | |
| 5763 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5764 | |
| 5765 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 5766 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5767 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 5768 | WMITLV_GET_STRUCT_TLVLEN |
| 5769 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 5770 | cmd->vdev_id = vdev_id; |
| 5771 | cmd->ie_buf_len = ie_len; |
| 5772 | |
| 5773 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 5774 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 5775 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5776 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5777 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5778 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5779 | |
| 5780 | ret = wmi_unified_cmd_send(wmi_handle, |
| 5781 | wmi_buf, wmi_buf_len, |
| 5782 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5783 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5784 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5785 | wmi_buf_free(wmi_buf); |
| 5786 | } |
| 5787 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5788 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5789 | return ret; |
| 5790 | } |
| 5791 | |
| 5792 | /** |
| 5793 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 5794 | * @wmi_handle: wmi handle |
| 5795 | * @req: gateway parameter update request structure |
| 5796 | * |
| 5797 | * This function reads the incoming @req and fill in the destination |
| 5798 | * WMI structure and sends down the gateway configs down to the firmware |
| 5799 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5800 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5801 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5802 | static QDF_STATUS send_set_gateway_params_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5803 | struct gateway_update_req_param *req) |
| 5804 | { |
| 5805 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 5806 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5807 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5808 | int len = sizeof(*cmd); |
| 5809 | |
| 5810 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5811 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5812 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5813 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5814 | } |
| 5815 | |
| 5816 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 5817 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5818 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 5819 | WMITLV_GET_STRUCT_TLVLEN( |
| 5820 | wmi_roam_subnet_change_config_fixed_param)); |
| 5821 | |
| 5822 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5823 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 5824 | QDF_IPV4_ADDR_SIZE); |
| 5825 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 5826 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5827 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 5828 | &cmd->inet_gw_mac_addr); |
| 5829 | cmd->max_retries = req->max_retries; |
| 5830 | cmd->timeout = req->timeout; |
| 5831 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 5832 | cmd->flag = 0; |
| 5833 | if (req->ipv4_addr_type) |
| 5834 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 5835 | |
| 5836 | if (req->ipv6_addr_type) |
| 5837 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 5838 | |
| 5839 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5840 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5841 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5842 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5843 | ret); |
| 5844 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5845 | } |
| 5846 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5847 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5848 | } |
| 5849 | |
| 5850 | /** |
| 5851 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 5852 | * @wmi_handle: wmi handle |
| 5853 | * @req: rssi monitoring request structure |
| 5854 | * |
| 5855 | * This function reads the incoming @req and fill in the destination |
| 5856 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 5857 | * |
| 5858 | * Return: 0 on success; error number otherwise |
| 5859 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5860 | static QDF_STATUS send_set_rssi_monitoring_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5861 | struct rssi_monitor_param *req) |
| 5862 | { |
| 5863 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 5864 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5865 | QDF_STATUS ret; |
| 5866 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5867 | |
| 5868 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5869 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5870 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5871 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5872 | } |
| 5873 | |
| 5874 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 5875 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5876 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 5877 | WMITLV_GET_STRUCT_TLVLEN( |
| 5878 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 5879 | |
| 5880 | cmd->vdev_id = req->session_id; |
| 5881 | cmd->request_id = req->request_id; |
| 5882 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 5883 | cmd->hi_rssi_reenable_histeresis = 0; |
| 5884 | cmd->min_report_interval = 0; |
| 5885 | cmd->max_num_report = 1; |
| 5886 | if (req->control) { |
| 5887 | /* enable one threshold for each min/max */ |
| 5888 | cmd->enabled_bitmap = 0x09; |
| 5889 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 5890 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 5891 | } else { |
| 5892 | cmd->enabled_bitmap = 0; |
| 5893 | cmd->low_rssi_breach_threshold[0] = 0; |
| 5894 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 5895 | } |
| 5896 | |
| 5897 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5898 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5899 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5900 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5901 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5902 | } |
| 5903 | |
Rajeev Kumar | ca1de3e | 2017-06-14 10:34:00 -0700 | [diff] [blame] | 5904 | WMI_LOGD("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
| 5905 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5906 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5907 | } |
| 5908 | |
| 5909 | /** |
| 5910 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 5911 | * @wmi_handle: wmi handle |
| 5912 | * @psetoui: OUI parameters |
| 5913 | * |
| 5914 | * set scan probe OUI parameters in firmware |
| 5915 | * |
| 5916 | * Return: CDF status |
| 5917 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5918 | 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] | 5919 | struct scan_mac_oui *psetoui) |
| 5920 | { |
| 5921 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 5922 | wmi_buf_t wmi_buf; |
| 5923 | uint32_t len; |
| 5924 | uint8_t *buf_ptr; |
| 5925 | uint32_t *oui_buf; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5926 | struct probe_req_whitelist_attr *ie_whitelist = &psetoui->ie_whitelist; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5927 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5928 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 5929 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 5930 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5931 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5932 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5933 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5934 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5935 | } |
| 5936 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5937 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 5938 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5939 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 5940 | WMITLV_GET_STRUCT_TLVLEN |
| 5941 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 5942 | |
| 5943 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5944 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5945 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 5946 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5947 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5948 | cmd->prob_req_oui); |
| 5949 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 5950 | cmd->vdev_id = psetoui->vdev_id; |
| 5951 | cmd->flags = WMI_SCAN_PROBE_OUI_SPOOFED_MAC_IN_PROBE_REQ; |
| 5952 | if (psetoui->enb_probe_req_sno_randomization) |
| 5953 | cmd->flags |= WMI_SCAN_PROBE_OUI_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 5954 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5955 | if (ie_whitelist->white_list) { |
| 5956 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 5957 | &cmd->num_vendor_oui, |
| 5958 | ie_whitelist); |
| 5959 | cmd->flags |= |
| 5960 | WMI_SCAN_PROBE_OUI_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 5961 | } |
| 5962 | |
| 5963 | buf_ptr += sizeof(*cmd); |
| 5964 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5965 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 5966 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5967 | |
| 5968 | if (cmd->num_vendor_oui != 0) { |
| 5969 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 5970 | ie_whitelist->voui); |
| 5971 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 5972 | } |
| 5973 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5974 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5975 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5976 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5977 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5978 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5979 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5980 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5981 | } |
| 5982 | |
| 5983 | /** |
| 5984 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 5985 | * @wmi_handle: wmi handle |
| 5986 | * @req: passpoint network request structure |
| 5987 | * |
| 5988 | * This function sends down WMI command with network id set to wildcard id. |
| 5989 | * firmware shall clear all the config entries |
| 5990 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5991 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5992 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5993 | static QDF_STATUS send_reset_passpoint_network_list_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5994 | struct wifi_passpoint_req_param *req) |
| 5995 | { |
| 5996 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5997 | wmi_buf_t buf; |
| 5998 | uint32_t len; |
| 5999 | int ret; |
| 6000 | |
| 6001 | len = sizeof(*cmd); |
| 6002 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6003 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6004 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6005 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6006 | } |
| 6007 | |
| 6008 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6009 | |
| 6010 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6011 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 6012 | WMITLV_GET_STRUCT_TLVLEN( |
| 6013 | wmi_passpoint_config_cmd_fixed_param)); |
| 6014 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 6015 | |
| 6016 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6017 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 6018 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6019 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6020 | __func__); |
| 6021 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6022 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6023 | } |
| 6024 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6025 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6026 | } |
| 6027 | |
| 6028 | /** |
| 6029 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 6030 | * @wmi_handle: wmi handle |
| 6031 | * @req: passpoint network request structure |
| 6032 | * |
| 6033 | * This function reads the incoming @req and fill in the destination |
| 6034 | * WMI structure and send down the passpoint configs down to the firmware |
| 6035 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6036 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6037 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6038 | static QDF_STATUS send_set_passpoint_network_list_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6039 | struct wifi_passpoint_req_param *req) |
| 6040 | { |
| 6041 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 6042 | u_int8_t i, j, *bytes; |
| 6043 | wmi_buf_t buf; |
| 6044 | uint32_t len; |
| 6045 | int ret; |
| 6046 | |
| 6047 | len = sizeof(*cmd); |
| 6048 | for (i = 0; i < req->num_networks; i++) { |
| 6049 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6050 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6051 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6052 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6053 | } |
| 6054 | |
| 6055 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 6056 | wmi_buf_data(buf); |
| 6057 | |
| 6058 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6059 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 6060 | WMITLV_GET_STRUCT_TLVLEN( |
| 6061 | wmi_passpoint_config_cmd_fixed_param)); |
| 6062 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6063 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 6064 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6065 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6066 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6067 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 6068 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6069 | WMI_LOGD("index: %d rcids: %02x %02x %02x %02x %02x %02x %02x %02x", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6070 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 6071 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 6072 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6073 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6074 | &req->networks[i].roaming_consortium_ids[j], |
| 6075 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 6076 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6077 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6078 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6079 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6080 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 6081 | |
| 6082 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6083 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 6084 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6085 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6086 | __func__); |
| 6087 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6088 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6089 | } |
| 6090 | } |
| 6091 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6092 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6093 | } |
| 6094 | |
Sridhar Selvaraj | 411833a | 2017-08-21 16:35:45 +0530 | [diff] [blame] | 6095 | #if defined(WLAN_FEATURE_FILS_SK) && defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 6096 | /** |
| 6097 | * wmi_add_fils_tlv() - Add FILS TLV to roam scan offload command |
| 6098 | * @wmi_handle: wmi handle |
| 6099 | * @roam_req: Roam scan offload params |
| 6100 | * @buf_ptr: command buffer to send |
| 6101 | * @fils_tlv_len: fils tlv length |
| 6102 | * |
| 6103 | * Return: Updated buffer pointer |
| 6104 | */ |
| 6105 | static uint8_t *wmi_add_fils_tlv(wmi_unified_t wmi_handle, |
| 6106 | struct roam_offload_scan_params *roam_req, |
| 6107 | uint8_t *buf_ptr, uint32_t fils_tlv_len) |
| 6108 | { |
| 6109 | wmi_roam_fils_offload_tlv_param *fils_tlv; |
| 6110 | wmi_erp_info *erp_info; |
| 6111 | struct roam_fils_params *roam_fils_params; |
| 6112 | |
| 6113 | if (!roam_req->add_fils_tlv) |
| 6114 | return buf_ptr; |
| 6115 | |
| 6116 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6117 | sizeof(*fils_tlv)); |
| 6118 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6119 | |
| 6120 | fils_tlv = (wmi_roam_fils_offload_tlv_param *)buf_ptr; |
| 6121 | WMITLV_SET_HDR(&fils_tlv->tlv_header, |
| 6122 | WMITLV_TAG_STRUC_wmi_roam_fils_offload_tlv_param, |
| 6123 | WMITLV_GET_STRUCT_TLVLEN |
| 6124 | (wmi_roam_fils_offload_tlv_param)); |
| 6125 | |
| 6126 | roam_fils_params = &roam_req->roam_fils_params; |
| 6127 | erp_info = (wmi_erp_info *)(&fils_tlv->vdev_erp_info); |
| 6128 | |
| 6129 | erp_info->username_length = roam_fils_params->username_length; |
| 6130 | qdf_mem_copy(erp_info->username, roam_fils_params->username, |
| 6131 | erp_info->username_length); |
| 6132 | |
| 6133 | erp_info->next_erp_seq_num = roam_fils_params->next_erp_seq_num; |
| 6134 | |
| 6135 | erp_info->rRk_length = roam_fils_params->rrk_length; |
| 6136 | qdf_mem_copy(erp_info->rRk, roam_fils_params->rrk, |
| 6137 | erp_info->rRk_length); |
| 6138 | |
| 6139 | erp_info->rIk_length = roam_fils_params->rik_length; |
| 6140 | qdf_mem_copy(erp_info->rIk, roam_fils_params->rik, |
| 6141 | erp_info->rIk_length); |
| 6142 | |
| 6143 | erp_info->realm_len = roam_fils_params->realm_len; |
| 6144 | qdf_mem_copy(erp_info->realm, roam_fils_params->realm, |
| 6145 | erp_info->realm_len); |
| 6146 | |
| 6147 | buf_ptr += sizeof(*fils_tlv); |
| 6148 | return buf_ptr; |
| 6149 | } |
| 6150 | #else |
| 6151 | static inline uint8_t *wmi_add_fils_tlv(wmi_unified_t wmi_handle, |
| 6152 | struct roam_offload_scan_params *roam_req, |
| 6153 | uint8_t *buf_ptr, uint32_t fils_tlv_len) |
| 6154 | { |
| 6155 | return buf_ptr; |
| 6156 | } |
| 6157 | #endif |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6158 | /** |
| 6159 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 6160 | * @wmi_handle: wmi handle |
| 6161 | * @scan_cmd_fp: start scan command ptr |
| 6162 | * @roam_req: roam request param |
| 6163 | * |
| 6164 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 6165 | * of WMI_ROAM_SCAN_MODE. |
| 6166 | * |
| 6167 | * Return: QDF status |
| 6168 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6169 | static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6170 | wmi_start_scan_cmd_fixed_param * |
| 6171 | scan_cmd_fp, |
| 6172 | struct roam_offload_scan_params *roam_req) |
| 6173 | { |
| 6174 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6175 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6176 | int len; |
| 6177 | uint8_t *buf_ptr; |
| 6178 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6179 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6180 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 6181 | int auth_mode = roam_req->auth_mode; |
| 6182 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 6183 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 6184 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 6185 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 6186 | wmi_tlv_buf_len_param *assoc_ies; |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 6187 | uint32_t fils_tlv_len = 0; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6188 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 6189 | /* Need to create a buf with roam_scan command at |
| 6190 | * front and piggyback with scan command */ |
| 6191 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 6192 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 6193 | (2 * WMI_TLV_HDR_SIZE) + |
| 6194 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 6195 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 6196 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 6197 | WMI_LOGD("auth_mode = %d", auth_mode); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6198 | if (roam_req->is_roam_req_valid && |
| 6199 | roam_req->roam_offload_enabled) { |
| 6200 | len += sizeof(wmi_roam_offload_tlv_param); |
| 6201 | len += WMI_TLV_HDR_SIZE; |
| 6202 | if ((auth_mode != WMI_AUTH_NONE) && |
| 6203 | ((auth_mode != WMI_AUTH_OPEN) || |
| 6204 | (auth_mode == WMI_AUTH_OPEN && |
| 6205 | roam_req->mdid.mdie_present) || |
| 6206 | roam_req->is_ese_assoc)) { |
| 6207 | len += WMI_TLV_HDR_SIZE; |
| 6208 | if (roam_req->is_ese_assoc) |
| 6209 | len += |
| 6210 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 6211 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 6212 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 6213 | (auth_mode == WMI_AUTH_OPEN && |
| 6214 | roam_req->mdid.mdie_present)) |
| 6215 | len += |
| 6216 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 6217 | else |
| 6218 | len += |
| 6219 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 6220 | } else { |
| 6221 | len += WMI_TLV_HDR_SIZE; |
| 6222 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 6223 | |
| 6224 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 6225 | + roundup(roam_req->assoc_ie_length, |
| 6226 | sizeof(uint32_t))); |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 6227 | |
| 6228 | if (roam_req->add_fils_tlv) { |
| 6229 | fils_tlv_len = sizeof( |
| 6230 | wmi_roam_fils_offload_tlv_param); |
| 6231 | len += WMI_TLV_HDR_SIZE + fils_tlv_len; |
| 6232 | } |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6233 | } else { |
| 6234 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6235 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6236 | __func__, roam_req->roam_offload_enabled); |
| 6237 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6238 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 6239 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6240 | } |
| 6241 | if (roam_req->is_roam_req_valid && |
| 6242 | roam_req->roam_offload_enabled) { |
| 6243 | roam_req->mode = roam_req->mode | |
| 6244 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 6245 | } |
| 6246 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 6247 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 6248 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 6249 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 6250 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 6251 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6252 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6253 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6254 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6255 | return QDF_STATUS_E_NOMEM; |
| 6256 | } |
| 6257 | |
| 6258 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6259 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 6260 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 6261 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 6262 | WMITLV_GET_STRUCT_TLVLEN |
| 6263 | (wmi_roam_scan_mode_fixed_param)); |
| 6264 | |
| 6265 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 6266 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 6267 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE | |
| 6268 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) { |
| 6269 | roam_scan_mode_fp->flags |= |
| 6270 | WMI_ROAM_SCAN_MODE_FLAG_REPORT_STATUS; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 6271 | goto send_roam_scan_mode_cmd; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 6272 | } |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 6273 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6274 | /* Fill in scan parameters suitable for roaming scan */ |
| 6275 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 6276 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6277 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 6278 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 6279 | /* Ensure there is no additional IEs */ |
| 6280 | scan_cmd_fp->ie_len = 0; |
| 6281 | WMITLV_SET_HDR(buf_ptr, |
| 6282 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 6283 | WMITLV_GET_STRUCT_TLVLEN |
| 6284 | (wmi_start_scan_cmd_fixed_param)); |
| 6285 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 6286 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 6287 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 6288 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6289 | sizeof(wmi_roam_offload_tlv_param)); |
| 6290 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6291 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 6292 | WMITLV_SET_HDR(buf_ptr, |
| 6293 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 6294 | WMITLV_GET_STRUCT_TLVLEN |
| 6295 | (wmi_roam_offload_tlv_param)); |
| 6296 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 6297 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 6298 | roam_offload_params->select_5g_margin = |
| 6299 | roam_req->select_5ghz_margin; |
| 6300 | roam_offload_params->reassoc_failure_timeout = |
| 6301 | roam_req->reassoc_failure_timeout; |
| 6302 | |
| 6303 | /* Fill the capabilities */ |
| 6304 | roam_offload_params->capability = |
| 6305 | roam_req->roam_offload_params.capability; |
| 6306 | roam_offload_params->ht_caps_info = |
| 6307 | roam_req->roam_offload_params.ht_caps_info; |
| 6308 | roam_offload_params->ampdu_param = |
| 6309 | roam_req->roam_offload_params.ampdu_param; |
| 6310 | roam_offload_params->ht_ext_cap = |
| 6311 | roam_req->roam_offload_params.ht_ext_cap; |
| 6312 | roam_offload_params->ht_txbf = |
| 6313 | roam_req->roam_offload_params.ht_txbf; |
| 6314 | roam_offload_params->asel_cap = |
| 6315 | roam_req->roam_offload_params.asel_cap; |
| 6316 | roam_offload_params->qos_caps = |
| 6317 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 6318 | roam_offload_params->qos_enabled = |
| 6319 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6320 | roam_offload_params->wmm_caps = |
| 6321 | roam_req->roam_offload_params.wmm_caps; |
| 6322 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 6323 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 6324 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 6325 | |
| 6326 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 6327 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 6328 | * they are filled in the same order.Depending on the |
| 6329 | * authentication type, the other mode TLV's are nullified |
| 6330 | * and only headers are filled.*/ |
| 6331 | if ((auth_mode != WMI_AUTH_NONE) && |
| 6332 | ((auth_mode != WMI_AUTH_OPEN) || |
| 6333 | (auth_mode == WMI_AUTH_OPEN |
| 6334 | && roam_req->mdid.mdie_present) || |
| 6335 | roam_req->is_ese_assoc)) { |
| 6336 | if (roam_req->is_ese_assoc) { |
| 6337 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6338 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6339 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6340 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6341 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6342 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6343 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6344 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 6345 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6346 | roam_offload_ese = |
| 6347 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 6348 | qdf_mem_copy(roam_offload_ese->krk, |
| 6349 | roam_req->krk, |
| 6350 | sizeof(roam_req->krk)); |
| 6351 | qdf_mem_copy(roam_offload_ese->btk, |
| 6352 | roam_req->btk, |
| 6353 | sizeof(roam_req->btk)); |
| 6354 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 6355 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 6356 | WMITLV_GET_STRUCT_TLVLEN |
| 6357 | (wmi_roam_ese_offload_tlv_param)); |
| 6358 | buf_ptr += |
| 6359 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 6360 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 6361 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 6362 | || (auth_mode == WMI_AUTH_OPEN |
| 6363 | && roam_req->mdid.mdie_present)) { |
| 6364 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6365 | 0); |
| 6366 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6367 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6368 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 6369 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6370 | roam_offload_11r = |
| 6371 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 6372 | roam_offload_11r->r0kh_id_len = |
| 6373 | roam_req->rokh_id_length; |
| 6374 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 6375 | roam_req->rokh_id, |
| 6376 | roam_offload_11r->r0kh_id_len); |
| 6377 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 6378 | roam_req->psk_pmk, |
| 6379 | sizeof(roam_req->psk_pmk)); |
| 6380 | roam_offload_11r->psk_msk_len = |
| 6381 | roam_req->pmk_len; |
| 6382 | roam_offload_11r->mdie_present = |
| 6383 | roam_req->mdid.mdie_present; |
| 6384 | roam_offload_11r->mdid = |
| 6385 | roam_req->mdid.mobility_domain; |
| 6386 | if (auth_mode == WMI_AUTH_OPEN) { |
| 6387 | /* If FT-Open ensure pmk length |
| 6388 | and r0khid len are zero */ |
| 6389 | roam_offload_11r->r0kh_id_len = 0; |
| 6390 | roam_offload_11r->psk_msk_len = 0; |
| 6391 | } |
| 6392 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 6393 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 6394 | WMITLV_GET_STRUCT_TLVLEN |
| 6395 | (wmi_roam_11r_offload_tlv_param)); |
| 6396 | buf_ptr += |
| 6397 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 6398 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6399 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6400 | buf_ptr += WMI_TLV_HDR_SIZE; |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 6401 | WMI_LOGD("psk_msk_len = %d", |
| 6402 | roam_offload_11r->psk_msk_len); |
| 6403 | if (roam_offload_11r->psk_msk_len) |
| 6404 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, |
| 6405 | QDF_TRACE_LEVEL_DEBUG, |
| 6406 | roam_offload_11r->psk_msk, |
| 6407 | roam_offload_11r->psk_msk_len); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6408 | } else { |
| 6409 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6410 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 6411 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6412 | roam_offload_11i = |
| 6413 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 6414 | |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 6415 | if (roam_req->roam_key_mgmt_offload_enabled && |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 6416 | roam_req->fw_okc) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6417 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 6418 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 6419 | WMI_LOGI("LFR3:OKC enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6420 | } else { |
| 6421 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 6422 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 6423 | WMI_LOGI("LFR3:OKC disabled"); |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 6424 | } |
| 6425 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 6426 | roam_req->fw_pmksa_cache) { |
| 6427 | WMI_SET_ROAM_OFFLOAD_PMK_CACHE_ENABLED |
| 6428 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 6429 | WMI_LOGI("LFR3:PMKSA caching enabled"); |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 6430 | } else { |
| 6431 | WMI_SET_ROAM_OFFLOAD_PMK_CACHE_DISABLED |
| 6432 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 6433 | WMI_LOGI("LFR3:PMKSA caching disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6434 | } |
| 6435 | |
| 6436 | qdf_mem_copy(roam_offload_11i->pmk, |
| 6437 | roam_req->psk_pmk, |
| 6438 | sizeof(roam_req->psk_pmk)); |
| 6439 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 6440 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 6441 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 6442 | WMITLV_GET_STRUCT_TLVLEN |
| 6443 | (wmi_roam_11i_offload_tlv_param)); |
| 6444 | buf_ptr += |
| 6445 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 6446 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6447 | 0); |
| 6448 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6449 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6450 | 0); |
| 6451 | buf_ptr += WMI_TLV_HDR_SIZE; |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 6452 | WMI_LOGD("pmk_len = %d", |
| 6453 | roam_offload_11i->pmk_len); |
| 6454 | if (roam_offload_11i->pmk_len) |
| 6455 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, |
| 6456 | QDF_TRACE_LEVEL_DEBUG, |
| 6457 | roam_offload_11i->pmk, |
| 6458 | roam_offload_11i->pmk_len); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6459 | } |
| 6460 | } else { |
| 6461 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6462 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6463 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6464 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6465 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6466 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6467 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6468 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 6469 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6470 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 6471 | |
| 6472 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6473 | sizeof(*assoc_ies)); |
| 6474 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6475 | |
| 6476 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 6477 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 6478 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 6479 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 6480 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 6481 | |
| 6482 | buf_ptr += sizeof(*assoc_ies); |
| 6483 | |
| 6484 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 6485 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 6486 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6487 | |
| 6488 | if (assoc_ies->buf_len != 0) { |
| 6489 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 6490 | assoc_ies->buf_len); |
| 6491 | } |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 6492 | buf_ptr += qdf_roundup(assoc_ies->buf_len, sizeof(uint32_t)); |
| 6493 | buf_ptr = wmi_add_fils_tlv(wmi_handle, roam_req, |
| 6494 | buf_ptr, fils_tlv_len); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6495 | } else { |
| 6496 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6497 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6498 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6499 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6500 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6501 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6502 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6503 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6504 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6505 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6506 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 6507 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6508 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6509 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 6510 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6511 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 6512 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6513 | } |
| 6514 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 6515 | |
| 6516 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6517 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6518 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6519 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6520 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6521 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 6522 | status); |
| 6523 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6524 | } |
| 6525 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6526 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6527 | } |
| 6528 | |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 6529 | static QDF_STATUS send_roam_mawc_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6530 | struct wmi_mawc_roam_params *params) |
| 6531 | { |
| 6532 | wmi_buf_t buf = NULL; |
| 6533 | QDF_STATUS status; |
| 6534 | int len; |
| 6535 | uint8_t *buf_ptr; |
| 6536 | wmi_roam_configure_mawc_cmd_fixed_param *wmi_roam_mawc_params; |
| 6537 | |
| 6538 | len = sizeof(*wmi_roam_mawc_params); |
| 6539 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6540 | if (!buf) { |
| 6541 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6542 | return QDF_STATUS_E_NOMEM; |
| 6543 | } |
| 6544 | |
| 6545 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6546 | wmi_roam_mawc_params = |
| 6547 | (wmi_roam_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 6548 | WMITLV_SET_HDR(&wmi_roam_mawc_params->tlv_header, |
| 6549 | WMITLV_TAG_STRUC_wmi_roam_configure_mawc_cmd_fixed_param, |
| 6550 | WMITLV_GET_STRUCT_TLVLEN |
| 6551 | (wmi_roam_configure_mawc_cmd_fixed_param)); |
| 6552 | wmi_roam_mawc_params->vdev_id = params->vdev_id; |
| 6553 | if (params->enable) |
| 6554 | wmi_roam_mawc_params->enable = 1; |
| 6555 | else |
| 6556 | wmi_roam_mawc_params->enable = 0; |
| 6557 | wmi_roam_mawc_params->traffic_load_threshold = |
| 6558 | params->traffic_load_threshold; |
| 6559 | wmi_roam_mawc_params->best_ap_rssi_threshold = |
| 6560 | params->best_ap_rssi_threshold; |
| 6561 | wmi_roam_mawc_params->rssi_stationary_high_adjust = |
| 6562 | params->rssi_stationary_high_adjust; |
| 6563 | wmi_roam_mawc_params->rssi_stationary_low_adjust = |
| 6564 | params->rssi_stationary_low_adjust; |
Varun Reddy Yeturu | 7a8c337 | 2017-08-21 10:28:13 -0700 | [diff] [blame] | 6565 | WMI_LOGD(FL("MAWC roam en=%d, vdev=%d, tr=%d, ap=%d, high=%d, low=%d"), |
| 6566 | wmi_roam_mawc_params->enable, wmi_roam_mawc_params->vdev_id, |
| 6567 | wmi_roam_mawc_params->traffic_load_threshold, |
| 6568 | wmi_roam_mawc_params->best_ap_rssi_threshold, |
| 6569 | wmi_roam_mawc_params->rssi_stationary_high_adjust, |
| 6570 | wmi_roam_mawc_params->rssi_stationary_low_adjust); |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 6571 | |
| 6572 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6573 | len, WMI_ROAM_CONFIGURE_MAWC_CMDID); |
| 6574 | if (QDF_IS_STATUS_ERROR(status)) { |
| 6575 | WMI_LOGE("WMI_ROAM_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 6576 | status); |
| 6577 | wmi_buf_free(buf); |
| 6578 | return status; |
| 6579 | } |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 6580 | |
| 6581 | return QDF_STATUS_SUCCESS; |
| 6582 | } |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6583 | |
| 6584 | /** |
| 6585 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 6586 | * rssi threashold |
| 6587 | * @wmi_handle: wmi handle |
| 6588 | * @roam_req: Roaming request buffer |
| 6589 | * |
| 6590 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 6591 | * |
| 6592 | * Return: QDF status |
| 6593 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6594 | static QDF_STATUS send_roam_scan_offload_rssi_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6595 | struct roam_offload_scan_rssi_params *roam_req) |
| 6596 | { |
| 6597 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6598 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6599 | int len; |
| 6600 | uint8_t *buf_ptr; |
| 6601 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 6602 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 6603 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 6604 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6605 | wmi_roam_bg_scan_roaming_param *bg_scan_params = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6606 | |
| 6607 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 6608 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 6609 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 6610 | len += WMI_TLV_HDR_SIZE; |
| 6611 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 6612 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 6613 | len += sizeof(wmi_roam_dense_thres_param); |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6614 | len += WMI_TLV_HDR_SIZE; /* TLV for BG Scan*/ |
| 6615 | len += sizeof(wmi_roam_bg_scan_roaming_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6616 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6617 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6618 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6619 | return QDF_STATUS_E_NOMEM; |
| 6620 | } |
| 6621 | |
| 6622 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6623 | rssi_threshold_fp = |
| 6624 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 6625 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 6626 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 6627 | WMITLV_GET_STRUCT_TLVLEN |
| 6628 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 6629 | /* fill in threshold values */ |
| 6630 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 6631 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 6632 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 6633 | rssi_threshold_fp->hirssi_scan_max_count = |
| 6634 | roam_req->hi_rssi_scan_max_count; |
| 6635 | rssi_threshold_fp->hirssi_scan_delta = |
| 6636 | roam_req->hi_rssi_scan_rssi_delta; |
| 6637 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
Varun Reddy Yeturu | 6ef9a65 | 2017-06-26 13:53:17 -0700 | [diff] [blame] | 6638 | rssi_threshold_fp->rssi_thresh_offset_5g = |
| 6639 | roam_req->rssi_thresh_offset_5g; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6640 | |
| 6641 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 6642 | WMITLV_SET_HDR(buf_ptr, |
| 6643 | WMITLV_TAG_ARRAY_STRUC, |
| 6644 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 6645 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6646 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 6647 | |
| 6648 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 6649 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 6650 | ext_thresholds->boost_threshold_5g = |
| 6651 | roam_req->boost_threshold_5g; |
| 6652 | |
| 6653 | ext_thresholds->boost_algorithm_5g = |
| 6654 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 6655 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 6656 | ext_thresholds->penalty_algorithm_5g = |
| 6657 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 6658 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 6659 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 6660 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 6661 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 6662 | |
| 6663 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 6664 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 6665 | WMITLV_GET_STRUCT_TLVLEN |
| 6666 | (wmi_roam_scan_extended_threshold_param)); |
| 6667 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 6668 | WMITLV_SET_HDR(buf_ptr, |
| 6669 | WMITLV_TAG_ARRAY_STRUC, |
| 6670 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 6671 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6672 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 6673 | early_stop_thresholds->roam_earlystop_thres_min = |
| 6674 | roam_req->roam_earlystop_thres_min; |
| 6675 | early_stop_thresholds->roam_earlystop_thres_max = |
| 6676 | roam_req->roam_earlystop_thres_max; |
| 6677 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 6678 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 6679 | WMITLV_GET_STRUCT_TLVLEN |
| 6680 | (wmi_roam_earlystop_rssi_thres_param)); |
| 6681 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 6682 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 6683 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6684 | sizeof(wmi_roam_dense_thres_param)); |
| 6685 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6686 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 6687 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 6688 | roam_req->dense_rssi_thresh_offset; |
| 6689 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 6690 | dense_thresholds->roam_dense_traffic_thres = |
| 6691 | roam_req->traffic_threshold; |
| 6692 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 6693 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 6694 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 6695 | WMITLV_GET_STRUCT_TLVLEN |
| 6696 | (wmi_roam_dense_thres_param)); |
| 6697 | |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6698 | buf_ptr += sizeof(wmi_roam_dense_thres_param); |
| 6699 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6700 | sizeof(wmi_roam_bg_scan_roaming_param)); |
| 6701 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6702 | bg_scan_params = (wmi_roam_bg_scan_roaming_param *) buf_ptr; |
| 6703 | bg_scan_params->roam_bg_scan_bad_rssi_thresh = |
| 6704 | roam_req->bg_scan_bad_rssi_thresh; |
| 6705 | bg_scan_params->roam_bg_scan_client_bitmap = |
| 6706 | roam_req->bg_scan_client_bitmap; |
Vignesh Viswanathan | 5f1ccf6 | 2017-09-07 18:58:08 +0530 | [diff] [blame] | 6707 | bg_scan_params->bad_rssi_thresh_offset_2g = |
| 6708 | roam_req->roam_bad_rssi_thresh_offset_2g; |
| 6709 | bg_scan_params->flags = roam_req->flags; |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6710 | WMITLV_SET_HDR(&bg_scan_params->tlv_header, |
| 6711 | WMITLV_TAG_STRUC_wmi_roam_bg_scan_roaming_param, |
| 6712 | WMITLV_GET_STRUCT_TLVLEN |
| 6713 | (wmi_roam_bg_scan_roaming_param)); |
| 6714 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6715 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6716 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6717 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6718 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6719 | status); |
| 6720 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6721 | } |
| 6722 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6723 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6724 | } |
| 6725 | |
| 6726 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6727 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 6728 | * configuration params |
| 6729 | * @wma_handle: wma handler |
| 6730 | * @dwelltime_params: pointer to dwelltime_params |
| 6731 | * |
| 6732 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 6733 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6734 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6735 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6736 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 6737 | { |
| 6738 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 6739 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 6740 | wmi_buf_t buf; |
| 6741 | uint8_t *buf_ptr; |
| 6742 | int32_t err; |
| 6743 | int len; |
| 6744 | |
| 6745 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 6746 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 6747 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 6748 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6749 | if (!buf) { |
| 6750 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 6751 | __func__); |
| 6752 | return QDF_STATUS_E_NOMEM; |
| 6753 | } |
| 6754 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6755 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 6756 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 6757 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 6758 | WMITLV_GET_STRUCT_TLVLEN |
| 6759 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 6760 | |
| 6761 | dwell_param->enable = dwelltime_params->is_enabled; |
| 6762 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 6763 | WMITLV_SET_HDR(buf_ptr, |
| 6764 | WMITLV_TAG_ARRAY_STRUC, |
| 6765 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 6766 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6767 | |
| 6768 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 6769 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6770 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 6771 | WMITLV_GET_STRUCT_TLVLEN( |
| 6772 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 6773 | |
| 6774 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 6775 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 6776 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 6777 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 6778 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 6779 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 6780 | if (err) { |
| 6781 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 6782 | wmi_buf_free(buf); |
| 6783 | return QDF_STATUS_E_FAILURE; |
| 6784 | } |
| 6785 | |
| 6786 | return QDF_STATUS_SUCCESS; |
| 6787 | } |
| 6788 | |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 6789 | /** |
| 6790 | * send_dbs_scan_sel_params_cmd_tlv() - send wmi cmd of DBS scan selection |
| 6791 | * configuration params |
| 6792 | * @wmi_handle: wmi handler |
| 6793 | * @dbs_scan_params: pointer to wmi_dbs_scan_sel_params |
| 6794 | * |
| 6795 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 6796 | */ |
| 6797 | static QDF_STATUS send_dbs_scan_sel_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6798 | struct wmi_dbs_scan_sel_params *dbs_scan_params) |
| 6799 | { |
| 6800 | wmi_scan_dbs_duty_cycle_fixed_param *dbs_scan_param; |
| 6801 | wmi_scan_dbs_duty_cycle_tlv_param *cmd; |
| 6802 | wmi_buf_t buf; |
| 6803 | uint8_t *buf_ptr; |
| 6804 | QDF_STATUS err; |
| 6805 | uint32_t i; |
| 6806 | int len; |
| 6807 | |
| 6808 | len = sizeof(*dbs_scan_param); |
| 6809 | len += WMI_TLV_HDR_SIZE; |
| 6810 | len += dbs_scan_params->num_clients * sizeof(*cmd); |
| 6811 | |
| 6812 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6813 | if (!buf) { |
| 6814 | WMI_LOGE("%s:Failed to allocate buffer to send cmd", __func__); |
| 6815 | return QDF_STATUS_E_NOMEM; |
| 6816 | } |
| 6817 | |
| 6818 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6819 | dbs_scan_param = (wmi_scan_dbs_duty_cycle_fixed_param *) buf_ptr; |
| 6820 | WMITLV_SET_HDR(&dbs_scan_param->tlv_header, |
| 6821 | WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_fixed_param, |
| 6822 | WMITLV_GET_STRUCT_TLVLEN |
| 6823 | (wmi_scan_dbs_duty_cycle_fixed_param)); |
| 6824 | |
| 6825 | dbs_scan_param->num_clients = dbs_scan_params->num_clients; |
| 6826 | dbs_scan_param->pdev_id = dbs_scan_params->pdev_id; |
| 6827 | buf_ptr += sizeof(*dbs_scan_param); |
| 6828 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6829 | (sizeof(*cmd) * dbs_scan_params->num_clients)); |
| 6830 | buf_ptr = buf_ptr + (uint8_t) WMI_TLV_HDR_SIZE; |
| 6831 | |
| 6832 | for (i = 0; i < dbs_scan_params->num_clients; i++) { |
| 6833 | cmd = (wmi_scan_dbs_duty_cycle_tlv_param *) buf_ptr; |
| 6834 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6835 | WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_param_tlv, |
| 6836 | WMITLV_GET_STRUCT_TLVLEN( |
| 6837 | wmi_scan_dbs_duty_cycle_tlv_param)); |
| 6838 | cmd->module_id = dbs_scan_params->module_id[i]; |
| 6839 | cmd->num_dbs_scans = dbs_scan_params->num_dbs_scans[i]; |
| 6840 | cmd->num_non_dbs_scans = dbs_scan_params->num_non_dbs_scans[i]; |
| 6841 | buf_ptr = buf_ptr + (uint8_t) sizeof(*cmd); |
| 6842 | } |
| 6843 | |
| 6844 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 6845 | len, WMI_SET_SCAN_DBS_DUTY_CYCLE_CMDID); |
| 6846 | if (QDF_IS_STATUS_ERROR(err)) { |
| 6847 | WMI_LOGE("Failed to send dbs scan selection cmd err=%d", err); |
| 6848 | wmi_buf_free(buf); |
| 6849 | return QDF_STATUS_E_FAILURE; |
| 6850 | } |
| 6851 | |
| 6852 | return QDF_STATUS_SUCCESS; |
| 6853 | } |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6854 | |
| 6855 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6856 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 6857 | * @wmi_handle: wmi handle |
| 6858 | * @roam_req: Request which contains the filters |
| 6859 | * |
| 6860 | * There are filters such as whitelist, blacklist and preferred |
| 6861 | * list that need to be applied to the scan results to form the |
| 6862 | * probable candidates for roaming. |
| 6863 | * |
| 6864 | * Return: Return success upon succesfully passing the |
| 6865 | * parameters to the firmware, otherwise failure. |
| 6866 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6867 | static QDF_STATUS send_roam_scan_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6868 | struct roam_scan_filter_params *roam_req) |
| 6869 | { |
| 6870 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6871 | QDF_STATUS status; |
| 6872 | uint32_t i; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6873 | uint32_t len, blist_len = 0; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6874 | uint8_t *buf_ptr; |
| 6875 | wmi_roam_filter_fixed_param *roam_filter; |
| 6876 | uint8_t *bssid_src_ptr = NULL; |
| 6877 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 6878 | wmi_ssid *ssid_ptr = NULL; |
| 6879 | uint32_t *bssid_preferred_factor_ptr = NULL; |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6880 | wmi_roam_lca_disallow_config_tlv_param *blist_param; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6881 | wmi_roam_rssi_rejection_oce_config_param *rssi_rej; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6882 | |
| 6883 | len = sizeof(wmi_roam_filter_fixed_param); |
Abhishek Singh | 54aa620 | 2017-07-06 11:25:15 +0530 | [diff] [blame] | 6884 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6885 | len += WMI_TLV_HDR_SIZE; |
Abhishek Singh | 54aa620 | 2017-07-06 11:25:15 +0530 | [diff] [blame] | 6886 | if (roam_req->num_bssid_black_list) |
| 6887 | len += roam_req->num_bssid_black_list * sizeof(wmi_mac_addr); |
| 6888 | len += WMI_TLV_HDR_SIZE; |
| 6889 | if (roam_req->num_ssid_white_list) |
| 6890 | len += roam_req->num_ssid_white_list * sizeof(wmi_ssid); |
| 6891 | len += 2 * WMI_TLV_HDR_SIZE; |
| 6892 | if (roam_req->num_bssid_preferred_list) { |
| 6893 | len += roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr); |
| 6894 | len += roam_req->num_bssid_preferred_list * sizeof(A_UINT32); |
| 6895 | } |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6896 | len += WMI_TLV_HDR_SIZE; |
| 6897 | if (roam_req->lca_disallow_config_present) { |
| 6898 | len += sizeof(*blist_param); |
| 6899 | blist_len = sizeof(*blist_param); |
| 6900 | } |
| 6901 | |
| 6902 | len += WMI_TLV_HDR_SIZE; |
| 6903 | if (roam_req->num_rssi_rejection_ap) |
| 6904 | len += roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6905 | |
| 6906 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6907 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6908 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6909 | return QDF_STATUS_E_NOMEM; |
| 6910 | } |
| 6911 | |
| 6912 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 6913 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 6914 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 6915 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 6916 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 6917 | /* fill in fixed values */ |
| 6918 | roam_filter->vdev_id = roam_req->session_id; |
| 6919 | roam_filter->flags = 0; |
| 6920 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 6921 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 6922 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 6923 | roam_filter->num_bssid_preferred_list = |
| 6924 | roam_req->num_bssid_preferred_list; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6925 | roam_filter->num_rssi_rejection_ap = |
| 6926 | roam_req->num_rssi_rejection_ap; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6927 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 6928 | |
| 6929 | WMITLV_SET_HDR((buf_ptr), |
| 6930 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6931 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 6932 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 6933 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6934 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 6935 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 6936 | bssid_src_ptr += ATH_MAC_LEN; |
| 6937 | bssid_dst_ptr++; |
| 6938 | } |
| 6939 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6940 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 6941 | WMITLV_SET_HDR((buf_ptr), |
| 6942 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6943 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 6944 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6945 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 6946 | qdf_mem_copy(&ssid_ptr->ssid, |
| 6947 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 6948 | roam_req->ssid_allowed_list[i].length); |
| 6949 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 6950 | ssid_ptr++; |
| 6951 | } |
| 6952 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 6953 | sizeof(wmi_ssid)); |
| 6954 | WMITLV_SET_HDR((buf_ptr), |
| 6955 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6956 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 6957 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 6958 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6959 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 6960 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 6961 | (wmi_mac_addr *)bssid_dst_ptr); |
| 6962 | bssid_src_ptr += ATH_MAC_LEN; |
| 6963 | bssid_dst_ptr++; |
| 6964 | } |
| 6965 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6966 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 6967 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6968 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 6969 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6970 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 6971 | *bssid_preferred_factor_ptr = |
| 6972 | roam_req->bssid_favored_factor[i]; |
| 6973 | bssid_preferred_factor_ptr++; |
| 6974 | } |
| 6975 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6976 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 6977 | |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6978 | WMITLV_SET_HDR(buf_ptr, |
| 6979 | WMITLV_TAG_ARRAY_STRUC, blist_len); |
| 6980 | buf_ptr += WMI_TLV_HDR_SIZE; |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6981 | if (roam_req->lca_disallow_config_present) { |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6982 | blist_param = |
| 6983 | (wmi_roam_lca_disallow_config_tlv_param *) buf_ptr; |
| 6984 | WMITLV_SET_HDR(&blist_param->tlv_header, |
| 6985 | WMITLV_TAG_STRUC_wmi_roam_lca_disallow_config_tlv_param, |
| 6986 | WMITLV_GET_STRUCT_TLVLEN( |
| 6987 | wmi_roam_lca_disallow_config_tlv_param)); |
| 6988 | |
| 6989 | blist_param->disallow_duration = roam_req->disallow_duration; |
| 6990 | blist_param->rssi_channel_penalization = |
| 6991 | roam_req->rssi_channel_penalization; |
| 6992 | blist_param->num_disallowed_aps = roam_req->num_disallowed_aps; |
Vignesh Viswanathan | a9497fc | 2017-09-14 17:47:48 +0530 | [diff] [blame] | 6993 | blist_param->disallow_lca_enable_source_bitmap = |
| 6994 | (WMI_ROAM_LCA_DISALLOW_SOURCE_PER | |
| 6995 | WMI_ROAM_LCA_DISALLOW_SOURCE_BACKGROUND); |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6996 | buf_ptr += (sizeof(wmi_roam_lca_disallow_config_tlv_param)); |
| 6997 | } |
| 6998 | |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6999 | WMITLV_SET_HDR(buf_ptr, |
| 7000 | WMITLV_TAG_ARRAY_STRUC, |
| 7001 | (roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej))); |
| 7002 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7003 | for (i = 0; i < roam_req->num_rssi_rejection_ap; i++) { |
| 7004 | rssi_rej = |
| 7005 | (wmi_roam_rssi_rejection_oce_config_param *) buf_ptr; |
| 7006 | WMITLV_SET_HDR(&rssi_rej->tlv_header, |
| 7007 | WMITLV_TAG_STRUC_wmi_roam_rssi_rejection_oce_config_param, |
| 7008 | WMITLV_GET_STRUCT_TLVLEN( |
| 7009 | wmi_roam_rssi_rejection_oce_config_param)); |
| 7010 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 7011 | roam_req->rssi_rejection_ap[i].bssid.bytes, |
| 7012 | &rssi_rej->bssid); |
| 7013 | rssi_rej->remaining_disallow_duration = |
| 7014 | roam_req->rssi_rejection_ap[i].remaining_duration; |
| 7015 | rssi_rej->requested_rssi = |
| 7016 | (A_INT32)roam_req->rssi_rejection_ap[i].expected_rssi; |
| 7017 | buf_ptr += |
| 7018 | (sizeof(wmi_roam_rssi_rejection_oce_config_param)); |
| 7019 | } |
| 7020 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 7021 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7022 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7023 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7024 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 7025 | status); |
| 7026 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 7027 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7028 | |
| 7029 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 7030 | } |
| 7031 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 7032 | #if defined(WLAN_FEATURE_FILS_SK) |
| 7033 | static QDF_STATUS send_roam_scan_send_hlp_cmd_tlv(wmi_unified_t wmi_handle, |
| 7034 | struct hlp_params *params) |
| 7035 | { |
| 7036 | uint32_t len; |
| 7037 | uint8_t *buf_ptr; |
| 7038 | wmi_buf_t buf = NULL; |
| 7039 | wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param *hlp_params; |
| 7040 | |
| 7041 | len = sizeof(wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param); |
| 7042 | len += WMI_TLV_HDR_SIZE; |
| 7043 | len += qdf_roundup(params->hlp_ie_len, sizeof(uint32_t)); |
| 7044 | |
| 7045 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7046 | if (!buf) { |
| 7047 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7048 | return QDF_STATUS_E_NOMEM; |
| 7049 | } |
| 7050 | |
| 7051 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7052 | hlp_params = (wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param *) buf_ptr; |
| 7053 | WMITLV_SET_HDR(&hlp_params->tlv_header, |
| 7054 | WMITLV_TAG_STRUC_wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param, |
| 7055 | WMITLV_GET_STRUCT_TLVLEN( |
| 7056 | wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param)); |
| 7057 | |
| 7058 | hlp_params->vdev_id = params->vdev_id; |
| 7059 | hlp_params->size = params->hlp_ie_len; |
| 7060 | hlp_params->pkt_type = WMI_FILS_HLP_PKT_TYPE_DHCP_DISCOVER; |
| 7061 | |
| 7062 | buf_ptr += sizeof(*hlp_params); |
| 7063 | |
| 7064 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 7065 | round_up(params->hlp_ie_len, |
| 7066 | sizeof(uint32_t))); |
| 7067 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7068 | qdf_mem_copy(buf_ptr, params->hlp_ie, params->hlp_ie_len); |
| 7069 | |
| 7070 | WMI_LOGD(FL("send FILS HLP pkt vdev %d len %d"), |
| 7071 | hlp_params->vdev_id, hlp_params->size); |
| 7072 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7073 | WMI_PDEV_UPDATE_FILS_HLP_PKT_CMDID)) { |
| 7074 | WMI_LOGE(FL("Failed to send FILS HLP pkt cmd")); |
| 7075 | wmi_buf_free(buf); |
| 7076 | return QDF_STATUS_E_FAILURE; |
| 7077 | } |
| 7078 | |
| 7079 | return QDF_STATUS_SUCCESS; |
| 7080 | } |
| 7081 | #endif |
| 7082 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7083 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 7084 | * @wmi_handle: wmi handle |
| 7085 | * @req: epno config params request structure |
| 7086 | * |
| 7087 | * This function reads the incoming epno config request structure |
| 7088 | * and constructs the WMI message to the firmware. |
| 7089 | * |
| 7090 | * Returns: 0 on success, error number otherwise |
| 7091 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7092 | static QDF_STATUS send_set_epno_network_list_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7093 | struct wifi_enhanched_pno_params *req) |
| 7094 | { |
| 7095 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 7096 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7097 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7098 | u_int8_t i, *buf_ptr; |
| 7099 | wmi_buf_t buf; |
| 7100 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7101 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7102 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7103 | /* Fixed Params */ |
| 7104 | len = sizeof(*cmd); |
| 7105 | if (req->num_networks) { |
| 7106 | /* TLV place holder for array of structures |
| 7107 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 7108 | */ |
| 7109 | len += WMI_TLV_HDR_SIZE; |
| 7110 | len += (sizeof(nlo_configured_parameters) |
| 7111 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 7112 | /* TLV for array of uint32 channel_list */ |
| 7113 | len += WMI_TLV_HDR_SIZE; |
| 7114 | /* TLV for nlo_channel_prediction_cfg */ |
| 7115 | len += WMI_TLV_HDR_SIZE; |
| 7116 | /* TLV for candidate score params */ |
| 7117 | len += sizeof(enlo_candidate_score_params); |
| 7118 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7119 | |
| 7120 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7121 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7122 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7123 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7124 | } |
| 7125 | |
| 7126 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 7127 | |
| 7128 | buf_ptr = (u_int8_t *) cmd; |
| 7129 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7130 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 7131 | WMITLV_GET_STRUCT_TLVLEN( |
| 7132 | wmi_nlo_config_cmd_fixed_param)); |
| 7133 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7134 | |
| 7135 | /* set flag to reset if num of networks are 0 */ |
| 7136 | cmd->flags = (req->num_networks == 0 ? |
| 7137 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7138 | |
| 7139 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 7140 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7141 | cmd->no_of_ssids = QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7142 | WMI_LOGD("SSID count: %d flags: %d", |
| 7143 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7144 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7145 | /* Fill nlo_config only when num_networks are non zero */ |
| 7146 | if (cmd->no_of_ssids) { |
| 7147 | /* Fill networks */ |
| 7148 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7149 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 7150 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7151 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7152 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 7153 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 7154 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 7155 | WMITLV_TAG_ARRAY_BYTE, |
| 7156 | WMITLV_GET_STRUCT_TLVLEN( |
| 7157 | nlo_configured_parameters)); |
| 7158 | /* Copy ssid and it's length */ |
| 7159 | nlo_list[i].ssid.valid = true; |
| 7160 | nlo_list[i].ssid.ssid.ssid_len = |
| 7161 | req->networks[i].ssid.length; |
| 7162 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 7163 | req->networks[i].ssid.mac_ssid, |
| 7164 | nlo_list[i].ssid.ssid.ssid_len); |
| 7165 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 7166 | nlo_list[i].ssid.ssid.ssid_len, |
| 7167 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 7168 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7169 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7170 | /* Copy pno flags */ |
| 7171 | nlo_list[i].bcast_nw_type.valid = true; |
| 7172 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 7173 | req->networks[i].flags; |
| 7174 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7175 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 7176 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7177 | /* Copy auth bit field */ |
| 7178 | nlo_list[i].auth_type.valid = true; |
| 7179 | nlo_list[i].auth_type.auth_type = |
| 7180 | req->networks[i].auth_bit_field; |
| 7181 | WMI_LOGD("Auth bit field (%u)", |
| 7182 | nlo_list[i].auth_type.auth_type); |
| 7183 | } |
| 7184 | |
| 7185 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 7186 | /* Fill the channel list */ |
| 7187 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7188 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7189 | |
| 7190 | /* Fill prediction_param */ |
| 7191 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7192 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7193 | |
| 7194 | /* Fill epno candidate score params */ |
| 7195 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 7196 | WMITLV_SET_HDR(buf_ptr, |
| 7197 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 7198 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 7199 | cand_score_params->min5GHz_rssi = |
| 7200 | req->min_5ghz_rssi; |
| 7201 | cand_score_params->min24GHz_rssi = |
| 7202 | req->min_24ghz_rssi; |
| 7203 | cand_score_params->initial_score_max = |
| 7204 | req->initial_score_max; |
| 7205 | cand_score_params->current_connection_bonus = |
| 7206 | req->current_connection_bonus; |
| 7207 | cand_score_params->same_network_bonus = |
| 7208 | req->same_network_bonus; |
| 7209 | cand_score_params->secure_bonus = |
| 7210 | req->secure_bonus; |
| 7211 | cand_score_params->band5GHz_bonus = |
| 7212 | req->band_5ghz_bonus; |
| 7213 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7214 | } |
| 7215 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7216 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7217 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7218 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7219 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7220 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7221 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7222 | } |
| 7223 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7224 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7225 | req->session_id); |
| 7226 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7227 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7228 | } |
| 7229 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 7230 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7231 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 7232 | * @wmi_handle: wmi handle |
| 7233 | * @ipa_offload: ipa offload control parameter |
| 7234 | * |
| 7235 | * Returns: 0 on success, error number otherwise |
| 7236 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7237 | static QDF_STATUS send_ipa_offload_control_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7238 | struct ipa_offload_control_params *ipa_offload) |
| 7239 | { |
| 7240 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 7241 | wmi_buf_t wmi_buf; |
| 7242 | uint32_t len; |
| 7243 | u_int8_t *buf_ptr; |
| 7244 | |
| 7245 | len = sizeof(*cmd); |
| 7246 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7247 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7248 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 7249 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7250 | } |
| 7251 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 7252 | WMI_LOGD("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7253 | ipa_offload->offload_type, ipa_offload->enable); |
| 7254 | |
| 7255 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 7256 | |
| 7257 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 7258 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7259 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 7260 | WMITLV_GET_STRUCT_TLVLEN( |
| 7261 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 7262 | |
| 7263 | cmd->offload_type = ipa_offload->offload_type; |
| 7264 | cmd->vdev_id = ipa_offload->vdev_id; |
| 7265 | cmd->enable = ipa_offload->enable; |
| 7266 | |
| 7267 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7268 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7269 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7270 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7271 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7272 | } |
| 7273 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7274 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7275 | } |
| 7276 | |
| 7277 | /** |
| 7278 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 7279 | * @wmi_handle: wmi handle |
| 7280 | * @pgetcapab: get capabilities params |
| 7281 | * |
| 7282 | * This function send request to fw to get extscan capabilities. |
| 7283 | * |
| 7284 | * Return: CDF status |
| 7285 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7286 | static QDF_STATUS send_extscan_get_capabilities_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7287 | struct extscan_capabilities_params *pgetcapab) |
| 7288 | { |
| 7289 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 7290 | wmi_buf_t wmi_buf; |
| 7291 | uint32_t len; |
| 7292 | uint8_t *buf_ptr; |
| 7293 | |
| 7294 | len = sizeof(*cmd); |
| 7295 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7296 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7297 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7298 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7299 | } |
| 7300 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7301 | |
| 7302 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 7303 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7304 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 7305 | WMITLV_GET_STRUCT_TLVLEN |
| 7306 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 7307 | |
| 7308 | cmd->request_id = pgetcapab->request_id; |
| 7309 | |
| 7310 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7311 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7312 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7313 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7314 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7315 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7316 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7317 | } |
| 7318 | |
| 7319 | /** |
| 7320 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 7321 | * @wmi_handle: wmi handle |
| 7322 | * @pcached_results: cached results parameters |
| 7323 | * |
| 7324 | * This function send request to fw to get cached results. |
| 7325 | * |
| 7326 | * Return: CDF status |
| 7327 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7328 | static QDF_STATUS send_extscan_get_cached_results_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7329 | struct extscan_cached_result_params *pcached_results) |
| 7330 | { |
| 7331 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 7332 | wmi_buf_t wmi_buf; |
| 7333 | uint32_t len; |
| 7334 | uint8_t *buf_ptr; |
| 7335 | |
| 7336 | len = sizeof(*cmd); |
| 7337 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7338 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7339 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7340 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7341 | } |
| 7342 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7343 | |
| 7344 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 7345 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7346 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 7347 | WMITLV_GET_STRUCT_TLVLEN |
| 7348 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 7349 | |
| 7350 | cmd->request_id = pcached_results->request_id; |
| 7351 | cmd->vdev_id = pcached_results->session_id; |
| 7352 | cmd->control_flags = pcached_results->flush; |
| 7353 | |
| 7354 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7355 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7356 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7357 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7358 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7359 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7360 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7361 | } |
| 7362 | |
| 7363 | /** |
| 7364 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 7365 | * @wmi_handle: wmi handle |
| 7366 | * @reset_req: Reset change request params |
| 7367 | * |
| 7368 | * This function sends stop change monitor request to fw. |
| 7369 | * |
| 7370 | * Return: CDF status |
| 7371 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7372 | static QDF_STATUS send_extscan_stop_change_monitor_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7373 | struct extscan_capabilities_reset_params *reset_req) |
| 7374 | { |
| 7375 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 7376 | wmi_buf_t wmi_buf; |
| 7377 | uint32_t len; |
| 7378 | uint8_t *buf_ptr; |
| 7379 | int change_list = 0; |
| 7380 | |
| 7381 | len = sizeof(*cmd); |
| 7382 | |
| 7383 | /* reset significant change tlv is set to 0 */ |
| 7384 | len += WMI_TLV_HDR_SIZE; |
| 7385 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 7386 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7387 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7388 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7389 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7390 | } |
| 7391 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7392 | |
| 7393 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 7394 | buf_ptr; |
| 7395 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7396 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 7397 | WMITLV_GET_STRUCT_TLVLEN |
| 7398 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 7399 | |
| 7400 | cmd->request_id = reset_req->request_id; |
| 7401 | cmd->vdev_id = reset_req->session_id; |
| 7402 | cmd->mode = 0; |
| 7403 | |
| 7404 | buf_ptr += sizeof(*cmd); |
| 7405 | WMITLV_SET_HDR(buf_ptr, |
| 7406 | WMITLV_TAG_ARRAY_STRUC, |
| 7407 | change_list * |
| 7408 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 7409 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 7410 | sizeof |
| 7411 | (wmi_extscan_wlan_change_bssid_param)); |
| 7412 | |
| 7413 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7414 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7415 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7416 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7417 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7418 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7419 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7420 | } |
| 7421 | |
| 7422 | /** |
| 7423 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 7424 | * @wmi_handle: wmi handle |
| 7425 | * @psigchange: change monitor request params |
| 7426 | * @buf: wmi buffer |
| 7427 | * @buf_len: buffer length |
| 7428 | * |
| 7429 | * This function fills elements of change monitor request buffer. |
| 7430 | * |
| 7431 | * Return: CDF status |
| 7432 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7433 | static QDF_STATUS wmi_get_buf_extscan_change_monitor_cmd(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7434 | struct extscan_set_sig_changereq_params |
| 7435 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 7436 | { |
| 7437 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 7438 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 7439 | uint8_t *buf_ptr; |
| 7440 | int j; |
| 7441 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 7442 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7443 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 7444 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 7445 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7446 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 7447 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7448 | } |
| 7449 | len += WMI_TLV_HDR_SIZE; |
| 7450 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 7451 | |
| 7452 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 7453 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7454 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7455 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7456 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7457 | } |
| 7458 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 7459 | cmd = |
| 7460 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 7461 | buf_ptr; |
| 7462 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7463 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 7464 | WMITLV_GET_STRUCT_TLVLEN |
| 7465 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 7466 | |
| 7467 | cmd->request_id = psigchange->request_id; |
| 7468 | cmd->vdev_id = psigchange->session_id; |
| 7469 | cmd->total_entries = numap; |
| 7470 | cmd->mode = 1; |
| 7471 | cmd->num_entries_in_page = numap; |
| 7472 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 7473 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 7474 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 7475 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 7476 | |
| 7477 | buf_ptr += sizeof(*cmd); |
| 7478 | WMITLV_SET_HDR(buf_ptr, |
| 7479 | WMITLV_TAG_ARRAY_STRUC, |
| 7480 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 7481 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 7482 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7483 | |
| 7484 | for (j = 0; j < numap; j++) { |
| 7485 | WMITLV_SET_HDR(dest_chglist, |
| 7486 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 7487 | WMITLV_GET_STRUCT_TLVLEN |
| 7488 | (wmi_extscan_wlan_change_bssid_param)); |
| 7489 | |
| 7490 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 7491 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 7492 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 7493 | &dest_chglist->bssid); |
| 7494 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7495 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7496 | dest_chglist->lower_rssi_limit); |
| 7497 | dest_chglist++; |
| 7498 | src_ap++; |
| 7499 | } |
| 7500 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 7501 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 7502 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7503 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7504 | } |
| 7505 | |
| 7506 | /** |
| 7507 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 7508 | * @wmi_handle: wmi handle |
| 7509 | * @psigchange: change monitor request params |
| 7510 | * |
| 7511 | * This function sends start change monitor request to fw. |
| 7512 | * |
| 7513 | * Return: CDF status |
| 7514 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7515 | static QDF_STATUS send_extscan_start_change_monitor_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7516 | struct extscan_set_sig_changereq_params * |
| 7517 | psigchange) |
| 7518 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7519 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7520 | wmi_buf_t buf; |
| 7521 | int len; |
| 7522 | |
| 7523 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7524 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7525 | psigchange, &buf, |
| 7526 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7527 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 7528 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7529 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7530 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7531 | } |
| 7532 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7533 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 7534 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7535 | } |
| 7536 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7537 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7538 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7539 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7540 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7541 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7542 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7543 | } |
| 7544 | |
| 7545 | /** |
| 7546 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 7547 | * @wmi_handle: wmi handle |
| 7548 | * @photlist_reset: hotlist reset params |
| 7549 | * |
| 7550 | * This function configures hotlist monitor to stop in fw. |
| 7551 | * |
| 7552 | * Return: CDF status |
| 7553 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7554 | static QDF_STATUS send_extscan_stop_hotlist_monitor_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7555 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 7556 | { |
| 7557 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 7558 | wmi_buf_t wmi_buf; |
| 7559 | uint32_t len; |
| 7560 | uint8_t *buf_ptr; |
| 7561 | int hotlist_entries = 0; |
| 7562 | |
| 7563 | len = sizeof(*cmd); |
| 7564 | |
| 7565 | /* reset bssid hotlist with tlv set to 0 */ |
| 7566 | len += WMI_TLV_HDR_SIZE; |
| 7567 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 7568 | |
| 7569 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7570 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7571 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7572 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7573 | } |
| 7574 | |
| 7575 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7576 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 7577 | buf_ptr; |
| 7578 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7579 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 7580 | WMITLV_GET_STRUCT_TLVLEN |
| 7581 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 7582 | |
| 7583 | cmd->request_id = photlist_reset->request_id; |
| 7584 | cmd->vdev_id = photlist_reset->session_id; |
| 7585 | cmd->mode = 0; |
| 7586 | |
| 7587 | buf_ptr += sizeof(*cmd); |
| 7588 | WMITLV_SET_HDR(buf_ptr, |
| 7589 | WMITLV_TAG_ARRAY_STRUC, |
| 7590 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 7591 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 7592 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 7593 | |
| 7594 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7595 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7596 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7597 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7598 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7599 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7600 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7601 | } |
| 7602 | |
| 7603 | /** |
| 7604 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 7605 | * @wmi_handle: wmi handle |
| 7606 | * @pstopcmd: stop scan command request params |
| 7607 | * |
| 7608 | * This function sends stop extscan request to fw. |
| 7609 | * |
| 7610 | * Return: CDF Status. |
| 7611 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7612 | static QDF_STATUS send_stop_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7613 | struct extscan_stop_req_params *pstopcmd) |
| 7614 | { |
| 7615 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 7616 | wmi_buf_t wmi_buf; |
| 7617 | uint32_t len; |
| 7618 | uint8_t *buf_ptr; |
| 7619 | |
| 7620 | len = sizeof(*cmd); |
| 7621 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7622 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7623 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7624 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7625 | } |
| 7626 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7627 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 7628 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7629 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 7630 | WMITLV_GET_STRUCT_TLVLEN |
| 7631 | (wmi_extscan_stop_cmd_fixed_param)); |
| 7632 | |
| 7633 | cmd->request_id = pstopcmd->request_id; |
| 7634 | cmd->vdev_id = pstopcmd->session_id; |
| 7635 | |
| 7636 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7637 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7638 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7639 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7640 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7641 | } |
| 7642 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7643 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7644 | } |
| 7645 | |
| 7646 | /** |
| 7647 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 7648 | * @wmi_handle: wmi handle |
| 7649 | * @pstart: scan command request params |
| 7650 | * @buf: event buffer |
| 7651 | * @buf_len: length of buffer |
| 7652 | * |
| 7653 | * This function fills individual elements of extscan request and |
| 7654 | * TLV for buckets, channel list. |
| 7655 | * |
| 7656 | * Return: CDF Status. |
| 7657 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 7658 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7659 | QDF_STATUS wmi_get_buf_extscan_start_cmd(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7660 | struct wifi_scan_cmd_req_params *pstart, |
| 7661 | wmi_buf_t *buf, int *buf_len) |
| 7662 | { |
| 7663 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 7664 | wmi_extscan_bucket *dest_blist; |
| 7665 | wmi_extscan_bucket_channel *dest_clist; |
| 7666 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 7667 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 7668 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 7669 | |
| 7670 | uint8_t *buf_ptr; |
| 7671 | int i, k, count = 0; |
| 7672 | int len = sizeof(*cmd); |
| 7673 | int nbuckets = pstart->numBuckets; |
| 7674 | int nchannels = 0; |
| 7675 | |
| 7676 | /* These TLV's are are NULL by default */ |
| 7677 | uint32_t ie_len_with_pad = 0; |
| 7678 | int num_ssid = 0; |
| 7679 | int num_bssid = 0; |
| 7680 | int ie_len = 0; |
| 7681 | |
| 7682 | uint32_t base_period = pstart->basePeriod; |
| 7683 | |
| 7684 | /* TLV placeholder for ssid_list (NULL) */ |
| 7685 | len += WMI_TLV_HDR_SIZE; |
| 7686 | len += num_ssid * sizeof(wmi_ssid); |
| 7687 | |
| 7688 | /* TLV placeholder for bssid_list (NULL) */ |
| 7689 | len += WMI_TLV_HDR_SIZE; |
| 7690 | len += num_bssid * sizeof(wmi_mac_addr); |
| 7691 | |
| 7692 | /* TLV placeholder for ie_data (NULL) */ |
| 7693 | len += WMI_TLV_HDR_SIZE; |
| 7694 | len += ie_len * sizeof(uint32_t); |
| 7695 | |
| 7696 | /* TLV placeholder for bucket */ |
| 7697 | len += WMI_TLV_HDR_SIZE; |
| 7698 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 7699 | |
| 7700 | /* TLV channel placeholder */ |
| 7701 | len += WMI_TLV_HDR_SIZE; |
| 7702 | for (i = 0; i < nbuckets; i++) { |
| 7703 | nchannels += src_bucket->numChannels; |
| 7704 | src_bucket++; |
| 7705 | } |
| 7706 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7707 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7708 | __func__, nbuckets, nchannels); |
| 7709 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 7710 | /* Allocate the memory */ |
| 7711 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 7712 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7713 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7714 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7715 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7716 | } |
| 7717 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 7718 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 7719 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7720 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 7721 | WMITLV_GET_STRUCT_TLVLEN |
| 7722 | (wmi_extscan_start_cmd_fixed_param)); |
| 7723 | |
| 7724 | cmd->request_id = pstart->requestId; |
| 7725 | cmd->vdev_id = pstart->sessionId; |
| 7726 | cmd->base_period = pstart->basePeriod; |
| 7727 | cmd->num_buckets = nbuckets; |
| 7728 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 7729 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7730 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7731 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7732 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7733 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7734 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 7735 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7736 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 7737 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 7738 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7739 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 7740 | |
| 7741 | /* The max dwell time is retrieved from the first channel |
| 7742 | * of the first bucket and kept common for all channels. |
| 7743 | */ |
| 7744 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 7745 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 7746 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 7747 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 7748 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 7749 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 7750 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 7751 | |
| 7752 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7753 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7754 | cmd->probe_delay = 0; |
| 7755 | cmd->probe_spacing_time = 0; |
| 7756 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7757 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 7758 | WMI_SCAN_ADD_CCK_RATES | |
| 7759 | WMI_SCAN_ADD_OFDM_RATES | |
| 7760 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 7761 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 7762 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 7763 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 7764 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7765 | cmd->num_ssids = 0; |
| 7766 | cmd->num_bssid = 0; |
| 7767 | cmd->ie_len = 0; |
| 7768 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 7769 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 7770 | |
| 7771 | buf_ptr += sizeof(*cmd); |
| 7772 | WMITLV_SET_HDR(buf_ptr, |
| 7773 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 7774 | num_ssid * sizeof(wmi_ssid)); |
| 7775 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 7776 | |
| 7777 | WMITLV_SET_HDR(buf_ptr, |
| 7778 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 7779 | num_bssid * sizeof(wmi_mac_addr)); |
| 7780 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 7781 | |
| 7782 | ie_len_with_pad = 0; |
| 7783 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 7784 | ie_len_with_pad); |
| 7785 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 7786 | |
| 7787 | WMITLV_SET_HDR(buf_ptr, |
| 7788 | WMITLV_TAG_ARRAY_STRUC, |
| 7789 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 7790 | dest_blist = (wmi_extscan_bucket *) |
| 7791 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7792 | src_bucket = pstart->buckets; |
| 7793 | |
| 7794 | /* Retrieve scanning information from each bucket and |
| 7795 | * channels and send it to the target |
| 7796 | */ |
| 7797 | for (i = 0; i < nbuckets; i++) { |
| 7798 | WMITLV_SET_HDR(dest_blist, |
| 7799 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 7800 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 7801 | |
| 7802 | dest_blist->bucket_id = src_bucket->bucket; |
| 7803 | dest_blist->base_period_multiplier = |
| 7804 | src_bucket->period / base_period; |
| 7805 | dest_blist->min_period = src_bucket->period; |
| 7806 | dest_blist->max_period = src_bucket->max_period; |
| 7807 | dest_blist->exp_backoff = src_bucket->exponent; |
| 7808 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 7809 | dest_blist->channel_band = src_bucket->band; |
| 7810 | dest_blist->num_channels = src_bucket->numChannels; |
| 7811 | dest_blist->notify_extscan_events = 0; |
| 7812 | |
| 7813 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 7814 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 7815 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 7816 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7817 | |
| 7818 | if (src_bucket->reportEvents & |
| 7819 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 7820 | dest_blist->forwarding_flags = |
| 7821 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 7822 | dest_blist->notify_extscan_events |= |
| 7823 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 7824 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 7825 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 7826 | } else { |
| 7827 | dest_blist->forwarding_flags = |
| 7828 | WMI_EXTSCAN_NO_FORWARDING; |
| 7829 | } |
| 7830 | |
| 7831 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 7832 | dest_blist->configuration_flags = 0; |
| 7833 | else |
| 7834 | dest_blist->configuration_flags = |
| 7835 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 7836 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7837 | WMI_LOGI("%s: ntfy_extscan_events:%u cfg_flags:%u fwd_flags:%u", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7838 | __func__, dest_blist->notify_extscan_events, |
| 7839 | dest_blist->configuration_flags, |
| 7840 | dest_blist->forwarding_flags); |
| 7841 | |
| 7842 | dest_blist->min_dwell_time_active = |
| 7843 | src_bucket->min_dwell_time_active; |
| 7844 | dest_blist->max_dwell_time_active = |
| 7845 | src_bucket->max_dwell_time_active; |
| 7846 | dest_blist->min_dwell_time_passive = |
| 7847 | src_bucket->min_dwell_time_passive; |
| 7848 | dest_blist->max_dwell_time_passive = |
| 7849 | src_bucket->max_dwell_time_passive; |
| 7850 | src_channel = src_bucket->channels; |
| 7851 | |
| 7852 | /* save the channel info to later populate |
| 7853 | * the channel TLV |
| 7854 | */ |
| 7855 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 7856 | save_channel[count++].channel = src_channel->channel; |
| 7857 | src_channel++; |
| 7858 | } |
| 7859 | dest_blist++; |
| 7860 | src_bucket++; |
| 7861 | } |
| 7862 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 7863 | WMITLV_SET_HDR(buf_ptr, |
| 7864 | WMITLV_TAG_ARRAY_STRUC, |
| 7865 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 7866 | dest_clist = (wmi_extscan_bucket_channel *) |
| 7867 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7868 | |
| 7869 | /* Active or passive scan is based on the bucket dwell time |
| 7870 | * and channel specific active,passive scans are not |
| 7871 | * supported yet |
| 7872 | */ |
| 7873 | for (i = 0; i < nchannels; i++) { |
| 7874 | WMITLV_SET_HDR(dest_clist, |
| 7875 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 7876 | WMITLV_GET_STRUCT_TLVLEN |
| 7877 | (wmi_extscan_bucket_channel)); |
| 7878 | dest_clist->channel = save_channel[i].channel; |
| 7879 | dest_clist++; |
| 7880 | } |
| 7881 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 7882 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 7883 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7884 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7885 | } |
| 7886 | |
| 7887 | /** |
| 7888 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 7889 | * @wmi_handle: wmi handle |
| 7890 | * @pstart: scan command request params |
| 7891 | * |
| 7892 | * This function sends start extscan request to fw. |
| 7893 | * |
| 7894 | * Return: CDF Status. |
| 7895 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7896 | static QDF_STATUS send_start_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7897 | struct wifi_scan_cmd_req_params *pstart) |
| 7898 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7899 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7900 | wmi_buf_t buf; |
| 7901 | int len; |
| 7902 | |
| 7903 | /* Fill individual elements of extscan request and |
| 7904 | * TLV for buckets, channel list. |
| 7905 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7906 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7907 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7908 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 7909 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 7910 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7911 | } |
| 7912 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7913 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7914 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7915 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7916 | } |
| 7917 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 7918 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7919 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7920 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7921 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7922 | } |
| 7923 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7924 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7925 | } |
| 7926 | |
| 7927 | /** |
| 7928 | * send_plm_stop_cmd_tlv() - plm stop request |
| 7929 | * @wmi_handle: wmi handle |
| 7930 | * @plm: plm request parameters |
| 7931 | * |
| 7932 | * This function request FW to stop PLM. |
| 7933 | * |
| 7934 | * Return: CDF status |
| 7935 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7936 | static QDF_STATUS send_plm_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7937 | const struct plm_req_params *plm) |
| 7938 | { |
| 7939 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 7940 | int32_t len; |
| 7941 | wmi_buf_t buf; |
| 7942 | uint8_t *buf_ptr; |
| 7943 | int ret; |
| 7944 | |
| 7945 | len = sizeof(*cmd); |
| 7946 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7947 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7948 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7949 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7950 | } |
| 7951 | |
| 7952 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 7953 | |
| 7954 | buf_ptr = (uint8_t *) cmd; |
| 7955 | |
| 7956 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7957 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 7958 | WMITLV_GET_STRUCT_TLVLEN |
| 7959 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 7960 | |
| 7961 | cmd->vdev_id = plm->session_id; |
| 7962 | |
| 7963 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7964 | WMI_LOGD("vdev %d meas token %d", cmd->vdev_id, cmd->meas_token); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7965 | |
| 7966 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7967 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 7968 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7969 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7970 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7971 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7972 | } |
| 7973 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7974 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7975 | } |
| 7976 | |
| 7977 | /** |
| 7978 | * send_plm_start_cmd_tlv() - plm start request |
| 7979 | * @wmi_handle: wmi handle |
| 7980 | * @plm: plm request parameters |
| 7981 | * |
| 7982 | * This function request FW to start PLM. |
| 7983 | * |
| 7984 | * Return: CDF status |
| 7985 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7986 | static QDF_STATUS send_plm_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7987 | const struct plm_req_params *plm, |
| 7988 | uint32_t *gchannel_list) |
| 7989 | { |
| 7990 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 7991 | uint32_t *channel_list; |
| 7992 | int32_t len; |
| 7993 | wmi_buf_t buf; |
| 7994 | uint8_t *buf_ptr; |
| 7995 | uint8_t count; |
| 7996 | int ret; |
| 7997 | |
| 7998 | /* TLV place holder for channel_list */ |
| 7999 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 8000 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 8001 | |
| 8002 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8003 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8004 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8005 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8006 | } |
| 8007 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 8008 | |
| 8009 | buf_ptr = (uint8_t *) cmd; |
| 8010 | |
| 8011 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8012 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 8013 | WMITLV_GET_STRUCT_TLVLEN |
| 8014 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 8015 | |
| 8016 | cmd->vdev_id = plm->session_id; |
| 8017 | |
| 8018 | cmd->meas_token = plm->meas_token; |
| 8019 | cmd->dialog_token = plm->diag_token; |
| 8020 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8021 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8022 | cmd->off_duration = plm->meas_duration; |
| 8023 | cmd->burst_cycle = plm->burst_len; |
| 8024 | cmd->tx_power = plm->desired_tx_pwr; |
| 8025 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 8026 | cmd->num_chans = plm->plm_num_ch; |
| 8027 | |
| 8028 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 8029 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8030 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 8031 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 8032 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 8033 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 8034 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 8035 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 8036 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 8037 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8038 | |
| 8039 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 8040 | (cmd->num_chans * sizeof(uint32_t))); |
| 8041 | |
| 8042 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8043 | if (cmd->num_chans) { |
| 8044 | channel_list = (uint32_t *) buf_ptr; |
| 8045 | for (count = 0; count < cmd->num_chans; count++) { |
| 8046 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8047 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8048 | channel_list[count] = |
| 8049 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8050 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8051 | } |
| 8052 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 8053 | } |
| 8054 | |
| 8055 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8056 | WMI_VDEV_PLMREQ_START_CMDID); |
| 8057 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8058 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8059 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8060 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8061 | } |
| 8062 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8063 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8064 | } |
| 8065 | |
| 8066 | /** |
| 8067 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 8068 | * @wmi_handle: wmi handle |
| 8069 | * @vdev_id: vdev id |
| 8070 | * |
| 8071 | * This function request FW to stop ongoing PNO operation. |
| 8072 | * |
| 8073 | * Return: CDF status |
| 8074 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8075 | 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] | 8076 | { |
| 8077 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 8078 | int32_t len = sizeof(*cmd); |
| 8079 | wmi_buf_t buf; |
| 8080 | uint8_t *buf_ptr; |
| 8081 | int ret; |
| 8082 | |
| 8083 | /* |
| 8084 | * TLV place holder for array of structures nlo_configured_parameters |
| 8085 | * TLV place holder for array of uint32_t channel_list |
| 8086 | * TLV place holder for chnl prediction cfg |
| 8087 | */ |
| 8088 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 8089 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8090 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8091 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8092 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8093 | } |
| 8094 | |
| 8095 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 8096 | buf_ptr = (uint8_t *) cmd; |
| 8097 | |
| 8098 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8099 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 8100 | WMITLV_GET_STRUCT_TLVLEN |
| 8101 | (wmi_nlo_config_cmd_fixed_param)); |
| 8102 | |
| 8103 | cmd->vdev_id = vdev_id; |
| 8104 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 8105 | buf_ptr += sizeof(*cmd); |
| 8106 | |
| 8107 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 8108 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8109 | |
| 8110 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 8111 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8112 | |
| 8113 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 8114 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8115 | |
| 8116 | |
| 8117 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8118 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 8119 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8120 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8121 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8122 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8123 | } |
| 8124 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8125 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8126 | } |
| 8127 | |
| 8128 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 8129 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 8130 | * @buf_ptr: Buffer passed by upper layers |
| 8131 | * @pno: Buffer to be sent to the firmware |
| 8132 | * |
| 8133 | * Copy the PNO Channel prediction configuration parameters |
| 8134 | * passed by the upper layers to a WMI format TLV and send it |
| 8135 | * down to the firmware. |
| 8136 | * |
| 8137 | * Return: None |
| 8138 | */ |
| 8139 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 8140 | struct pno_scan_req_params *pno) |
| 8141 | { |
| 8142 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 8143 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 8144 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 8145 | WMITLV_TAG_ARRAY_BYTE, |
| 8146 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8147 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 8148 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 8149 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 8150 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 8151 | channel_prediction_cfg->full_scan_period_ms = |
| 8152 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8153 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 8154 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 8155 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 8156 | channel_prediction_cfg->enable, |
| 8157 | channel_prediction_cfg->top_k_num, |
| 8158 | channel_prediction_cfg->stationary_threshold, |
| 8159 | channel_prediction_cfg->full_scan_period_ms); |
| 8160 | } |
| 8161 | |
| 8162 | /** |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 8163 | * send_nlo_mawc_cmd_tlv() - Send MAWC NLO configuration |
| 8164 | * @wmi_handle: wmi handle |
| 8165 | * @params: configuration parameters |
| 8166 | * |
| 8167 | * Return: QDF_STATUS |
| 8168 | */ |
| 8169 | static QDF_STATUS send_nlo_mawc_cmd_tlv(wmi_unified_t wmi_handle, |
| 8170 | struct nlo_mawc_params *params) |
| 8171 | { |
| 8172 | wmi_buf_t buf = NULL; |
| 8173 | QDF_STATUS status; |
| 8174 | int len; |
| 8175 | uint8_t *buf_ptr; |
| 8176 | wmi_nlo_configure_mawc_cmd_fixed_param *wmi_nlo_mawc_params; |
| 8177 | |
| 8178 | len = sizeof(*wmi_nlo_mawc_params); |
| 8179 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8180 | if (!buf) { |
| 8181 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8182 | return QDF_STATUS_E_NOMEM; |
| 8183 | } |
| 8184 | |
| 8185 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8186 | wmi_nlo_mawc_params = |
| 8187 | (wmi_nlo_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 8188 | WMITLV_SET_HDR(&wmi_nlo_mawc_params->tlv_header, |
| 8189 | WMITLV_TAG_STRUC_wmi_nlo_configure_mawc_cmd_fixed_param, |
| 8190 | WMITLV_GET_STRUCT_TLVLEN |
| 8191 | (wmi_nlo_configure_mawc_cmd_fixed_param)); |
| 8192 | wmi_nlo_mawc_params->vdev_id = params->vdev_id; |
| 8193 | if (params->enable) |
| 8194 | wmi_nlo_mawc_params->enable = 1; |
| 8195 | else |
| 8196 | wmi_nlo_mawc_params->enable = 0; |
| 8197 | wmi_nlo_mawc_params->exp_backoff_ratio = params->exp_backoff_ratio; |
| 8198 | wmi_nlo_mawc_params->init_scan_interval = params->init_scan_interval; |
| 8199 | wmi_nlo_mawc_params->max_scan_interval = params->max_scan_interval; |
Varun Reddy Yeturu | 7a8c337 | 2017-08-21 10:28:13 -0700 | [diff] [blame] | 8200 | WMI_LOGD(FL("MAWC NLO en=%d, vdev=%d, ratio=%d, SCAN init=%d, max=%d"), |
| 8201 | wmi_nlo_mawc_params->enable, wmi_nlo_mawc_params->vdev_id, |
| 8202 | wmi_nlo_mawc_params->exp_backoff_ratio, |
| 8203 | wmi_nlo_mawc_params->init_scan_interval, |
| 8204 | wmi_nlo_mawc_params->max_scan_interval); |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 8205 | |
| 8206 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8207 | len, WMI_NLO_CONFIGURE_MAWC_CMDID); |
| 8208 | if (QDF_IS_STATUS_ERROR(status)) { |
| 8209 | WMI_LOGE("WMI_NLO_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 8210 | status); |
| 8211 | wmi_buf_free(buf); |
| 8212 | return QDF_STATUS_E_FAILURE; |
| 8213 | } |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 8214 | |
| 8215 | return QDF_STATUS_SUCCESS; |
| 8216 | } |
| 8217 | |
| 8218 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8219 | * send_pno_start_cmd_tlv() - PNO start request |
| 8220 | * @wmi_handle: wmi handle |
| 8221 | * @pno: PNO request |
| 8222 | * |
| 8223 | * This function request FW to start PNO request. |
| 8224 | * Request: CDF status |
| 8225 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8226 | 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] | 8227 | struct pno_scan_req_params *pno) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8228 | { |
| 8229 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 8230 | nlo_configured_parameters *nlo_list; |
| 8231 | uint32_t *channel_list; |
| 8232 | int32_t len; |
| 8233 | wmi_buf_t buf; |
| 8234 | uint8_t *buf_ptr; |
| 8235 | uint8_t i; |
| 8236 | int ret; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 8237 | struct probe_req_whitelist_attr *ie_whitelist = &pno->ie_whitelist; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 8238 | connected_nlo_rssi_params *nlo_relative_rssi; |
| 8239 | connected_nlo_bss_band_rssi_pref *nlo_band_rssi; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8240 | |
| 8241 | /* |
| 8242 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 8243 | * TLV place holder for array of uint32_t channel_list |
| 8244 | * TLV place holder for chnnl prediction cfg |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 8245 | * TLV place holder for array of wmi_vendor_oui |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 8246 | * TLV place holder for array of connected_nlo_bss_band_rssi_pref |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8247 | */ |
| 8248 | len = sizeof(*cmd) + |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 8249 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 8250 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8251 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8252 | len += sizeof(uint32_t) * QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8253 | WMI_NLO_MAX_CHAN); |
| 8254 | len += sizeof(nlo_configured_parameters) * |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8255 | QDF_MIN(pno->networks_cnt, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8256 | len += sizeof(nlo_channel_prediction_cfg); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 8257 | len += sizeof(enlo_candidate_score_params); |
| 8258 | len += sizeof(wmi_vendor_oui) * ie_whitelist->num_vendor_oui; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 8259 | len += sizeof(connected_nlo_rssi_params); |
| 8260 | len += sizeof(connected_nlo_bss_band_rssi_pref); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8261 | |
| 8262 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8263 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8264 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8265 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8266 | } |
| 8267 | |
| 8268 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 8269 | |
| 8270 | buf_ptr = (uint8_t *) cmd; |
| 8271 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8272 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 8273 | WMITLV_GET_STRUCT_TLVLEN |
| 8274 | (wmi_nlo_config_cmd_fixed_param)); |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8275 | cmd->vdev_id = pno->vdev_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8276 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 8277 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8278 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 8279 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8280 | pno->adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8281 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8282 | /* Current FW does not support min-max range for dwell time */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8283 | cmd->active_dwell_time = pno->active_dwell_time; |
| 8284 | cmd->passive_dwell_time = pno->passive_dwell_time; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8285 | |
Manjeet Singh | cd2dc06 | 2016-08-11 15:31:34 +0530 | [diff] [blame] | 8286 | if (pno->do_passive_scan) |
| 8287 | cmd->flags |= WMI_NLO_CONFIG_SCAN_PASSIVE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8288 | /* Copy scan interval */ |
| 8289 | cmd->fast_scan_period = pno->fast_scan_period; |
| 8290 | cmd->slow_scan_period = pno->slow_scan_period; |
Arif Hussain | 17ff203 | 2017-03-02 11:56:04 -0800 | [diff] [blame] | 8291 | cmd->delay_start_time = WMI_SEC_TO_MSEC(pno->delay_start_time); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8292 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Dustin Brown | 9d86564 | 2017-04-24 10:47:42 -0700 | [diff] [blame] | 8293 | cmd->scan_backoff_multiplier = pno->scan_backoff_multiplier; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8294 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8295 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8296 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8297 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 8298 | /* mac randomization attributes */ |
| 8299 | if (pno->scan_random.randomize) { |
| 8300 | cmd->flags |= WMI_NLO_CONFIG_SPOOFED_MAC_IN_PROBE_REQ | |
| 8301 | WMI_NLO_CONFIG_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 8302 | wmi_copy_scan_random_mac(pno->scan_random.mac_addr, |
| 8303 | pno->scan_random.mac_mask, |
| 8304 | &cmd->mac_addr, |
| 8305 | &cmd->mac_mask); |
| 8306 | } |
| 8307 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8308 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 8309 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8310 | 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] | 8311 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8312 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 8313 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 8314 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8315 | |
| 8316 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 8317 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 8318 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 8319 | WMITLV_TAG_ARRAY_BYTE, |
| 8320 | WMITLV_GET_STRUCT_TLVLEN |
| 8321 | (nlo_configured_parameters)); |
| 8322 | /* Copy ssid and it's length */ |
| 8323 | nlo_list[i].ssid.valid = true; |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8324 | nlo_list[i].ssid.ssid.ssid_len = |
| 8325 | pno->networks_list[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8326 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8327 | pno->networks_list[i].ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8328 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8329 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8330 | nlo_list[i].ssid.ssid.ssid_len, |
| 8331 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 8332 | nlo_list[i].ssid.ssid.ssid_len); |
| 8333 | |
| 8334 | /* Copy rssi threshold */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8335 | if (pno->networks_list[i].rssi_thresh && |
| 8336 | pno->networks_list[i].rssi_thresh > |
| 8337 | WMI_RSSI_THOLD_DEFAULT) { |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8338 | nlo_list[i].rssi_cond.valid = true; |
| 8339 | nlo_list[i].rssi_cond.rssi = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8340 | pno->networks_list[i].rssi_thresh; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8341 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8342 | nlo_list[i].rssi_cond.rssi); |
| 8343 | } |
| 8344 | nlo_list[i].bcast_nw_type.valid = true; |
| 8345 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8346 | pno->networks_list[i].bc_new_type; |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 8347 | WMI_LOGD("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8348 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 8349 | } |
| 8350 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 8351 | |
| 8352 | /* Copy channel info */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8353 | cmd->num_of_channels = QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8354 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8355 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8356 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 8357 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 8358 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8359 | |
| 8360 | channel_list = (uint32_t *) buf_ptr; |
| 8361 | for (i = 0; i < cmd->num_of_channels; i++) { |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8362 | channel_list[i] = pno->networks_list[0].channels[i]; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8363 | |
| 8364 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 8365 | channel_list[i] = |
| 8366 | wlan_chan_to_freq(pno-> |
| 8367 | networks_list[0].channels[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8368 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8369 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8370 | } |
| 8371 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 8372 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 8373 | sizeof(nlo_channel_prediction_cfg)); |
| 8374 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 8375 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 8376 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8377 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 8378 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 8379 | */ |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 8380 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 8381 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 8382 | buf_ptr += sizeof(enlo_candidate_score_params); |
| 8383 | |
| 8384 | if (ie_whitelist->white_list) { |
| 8385 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 8386 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 8387 | &cmd->num_vendor_oui, |
| 8388 | ie_whitelist); |
| 8389 | } |
| 8390 | |
| 8391 | /* ie white list */ |
| 8392 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 8393 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 8394 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8395 | if (cmd->num_vendor_oui != 0) { |
| 8396 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 8397 | ie_whitelist->voui); |
| 8398 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 8399 | } |
| 8400 | |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 8401 | if (pno->relative_rssi_set) |
| 8402 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_CNLO_RSSI_CONFIG; |
| 8403 | |
| 8404 | /* |
| 8405 | * Firmware calculation using connected PNO params: |
| 8406 | * New AP's RSSI >= (Connected AP's RSSI + relative_rssi +/- rssi_pref) |
| 8407 | * deduction of rssi_pref for chosen band_pref and |
| 8408 | * addition of rssi_pref for remaining bands (other than chosen band). |
| 8409 | */ |
| 8410 | nlo_relative_rssi = (connected_nlo_rssi_params *) buf_ptr; |
| 8411 | WMITLV_SET_HDR(&nlo_relative_rssi->tlv_header, |
| 8412 | WMITLV_TAG_STRUC_wmi_connected_nlo_rssi_params, |
| 8413 | WMITLV_GET_STRUCT_TLVLEN(connected_nlo_rssi_params)); |
| 8414 | nlo_relative_rssi->relative_rssi = pno->relative_rssi; |
| 8415 | WMI_LOGD("relative_rssi %d", nlo_relative_rssi->relative_rssi); |
| 8416 | buf_ptr += sizeof(*nlo_relative_rssi); |
| 8417 | |
| 8418 | /* |
| 8419 | * As of now Kernel and Host supports one band and rssi preference. |
| 8420 | * Firmware supports array of band and rssi preferences |
| 8421 | */ |
| 8422 | cmd->num_cnlo_band_pref = 1; |
| 8423 | WMITLV_SET_HDR(buf_ptr, |
| 8424 | WMITLV_TAG_ARRAY_STRUC, |
| 8425 | cmd->num_cnlo_band_pref * |
| 8426 | sizeof(connected_nlo_bss_band_rssi_pref)); |
| 8427 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8428 | |
| 8429 | nlo_band_rssi = (connected_nlo_bss_band_rssi_pref *) buf_ptr; |
| 8430 | for (i = 0; i < cmd->num_cnlo_band_pref; i++) { |
| 8431 | WMITLV_SET_HDR(&nlo_band_rssi[i].tlv_header, |
| 8432 | WMITLV_TAG_STRUC_wmi_connected_nlo_bss_band_rssi_pref, |
| 8433 | WMITLV_GET_STRUCT_TLVLEN( |
| 8434 | connected_nlo_bss_band_rssi_pref)); |
| 8435 | nlo_band_rssi[i].band = pno->band_rssi_pref.band; |
| 8436 | nlo_band_rssi[i].rssi_pref = pno->band_rssi_pref.rssi; |
| 8437 | WMI_LOGI("band_pref %d, rssi_pref %d", |
| 8438 | nlo_band_rssi[i].band, |
| 8439 | nlo_band_rssi[i].rssi_pref); |
| 8440 | } |
| 8441 | buf_ptr += cmd->num_cnlo_band_pref * sizeof(*nlo_band_rssi); |
| 8442 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8443 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8444 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 8445 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8446 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8447 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8448 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8449 | } |
| 8450 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8451 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8452 | } |
| 8453 | |
| 8454 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 8455 | * @wmi_handle: wmi handle |
| 8456 | * @msg: message |
| 8457 | * @is_add_ts: is addts required |
| 8458 | * |
| 8459 | * This function sets ric request element for 11r roaming. |
| 8460 | * |
| 8461 | * Return: CDF status |
| 8462 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8463 | static QDF_STATUS send_set_ric_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8464 | void *msg, uint8_t is_add_ts) |
| 8465 | { |
| 8466 | wmi_ric_request_fixed_param *cmd; |
| 8467 | wmi_ric_tspec *tspec_param; |
| 8468 | wmi_buf_t buf; |
| 8469 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8470 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8471 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 8472 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 8473 | |
| 8474 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8475 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8476 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8477 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8478 | } |
| 8479 | |
| 8480 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8481 | |
| 8482 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 8483 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8484 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 8485 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 8486 | if (is_add_ts) |
Deepak Dhamdhere | 990df85 | 2017-04-24 16:17:48 -0700 | [diff] [blame] | 8487 | cmd->vdev_id = ((struct add_ts_param *) msg)->sme_session_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8488 | else |
| 8489 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 8490 | cmd->num_ric_request = 1; |
| 8491 | cmd->is_add_ric = is_add_ts; |
| 8492 | |
| 8493 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 8494 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 8495 | |
| 8496 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8497 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 8498 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 8499 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 8500 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 8501 | |
| 8502 | if (is_add_ts) |
| 8503 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8504 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8505 | else |
| 8506 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8507 | #endif |
| 8508 | if (ptspecIE) { |
| 8509 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8510 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8511 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 8512 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8513 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8514 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 8515 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8516 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 8517 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8518 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 8519 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 8520 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 8521 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 8522 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 8523 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 8524 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 8525 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 8526 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 8527 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 8528 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 8529 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 8530 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 8531 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 8532 | tspec_param->medium_time = 0; |
| 8533 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8534 | WMI_LOGI("%s: Set RIC Req is_add_ts:%d", __func__, is_add_ts); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8535 | |
| 8536 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8537 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8538 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8539 | __func__); |
| 8540 | if (is_add_ts) |
| 8541 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8542 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8543 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8544 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8545 | } |
| 8546 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8547 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8548 | } |
| 8549 | |
| 8550 | /** |
| 8551 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 8552 | * @wmi_handle: wmi handle |
| 8553 | * @clear_req: ll stats clear request command params |
| 8554 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8555 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8556 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8557 | 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] | 8558 | const struct ll_stats_clear_params *clear_req, |
| 8559 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 8560 | { |
| 8561 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 8562 | int32_t len; |
| 8563 | wmi_buf_t buf; |
| 8564 | uint8_t *buf_ptr; |
| 8565 | int ret; |
| 8566 | |
| 8567 | len = sizeof(*cmd); |
| 8568 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8569 | |
| 8570 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8571 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8572 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8573 | } |
| 8574 | |
| 8575 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8576 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8577 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 8578 | |
| 8579 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8580 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 8581 | WMITLV_GET_STRUCT_TLVLEN |
| 8582 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 8583 | |
| 8584 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 8585 | cmd->vdev_id = clear_req->sta_id; |
| 8586 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 8587 | |
| 8588 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 8589 | &cmd->peer_macaddr); |
| 8590 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8591 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 8592 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 8593 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 8594 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 8595 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8596 | cmd->peer_macaddr); */ |
| 8597 | |
| 8598 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8599 | WMI_CLEAR_LINK_STATS_CMDID); |
| 8600 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8601 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8602 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8603 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8604 | } |
| 8605 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8606 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 8607 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8608 | } |
| 8609 | |
| 8610 | /** |
| 8611 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 8612 | * @wmi_handle: wmi handle |
| 8613 | * @setReq: ll stats set request command params |
| 8614 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8615 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8616 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8617 | 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] | 8618 | const struct ll_stats_set_params *set_req) |
| 8619 | { |
| 8620 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 8621 | int32_t len; |
| 8622 | wmi_buf_t buf; |
| 8623 | uint8_t *buf_ptr; |
| 8624 | int ret; |
| 8625 | |
| 8626 | len = sizeof(*cmd); |
| 8627 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8628 | |
| 8629 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8630 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8631 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8632 | } |
| 8633 | |
| 8634 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8635 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8636 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 8637 | |
| 8638 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8639 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 8640 | WMITLV_GET_STRUCT_TLVLEN |
| 8641 | (wmi_start_link_stats_cmd_fixed_param)); |
| 8642 | |
| 8643 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 8644 | cmd->aggressive_statistics_gathering = |
| 8645 | set_req->aggressive_statistics_gathering; |
| 8646 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8647 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 8648 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 8649 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8650 | |
| 8651 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8652 | WMI_START_LINK_STATS_CMDID); |
| 8653 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8654 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8655 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8656 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8657 | } |
| 8658 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8659 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8660 | } |
| 8661 | |
| 8662 | /** |
| 8663 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 8664 | * @wmi_handle:wmi handle |
| 8665 | * @get_req:ll stats get request command params |
| 8666 | * @addr: mac address |
| 8667 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8668 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8669 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8670 | 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] | 8671 | const struct ll_stats_get_params *get_req, |
| 8672 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 8673 | { |
| 8674 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 8675 | int32_t len; |
| 8676 | wmi_buf_t buf; |
| 8677 | uint8_t *buf_ptr; |
| 8678 | int ret; |
| 8679 | |
| 8680 | len = sizeof(*cmd); |
| 8681 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8682 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 8683 | if (!buf) { |
| 8684 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 8685 | return QDF_STATUS_E_NOMEM; |
| 8686 | } |
| 8687 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8688 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8689 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8690 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 8691 | |
| 8692 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8693 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 8694 | WMITLV_GET_STRUCT_TLVLEN |
| 8695 | (wmi_request_link_stats_cmd_fixed_param)); |
| 8696 | |
| 8697 | cmd->request_id = get_req->req_id; |
| 8698 | cmd->stats_type = get_req->param_id_mask; |
| 8699 | cmd->vdev_id = get_req->sta_id; |
| 8700 | |
| 8701 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 8702 | &cmd->peer_macaddr); |
| 8703 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8704 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
Krishna Kumaar Natarajan | f6a996c | 2017-03-10 17:24:55 -0800 | [diff] [blame] | 8705 | WMI_LOGD("Request ID : %u", cmd->request_id); |
| 8706 | WMI_LOGD("Stats Type : %0x", cmd->stats_type); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8707 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 8708 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8709 | |
| 8710 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8711 | WMI_REQUEST_LINK_STATS_CMDID); |
| 8712 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8713 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8714 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8715 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8716 | } |
| 8717 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8718 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8719 | } |
| 8720 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8721 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8722 | /** |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 8723 | * send_congestion_cmd_tlv() - send request to fw to get CCA |
| 8724 | * @wmi_handle: wmi handle |
| 8725 | * @vdev_id: vdev id |
| 8726 | * |
| 8727 | * Return: CDF status |
| 8728 | */ |
| 8729 | static QDF_STATUS send_congestion_cmd_tlv(wmi_unified_t wmi_handle, |
| 8730 | A_UINT8 vdev_id) |
| 8731 | { |
| 8732 | wmi_buf_t buf; |
| 8733 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8734 | uint8_t len; |
| 8735 | uint8_t *buf_ptr; |
| 8736 | |
| 8737 | len = sizeof(*cmd); |
| 8738 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8739 | if (!buf) { |
| 8740 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 8741 | return QDF_STATUS_E_FAILURE; |
| 8742 | } |
| 8743 | |
| 8744 | buf_ptr = wmi_buf_data(buf); |
| 8745 | cmd = (wmi_request_stats_cmd_fixed_param *)buf_ptr; |
| 8746 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8747 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8748 | WMITLV_GET_STRUCT_TLVLEN |
| 8749 | (wmi_request_stats_cmd_fixed_param)); |
| 8750 | |
| 8751 | cmd->stats_id = WMI_REQUEST_CONGESTION_STAT; |
| 8752 | cmd->vdev_id = vdev_id; |
| 8753 | WMI_LOGD("STATS REQ VDEV_ID:%d stats_id %d -->", |
| 8754 | cmd->vdev_id, cmd->stats_id); |
| 8755 | |
| 8756 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8757 | WMI_REQUEST_STATS_CMDID)) { |
| 8758 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
| 8759 | __func__); |
| 8760 | wmi_buf_free(buf); |
| 8761 | return QDF_STATUS_E_FAILURE; |
| 8762 | } |
| 8763 | |
| 8764 | return QDF_STATUS_SUCCESS; |
| 8765 | } |
| 8766 | |
| 8767 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8768 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 8769 | * @wmi_handle: wmi handle |
| 8770 | * @rssi_req: get RSSI request |
| 8771 | * |
| 8772 | * Return: CDF status |
| 8773 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8774 | 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] | 8775 | { |
| 8776 | wmi_buf_t buf; |
| 8777 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8778 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8779 | |
| 8780 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8781 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8782 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8783 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8784 | } |
| 8785 | |
| 8786 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8787 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8788 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8789 | WMITLV_GET_STRUCT_TLVLEN |
| 8790 | (wmi_request_stats_cmd_fixed_param)); |
| 8791 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 8792 | if (wmi_unified_cmd_send |
| 8793 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8794 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8795 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8796 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8797 | } |
| 8798 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8799 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8800 | } |
| 8801 | |
| 8802 | /** |
| 8803 | * send_snr_cmd_tlv() - get RSSI from fw |
| 8804 | * @wmi_handle: wmi handle |
| 8805 | * @vdev_id: vdev id |
| 8806 | * |
| 8807 | * Return: CDF status |
| 8808 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8809 | 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] | 8810 | { |
| 8811 | wmi_buf_t buf; |
| 8812 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8813 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8814 | |
| 8815 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8816 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8817 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8818 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8819 | } |
| 8820 | |
| 8821 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8822 | cmd->vdev_id = vdev_id; |
| 8823 | |
| 8824 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8825 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8826 | WMITLV_GET_STRUCT_TLVLEN |
| 8827 | (wmi_request_stats_cmd_fixed_param)); |
| 8828 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 8829 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8830 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8831 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8832 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8833 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8834 | } |
| 8835 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8836 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8837 | } |
| 8838 | |
| 8839 | /** |
| 8840 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 8841 | * @wmi_handle: wmi handle |
| 8842 | * @link_status: get link params |
| 8843 | * |
| 8844 | * Return: CDF status |
| 8845 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8846 | 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] | 8847 | struct link_status_params *link_status) |
| 8848 | { |
| 8849 | wmi_buf_t buf; |
| 8850 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8851 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8852 | |
| 8853 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8854 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8855 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8856 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8857 | } |
| 8858 | |
| 8859 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8860 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8861 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8862 | WMITLV_GET_STRUCT_TLVLEN |
| 8863 | (wmi_request_stats_cmd_fixed_param)); |
| 8864 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 8865 | cmd->vdev_id = link_status->session_id; |
| 8866 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8867 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8868 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8869 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8870 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8871 | } |
| 8872 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8873 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8874 | } |
| 8875 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8876 | /** |
| 8877 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 8878 | * @wmi_handle: wmi handle |
| 8879 | * @ta_dhcp_ind: DHCP indication parameter |
| 8880 | * |
| 8881 | * Return: CDF Status |
| 8882 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8883 | static QDF_STATUS send_process_dhcp_ind_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8884 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 8885 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8886 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8887 | wmi_buf_t buf = NULL; |
| 8888 | uint8_t *buf_ptr; |
| 8889 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 8890 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 8891 | |
| 8892 | |
| 8893 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8894 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8895 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8896 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8897 | } |
| 8898 | |
| 8899 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8900 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 8901 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 8902 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 8903 | WMITLV_GET_STRUCT_TLVLEN |
| 8904 | (wmi_peer_set_param_cmd_fixed_param)); |
| 8905 | |
| 8906 | /* fill in values */ |
| 8907 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 8908 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 8909 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8910 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8911 | &ta_dhcp_ind->peer_macaddr, |
| 8912 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 8913 | |
| 8914 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8915 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 8916 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8917 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8918 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 8919 | wmi_buf_free(buf); |
| 8920 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8921 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8922 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8923 | } |
| 8924 | |
| 8925 | /** |
| 8926 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 8927 | * @wmi_handle: wmi handle |
| 8928 | * @pLinkSpeed: link speed info |
| 8929 | * |
| 8930 | * Return: CDF status |
| 8931 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8932 | static QDF_STATUS send_get_link_speed_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8933 | wmi_mac_addr peer_macaddr) |
| 8934 | { |
| 8935 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 8936 | wmi_buf_t wmi_buf; |
| 8937 | uint32_t len; |
| 8938 | uint8_t *buf_ptr; |
| 8939 | |
| 8940 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 8941 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8942 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8943 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8944 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8945 | } |
| 8946 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8947 | |
| 8948 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 8949 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8950 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 8951 | WMITLV_GET_STRUCT_TLVLEN |
| 8952 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 8953 | |
| 8954 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8955 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8956 | &peer_macaddr, |
| 8957 | sizeof(peer_macaddr)); |
| 8958 | |
| 8959 | |
| 8960 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8961 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8962 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8963 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8964 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8965 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8966 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8967 | } |
| 8968 | |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 8969 | #ifdef WLAN_SUPPORT_GREEN_AP |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8970 | /** |
| 8971 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 8972 | * @wmi_handle: wmi handler |
| 8973 | * @egap_params: pointer to egap_params |
| 8974 | * |
| 8975 | * Return: 0 for success, otherwise appropriate error code |
| 8976 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8977 | 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] | 8978 | struct wlan_green_ap_egap_params *egap_params) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8979 | { |
| 8980 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 8981 | wmi_buf_t buf; |
| 8982 | int32_t err; |
| 8983 | |
| 8984 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8985 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8986 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 8987 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8988 | } |
| 8989 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 8990 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8991 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 8992 | WMITLV_GET_STRUCT_TLVLEN( |
| 8993 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 8994 | |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 8995 | cmd->enable = egap_params->host_enable_egap; |
| 8996 | cmd->inactivity_time = egap_params->egap_inactivity_time; |
| 8997 | cmd->wait_time = egap_params->egap_wait_time; |
| 8998 | cmd->flags = egap_params->egap_feature_flags; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8999 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 9000 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 9001 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9002 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9003 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9004 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9005 | } |
| 9006 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9007 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9008 | } |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 9009 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9010 | |
| 9011 | /** |
| 9012 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 9013 | * @wmi_handl: wmi handle |
| 9014 | * @cmd: Profiling command index |
| 9015 | * @value1: parameter1 value |
| 9016 | * @value2: parameter2 value |
| 9017 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9018 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9019 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9020 | static QDF_STATUS send_fw_profiling_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9021 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 9022 | { |
| 9023 | wmi_buf_t buf; |
| 9024 | int32_t len = 0; |
| 9025 | int ret; |
| 9026 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 9027 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 9028 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 9029 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 9030 | |
| 9031 | switch (cmd) { |
| 9032 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 9033 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 9034 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9035 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9036 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9037 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9038 | } |
| 9039 | prof_trig_cmd = |
| 9040 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 9041 | wmi_buf_data(buf); |
| 9042 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 9043 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 9044 | WMITLV_GET_STRUCT_TLVLEN |
| 9045 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 9046 | prof_trig_cmd->enable = value1; |
| 9047 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9048 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 9049 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9050 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9051 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9052 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9053 | return ret; |
| 9054 | } |
| 9055 | break; |
| 9056 | |
| 9057 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 9058 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 9059 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9060 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9061 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9062 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9063 | } |
| 9064 | profile_getdata_cmd = |
| 9065 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 9066 | wmi_buf_data(buf); |
| 9067 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 9068 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 9069 | WMITLV_GET_STRUCT_TLVLEN |
| 9070 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 9071 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9072 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 9073 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9074 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9075 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9076 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9077 | return ret; |
| 9078 | } |
| 9079 | break; |
| 9080 | |
| 9081 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 9082 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 9083 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9084 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9085 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9086 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9087 | } |
| 9088 | hist_intvl_cmd = |
| 9089 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 9090 | wmi_buf_data(buf); |
| 9091 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 9092 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 9093 | WMITLV_GET_STRUCT_TLVLEN |
| 9094 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 9095 | hist_intvl_cmd->profile_id = value1; |
| 9096 | hist_intvl_cmd->value = value2; |
| 9097 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9098 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 9099 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9100 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9101 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9102 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9103 | return ret; |
| 9104 | } |
| 9105 | break; |
| 9106 | |
| 9107 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 9108 | len = |
| 9109 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 9110 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9111 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9112 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9113 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9114 | } |
| 9115 | profile_enable_cmd = |
| 9116 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 9117 | wmi_buf_data(buf); |
| 9118 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 9119 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 9120 | WMITLV_GET_STRUCT_TLVLEN |
| 9121 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 9122 | profile_enable_cmd->profile_id = value1; |
| 9123 | profile_enable_cmd->enable = value2; |
| 9124 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9125 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 9126 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9127 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9128 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9129 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9130 | return ret; |
| 9131 | } |
| 9132 | break; |
| 9133 | |
| 9134 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9135 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9136 | break; |
| 9137 | } |
| 9138 | |
| 9139 | return 0; |
| 9140 | } |
| 9141 | |
Paul Zhang | 92ab8d3 | 2017-12-08 16:08:00 +0800 | [diff] [blame] | 9142 | static QDF_STATUS send_wlm_latency_level_cmd_tlv(wmi_unified_t wmi_handle, |
| 9143 | struct wlm_latency_level_param *params) |
| 9144 | { |
| 9145 | wmi_wlm_config_cmd_fixed_param *cmd; |
| 9146 | wmi_buf_t buf; |
| 9147 | uint32_t len = sizeof(*cmd); |
| 9148 | static uint32_t ll[4] = {100, 60, 40, 20}; |
| 9149 | |
| 9150 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9151 | if (!buf) { |
| 9152 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9153 | return QDF_STATUS_E_NOMEM; |
| 9154 | } |
| 9155 | cmd = (wmi_wlm_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 9156 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9157 | WMITLV_TAG_STRUC_wmi_wlm_config_cmd_fixed_param, |
| 9158 | WMITLV_GET_STRUCT_TLVLEN |
| 9159 | (wmi_wlm_config_cmd_fixed_param)); |
| 9160 | cmd->vdev_id = params->vdev_id; |
| 9161 | cmd->latency_level = params->wlm_latency_level; |
| 9162 | cmd->ul_latency = ll[params->wlm_latency_level]; |
| 9163 | cmd->dl_latency = ll[params->wlm_latency_level]; |
| 9164 | cmd->flags = params->wlm_latency_flags; |
| 9165 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9166 | WMI_WLM_CONFIG_CMDID)) { |
| 9167 | WMI_LOGE("%s: Failed to send setting latency config command", |
| 9168 | __func__); |
| 9169 | wmi_buf_free(buf); |
| 9170 | return QDF_STATUS_E_FAILURE; |
| 9171 | } |
| 9172 | |
| 9173 | return 0; |
| 9174 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9175 | /** |
| 9176 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 9177 | * @wmi_handle: wmi handle |
| 9178 | * @vdev_id: vdev id |
| 9179 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9180 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9181 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9182 | static QDF_STATUS send_nat_keepalive_en_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9183 | { |
| 9184 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 9185 | wmi_buf_t buf; |
| 9186 | int32_t len = sizeof(*cmd); |
| 9187 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9188 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9189 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9190 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9191 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9192 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9193 | } |
| 9194 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 9195 | wmi_buf_data(buf); |
| 9196 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9197 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 9198 | WMITLV_GET_STRUCT_TLVLEN |
| 9199 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 9200 | cmd->vdev_id = vdev_id; |
| 9201 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 9202 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9203 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9204 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9205 | __func__); |
| 9206 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9207 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9208 | } |
| 9209 | |
| 9210 | return 0; |
| 9211 | } |
| 9212 | |
| 9213 | /** |
| 9214 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 9215 | * @wmi_handle: wmi handle |
| 9216 | * @vdev_id: vdev id |
| 9217 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9218 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9219 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9220 | 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] | 9221 | uint8_t vdev_id) |
| 9222 | { |
| 9223 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 9224 | wmi_buf_t buf; |
| 9225 | int32_t len = sizeof(*cmd); |
| 9226 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9227 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9228 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9229 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9230 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9231 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9232 | } |
| 9233 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 9234 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9235 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 9236 | WMITLV_GET_STRUCT_TLVLEN |
| 9237 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 9238 | cmd->vdev_id = vdev_id; |
| 9239 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 9240 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9241 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9242 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9243 | __func__); |
| 9244 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9245 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9246 | } |
| 9247 | |
| 9248 | return 0; |
| 9249 | } |
| 9250 | |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 9251 | #ifdef WLAN_FEATURE_CIF_CFR |
| 9252 | /** |
| 9253 | * send_oem_dma_cfg_cmd_tlv() - configure OEM DMA rings |
| 9254 | * @wmi_handle: wmi handle |
| 9255 | * @data_len: len of dma cfg req |
| 9256 | * @data: dma cfg req |
| 9257 | * |
| 9258 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure |
| 9259 | */ |
| 9260 | static QDF_STATUS send_oem_dma_cfg_cmd_tlv(wmi_unified_t wmi_handle, |
| 9261 | wmi_oem_dma_ring_cfg_req_fixed_param *cfg) |
| 9262 | { |
| 9263 | wmi_buf_t buf; |
| 9264 | uint8_t *cmd; |
| 9265 | QDF_STATUS ret; |
| 9266 | |
| 9267 | WMITLV_SET_HDR(cfg, |
| 9268 | WMITLV_TAG_STRUC_wmi_oem_dma_ring_cfg_req_fixed_param, |
| 9269 | (sizeof(*cfg) - WMI_TLV_HDR_SIZE)); |
| 9270 | |
| 9271 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cfg)); |
| 9272 | if (!buf) { |
| 9273 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9274 | return QDF_STATUS_E_FAILURE; |
| 9275 | } |
| 9276 | |
| 9277 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 9278 | qdf_mem_copy(cmd, cfg, sizeof(*cfg)); |
| 9279 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %lu"), |
| 9280 | sizeof(*cfg)); |
| 9281 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cfg), |
| 9282 | WMI_OEM_DMA_RING_CFG_REQ_CMDID); |
| 9283 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 9284 | WMI_LOGE(FL(":wmi cmd send failed")); |
| 9285 | wmi_buf_free(buf); |
| 9286 | } |
| 9287 | |
| 9288 | return ret; |
| 9289 | } |
| 9290 | #endif |
| 9291 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9292 | /** |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 9293 | * send_dbr_cfg_cmd_tlv() - configure DMA rings for Direct Buf RX |
| 9294 | * @wmi_handle: wmi handle |
| 9295 | * @data_len: len of dma cfg req |
| 9296 | * @data: dma cfg req |
| 9297 | * |
| 9298 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure |
| 9299 | */ |
| 9300 | static QDF_STATUS send_dbr_cfg_cmd_tlv(wmi_unified_t wmi_handle, |
| 9301 | struct direct_buf_rx_cfg_req *cfg) |
| 9302 | { |
| 9303 | wmi_buf_t buf; |
| 9304 | wmi_dma_ring_cfg_req_fixed_param *cmd; |
| 9305 | QDF_STATUS ret; |
| 9306 | int32_t len = sizeof(*cmd); |
| 9307 | |
| 9308 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 9309 | if (!buf) { |
| 9310 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9311 | return QDF_STATUS_E_FAILURE; |
| 9312 | } |
| 9313 | |
| 9314 | cmd = (wmi_dma_ring_cfg_req_fixed_param *)wmi_buf_data(buf); |
| 9315 | |
| 9316 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9317 | WMITLV_TAG_STRUC_wmi_dma_ring_cfg_req_fixed_param, |
| 9318 | WMITLV_GET_STRUCT_TLVLEN(wmi_dma_ring_cfg_req_fixed_param)); |
| 9319 | |
| 9320 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9321 | cfg->pdev_id); |
| 9322 | cmd->mod_id = cfg->mod_id; |
| 9323 | cmd->base_paddr_lo = cfg->base_paddr_lo; |
| 9324 | cmd->base_paddr_hi = cfg->base_paddr_hi; |
| 9325 | cmd->head_idx_paddr_lo = cfg->head_idx_paddr_lo; |
| 9326 | cmd->head_idx_paddr_hi = cfg->head_idx_paddr_hi; |
| 9327 | cmd->tail_idx_paddr_lo = cfg->tail_idx_paddr_lo; |
| 9328 | cmd->tail_idx_paddr_hi = cfg->tail_idx_paddr_hi; |
| 9329 | cmd->num_elems = cfg->num_elems; |
| 9330 | cmd->buf_size = cfg->buf_size; |
| 9331 | cmd->num_resp_per_event = cfg->num_resp_per_event; |
| 9332 | cmd->event_timeout_ms = cfg->event_timeout_ms; |
| 9333 | |
| 9334 | WMI_LOGD("%s: wmi_dma_ring_cfg_req_fixed_param pdev id %d mod id %d" |
| 9335 | "base paddr lo %x base paddr hi %x head idx paddr lo %x" |
| 9336 | "head idx paddr hi %x tail idx paddr lo %x" |
| 9337 | "tail idx addr hi %x num elems %d buf size %d num resp %d" |
| 9338 | "event timeout %d\n", __func__, cmd->pdev_id, |
| 9339 | cmd->mod_id, cmd->base_paddr_lo, cmd->base_paddr_hi, |
| 9340 | cmd->head_idx_paddr_lo, cmd->head_idx_paddr_hi, |
| 9341 | cmd->tail_idx_paddr_lo, cmd->tail_idx_paddr_hi, |
| 9342 | cmd->num_elems, cmd->buf_size, cmd->num_resp_per_event, |
| 9343 | cmd->event_timeout_ms); |
| 9344 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9345 | WMI_PDEV_DMA_RING_CFG_REQ_CMDID); |
| 9346 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 9347 | WMI_LOGE(FL(":wmi cmd send failed")); |
| 9348 | wmi_buf_free(buf); |
| 9349 | } |
| 9350 | |
| 9351 | return ret; |
| 9352 | } |
| 9353 | |
| 9354 | /** |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 9355 | * send_start_11d_scan_cmd_tlv() - start 11d scan request |
| 9356 | * @wmi_handle: wmi handle |
| 9357 | * @start_11d_scan: 11d scan start request parameters |
| 9358 | * |
| 9359 | * This function request FW to start 11d scan. |
| 9360 | * |
| 9361 | * Return: QDF status |
| 9362 | */ |
| 9363 | static QDF_STATUS send_start_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 9364 | struct reg_start_11d_scan_req *start_11d_scan) |
| 9365 | { |
| 9366 | wmi_11d_scan_start_cmd_fixed_param *cmd; |
| 9367 | int32_t len; |
| 9368 | wmi_buf_t buf; |
| 9369 | int ret; |
| 9370 | |
| 9371 | len = sizeof(*cmd); |
| 9372 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9373 | if (!buf) { |
| 9374 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9375 | return QDF_STATUS_E_NOMEM; |
| 9376 | } |
| 9377 | |
| 9378 | cmd = (wmi_11d_scan_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 9379 | |
| 9380 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9381 | WMITLV_TAG_STRUC_wmi_11d_scan_start_cmd_fixed_param, |
| 9382 | WMITLV_GET_STRUCT_TLVLEN |
| 9383 | (wmi_11d_scan_start_cmd_fixed_param)); |
| 9384 | |
| 9385 | cmd->vdev_id = start_11d_scan->vdev_id; |
| 9386 | cmd->scan_period_msec = start_11d_scan->scan_period_msec; |
| 9387 | cmd->start_interval_msec = start_11d_scan->start_interval_msec; |
| 9388 | |
| 9389 | WMI_LOGD("vdev %d sending 11D scan start req", cmd->vdev_id); |
| 9390 | |
| 9391 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9392 | WMI_11D_SCAN_START_CMDID); |
| 9393 | if (ret) { |
| 9394 | WMI_LOGE("%s: Failed to send start 11d scan wmi cmd", __func__); |
| 9395 | wmi_buf_free(buf); |
| 9396 | return QDF_STATUS_E_FAILURE; |
| 9397 | } |
| 9398 | |
| 9399 | return QDF_STATUS_SUCCESS; |
| 9400 | } |
| 9401 | |
| 9402 | /** |
| 9403 | * send_stop_11d_scan_cmd_tlv() - stop 11d scan request |
| 9404 | * @wmi_handle: wmi handle |
| 9405 | * @start_11d_scan: 11d scan stop request parameters |
| 9406 | * |
| 9407 | * This function request FW to stop 11d scan. |
| 9408 | * |
| 9409 | * Return: QDF status |
| 9410 | */ |
| 9411 | static QDF_STATUS send_stop_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 9412 | struct reg_stop_11d_scan_req *stop_11d_scan) |
| 9413 | { |
| 9414 | wmi_11d_scan_stop_cmd_fixed_param *cmd; |
| 9415 | int32_t len; |
| 9416 | wmi_buf_t buf; |
| 9417 | int ret; |
| 9418 | |
| 9419 | len = sizeof(*cmd); |
| 9420 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9421 | if (!buf) { |
| 9422 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9423 | return QDF_STATUS_E_NOMEM; |
| 9424 | } |
| 9425 | |
| 9426 | cmd = (wmi_11d_scan_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 9427 | |
| 9428 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9429 | WMITLV_TAG_STRUC_wmi_11d_scan_stop_cmd_fixed_param, |
| 9430 | WMITLV_GET_STRUCT_TLVLEN |
| 9431 | (wmi_11d_scan_stop_cmd_fixed_param)); |
| 9432 | |
| 9433 | cmd->vdev_id = stop_11d_scan->vdev_id; |
| 9434 | |
| 9435 | WMI_LOGD("vdev %d sending 11D scan stop req", cmd->vdev_id); |
| 9436 | |
| 9437 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9438 | WMI_11D_SCAN_STOP_CMDID); |
| 9439 | if (ret) { |
| 9440 | WMI_LOGE("%s: Failed to send stop 11d scan wmi cmd", __func__); |
| 9441 | wmi_buf_free(buf); |
| 9442 | return QDF_STATUS_E_FAILURE; |
| 9443 | } |
| 9444 | |
| 9445 | return QDF_STATUS_SUCCESS; |
| 9446 | } |
| 9447 | |
| 9448 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9449 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 9450 | * @wmi_handle: wmi handle |
| 9451 | * @startOemDataReq: start request params |
| 9452 | * |
| 9453 | * Return: CDF status |
| 9454 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9455 | 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] | 9456 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9457 | uint8_t *data) |
| 9458 | { |
| 9459 | wmi_buf_t buf; |
| 9460 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9461 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9462 | |
| 9463 | buf = wmi_buf_alloc(wmi_handle, |
| 9464 | (data_len + WMI_TLV_HDR_SIZE)); |
| 9465 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9466 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9467 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9468 | } |
| 9469 | |
| 9470 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 9471 | |
| 9472 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 9473 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9474 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9475 | data_len); |
| 9476 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 9477 | WMI_LOGD(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9478 | data_len); |
| 9479 | |
| 9480 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 9481 | (data_len + |
| 9482 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 9483 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9484 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9485 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9486 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9487 | } |
| 9488 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9489 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9490 | } |
| 9491 | |
| 9492 | /** |
| 9493 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 9494 | * @wmi_handle: wmi handle |
| 9495 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 9496 | * |
| 9497 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 9498 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 9499 | * to firmware based on phyerr filtering |
| 9500 | * offload status. |
| 9501 | * |
| 9502 | * Return: 1 success, 0 failure |
| 9503 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9504 | static QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9505 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 9506 | bool dfs_phyerr_filter_offload) |
| 9507 | { |
| 9508 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 9509 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 9510 | wmi_buf_t buf; |
| 9511 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9512 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9513 | |
| 9514 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 9515 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9516 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9517 | __func__); |
| 9518 | len = sizeof(*disable_phyerr_offload_cmd); |
| 9519 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9520 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9521 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9522 | return 0; |
| 9523 | } |
| 9524 | disable_phyerr_offload_cmd = |
| 9525 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 9526 | wmi_buf_data(buf); |
| 9527 | |
| 9528 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 9529 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 9530 | WMITLV_GET_STRUCT_TLVLEN |
| 9531 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 9532 | |
| 9533 | /* |
| 9534 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 9535 | * to the firmware to disable the phyerror |
| 9536 | * filtering offload. |
| 9537 | */ |
| 9538 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9539 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9540 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9541 | 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] | 9542 | __func__, ret); |
| 9543 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9544 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9545 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9546 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9547 | __func__); |
| 9548 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9549 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9550 | __func__); |
| 9551 | |
| 9552 | len = sizeof(*enable_phyerr_offload_cmd); |
| 9553 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9554 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9555 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 9556 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9557 | } |
| 9558 | |
| 9559 | enable_phyerr_offload_cmd = |
| 9560 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 9561 | wmi_buf_data(buf); |
| 9562 | |
| 9563 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 9564 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 9565 | WMITLV_GET_STRUCT_TLVLEN |
| 9566 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 9567 | |
| 9568 | /* |
| 9569 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 9570 | * to the firmware to enable the phyerror |
| 9571 | * filtering offload. |
| 9572 | */ |
| 9573 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9574 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 9575 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9576 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9577 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9578 | __func__, ret); |
| 9579 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9580 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9581 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9582 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9583 | __func__); |
| 9584 | } |
| 9585 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9586 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9587 | } |
| 9588 | |
Naveen Rawat | a5817e7 | 2017-10-26 18:50:19 -0700 | [diff] [blame] | 9589 | /** |
| 9590 | * send_wow_timer_pattern_cmd_tlv() - set timer pattern tlv, so that firmware |
| 9591 | * will wake up host after specified time is elapsed |
| 9592 | * @wmi_handle: wmi handle |
| 9593 | * @vdev_id: vdev id |
| 9594 | * @cookie: value to identify reason why host set up wake call. |
| 9595 | * @time: time in ms |
| 9596 | * |
| 9597 | * Return: QDF status |
| 9598 | */ |
| 9599 | static QDF_STATUS send_wow_timer_pattern_cmd_tlv(wmi_unified_t wmi_handle, |
| 9600 | uint8_t vdev_id, uint32_t cookie, uint32_t time) |
| 9601 | { |
| 9602 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 9603 | wmi_buf_t buf; |
| 9604 | uint8_t *buf_ptr; |
| 9605 | int32_t len; |
| 9606 | int ret; |
| 9607 | |
| 9608 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 9609 | WMI_TLV_HDR_SIZE + 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 9610 | WMI_TLV_HDR_SIZE + 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 9611 | WMI_TLV_HDR_SIZE + 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 9612 | WMI_TLV_HDR_SIZE + 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 9613 | WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32) + |
| 9614 | WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 9615 | |
| 9616 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9617 | if (!buf) { |
| 9618 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9619 | return QDF_STATUS_E_NOMEM; |
| 9620 | } |
| 9621 | |
| 9622 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 9623 | buf_ptr = (uint8_t *) cmd; |
| 9624 | |
| 9625 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9626 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 9627 | WMITLV_GET_STRUCT_TLVLEN |
| 9628 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 9629 | cmd->vdev_id = vdev_id; |
| 9630 | cmd->pattern_id = cookie, |
| 9631 | cmd->pattern_type = WOW_TIMER_PATTERN; |
| 9632 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 9633 | |
| 9634 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 9635 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 9636 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9637 | |
| 9638 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 9639 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 9640 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9641 | |
| 9642 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 9643 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 9644 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9645 | |
| 9646 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 9647 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 9648 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9649 | |
| 9650 | /* Fill TLV for pattern_info_timeout, and time value */ |
| 9651 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 9652 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9653 | *((A_UINT32 *) buf_ptr) = time; |
| 9654 | buf_ptr += sizeof(A_UINT32); |
| 9655 | |
| 9656 | /* Fill TLV for ra_ratelimit_interval. with dummy 0 value */ |
| 9657 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 9658 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9659 | *((A_UINT32 *) buf_ptr) = 0; |
| 9660 | |
| 9661 | WMI_LOGD("%s: send wake timer pattern with time[%d] to fw vdev = %d", |
| 9662 | __func__, time, vdev_id); |
| 9663 | |
| 9664 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9665 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 9666 | if (ret) { |
| 9667 | WMI_LOGE("%s: Failed to send wake timer pattern to fw", |
| 9668 | __func__); |
| 9669 | wmi_buf_free(buf); |
| 9670 | return QDF_STATUS_E_FAILURE; |
| 9671 | } |
| 9672 | |
| 9673 | return QDF_STATUS_SUCCESS; |
| 9674 | } |
| 9675 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9676 | #if !defined(REMOVE_PKT_LOG) |
| 9677 | /** |
| 9678 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 9679 | * @wmi_handle: wmi handle |
| 9680 | * @pktlog_event: pktlog event |
| 9681 | * @cmd_id: pktlog cmd id |
| 9682 | * |
| 9683 | * Return: CDF status |
| 9684 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9685 | 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] | 9686 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 9687 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9688 | { |
| 9689 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 9690 | WMI_CMD_ID CMD_ID; |
| 9691 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 9692 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 9693 | int len = 0; |
| 9694 | wmi_buf_t buf; |
| 9695 | |
| 9696 | PKTLOG_EVENT = pktlog_event; |
| 9697 | CMD_ID = cmd_id; |
| 9698 | |
| 9699 | switch (CMD_ID) { |
| 9700 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 9701 | len = sizeof(*cmd); |
| 9702 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9703 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9704 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 9705 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9706 | } |
| 9707 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 9708 | wmi_buf_data(buf); |
| 9709 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9710 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 9711 | WMITLV_GET_STRUCT_TLVLEN |
| 9712 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 9713 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 9714 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 9715 | : WMI_PKTLOG_ENABLE_AUTO; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9716 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9717 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9718 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9719 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9720 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9721 | goto wmi_send_failed; |
| 9722 | } |
| 9723 | break; |
| 9724 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 9725 | len = sizeof(*disable_cmd); |
| 9726 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9727 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9728 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 9729 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9730 | } |
| 9731 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 9732 | wmi_buf_data(buf); |
| 9733 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 9734 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 9735 | WMITLV_GET_STRUCT_TLVLEN |
| 9736 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9737 | disable_cmd->pdev_id = |
| 9738 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9739 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9740 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9741 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9742 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9743 | goto wmi_send_failed; |
| 9744 | } |
| 9745 | break; |
| 9746 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9747 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9748 | break; |
| 9749 | } |
| 9750 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9751 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9752 | |
| 9753 | wmi_send_failed: |
| 9754 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9755 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9756 | } |
| 9757 | #endif /* REMOVE_PKT_LOG */ |
| 9758 | |
| 9759 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9760 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 9761 | * @wmi_handle: wmi handle |
| 9762 | * @ptrn_id: pattern id |
| 9763 | * @vdev_id: vdev id |
| 9764 | * |
| 9765 | * Return: CDF status |
| 9766 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 9767 | static QDF_STATUS send_wow_delete_pattern_cmd_tlv(wmi_unified_t wmi_handle, |
| 9768 | uint8_t ptrn_id, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9769 | { |
| 9770 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 9771 | wmi_buf_t buf; |
| 9772 | int32_t len; |
| 9773 | int ret; |
| 9774 | |
| 9775 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 9776 | |
| 9777 | |
| 9778 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9779 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9780 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9781 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9782 | } |
| 9783 | |
| 9784 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 9785 | |
| 9786 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9787 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 9788 | WMITLV_GET_STRUCT_TLVLEN( |
| 9789 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 9790 | cmd->vdev_id = vdev_id; |
| 9791 | cmd->pattern_id = ptrn_id; |
| 9792 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 9793 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9794 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9795 | cmd->pattern_id, vdev_id); |
| 9796 | |
| 9797 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9798 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 9799 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9800 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9801 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9802 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9803 | } |
| 9804 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9805 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9806 | } |
| 9807 | |
| 9808 | /** |
| 9809 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 9810 | * @wmi_handle: wmi handle |
| 9811 | * |
| 9812 | * Sends host wakeup indication to FW. On receiving this indication, |
| 9813 | * FW will come out of WOW. |
| 9814 | * |
| 9815 | * Return: CDF status |
| 9816 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9817 | static QDF_STATUS send_host_wakeup_ind_to_fw_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9818 | { |
| 9819 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 9820 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9821 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9822 | int32_t len; |
| 9823 | int ret; |
| 9824 | |
| 9825 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 9826 | |
| 9827 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9828 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9829 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9830 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9831 | } |
| 9832 | |
| 9833 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 9834 | wmi_buf_data(buf); |
| 9835 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9836 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 9837 | WMITLV_GET_STRUCT_TLVLEN |
| 9838 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 9839 | |
| 9840 | |
| 9841 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9842 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 9843 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9844 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9845 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9846 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9847 | } |
| 9848 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9849 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9850 | } |
| 9851 | |
| 9852 | /** |
| 9853 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 9854 | * @wmi_handle: wmi handle |
| 9855 | * @msg: delts params |
| 9856 | * |
| 9857 | * Return: CDF status |
| 9858 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9859 | static QDF_STATUS send_del_ts_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9860 | uint8_t ac) |
| 9861 | { |
| 9862 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 9863 | wmi_buf_t buf; |
| 9864 | int32_t len = sizeof(*cmd); |
| 9865 | |
| 9866 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9867 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9868 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9869 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9870 | } |
| 9871 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 9872 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9873 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 9874 | WMITLV_GET_STRUCT_TLVLEN |
| 9875 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 9876 | cmd->vdev_id = vdev_id; |
| 9877 | cmd->ac = ac; |
| 9878 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9879 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9880 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 9881 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9882 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9883 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9884 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9885 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9886 | } |
| 9887 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9888 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9889 | } |
| 9890 | |
| 9891 | /** |
| 9892 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 9893 | * @wmi_handle: handle to wmi |
| 9894 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 9895 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9896 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9897 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 9898 | * active flow. |
| 9899 | * |
| 9900 | * Return: CDF status |
| 9901 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9902 | static QDF_STATUS send_aggr_qos_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9903 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 9904 | { |
| 9905 | int i = 0; |
| 9906 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 9907 | wmi_buf_t buf; |
| 9908 | int32_t len = sizeof(*cmd); |
| 9909 | |
| 9910 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 9911 | /* if flow in this AC is active */ |
| 9912 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 9913 | /* |
| 9914 | * as per implementation of wma_add_ts_req() we |
| 9915 | * are not waiting any response from firmware so |
| 9916 | * apart from sending ADDTS to firmware just send |
| 9917 | * success to upper layers |
| 9918 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9919 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9920 | |
| 9921 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9922 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9923 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9924 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9925 | } |
| 9926 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 9927 | wmi_buf_data(buf); |
| 9928 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9929 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 9930 | WMITLV_GET_STRUCT_TLVLEN |
| 9931 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 9932 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 9933 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9934 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9935 | traffic.userPrio); |
| 9936 | cmd->medium_time_us = |
| 9937 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 9938 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9939 | WMI_LOGD("%s:%d: Addts vdev:%d, ac:%d, mediumTime:%d downgrade_type:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9940 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 9941 | cmd->medium_time_us, cmd->downgrade_type); |
| 9942 | if (wmi_unified_cmd_send |
| 9943 | (wmi_handle, buf, len, |
| 9944 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9945 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9946 | __func__); |
| 9947 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9948 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9949 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9950 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9951 | } |
| 9952 | } |
| 9953 | } |
| 9954 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9955 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9956 | } |
| 9957 | |
| 9958 | /** |
| 9959 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 9960 | * @wmi_handle: wmi handle |
| 9961 | * @msg: ADDTS params |
| 9962 | * |
| 9963 | * Return: CDF status |
| 9964 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9965 | static QDF_STATUS send_add_ts_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9966 | struct add_ts_param *msg) |
| 9967 | { |
| 9968 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 9969 | wmi_buf_t buf; |
| 9970 | int32_t len = sizeof(*cmd); |
| 9971 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9972 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9973 | |
| 9974 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9975 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9976 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9977 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9978 | } |
| 9979 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 9980 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9981 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 9982 | WMITLV_GET_STRUCT_TLVLEN |
| 9983 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 9984 | cmd->vdev_id = msg->sme_session_id; |
| 9985 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 9986 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 9987 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9988 | WMI_LOGD("Addts vdev:%d, ac:%d, mediumTime:%d, downgrade_type:%d %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9989 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 9990 | cmd->downgrade_type, __func__, __LINE__); |
| 9991 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9992 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9993 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 9994 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9995 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9996 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9997 | } |
| 9998 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9999 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10000 | } |
| 10001 | |
| 10002 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10003 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 10004 | * @wmi_handle: wmi handle |
| 10005 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 10006 | * |
| 10007 | * Retrun: CDF status |
| 10008 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10009 | static QDF_STATUS send_process_add_periodic_tx_ptrn_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10010 | struct periodic_tx_pattern * |
| 10011 | pAddPeriodicTxPtrnParams, |
| 10012 | uint8_t vdev_id) |
| 10013 | { |
| 10014 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 10015 | wmi_buf_t wmi_buf; |
| 10016 | uint32_t len; |
| 10017 | uint8_t *buf_ptr; |
| 10018 | uint32_t ptrn_len, ptrn_len_aligned; |
| 10019 | int j; |
| 10020 | |
| 10021 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 10022 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 10023 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 10024 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 10025 | |
| 10026 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10027 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10028 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10029 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10030 | } |
| 10031 | |
| 10032 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 10033 | |
| 10034 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 10035 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10036 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 10037 | WMITLV_GET_STRUCT_TLVLEN |
| 10038 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 10039 | |
| 10040 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 10041 | cmd->vdev_id = vdev_id; |
| 10042 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 10043 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 10044 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 10045 | |
| 10046 | /* Pattern info */ |
| 10047 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 10048 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 10049 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10050 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10051 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10052 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10053 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10054 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10055 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 10056 | |
| 10057 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10058 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10059 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10060 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10061 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10062 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10063 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10064 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10065 | } |
| 10066 | |
| 10067 | /** |
| 10068 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 10069 | * @wmi_handle: wmi handle |
| 10070 | * @vdev_id: vdev id |
| 10071 | * @pattern_id: pattern id |
| 10072 | * |
| 10073 | * Retrun: CDF status |
| 10074 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10075 | static QDF_STATUS send_process_del_periodic_tx_ptrn_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10076 | uint8_t vdev_id, |
| 10077 | uint8_t pattern_id) |
| 10078 | { |
| 10079 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 10080 | wmi_buf_t wmi_buf; |
| 10081 | uint32_t len = |
| 10082 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 10083 | |
| 10084 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10085 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10086 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10087 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10088 | } |
| 10089 | |
| 10090 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 10091 | wmi_buf_data(wmi_buf); |
| 10092 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10093 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 10094 | WMITLV_GET_STRUCT_TLVLEN |
| 10095 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 10096 | |
| 10097 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 10098 | cmd->vdev_id = vdev_id; |
| 10099 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10100 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10101 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 10102 | |
| 10103 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10104 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10105 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10106 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10107 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10108 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10109 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10110 | } |
| 10111 | |
| 10112 | /** |
| 10113 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 10114 | * @wmi_handle: wmi handle |
| 10115 | * @preq: stats ext params |
| 10116 | * |
| 10117 | * Return: CDF status |
| 10118 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10119 | 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] | 10120 | struct stats_ext_params *preq) |
| 10121 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10122 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10123 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 10124 | wmi_buf_t buf; |
| 10125 | uint16_t len; |
| 10126 | uint8_t *buf_ptr; |
| 10127 | |
| 10128 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 10129 | |
| 10130 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10131 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10132 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10133 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10134 | } |
| 10135 | |
| 10136 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10137 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 10138 | |
| 10139 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10140 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 10141 | WMITLV_GET_STRUCT_TLVLEN |
| 10142 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 10143 | cmd->vdev_id = preq->vdev_id; |
| 10144 | cmd->data_len = preq->request_data_len; |
| 10145 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10146 | 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] | 10147 | __func__, preq->request_data_len, preq->vdev_id); |
| 10148 | |
| 10149 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 10150 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 10151 | |
| 10152 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10153 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10154 | |
| 10155 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10156 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10157 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10158 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10159 | ret); |
| 10160 | wmi_buf_free(buf); |
| 10161 | } |
| 10162 | |
| 10163 | return ret; |
| 10164 | } |
| 10165 | |
| 10166 | /** |
| 10167 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 10168 | * @wmi_handle: wmi handle |
| 10169 | * @params: ext wow params |
| 10170 | * |
| 10171 | * Return:0 for success or error code |
| 10172 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10173 | static QDF_STATUS send_enable_ext_wow_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10174 | struct ext_wow_params *params) |
| 10175 | { |
| 10176 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 10177 | wmi_buf_t buf; |
| 10178 | int32_t len; |
| 10179 | int ret; |
| 10180 | |
| 10181 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 10182 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10183 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10184 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 10185 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10186 | } |
| 10187 | |
| 10188 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 10189 | |
| 10190 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10191 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 10192 | WMITLV_GET_STRUCT_TLVLEN |
| 10193 | (wmi_extwow_enable_cmd_fixed_param)); |
| 10194 | |
| 10195 | cmd->vdev_id = params->vdev_id; |
| 10196 | cmd->type = params->type; |
| 10197 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 10198 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10199 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10200 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 10201 | |
| 10202 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10203 | WMI_EXTWOW_ENABLE_CMDID); |
| 10204 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10205 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10206 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10207 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10208 | } |
| 10209 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10210 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10211 | |
| 10212 | } |
| 10213 | |
| 10214 | /** |
| 10215 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 10216 | * @wmi_handle: wmi handle |
| 10217 | * @app_type1_params: app type1 params |
| 10218 | * |
| 10219 | * Return: CDF status |
| 10220 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10221 | static QDF_STATUS send_app_type1_params_in_fw_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10222 | struct app_type1_params *app_type1_params) |
| 10223 | { |
| 10224 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 10225 | wmi_buf_t buf; |
| 10226 | int32_t len; |
| 10227 | int ret; |
| 10228 | |
| 10229 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 10230 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10231 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10232 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 10233 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10234 | } |
| 10235 | |
| 10236 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 10237 | wmi_buf_data(buf); |
| 10238 | |
| 10239 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10240 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 10241 | WMITLV_GET_STRUCT_TLVLEN |
| 10242 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 10243 | |
| 10244 | cmd->vdev_id = app_type1_params->vdev_id; |
| 10245 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 10246 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10247 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10248 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10249 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10250 | cmd->passwd_len = app_type1_params->pass_length; |
| 10251 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10252 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10253 | "identification_id %.8s id_length %u " |
| 10254 | "password %.16s pass_length %u", |
| 10255 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 10256 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 10257 | |
| 10258 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10259 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 10260 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10261 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10262 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10263 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10264 | } |
| 10265 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10266 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10267 | } |
| 10268 | |
| 10269 | /** |
| 10270 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 10271 | * @wmi_handle: wmi handle |
| 10272 | * @appType2Params: app type2 params |
| 10273 | * |
| 10274 | * Return: CDF status |
| 10275 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10276 | static QDF_STATUS send_set_app_type2_params_in_fw_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10277 | struct app_type2_params *appType2Params) |
| 10278 | { |
| 10279 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 10280 | wmi_buf_t buf; |
| 10281 | int32_t len; |
| 10282 | int ret; |
| 10283 | |
| 10284 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 10285 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10286 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10287 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 10288 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10289 | } |
| 10290 | |
| 10291 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 10292 | wmi_buf_data(buf); |
| 10293 | |
| 10294 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10295 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 10296 | WMITLV_GET_STRUCT_TLVLEN |
| 10297 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 10298 | |
| 10299 | cmd->vdev_id = appType2Params->vdev_id; |
| 10300 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10301 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10302 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 10303 | |
| 10304 | cmd->ip_id = appType2Params->ip_id; |
| 10305 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 10306 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 10307 | |
| 10308 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 10309 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 10310 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 10311 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 10312 | |
| 10313 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 10314 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 10315 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 10316 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 10317 | |
| 10318 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 10319 | &cmd->gateway_mac); |
| 10320 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 10321 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 10322 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10323 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10324 | "rc4_key %.16s rc4_key_len %u " |
| 10325 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 10326 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 10327 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 10328 | "keepalive_max %u keepalive_inc %u " |
| 10329 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 10330 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 10331 | cmd->rc4_key, cmd->rc4_key_len, |
| 10332 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 10333 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 10334 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 10335 | cmd->keepalive_max, cmd->keepalive_inc, |
| 10336 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 10337 | |
| 10338 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10339 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 10340 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10341 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10342 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10343 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10344 | } |
| 10345 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10346 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10347 | |
| 10348 | } |
| 10349 | |
| 10350 | /** |
| 10351 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 10352 | * @wmi_handle: wmi handle |
| 10353 | * @timer_val: auto shutdown timer value |
| 10354 | * |
| 10355 | * Return: CDF status |
| 10356 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10357 | static QDF_STATUS send_set_auto_shutdown_timer_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10358 | uint32_t timer_val) |
| 10359 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10360 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10361 | wmi_buf_t buf = NULL; |
| 10362 | uint8_t *buf_ptr; |
| 10363 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 10364 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 10365 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10366 | WMI_LOGD("%s: Set WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID:TIMER_VAL=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10367 | __func__, timer_val); |
| 10368 | |
| 10369 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10370 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10371 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 10372 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10373 | } |
| 10374 | |
| 10375 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10376 | wmi_auto_sh_cmd = |
| 10377 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 10378 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 10379 | |
| 10380 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 10381 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 10382 | WMITLV_GET_STRUCT_TLVLEN |
| 10383 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 10384 | |
| 10385 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 10386 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10387 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10388 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10389 | __func__, status); |
| 10390 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10391 | } |
| 10392 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10393 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10394 | } |
| 10395 | |
| 10396 | /** |
| 10397 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 10398 | * @wmi_handle: wmi handle |
| 10399 | * @nan_req: request data which will be non-null |
| 10400 | * |
| 10401 | * Return: CDF status |
| 10402 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10403 | static QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10404 | struct nan_req_params *nan_req) |
| 10405 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10406 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10407 | wmi_nan_cmd_param *cmd; |
| 10408 | wmi_buf_t buf; |
| 10409 | uint16_t len = sizeof(*cmd); |
| 10410 | uint16_t nan_data_len, nan_data_len_aligned; |
| 10411 | uint8_t *buf_ptr; |
| 10412 | |
| 10413 | /* |
| 10414 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 10415 | * +------------+----------+-----------------------+--------------+ |
| 10416 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 10417 | * +------------+----------+-----------------------+--------------+ |
| 10418 | */ |
| 10419 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10420 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 10421 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10422 | } |
| 10423 | nan_data_len = nan_req->request_data_len; |
| 10424 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 10425 | sizeof(uint32_t)); |
| 10426 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 10427 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10428 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10429 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 10430 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10431 | } |
| 10432 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10433 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 10434 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10435 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 10436 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 10437 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10438 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10439 | __func__, nan_req->request_data_len); |
| 10440 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 10441 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 10442 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10443 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10444 | |
| 10445 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10446 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10447 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10448 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10449 | __func__, ret); |
| 10450 | wmi_buf_free(buf); |
| 10451 | } |
| 10452 | |
| 10453 | return ret; |
| 10454 | } |
| 10455 | |
| 10456 | /** |
| 10457 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 10458 | * @wmi_handle: wmi handle |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 10459 | * @params: DHCP server offload info |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10460 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10461 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10462 | */ |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 10463 | static QDF_STATUS |
| 10464 | send_process_dhcpserver_offload_cmd_tlv(wmi_unified_t wmi_handle, |
| 10465 | struct dhcp_offload_info_params *params) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10466 | { |
| 10467 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 10468 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10469 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10470 | |
| 10471 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 10472 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10473 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10474 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10475 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10476 | } |
| 10477 | |
| 10478 | 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] | 10479 | |
| 10480 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10481 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 10482 | WMITLV_GET_STRUCT_TLVLEN |
| 10483 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 10484 | cmd->vdev_id = params->vdev_id; |
| 10485 | cmd->enable = params->dhcp_offload_enabled; |
| 10486 | cmd->num_client = params->dhcp_client_num; |
| 10487 | cmd->srv_ipv4 = params->dhcp_srv_addr; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10488 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10489 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10490 | sizeof(*cmd), |
| 10491 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10492 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10493 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10494 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10495 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10496 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10497 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 10498 | params->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10499 | |
| 10500 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10501 | } |
| 10502 | |
| 10503 | /** |
| 10504 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 10505 | * @wmi_handle: wmi handle |
| 10506 | * @flashing: flashing request |
| 10507 | * |
| 10508 | * Return: CDF status |
| 10509 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10510 | static QDF_STATUS send_set_led_flashing_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10511 | struct flashing_req_params *flashing) |
| 10512 | { |
| 10513 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10514 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10515 | wmi_buf_t buf; |
| 10516 | uint8_t *buf_ptr; |
| 10517 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 10518 | |
| 10519 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10520 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10521 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10522 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10523 | } |
| 10524 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10525 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 10526 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10527 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 10528 | WMITLV_GET_STRUCT_TLVLEN |
| 10529 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 10530 | cmd->pattern_id = flashing->pattern_id; |
| 10531 | cmd->led_x0 = flashing->led_x0; |
| 10532 | cmd->led_x1 = flashing->led_x1; |
| 10533 | |
| 10534 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10535 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10536 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10537 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10538 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10539 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10540 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10541 | |
| 10542 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10543 | } |
| 10544 | |
| 10545 | /** |
| 10546 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 10547 | * @wmi_handle: wmi handle |
| 10548 | * @ch_avoid_update_req: channel avoid update params |
| 10549 | * |
| 10550 | * Return: CDF status |
| 10551 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10552 | static QDF_STATUS send_process_ch_avoid_update_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10553 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10554 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10555 | wmi_buf_t buf = NULL; |
| 10556 | uint8_t *buf_ptr; |
| 10557 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 10558 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 10559 | |
| 10560 | |
| 10561 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10562 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10563 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 10564 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10565 | } |
| 10566 | |
| 10567 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10568 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 10569 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 10570 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 10571 | WMITLV_GET_STRUCT_TLVLEN |
| 10572 | (wmi_chan_avoid_update_cmd_param)); |
| 10573 | |
| 10574 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 10575 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10576 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10577 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10578 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 10579 | " returned Error %d", status); |
| 10580 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10581 | } |
| 10582 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10583 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10584 | } |
| 10585 | |
| 10586 | /** |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 10587 | * send_pdev_set_regdomain_cmd_tlv() - send set regdomain command to fw |
| 10588 | * @wmi_handle: wmi handle |
| 10589 | * @param: pointer to pdev regdomain params |
| 10590 | * |
| 10591 | * Return: 0 for success or error code |
| 10592 | */ |
| 10593 | static QDF_STATUS |
| 10594 | send_pdev_set_regdomain_cmd_tlv(wmi_unified_t wmi_handle, |
| 10595 | struct pdev_set_regdomain_params *param) |
| 10596 | { |
| 10597 | wmi_buf_t buf; |
| 10598 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 10599 | int32_t len = sizeof(*cmd); |
| 10600 | |
| 10601 | |
| 10602 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10603 | if (!buf) { |
| 10604 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 10605 | return QDF_STATUS_E_NOMEM; |
| 10606 | } |
| 10607 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 10608 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10609 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 10610 | WMITLV_GET_STRUCT_TLVLEN |
| 10611 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 10612 | |
| 10613 | cmd->reg_domain = param->currentRDinuse; |
| 10614 | cmd->reg_domain_2G = param->currentRD2G; |
| 10615 | cmd->reg_domain_5G = param->currentRD5G; |
| 10616 | cmd->conformance_test_limit_2G = param->ctl_2G; |
| 10617 | cmd->conformance_test_limit_5G = param->ctl_5G; |
| 10618 | cmd->dfs_domain = param->dfsDomain; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10619 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10620 | param->pdev_id); |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 10621 | |
| 10622 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10623 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
| 10624 | WMI_LOGE("%s: Failed to send pdev set regdomain command", |
| 10625 | __func__); |
| 10626 | wmi_buf_free(buf); |
| 10627 | return QDF_STATUS_E_FAILURE; |
| 10628 | } |
| 10629 | |
| 10630 | return QDF_STATUS_SUCCESS; |
| 10631 | } |
| 10632 | |
| 10633 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10634 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 10635 | * @wmi_handle: wmi handle |
| 10636 | * @reg_dmn: reg domain |
| 10637 | * @regdmn2G: 2G reg domain |
| 10638 | * @regdmn5G: 5G reg domain |
| 10639 | * @ctl2G: 2G test limit |
| 10640 | * @ctl5G: 5G test limit |
| 10641 | * |
| 10642 | * Return: none |
| 10643 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10644 | 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] | 10645 | uint32_t reg_dmn, uint16_t regdmn2G, |
Rajeev Kumar Sirasanagandla | 4c1fecd | 2017-06-06 13:27:56 +0530 | [diff] [blame] | 10646 | uint16_t regdmn5G, uint8_t ctl2G, |
| 10647 | uint8_t ctl5G) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10648 | { |
| 10649 | wmi_buf_t buf; |
| 10650 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 10651 | int32_t len = sizeof(*cmd); |
| 10652 | |
| 10653 | |
| 10654 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10655 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10656 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 10657 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10658 | } |
| 10659 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 10660 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10661 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 10662 | WMITLV_GET_STRUCT_TLVLEN |
| 10663 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 10664 | cmd->reg_domain = reg_dmn; |
| 10665 | cmd->reg_domain_2G = regdmn2G; |
| 10666 | cmd->reg_domain_5G = regdmn5G; |
| 10667 | cmd->conformance_test_limit_2G = ctl2G; |
| 10668 | cmd->conformance_test_limit_5G = ctl5G; |
| 10669 | |
| 10670 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10671 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10672 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10673 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10674 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10675 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10676 | } |
| 10677 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10678 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10679 | } |
| 10680 | |
| 10681 | |
| 10682 | /** |
| 10683 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 10684 | * @wmi_handle: wmi handle |
| 10685 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 10686 | * |
| 10687 | * This function sets tdls off channel mode |
| 10688 | * |
| 10689 | * Return: 0 on success; Negative errno otherwise |
| 10690 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10691 | static QDF_STATUS send_set_tdls_offchan_mode_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10692 | struct tdls_channel_switch_params *chan_switch_params) |
| 10693 | { |
| 10694 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 10695 | wmi_buf_t wmi_buf; |
| 10696 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 10697 | |
| 10698 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10699 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10700 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 10701 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10702 | } |
| 10703 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 10704 | wmi_buf_data(wmi_buf); |
| 10705 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10706 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 10707 | WMITLV_GET_STRUCT_TLVLEN( |
| 10708 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 10709 | |
| 10710 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 10711 | &cmd->peer_macaddr); |
| 10712 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 10713 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 10714 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 10715 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 10716 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 10717 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 10718 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10719 | WMI_LOGD(FL("Peer MAC Addr mac_addr31to0: 0x%x, mac_addr47to32: 0x%x"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10720 | cmd->peer_macaddr.mac_addr31to0, |
| 10721 | cmd->peer_macaddr.mac_addr47to32); |
| 10722 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10723 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10724 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 10725 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 10726 | ), |
| 10727 | cmd->vdev_id, |
| 10728 | cmd->offchan_mode, |
| 10729 | cmd->offchan_num, |
| 10730 | cmd->offchan_bw_bitmap, |
| 10731 | cmd->is_peer_responder, |
| 10732 | cmd->offchan_oper_class); |
| 10733 | |
| 10734 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10735 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10736 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10737 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10738 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10739 | } |
| 10740 | |
| 10741 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10742 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10743 | } |
| 10744 | |
| 10745 | /** |
| 10746 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 10747 | * @wmi_handle: wmi handle |
| 10748 | * @pwmaTdlsparams: TDLS params |
| 10749 | * |
| 10750 | * Return: 0 for sucess or error code |
| 10751 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10752 | static QDF_STATUS send_update_fw_tdls_state_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10753 | void *tdls_param, uint8_t tdls_state) |
| 10754 | { |
| 10755 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 10756 | wmi_buf_t wmi_buf; |
| 10757 | |
| 10758 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 10759 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 10760 | |
| 10761 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10762 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10763 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10764 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10765 | } |
| 10766 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 10767 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10768 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 10769 | WMITLV_GET_STRUCT_TLVLEN |
| 10770 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 10771 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 10772 | cmd->state = tdls_state; |
| 10773 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 10774 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 10775 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 10776 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 10777 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 10778 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 10779 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 10780 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 10781 | wmi_tdls->peer_traffic_response_timeout; |
| 10782 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 10783 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 10784 | cmd->tdls_puapsd_rx_frame_threshold = |
| 10785 | wmi_tdls->puapsd_rx_frame_threshold; |
| 10786 | cmd->teardown_notification_ms = |
| 10787 | wmi_tdls->teardown_notification_ms; |
| 10788 | cmd->tdls_peer_kickout_threshold = |
| 10789 | wmi_tdls->tdls_peer_kickout_threshold; |
| 10790 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10791 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10792 | "notification_interval_ms: %d, " |
| 10793 | "tx_discovery_threshold: %d, " |
| 10794 | "tx_teardown_threshold: %d, " |
| 10795 | "rssi_teardown_threshold: %d, " |
| 10796 | "rssi_delta: %d, " |
| 10797 | "tdls_options: 0x%x, " |
| 10798 | "tdls_peer_traffic_ind_window: %d, " |
| 10799 | "tdls_peer_traffic_response_timeout: %d, " |
| 10800 | "tdls_puapsd_mask: 0x%x, " |
| 10801 | "tdls_puapsd_inactivity_time: %d, " |
| 10802 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 10803 | "teardown_notification_ms: %d, " |
| 10804 | "tdls_peer_kickout_threshold: %d", |
| 10805 | __func__, tdls_state, cmd->state, |
| 10806 | cmd->notification_interval_ms, |
| 10807 | cmd->tx_discovery_threshold, |
| 10808 | cmd->tx_teardown_threshold, |
| 10809 | cmd->rssi_teardown_threshold, |
| 10810 | cmd->rssi_delta, |
| 10811 | cmd->tdls_options, |
| 10812 | cmd->tdls_peer_traffic_ind_window, |
| 10813 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 10814 | cmd->tdls_puapsd_mask, |
| 10815 | cmd->tdls_puapsd_inactivity_time_ms, |
| 10816 | cmd->tdls_puapsd_rx_frame_threshold, |
| 10817 | cmd->teardown_notification_ms, |
| 10818 | cmd->tdls_peer_kickout_threshold); |
| 10819 | |
| 10820 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10821 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10822 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10823 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10824 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10825 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10826 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10827 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10828 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10829 | } |
| 10830 | |
| 10831 | /** |
| 10832 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 10833 | * @wmi_handle: wmi handle |
| 10834 | * @peerStateParams: TDLS peer state params |
| 10835 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10836 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10837 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10838 | static QDF_STATUS send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10839 | struct tdls_peer_state_params *peerStateParams, |
| 10840 | uint32_t *ch_mhz) |
| 10841 | { |
| 10842 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 10843 | wmi_tdls_peer_capabilities *peer_cap; |
| 10844 | wmi_channel *chan_info; |
| 10845 | wmi_buf_t wmi_buf; |
| 10846 | uint8_t *buf_ptr; |
| 10847 | uint32_t i; |
| 10848 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 10849 | sizeof(wmi_tdls_peer_capabilities); |
| 10850 | |
| 10851 | |
| 10852 | len += WMI_TLV_HDR_SIZE + |
| 10853 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 10854 | |
| 10855 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10856 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10857 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10858 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10859 | } |
| 10860 | |
| 10861 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 10862 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 10863 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10864 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 10865 | WMITLV_GET_STRUCT_TLVLEN |
| 10866 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 10867 | |
| 10868 | cmd->vdev_id = peerStateParams->vdevId; |
| 10869 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 10870 | &cmd->peer_macaddr); |
| 10871 | |
| 10872 | |
| 10873 | cmd->peer_state = peerStateParams->peerState; |
| 10874 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10875 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10876 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 10877 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 10878 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 10879 | cmd->peer_macaddr.mac_addr31to0, |
| 10880 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 10881 | |
| 10882 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 10883 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 10884 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 10885 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 10886 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 10887 | |
| 10888 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 10889 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 10890 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 10891 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 10892 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 10893 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 10894 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 10895 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 10896 | |
| 10897 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 10898 | * but fill SP |
| 10899 | */ |
| 10900 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 10901 | peerStateParams->peerCap.peerMaxSp); |
| 10902 | |
| 10903 | peer_cap->buff_sta_support = |
| 10904 | peerStateParams->peerCap.peerBuffStaSupport; |
| 10905 | peer_cap->off_chan_support = |
| 10906 | peerStateParams->peerCap.peerOffChanSupport; |
| 10907 | peer_cap->peer_curr_operclass = |
| 10908 | peerStateParams->peerCap.peerCurrOperClass; |
| 10909 | /* self curr operclass is not being used and so pass op class for |
| 10910 | * preferred off chan in it. |
| 10911 | */ |
| 10912 | peer_cap->self_curr_operclass = |
| 10913 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 10914 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 10915 | peer_cap->peer_operclass_len = |
| 10916 | peerStateParams->peerCap.peerOperClassLen; |
| 10917 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10918 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10919 | __func__, peer_cap->peer_operclass_len); |
| 10920 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 10921 | peer_cap->peer_operclass[i] = |
| 10922 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10923 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10924 | __func__, i, peer_cap->peer_operclass[i]); |
| 10925 | } |
| 10926 | |
| 10927 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 10928 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 10929 | peer_cap->pref_offchan_bw = |
| 10930 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 10931 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10932 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10933 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 10934 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 10935 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 10936 | " %d, pref_offchan_bw: %d", |
| 10937 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 10938 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 10939 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 10940 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 10941 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 10942 | |
| 10943 | /* next fill variable size array of peer chan info */ |
| 10944 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 10945 | WMITLV_SET_HDR(buf_ptr, |
| 10946 | WMITLV_TAG_ARRAY_STRUC, |
| 10947 | sizeof(wmi_channel) * |
| 10948 | peerStateParams->peerCap.peerChanLen); |
| 10949 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10950 | |
| 10951 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 10952 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 10953 | WMITLV_TAG_STRUC_wmi_channel, |
| 10954 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 10955 | chan_info->mhz = ch_mhz[i]; |
| 10956 | chan_info->band_center_freq1 = chan_info->mhz; |
| 10957 | chan_info->band_center_freq2 = 0; |
| 10958 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10959 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10960 | |
| 10961 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 10962 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10963 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10964 | peerStateParams->peerCap.peerChan[i].chanId, |
| 10965 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 10966 | } |
| 10967 | |
| 10968 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 10969 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 10970 | else |
| 10971 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 10972 | |
| 10973 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 10974 | peerStateParams->peerCap. |
| 10975 | peerChan[i].pwr); |
| 10976 | |
| 10977 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 10978 | peerStateParams->peerCap.peerChan[i]. |
| 10979 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10980 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10981 | peerStateParams->peerCap.peerChan[i].pwr); |
| 10982 | |
| 10983 | chan_info++; |
| 10984 | } |
| 10985 | |
| 10986 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10987 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10988 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10989 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10990 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10991 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10992 | } |
| 10993 | |
| 10994 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10995 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10996 | } |
| 10997 | |
| 10998 | /* |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10999 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 11000 | * @wmi_handle: Pointer to WMi handle |
| 11001 | * @ie_data: Pointer for ie data |
| 11002 | * |
| 11003 | * This function sends IE information to firmware |
| 11004 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11005 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11006 | * |
| 11007 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11008 | static QDF_STATUS send_process_set_ie_info_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11009 | struct vdev_ie_info_param *ie_info) |
| 11010 | { |
| 11011 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 11012 | wmi_buf_t buf; |
| 11013 | uint8_t *buf_ptr; |
| 11014 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11015 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11016 | |
| 11017 | |
| 11018 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 11019 | /* Allocate memory for the WMI command */ |
| 11020 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 11021 | |
| 11022 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11023 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11024 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 11025 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11026 | } |
| 11027 | |
| 11028 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11029 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11030 | |
| 11031 | /* Populate the WMI command */ |
| 11032 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 11033 | |
| 11034 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11035 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 11036 | WMITLV_GET_STRUCT_TLVLEN( |
| 11037 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 11038 | cmd->vdev_id = ie_info->vdev_id; |
| 11039 | cmd->ie_id = ie_info->ie_id; |
| 11040 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 11041 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11042 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11043 | WMI_LOGD(FL("IE:%d of size:%d sent for vdev:%d"), ie_info->ie_id, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11044 | ie_info->length, ie_info->vdev_id); |
| 11045 | |
| 11046 | buf_ptr += sizeof(*cmd); |
| 11047 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 11048 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11049 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11050 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11051 | |
| 11052 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11053 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11054 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11055 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 11056 | wmi_buf_free(buf); |
| 11057 | } |
| 11058 | |
| 11059 | return ret; |
| 11060 | } |
| 11061 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11062 | /** |
| 11063 | * send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function |
| 11064 | * |
| 11065 | * @param wmi_handle : handle to WMI. |
| 11066 | * @param param : pointer to antenna param |
| 11067 | * |
| 11068 | * This function sends smart antenna enable command to FW |
| 11069 | * |
| 11070 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11071 | */ |
| 11072 | static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 11073 | struct smart_ant_enable_params *param) |
| 11074 | { |
| 11075 | /* Send WMI COMMAND to Enable */ |
| 11076 | wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd; |
| 11077 | wmi_pdev_smart_ant_gpio_handle *gpio_param; |
| 11078 | wmi_buf_t buf; |
| 11079 | uint8_t *buf_ptr; |
| 11080 | int len = 0; |
| 11081 | QDF_STATUS ret; |
| 11082 | int loop = 0; |
| 11083 | |
| 11084 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11085 | len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle); |
| 11086 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11087 | |
| 11088 | if (!buf) { |
| 11089 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11090 | return QDF_STATUS_E_NOMEM; |
| 11091 | } |
| 11092 | |
| 11093 | buf_ptr = wmi_buf_data(buf); |
| 11094 | qdf_mem_zero(buf_ptr, len); |
| 11095 | cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr; |
| 11096 | |
| 11097 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11098 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param, |
| 11099 | WMITLV_GET_STRUCT_TLVLEN( |
| 11100 | wmi_pdev_smart_ant_enable_cmd_fixed_param)); |
| 11101 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11102 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11103 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11104 | cmd->enable = param->enable; |
| 11105 | cmd->mode = param->mode; |
| 11106 | cmd->rx_antenna = param->rx_antenna; |
| 11107 | cmd->tx_default_antenna = param->rx_antenna; |
| 11108 | |
| 11109 | /* TLV indicating array of structures to follow */ |
| 11110 | buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param); |
| 11111 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11112 | WMI_HAL_MAX_SANTENNA * |
| 11113 | sizeof(wmi_pdev_smart_ant_gpio_handle)); |
| 11114 | |
| 11115 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11116 | gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr; |
| 11117 | |
| 11118 | for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) { |
| 11119 | WMITLV_SET_HDR(&gpio_param->tlv_header, |
| 11120 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle, |
| 11121 | WMITLV_GET_STRUCT_TLVLEN( |
| 11122 | wmi_pdev_smart_ant_gpio_handle)); |
| 11123 | if (param->mode == SMART_ANT_MODE_SERIAL) { |
| 11124 | if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) { |
| 11125 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 11126 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 11127 | } else { |
| 11128 | gpio_param->gpio_pin = 0; |
| 11129 | gpio_param->gpio_func = 0; |
| 11130 | } |
| 11131 | } else if (param->mode == SMART_ANT_MODE_PARALLEL) { |
| 11132 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 11133 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 11134 | } |
| 11135 | /* Setting it to 0 for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11136 | gpio_param->pdev_id = |
| 11137 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11138 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11139 | gpio_param++; |
| 11140 | } |
| 11141 | |
| 11142 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11143 | buf, |
| 11144 | len, |
| 11145 | WMI_PDEV_SMART_ANT_ENABLE_CMDID); |
| 11146 | |
| 11147 | if (ret != 0) { |
| 11148 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11149 | WMI_LOGE("enable:%d mode:%d rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n", |
| 11150 | cmd->enable, |
| 11151 | cmd->mode, |
| 11152 | cmd->rx_antenna, |
| 11153 | param->gpio_pin[0], param->gpio_pin[1], |
| 11154 | param->gpio_pin[2], param->gpio_pin[3], |
| 11155 | param->gpio_func[0], param->gpio_func[1], |
| 11156 | param->gpio_func[2], param->gpio_func[3], |
| 11157 | ret); |
| 11158 | wmi_buf_free(buf); |
| 11159 | } |
| 11160 | |
| 11161 | return ret; |
| 11162 | } |
| 11163 | |
| 11164 | /** |
| 11165 | * send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function |
| 11166 | * |
| 11167 | * @param wmi_handle : handle to WMI. |
| 11168 | * @param param : pointer to rx antenna param |
| 11169 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11170 | */ |
| 11171 | static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 11172 | struct smart_ant_rx_ant_params *param) |
| 11173 | { |
| 11174 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd; |
| 11175 | wmi_buf_t buf; |
| 11176 | uint8_t *buf_ptr; |
| 11177 | uint32_t len; |
| 11178 | QDF_STATUS ret; |
| 11179 | |
| 11180 | len = sizeof(*cmd); |
| 11181 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11182 | WMI_LOGD("%s:\n", __func__); |
| 11183 | if (!buf) { |
| 11184 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11185 | return QDF_STATUS_E_NOMEM; |
| 11186 | } |
| 11187 | |
| 11188 | buf_ptr = wmi_buf_data(buf); |
| 11189 | cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr; |
| 11190 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11191 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param, |
| 11192 | WMITLV_GET_STRUCT_TLVLEN( |
| 11193 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param)); |
| 11194 | cmd->rx_antenna = param->antenna; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11195 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11196 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11197 | |
| 11198 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11199 | buf, |
| 11200 | len, |
| 11201 | WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID); |
| 11202 | |
| 11203 | if (ret != 0) { |
| 11204 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11205 | WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n", |
| 11206 | __func__, |
| 11207 | cmd->rx_antenna, |
| 11208 | ret); |
| 11209 | wmi_buf_free(buf); |
| 11210 | } |
| 11211 | |
| 11212 | return ret; |
| 11213 | } |
| 11214 | |
| 11215 | /** |
| 11216 | * send_set_ctl_table_cmd_tlv() - send ctl table cmd to fw |
| 11217 | * @wmi_handle: wmi handle |
| 11218 | * @param: pointer to hold ctl table param |
| 11219 | * |
| 11220 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11221 | */ |
| 11222 | static QDF_STATUS |
| 11223 | send_set_ctl_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 11224 | struct ctl_table_params *param) |
| 11225 | { |
| 11226 | uint16_t len, ctl_tlv_len; |
| 11227 | uint8_t *buf_ptr; |
| 11228 | wmi_buf_t buf; |
| 11229 | wmi_pdev_set_ctl_table_cmd_fixed_param *cmd; |
| 11230 | uint32_t *ctl_array; |
| 11231 | |
| 11232 | if (!param->ctl_array) |
| 11233 | return QDF_STATUS_E_FAILURE; |
| 11234 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11235 | ctl_tlv_len = WMI_TLV_HDR_SIZE + |
| 11236 | roundup(param->ctl_cmd_len, sizeof(A_UINT32)); |
| 11237 | len = sizeof(*cmd) + ctl_tlv_len; |
| 11238 | |
| 11239 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11240 | if (!buf) { |
| 11241 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11242 | return QDF_STATUS_E_FAILURE; |
| 11243 | } |
| 11244 | |
| 11245 | buf_ptr = wmi_buf_data(buf); |
| 11246 | qdf_mem_zero(buf_ptr, len); |
| 11247 | |
| 11248 | cmd = (wmi_pdev_set_ctl_table_cmd_fixed_param *)buf_ptr; |
| 11249 | |
| 11250 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11251 | WMITLV_TAG_STRUC_wmi_pdev_set_ctl_table_cmd_fixed_param, |
| 11252 | WMITLV_GET_STRUCT_TLVLEN( |
| 11253 | wmi_pdev_set_ctl_table_cmd_fixed_param)); |
| 11254 | cmd->ctl_len = param->ctl_cmd_len; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11255 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11256 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11257 | |
| 11258 | buf_ptr += sizeof(*cmd); |
| 11259 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11260 | (cmd->ctl_len)); |
| 11261 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11262 | ctl_array = (uint32_t *)buf_ptr; |
| 11263 | |
| 11264 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[0], ¶m->ctl_band, |
| 11265 | sizeof(param->ctl_band)); |
| 11266 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[1], param->ctl_array, |
| 11267 | param->ctl_cmd_len - |
| 11268 | sizeof(param->ctl_band)); |
| 11269 | |
| 11270 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11271 | WMI_PDEV_SET_CTL_TABLE_CMDID)) { |
| 11272 | WMI_LOGE("%s:Failed to send command\n", __func__); |
| 11273 | wmi_buf_free(buf); |
| 11274 | return QDF_STATUS_E_FAILURE; |
| 11275 | } |
| 11276 | |
| 11277 | return QDF_STATUS_SUCCESS; |
| 11278 | } |
| 11279 | |
| 11280 | /** |
| 11281 | * send_set_mimogain_table_cmd_tlv() - send mimogain table cmd to fw |
| 11282 | * @wmi_handle: wmi handle |
| 11283 | * @param: pointer to hold mimogain table param |
| 11284 | * |
| 11285 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11286 | */ |
| 11287 | static QDF_STATUS |
| 11288 | send_set_mimogain_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 11289 | struct mimogain_table_params *param) |
| 11290 | { |
| 11291 | uint16_t len, table_tlv_len; |
| 11292 | wmi_buf_t buf; |
| 11293 | uint8_t *buf_ptr; |
| 11294 | wmi_pdev_set_mimogain_table_cmd_fixed_param *cmd; |
| 11295 | uint32_t *gain_table; |
| 11296 | |
| 11297 | if (!param->array_gain) |
| 11298 | return QDF_STATUS_E_FAILURE; |
| 11299 | |
| 11300 | /* len must be multiple of a single array gain table */ |
| 11301 | if (param->tbl_len % |
| 11302 | ((WMI_HOST_TX_NUM_CHAIN-1) * WMI_HOST_TPC_REGINDEX_MAX * |
| 11303 | WMI_HOST_ARRAY_GAIN_NUM_STREAMS) != 0) { |
| 11304 | WMI_LOGE("Array gain table len not correct\n"); |
| 11305 | return QDF_STATUS_E_FAILURE; |
| 11306 | } |
| 11307 | |
| 11308 | table_tlv_len = WMI_TLV_HDR_SIZE + |
| 11309 | roundup(param->tbl_len, sizeof(uint32_t)); |
| 11310 | len = sizeof(*cmd) + table_tlv_len; |
| 11311 | |
| 11312 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11313 | if (!buf) { |
| 11314 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11315 | return QDF_STATUS_E_FAILURE; |
| 11316 | } |
| 11317 | |
| 11318 | buf_ptr = wmi_buf_data(buf); |
| 11319 | qdf_mem_zero(buf_ptr, len); |
| 11320 | |
| 11321 | cmd = (wmi_pdev_set_mimogain_table_cmd_fixed_param *)buf_ptr; |
| 11322 | |
| 11323 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11324 | WMITLV_TAG_STRUC_wmi_pdev_set_mimogain_table_cmd_fixed_param, |
| 11325 | WMITLV_GET_STRUCT_TLVLEN( |
| 11326 | wmi_pdev_set_mimogain_table_cmd_fixed_param)); |
| 11327 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11328 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11329 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11330 | WMI_MIMOGAIN_ARRAY_GAIN_LEN_SET(cmd->mimogain_info, param->tbl_len); |
| 11331 | WMI_MIMOGAIN_MULTI_CHAIN_BYPASS_SET(cmd->mimogain_info, |
| 11332 | param->multichain_gain_bypass); |
| 11333 | |
| 11334 | buf_ptr += sizeof(*cmd); |
| 11335 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11336 | (param->tbl_len)); |
| 11337 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11338 | gain_table = (uint32_t *)buf_ptr; |
| 11339 | |
| 11340 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(gain_table, |
| 11341 | param->array_gain, |
| 11342 | param->tbl_len); |
| 11343 | |
| 11344 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11345 | WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID)) { |
| 11346 | return QDF_STATUS_E_FAILURE; |
| 11347 | } |
| 11348 | |
| 11349 | return QDF_STATUS_SUCCESS; |
| 11350 | } |
| 11351 | |
| 11352 | /** |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 11353 | * enum packet_power_tlv_flags: target defined |
| 11354 | * packet power rate flags for TLV |
| 11355 | * @WMI_TLV_FLAG_ONE_CHAIN: one chain |
| 11356 | * @WMI_TLV_FLAG_TWO_CHAIN: two chain |
| 11357 | * @WMI_TLV_FLAG_THREE_CHAIN: three chain |
| 11358 | * @WMI_TLV_FLAG_FOUR_CHAIN: four chain |
| 11359 | * @WMI_TLV_FLAG_FIVE_CHAIN: five chain |
| 11360 | * @WMI_TLV_FLAG_SIX_CHAIN: six chain |
| 11361 | * @WMI_TLV_FLAG_SEVEN_CHAIN: seven chain |
| 11362 | * @WMI_TLV_FLAG_EIGHT_CHAIN:eight chain |
| 11363 | * @WMI_TLV_FLAG_STBC: STBC is set |
| 11364 | * @WMI_TLV_FLAG_40MHZ: 40MHz chan width |
| 11365 | * @WMI_TLV_FLAG_80MHZ: 80MHz chan width |
| 11366 | * @WMI_TLV_FLAG_160MHZ: 160MHz chan width |
| 11367 | * @WMI_TLV_FLAG_TXBF: Tx Bf enabled |
| 11368 | * @WMI_TLV_FLAG_RTSENA: RTS enabled |
| 11369 | * @WMI_TLV_FLAG_CTSENA: CTS enabled |
| 11370 | * @WMI_TLV_FLAG_LDPC: LDPC is set |
| 11371 | * @WMI_TLV_FLAG_SGI: Short gaurd interval |
| 11372 | * @WMI_TLV_FLAG_SU: SU Data |
| 11373 | * @WMI_TLV_FLAG_DL_MU_MIMO_AC: DL AC MU data |
| 11374 | * @WMI_TLV_FLAG_DL_MU_MIMO_AX: DL AX MU data |
| 11375 | * @WMI_TLV_FLAG_DL_OFDMA: DL OFDMA data |
| 11376 | * @WMI_TLV_FLAG_UL_OFDMA: UL OFDMA data |
| 11377 | * @WMI_TLV_FLAG_UL_MU_MIMO: UL MU data |
| 11378 | * |
| 11379 | * @WMI_TLV_FLAG_BW_MASK: bandwidth mask |
| 11380 | * @WMI_TLV_FLAG_BW_SHIFT: bandwidth shift |
| 11381 | * @WMI_TLV_FLAG_SU_MU_OFDMA_MASK: su/mu/ofdma mask |
| 11382 | * @WMI_TLV_FLAG_SU_MU_OFDMA_shift: su/mu/ofdma shift |
| 11383 | */ |
| 11384 | enum packet_power_tlv_flags { |
| 11385 | WMI_TLV_FLAG_ONE_CHAIN = 0x00000001, |
| 11386 | WMI_TLV_FLAG_TWO_CHAIN = 0x00000003, |
| 11387 | WMI_TLV_FLAG_THREE_CHAIN = 0x00000007, |
| 11388 | WMI_TLV_FLAG_FOUR_CHAIN = 0x0000000F, |
| 11389 | WMI_TLV_FLAG_FIVE_CHAIN = 0x0000001F, |
| 11390 | WMI_TLV_FLAG_SIX_CHAIN = 0x0000003F, |
| 11391 | WMI_TLV_FLAG_SEVEN_CHAIN = 0x0000007F, |
| 11392 | WMI_TLV_FLAG_EIGHT_CHAIN = 0x0000008F, |
| 11393 | WMI_TLV_FLAG_STBC = 0x00000100, |
| 11394 | WMI_TLV_FLAG_40MHZ = 0x00000200, |
| 11395 | WMI_TLV_FLAG_80MHZ = 0x00000300, |
| 11396 | WMI_TLV_FLAG_160MHZ = 0x00000400, |
| 11397 | WMI_TLV_FLAG_TXBF = 0x00000800, |
| 11398 | WMI_TLV_FLAG_RTSENA = 0x00001000, |
| 11399 | WMI_TLV_FLAG_CTSENA = 0x00002000, |
| 11400 | WMI_TLV_FLAG_LDPC = 0x00004000, |
| 11401 | WMI_TLV_FLAG_SGI = 0x00008000, |
| 11402 | WMI_TLV_FLAG_SU = 0x00100000, |
| 11403 | WMI_TLV_FLAG_DL_MU_MIMO_AC = 0x00200000, |
| 11404 | WMI_TLV_FLAG_DL_MU_MIMO_AX = 0x00300000, |
| 11405 | WMI_TLV_FLAG_DL_OFDMA = 0x00400000, |
| 11406 | WMI_TLV_FLAG_UL_OFDMA = 0x00500000, |
| 11407 | WMI_TLV_FLAG_UL_MU_MIMO = 0x00600000, |
| 11408 | |
| 11409 | WMI_TLV_FLAG_CHAIN_MASK = 0xff, |
| 11410 | WMI_TLV_FLAG_BW_MASK = 0x3, |
| 11411 | WMI_TLV_FLAG_BW_SHIFT = 9, |
| 11412 | WMI_TLV_FLAG_SU_MU_OFDMA_MASK = 0x7, |
| 11413 | WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT = 20, |
| 11414 | }; |
| 11415 | |
| 11416 | /** |
| 11417 | * convert_to_power_info_rate_flags() - convert packet_power_info_params |
| 11418 | * to FW understandable format |
| 11419 | * @param: pointer to hold packet power info param |
| 11420 | * |
| 11421 | * @return FW understandable 32 bit rate flags |
| 11422 | */ |
| 11423 | static uint32_t |
| 11424 | convert_to_power_info_rate_flags(struct packet_power_info_params *param) |
| 11425 | { |
| 11426 | uint32_t rateflags = 0; |
| 11427 | |
| 11428 | if (param->chainmask) |
| 11429 | rateflags |= |
| 11430 | (param->chainmask & WMI_TLV_FLAG_CHAIN_MASK); |
| 11431 | if (param->chan_width) |
| 11432 | rateflags |= |
| 11433 | ((param->chan_width & WMI_TLV_FLAG_BW_MASK) |
| 11434 | << WMI_TLV_FLAG_BW_SHIFT); |
| 11435 | if (param->su_mu_ofdma) |
| 11436 | rateflags |= |
| 11437 | ((param->su_mu_ofdma & WMI_TLV_FLAG_SU_MU_OFDMA_MASK) |
| 11438 | << WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT); |
| 11439 | if (param->rate_flags & WMI_HOST_FLAG_STBC) |
| 11440 | rateflags |= WMI_TLV_FLAG_STBC; |
| 11441 | if (param->rate_flags & WMI_HOST_FLAG_LDPC) |
| 11442 | rateflags |= WMI_TLV_FLAG_LDPC; |
| 11443 | if (param->rate_flags & WMI_HOST_FLAG_TXBF) |
| 11444 | rateflags |= WMI_TLV_FLAG_TXBF; |
| 11445 | if (param->rate_flags & WMI_HOST_FLAG_RTSENA) |
| 11446 | rateflags |= WMI_TLV_FLAG_RTSENA; |
| 11447 | if (param->rate_flags & WMI_HOST_FLAG_CTSENA) |
| 11448 | rateflags |= WMI_TLV_FLAG_CTSENA; |
| 11449 | if (param->rate_flags & WMI_HOST_FLAG_SGI) |
| 11450 | rateflags |= WMI_TLV_FLAG_SGI; |
| 11451 | |
| 11452 | return rateflags; |
| 11453 | } |
| 11454 | |
| 11455 | /** |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11456 | * send_packet_power_info_get_cmd_tlv() - send request to get packet power |
| 11457 | * info to fw |
| 11458 | * @wmi_handle: wmi handle |
| 11459 | * @param: pointer to hold packet power info param |
| 11460 | * |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 11461 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11462 | */ |
| 11463 | static QDF_STATUS |
| 11464 | send_packet_power_info_get_cmd_tlv(wmi_unified_t wmi_handle, |
| 11465 | struct packet_power_info_params *param) |
| 11466 | { |
| 11467 | wmi_pdev_get_tpc_cmd_fixed_param *cmd; |
| 11468 | wmi_buf_t wmibuf; |
| 11469 | uint8_t *buf_ptr; |
| 11470 | u_int32_t len = sizeof(wmi_pdev_get_tpc_cmd_fixed_param); |
| 11471 | |
| 11472 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 11473 | if (wmibuf == NULL) |
| 11474 | return QDF_STATUS_E_NOMEM; |
| 11475 | |
| 11476 | buf_ptr = (uint8_t *)wmi_buf_data(wmibuf); |
| 11477 | |
| 11478 | cmd = (wmi_pdev_get_tpc_cmd_fixed_param *)buf_ptr; |
| 11479 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11480 | WMITLV_TAG_STRUC_wmi_pdev_get_tpc_cmd_fixed_param, |
| 11481 | WMITLV_GET_STRUCT_TLVLEN( |
| 11482 | wmi_pdev_get_tpc_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11483 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11484 | param->pdev_id); |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 11485 | cmd->rate_flags = convert_to_power_info_rate_flags(param); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11486 | cmd->nss = param->nss; |
| 11487 | cmd->preamble = param->preamble; |
| 11488 | cmd->hw_rate = param->hw_rate; |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 11489 | |
| 11490 | WMI_LOGI("%s[%d] commandID %d, wmi_pdev_get_tpc_cmd=0x%x," |
| 11491 | "rate_flags: 0x%x, nss: %d, preamble: %d, hw_rate: %d\n", |
| 11492 | __func__, __LINE__, WMI_PDEV_GET_TPC_CMDID, *((u_int32_t *)cmd), |
| 11493 | cmd->rate_flags, cmd->nss, cmd->preamble, cmd->hw_rate); |
| 11494 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11495 | if (wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 11496 | WMI_PDEV_GET_TPC_CMDID)) { |
| 11497 | WMI_LOGE(FL("Failed to get tpc command\n")); |
| 11498 | wmi_buf_free(wmibuf); |
| 11499 | return QDF_STATUS_E_FAILURE; |
| 11500 | } |
| 11501 | |
| 11502 | return QDF_STATUS_SUCCESS; |
| 11503 | } |
| 11504 | |
| 11505 | /** |
| 11506 | * send_vdev_config_ratemask_cmd_tlv() - config ratemask param in fw |
| 11507 | * @wmi_handle: wmi handle |
| 11508 | * @param: pointer to hold config ratemask params |
| 11509 | * |
| 11510 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11511 | */ |
| 11512 | static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle, |
| 11513 | struct config_ratemask_params *param) |
| 11514 | { |
| 11515 | wmi_vdev_config_ratemask_cmd_fixed_param *cmd; |
| 11516 | wmi_buf_t buf; |
| 11517 | int32_t len = sizeof(*cmd); |
| 11518 | |
| 11519 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11520 | if (!buf) { |
| 11521 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11522 | return QDF_STATUS_E_FAILURE; |
| 11523 | } |
| 11524 | cmd = (wmi_vdev_config_ratemask_cmd_fixed_param *)wmi_buf_data(buf); |
| 11525 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11526 | WMITLV_TAG_STRUC_wmi_vdev_config_ratemask_fixed_param, |
| 11527 | WMITLV_GET_STRUCT_TLVLEN( |
| 11528 | wmi_vdev_config_ratemask_cmd_fixed_param)); |
| 11529 | cmd->vdev_id = param->vdev_id; |
| 11530 | cmd->type = param->type; |
| 11531 | cmd->mask_lower32 = param->lower32; |
| 11532 | cmd->mask_higher32 = param->higher32; |
| 11533 | WMI_LOGI("Setting vdev ratemask vdev id = 0x%X, type = 0x%X, mask_l32 = 0x%X mask_h32 = 0x%X\n", |
| 11534 | param->vdev_id, param->type, param->lower32, param->higher32); |
| 11535 | |
| 11536 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11537 | WMI_VDEV_RATEMASK_CMDID)) { |
| 11538 | WMI_LOGE("Seting vdev ratemask failed\n"); |
| 11539 | wmi_buf_free(buf); |
| 11540 | return QDF_STATUS_E_FAILURE; |
| 11541 | } |
| 11542 | |
| 11543 | return QDF_STATUS_SUCCESS; |
| 11544 | } |
| 11545 | |
| 11546 | /** |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 11547 | * copy_custom_aggr_bitmap() - copies host side bitmap using FW APIs |
| 11548 | * @param: param sent from the host side |
| 11549 | * @cmd: param to be sent to the fw side |
| 11550 | */ |
| 11551 | static inline void copy_custom_aggr_bitmap( |
| 11552 | struct set_custom_aggr_size_params *param, |
| 11553 | wmi_vdev_set_custom_aggr_size_cmd_fixed_param *cmd) |
| 11554 | { |
| 11555 | WMI_VDEV_CUSTOM_AGGR_AC_SET(cmd->enable_bitmap, |
| 11556 | param->ac); |
| 11557 | WMI_VDEV_CUSTOM_AGGR_TYPE_SET(cmd->enable_bitmap, |
| 11558 | param->aggr_type); |
| 11559 | WMI_VDEV_CUSTOM_TX_AGGR_SZ_DIS_SET(cmd->enable_bitmap, |
| 11560 | param->tx_aggr_size_disable); |
| 11561 | WMI_VDEV_CUSTOM_RX_AGGR_SZ_DIS_SET(cmd->enable_bitmap, |
| 11562 | param->rx_aggr_size_disable); |
| 11563 | WMI_VDEV_CUSTOM_TX_AC_EN_SET(cmd->enable_bitmap, |
| 11564 | param->tx_ac_enable); |
| 11565 | } |
| 11566 | |
| 11567 | /** |
| 11568 | * send_vdev_set_custom_aggr_size_cmd_tlv() - custom aggr size param in fw |
| 11569 | * @wmi_handle: wmi handle |
| 11570 | * @param: pointer to hold custom aggr size params |
| 11571 | * |
| 11572 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11573 | */ |
| 11574 | static QDF_STATUS send_vdev_set_custom_aggr_size_cmd_tlv( |
| 11575 | wmi_unified_t wmi_handle, |
| 11576 | struct set_custom_aggr_size_params *param) |
| 11577 | { |
| 11578 | wmi_vdev_set_custom_aggr_size_cmd_fixed_param *cmd; |
| 11579 | wmi_buf_t buf; |
| 11580 | int32_t len = sizeof(*cmd); |
| 11581 | |
| 11582 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11583 | if (!buf) { |
| 11584 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11585 | return QDF_STATUS_E_FAILURE; |
| 11586 | } |
| 11587 | cmd = (wmi_vdev_set_custom_aggr_size_cmd_fixed_param *) |
| 11588 | wmi_buf_data(buf); |
| 11589 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11590 | WMITLV_TAG_STRUC_wmi_vdev_set_custom_aggr_size_cmd_fixed_param, |
| 11591 | WMITLV_GET_STRUCT_TLVLEN( |
| 11592 | wmi_vdev_set_custom_aggr_size_cmd_fixed_param)); |
| 11593 | cmd->vdev_id = param->vdev_id; |
| 11594 | cmd->tx_aggr_size = param->tx_aggr_size; |
| 11595 | cmd->rx_aggr_size = param->rx_aggr_size; |
| 11596 | copy_custom_aggr_bitmap(param, cmd); |
| 11597 | |
| 11598 | WMI_LOGD("Set custom aggr: vdev id=0x%X, tx aggr size=0x%X " |
| 11599 | "rx_aggr_size=0x%X access category=0x%X, agg_type=0x%X " |
| 11600 | "tx_aggr_size_disable=0x%X, rx_aggr_size_disable=0x%X " |
| 11601 | "tx_ac_enable=0x%X\n", |
| 11602 | param->vdev_id, param->tx_aggr_size, param->rx_aggr_size, |
| 11603 | param->ac, param->aggr_type, param->tx_aggr_size_disable, |
| 11604 | param->rx_aggr_size_disable, param->tx_ac_enable); |
| 11605 | |
| 11606 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11607 | WMI_VDEV_SET_CUSTOM_AGGR_SIZE_CMDID)) { |
| 11608 | WMI_LOGE("Seting custom aggregation size failed\n"); |
| 11609 | wmi_buf_free(buf); |
| 11610 | return QDF_STATUS_E_FAILURE; |
| 11611 | } |
| 11612 | |
| 11613 | return QDF_STATUS_SUCCESS; |
| 11614 | } |
| 11615 | |
| 11616 | /** |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 11617 | * send_vdev_set_qdepth_thresh_cmd_tlv() - WMI set qdepth threshold |
| 11618 | * @param wmi_handle : handle to WMI. |
| 11619 | * @param param : pointer to tx antenna param |
| 11620 | * |
| 11621 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11622 | */ |
| 11623 | |
| 11624 | static QDF_STATUS send_vdev_set_qdepth_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
| 11625 | struct set_qdepth_thresh_params *param) |
| 11626 | { |
| 11627 | wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param *cmd; |
| 11628 | wmi_msduq_qdepth_thresh_update *cmd_update; |
| 11629 | wmi_buf_t buf; |
| 11630 | int32_t len = 0; |
| 11631 | int i; |
| 11632 | uint8_t *buf_ptr; |
| 11633 | QDF_STATUS ret; |
| 11634 | |
| 11635 | if (param->num_of_msduq_updates > QDEPTH_THRESH_MAX_UPDATES) { |
| 11636 | WMI_LOGE("%s: Invalid Update Count!\n", __func__); |
| 11637 | return QDF_STATUS_E_INVAL; |
| 11638 | } |
| 11639 | |
| 11640 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11641 | len += (sizeof(wmi_msduq_qdepth_thresh_update) * |
| 11642 | param->num_of_msduq_updates); |
| 11643 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11644 | |
| 11645 | if (!buf) { |
| 11646 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11647 | return QDF_STATUS_E_NOMEM; |
| 11648 | } |
| 11649 | |
| 11650 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11651 | cmd = (wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param *) |
| 11652 | buf_ptr; |
| 11653 | |
| 11654 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11655 | WMITLV_TAG_STRUC_wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param |
| 11656 | , WMITLV_GET_STRUCT_TLVLEN( |
| 11657 | wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param)); |
| 11658 | |
| 11659 | cmd->pdev_id = |
| 11660 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
| 11661 | cmd->vdev_id = param->vdev_id; |
| 11662 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->mac_addr, &cmd->peer_mac_address); |
| 11663 | cmd->num_of_msduq_updates = param->num_of_msduq_updates; |
| 11664 | |
| 11665 | buf_ptr += sizeof( |
| 11666 | wmi_peer_tid_msduq_qdepth_thresh_update_cmd_fixed_param); |
| 11667 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11668 | param->num_of_msduq_updates * |
| 11669 | sizeof(wmi_msduq_qdepth_thresh_update)); |
| 11670 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11671 | cmd_update = (wmi_msduq_qdepth_thresh_update *)buf_ptr; |
| 11672 | |
| 11673 | for (i = 0; i < cmd->num_of_msduq_updates; i++) { |
| 11674 | WMITLV_SET_HDR(&cmd_update->tlv_header, |
| 11675 | WMITLV_TAG_STRUC_wmi_msduq_qdepth_thresh_update, |
| 11676 | WMITLV_GET_STRUCT_TLVLEN( |
| 11677 | wmi_msduq_qdepth_thresh_update)); |
| 11678 | cmd_update->tid_num = param->update_params[i].tid_num; |
| 11679 | cmd_update->msduq_update_mask = |
| 11680 | param->update_params[i].msduq_update_mask; |
| 11681 | cmd_update->qdepth_thresh_value = |
| 11682 | param->update_params[i].qdepth_thresh_value; |
| 11683 | WMI_LOGD("Set QDepth Threshold: vdev=0x%X pdev=0x%X, tid=0x%X " |
| 11684 | "mac_addr_upper4=%X, mac_addr_lower2:%X," |
| 11685 | " update mask=0x%X thresh val=0x%X\n", |
| 11686 | cmd->vdev_id, cmd->pdev_id, cmd_update->tid_num, |
| 11687 | cmd->peer_mac_address.mac_addr31to0, |
| 11688 | cmd->peer_mac_address.mac_addr47to32, |
| 11689 | cmd_update->msduq_update_mask, |
| 11690 | cmd_update->qdepth_thresh_value); |
| 11691 | cmd_update++; |
| 11692 | } |
| 11693 | |
| 11694 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11695 | WMI_PEER_TID_MSDUQ_QDEPTH_THRESH_UPDATE_CMDID); |
| 11696 | |
| 11697 | if (ret != 0) { |
| 11698 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11699 | wmi_buf_free(buf); |
| 11700 | } |
| 11701 | |
| 11702 | return ret; |
| 11703 | } |
| 11704 | |
| 11705 | /** |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11706 | * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw |
| 11707 | * @wmi_handle: wmi handle |
| 11708 | * @param: pointer to hold vap dscp tid map param |
| 11709 | * |
| 11710 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11711 | */ |
| 11712 | static QDF_STATUS |
| 11713 | send_set_vap_dscp_tid_map_cmd_tlv(wmi_unified_t wmi_handle, |
| 11714 | struct vap_dscp_tid_map_params *param) |
| 11715 | { |
| 11716 | wmi_buf_t buf; |
| 11717 | wmi_vdev_set_dscp_tid_map_cmd_fixed_param *cmd; |
| 11718 | int32_t len = sizeof(*cmd); |
| 11719 | |
| 11720 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11721 | if (!buf) { |
| 11722 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11723 | return QDF_STATUS_E_FAILURE; |
| 11724 | } |
| 11725 | |
| 11726 | cmd = (wmi_vdev_set_dscp_tid_map_cmd_fixed_param *)wmi_buf_data(buf); |
| 11727 | qdf_mem_copy(cmd->dscp_to_tid_map, param->dscp_to_tid_map, |
| 11728 | sizeof(A_UINT32) * WMI_DSCP_MAP_MAX); |
| 11729 | |
| 11730 | cmd->vdev_id = param->vdev_id; |
| 11731 | cmd->enable_override = 0; |
| 11732 | |
| 11733 | WMI_LOGI("Setting dscp for vap id: %d\n", cmd->vdev_id); |
| 11734 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11735 | WMI_VDEV_SET_DSCP_TID_MAP_CMDID)) { |
| 11736 | WMI_LOGE("Failed to set dscp cmd\n"); |
| 11737 | wmi_buf_free(buf); |
| 11738 | return QDF_STATUS_E_FAILURE; |
| 11739 | } |
| 11740 | |
| 11741 | return QDF_STATUS_SUCCESS; |
| 11742 | } |
| 11743 | |
| 11744 | /** |
| 11745 | * send_vdev_set_neighbour_rx_cmd_tlv() - set neighbour rx param in fw |
| 11746 | * @wmi_handle: wmi handle |
| 11747 | * @macaddr: vdev mac address |
| 11748 | * @param: pointer to hold neigbour rx param |
| 11749 | * |
| 11750 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11751 | */ |
| 11752 | static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(wmi_unified_t wmi_handle, |
| 11753 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11754 | struct set_neighbour_rx_params *param) |
| 11755 | { |
| 11756 | wmi_vdev_filter_nrp_config_cmd_fixed_param *cmd; |
| 11757 | wmi_buf_t buf; |
| 11758 | int32_t len = sizeof(*cmd); |
| 11759 | |
| 11760 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11761 | if (!buf) { |
| 11762 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11763 | return QDF_STATUS_E_FAILURE; |
| 11764 | } |
| 11765 | cmd = (wmi_vdev_filter_nrp_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 11766 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11767 | WMITLV_TAG_STRUC_wmi_vdev_filter_nrp_config_cmd_fixed_param, |
| 11768 | WMITLV_GET_STRUCT_TLVLEN( |
| 11769 | wmi_vdev_filter_nrp_config_cmd_fixed_param)); |
| 11770 | cmd->vdev_id = param->vdev_id; |
| 11771 | cmd->bssid_idx = param->idx; |
| 11772 | cmd->action = param->action; |
| 11773 | cmd->type = param->type; |
| 11774 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr); |
| 11775 | cmd->flag = 0; |
| 11776 | |
| 11777 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11778 | WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID)) { |
| 11779 | WMI_LOGE("Failed to set neighbour rx param\n"); |
| 11780 | wmi_buf_free(buf); |
| 11781 | return QDF_STATUS_E_FAILURE; |
| 11782 | } |
| 11783 | |
| 11784 | return QDF_STATUS_SUCCESS; |
| 11785 | } |
| 11786 | |
| 11787 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 11788 | * send_smart_ant_set_tx_ant_cmd_tlv() - WMI set tx antenna function |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 11789 | * @param wmi_handle : handle to WMI. |
| 11790 | * @param macaddr : vdev mac address |
| 11791 | * @param param : pointer to tx antenna param |
| 11792 | * |
| 11793 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11794 | */ |
| 11795 | static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 11796 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11797 | struct smart_ant_tx_ant_params *param) |
| 11798 | { |
| 11799 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd; |
| 11800 | wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series; |
| 11801 | wmi_buf_t buf; |
| 11802 | int32_t len = 0; |
| 11803 | int i; |
| 11804 | uint8_t *buf_ptr; |
| 11805 | QDF_STATUS ret; |
| 11806 | |
| 11807 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11808 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 11809 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series); |
| 11810 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11811 | |
| 11812 | if (!buf) { |
| 11813 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11814 | return QDF_STATUS_E_NOMEM; |
| 11815 | } |
| 11816 | |
| 11817 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11818 | qdf_mem_zero(buf_ptr, len); |
| 11819 | cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr; |
| 11820 | |
| 11821 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11822 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param, |
| 11823 | WMITLV_GET_STRUCT_TLVLEN( |
| 11824 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param)); |
| 11825 | |
| 11826 | cmd->vdev_id = param->vdev_id; |
| 11827 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11828 | |
| 11829 | buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param); |
| 11830 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11831 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series)); |
| 11832 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11833 | ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr; |
| 11834 | |
| 11835 | for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) { |
| 11836 | WMITLV_SET_HDR(&ant_tx_series->tlv_header, |
| 11837 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series, |
| 11838 | WMITLV_GET_STRUCT_TLVLEN( |
| 11839 | wmi_peer_smart_ant_set_tx_antenna_series)); |
| 11840 | ant_tx_series->antenna_series = param->antenna_array[i]; |
| 11841 | ant_tx_series++; |
| 11842 | } |
| 11843 | |
| 11844 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11845 | buf, |
| 11846 | len, |
| 11847 | WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID); |
| 11848 | |
| 11849 | if (ret != 0) { |
| 11850 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11851 | wmi_buf_free(buf); |
| 11852 | } |
| 11853 | |
| 11854 | return ret; |
| 11855 | } |
| 11856 | |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11857 | /** |
| 11858 | * send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw |
| 11859 | * @wmi_handle: wmi handle |
| 11860 | * @param: pointer to hold ant switch tbl param |
| 11861 | * |
| 11862 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11863 | */ |
| 11864 | static QDF_STATUS |
| 11865 | send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle, |
| 11866 | struct ant_switch_tbl_params *param) |
| 11867 | { |
| 11868 | uint8_t len; |
| 11869 | wmi_buf_t buf; |
| 11870 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd; |
| 11871 | wmi_pdev_set_ant_ctrl_chain *ctrl_chain; |
| 11872 | uint8_t *buf_ptr; |
| 11873 | |
| 11874 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11875 | len += sizeof(wmi_pdev_set_ant_ctrl_chain); |
| 11876 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11877 | |
| 11878 | if (!buf) { |
| 11879 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11880 | return QDF_STATUS_E_NOMEM; |
| 11881 | } |
| 11882 | |
| 11883 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11884 | qdf_mem_zero(buf_ptr, len); |
| 11885 | cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr; |
| 11886 | |
| 11887 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11888 | WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param, |
| 11889 | WMITLV_GET_STRUCT_TLVLEN( |
| 11890 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param)); |
| 11891 | |
| 11892 | cmd->antCtrlCommon1 = param->ant_ctrl_common1; |
| 11893 | cmd->antCtrlCommon2 = param->ant_ctrl_common2; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11894 | cmd->mac_id = |
| 11895 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11896 | |
| 11897 | /* TLV indicating array of structures to follow */ |
| 11898 | buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param); |
| 11899 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11900 | sizeof(wmi_pdev_set_ant_ctrl_chain)); |
| 11901 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11902 | ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr; |
| 11903 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11904 | ctrl_chain->pdev_id = |
| 11905 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11906 | ctrl_chain->antCtrlChain = param->antCtrlChain; |
| 11907 | |
| 11908 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11909 | WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) { |
| 11910 | wmi_buf_free(buf); |
| 11911 | return QDF_STATUS_E_FAILURE; |
| 11912 | } |
| 11913 | |
| 11914 | return QDF_STATUS_SUCCESS; |
| 11915 | } |
| 11916 | |
| 11917 | /** |
| 11918 | * send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna |
| 11919 | * training information function |
| 11920 | * @param wmi_handle : handle to WMI. |
| 11921 | * @macaddr : vdev mac address |
| 11922 | * @param param : pointer to tx antenna param |
| 11923 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11924 | */ |
| 11925 | static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv( |
| 11926 | wmi_unified_t wmi_handle, |
| 11927 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11928 | struct smart_ant_training_info_params *param) |
| 11929 | { |
| 11930 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd; |
| 11931 | wmi_peer_smart_ant_set_train_antenna_param *train_param; |
| 11932 | wmi_buf_t buf; |
| 11933 | uint8_t *buf_ptr; |
| 11934 | int32_t len = 0; |
| 11935 | QDF_STATUS ret; |
| 11936 | int loop; |
| 11937 | |
| 11938 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11939 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 11940 | sizeof(wmi_peer_smart_ant_set_train_antenna_param); |
| 11941 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11942 | |
| 11943 | if (!buf) { |
| 11944 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11945 | return QDF_STATUS_E_NOMEM; |
| 11946 | } |
| 11947 | |
| 11948 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11949 | qdf_mem_zero(buf_ptr, len); |
| 11950 | cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr; |
| 11951 | |
| 11952 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11953 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param, |
| 11954 | WMITLV_GET_STRUCT_TLVLEN( |
| 11955 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param)); |
| 11956 | |
| 11957 | cmd->vdev_id = param->vdev_id; |
| 11958 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11959 | cmd->num_pkts = param->numpkts; |
| 11960 | |
| 11961 | buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param); |
| 11962 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11963 | sizeof(wmi_peer_smart_ant_set_train_antenna_param) * |
| 11964 | WMI_SMART_ANT_MAX_RATE_SERIES); |
| 11965 | |
| 11966 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11967 | train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr; |
| 11968 | |
| 11969 | for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) { |
| 11970 | WMITLV_SET_HDR(&train_param->tlv_header, |
| 11971 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param, |
| 11972 | WMITLV_GET_STRUCT_TLVLEN( |
| 11973 | wmi_peer_smart_ant_set_train_antenna_param)); |
| 11974 | train_param->train_rate_series = param->rate_array[loop]; |
| 11975 | train_param->train_antenna_series = param->antenna_array[loop]; |
| 11976 | train_param->rc_flags = 0; |
| 11977 | WMI_LOGI(FL("Series number:%d\n"), loop); |
| 11978 | WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"), |
| 11979 | train_param->train_rate_series, |
| 11980 | train_param->train_antenna_series); |
| 11981 | train_param++; |
| 11982 | } |
| 11983 | |
| 11984 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11985 | buf, |
| 11986 | len, |
| 11987 | WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID); |
| 11988 | |
| 11989 | if (ret != 0) { |
| 11990 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11991 | wmi_buf_free(buf); |
| 11992 | return QDF_STATUS_E_FAILURE; |
| 11993 | } |
| 11994 | |
| 11995 | return ret; |
| 11996 | } |
| 11997 | |
| 11998 | /** |
| 11999 | * send_smart_ant_set_node_config_cmd_tlv() - WMI set node |
| 12000 | * configuration function |
| 12001 | * @param wmi_handle : handle to WMI. |
| 12002 | * @macaddr : vdev mad address |
| 12003 | * @param param : pointer to tx antenna param |
| 12004 | * |
| 12005 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 12006 | */ |
| 12007 | static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv( |
| 12008 | wmi_unified_t wmi_handle, |
| 12009 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 12010 | struct smart_ant_node_config_params *param) |
| 12011 | { |
| 12012 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd; |
| 12013 | wmi_buf_t buf; |
| 12014 | uint8_t *buf_ptr; |
| 12015 | int32_t len = 0, args_tlv_len; |
| 12016 | int ret; |
| 12017 | int i = 0; |
| 12018 | A_UINT32 *node_config_args; |
| 12019 | |
| 12020 | args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(A_UINT32); |
| 12021 | len = sizeof(*cmd) + args_tlv_len; |
| 12022 | |
| 12023 | if ((param->args_count == 0)) { |
| 12024 | WMI_LOGE("%s: Can't send a command with %d arguments\n", |
| 12025 | __func__, param->args_count); |
| 12026 | return QDF_STATUS_E_FAILURE; |
| 12027 | } |
| 12028 | |
| 12029 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12030 | if (!buf) { |
| 12031 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 12032 | return QDF_STATUS_E_NOMEM; |
| 12033 | } |
| 12034 | |
| 12035 | cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *) |
| 12036 | wmi_buf_data(buf); |
| 12037 | buf_ptr = (uint8_t *)cmd; |
| 12038 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12039 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param, |
| 12040 | WMITLV_GET_STRUCT_TLVLEN( |
| 12041 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param)); |
| 12042 | cmd->vdev_id = param->vdev_id; |
| 12043 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 12044 | cmd->cmd_id = param->cmd_id; |
| 12045 | cmd->args_count = param->args_count; |
| 12046 | buf_ptr += sizeof( |
| 12047 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param); |
| 12048 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 12049 | (cmd->args_count * sizeof(A_UINT32))); |
| 12050 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12051 | node_config_args = (A_UINT32 *)buf_ptr; |
| 12052 | |
| 12053 | for (i = 0; i < param->args_count; i++) { |
| 12054 | node_config_args[i] = param->args_arr[i]; |
| 12055 | WMI_LOGI("%d", param->args_arr[i]); |
| 12056 | } |
| 12057 | |
| 12058 | ret = wmi_unified_cmd_send(wmi_handle, |
| 12059 | buf, |
| 12060 | len, |
| 12061 | WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID); |
| 12062 | |
| 12063 | if (ret != 0) { |
| 12064 | WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n", |
| 12065 | __func__, param->cmd_id, macaddr[0], |
| 12066 | macaddr[1], macaddr[2], macaddr[3], |
| 12067 | macaddr[4], macaddr[5], ret); |
| 12068 | wmi_buf_free(buf); |
| 12069 | } |
| 12070 | |
| 12071 | return ret; |
| 12072 | } |
| 12073 | |
| 12074 | /** |
| 12075 | * send_set_atf_cmd_tlv() - send set atf command to fw |
| 12076 | * @wmi_handle: wmi handle |
| 12077 | * @param: pointer to set atf param |
| 12078 | * |
| 12079 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 12080 | */ |
| 12081 | static QDF_STATUS |
| 12082 | send_set_atf_cmd_tlv(wmi_unified_t wmi_handle, |
| 12083 | struct set_atf_params *param) |
| 12084 | { |
| 12085 | wmi_atf_peer_info *peer_info; |
| 12086 | wmi_peer_atf_request_fixed_param *cmd; |
| 12087 | wmi_buf_t buf; |
| 12088 | uint8_t *buf_ptr; |
| 12089 | int i; |
| 12090 | int32_t len = 0; |
| 12091 | QDF_STATUS retval; |
| 12092 | |
| 12093 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 12094 | len += param->num_peers * sizeof(wmi_atf_peer_info); |
| 12095 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12096 | if (!buf) { |
| 12097 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 12098 | return QDF_STATUS_E_FAILURE; |
| 12099 | } |
| 12100 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 12101 | cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr; |
| 12102 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12103 | WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param, |
| 12104 | WMITLV_GET_STRUCT_TLVLEN( |
| 12105 | wmi_peer_atf_request_fixed_param)); |
| 12106 | cmd->num_peers = param->num_peers; |
| 12107 | |
| 12108 | buf_ptr += sizeof(*cmd); |
| 12109 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12110 | sizeof(wmi_atf_peer_info) * |
| 12111 | cmd->num_peers); |
| 12112 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12113 | peer_info = (wmi_atf_peer_info *)buf_ptr; |
| 12114 | |
| 12115 | for (i = 0; i < cmd->num_peers; i++) { |
| 12116 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 12117 | WMITLV_TAG_STRUC_wmi_atf_peer_info, |
| 12118 | WMITLV_GET_STRUCT_TLVLEN( |
| 12119 | wmi_atf_peer_info)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 12120 | qdf_mem_copy(&(peer_info->peer_macaddr), |
| 12121 | &(param->peer_info[i].peer_macaddr), |
| 12122 | sizeof(wmi_mac_addr)); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 12123 | peer_info->atf_units = param->peer_info[i].percentage_peer; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 12124 | peer_info->vdev_id = param->peer_info[i].vdev_id; |
| 12125 | peer_info->pdev_id = |
| 12126 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12127 | param->peer_info[i].pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 12128 | /* |
| 12129 | * TLV definition for peer atf request fixed param combines |
| 12130 | * extension stats. Legacy FW for WIN (Non-TLV) has peer atf |
| 12131 | * stats and atf extension stats as two different |
| 12132 | * implementations. |
| 12133 | * Need to discuss with FW on this. |
| 12134 | * |
| 12135 | * peer_info->atf_groupid = param->peer_ext_info[i].group_index; |
| 12136 | * peer_info->atf_units_reserved = |
| 12137 | * param->peer_ext_info[i].atf_index_reserved; |
| 12138 | */ |
| 12139 | peer_info++; |
| 12140 | } |
| 12141 | |
| 12142 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12143 | WMI_PEER_ATF_REQUEST_CMDID); |
| 12144 | |
| 12145 | if (retval != QDF_STATUS_SUCCESS) { |
| 12146 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 12147 | wmi_buf_free(buf); |
| 12148 | } |
| 12149 | |
| 12150 | return retval; |
| 12151 | } |
| 12152 | |
| 12153 | /** |
| 12154 | * send_vdev_set_fwtest_param_cmd_tlv() - send fwtest param in fw |
| 12155 | * @wmi_handle: wmi handle |
| 12156 | * @param: pointer to hold fwtest param |
| 12157 | * |
| 12158 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 12159 | */ |
| 12160 | static QDF_STATUS send_vdev_set_fwtest_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 12161 | struct set_fwtest_params *param) |
| 12162 | { |
| 12163 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 12164 | wmi_buf_t buf; |
| 12165 | int32_t len = sizeof(*cmd); |
| 12166 | |
| 12167 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12168 | |
| 12169 | if (!buf) { |
| 12170 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 12171 | return QDF_STATUS_E_FAILURE; |
| 12172 | } |
| 12173 | |
| 12174 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 12175 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12176 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 12177 | WMITLV_GET_STRUCT_TLVLEN( |
| 12178 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 12179 | cmd->param_id = param->arg; |
| 12180 | cmd->param_value = param->value; |
| 12181 | |
| 12182 | if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FWTEST_CMDID)) { |
| 12183 | WMI_LOGE("Setting FW test param failed\n"); |
| 12184 | wmi_buf_free(buf); |
| 12185 | return QDF_STATUS_E_FAILURE; |
| 12186 | } |
| 12187 | |
| 12188 | return QDF_STATUS_SUCCESS; |
| 12189 | } |
| 12190 | |
| 12191 | /** |
| 12192 | * send_set_qboost_param_cmd_tlv() - send set qboost command to fw |
| 12193 | * @wmi_handle: wmi handle |
| 12194 | * @param: pointer to qboost params |
| 12195 | * @macaddr: vdev mac address |
| 12196 | * |
| 12197 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 12198 | */ |
| 12199 | static QDF_STATUS |
| 12200 | send_set_qboost_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 12201 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 12202 | struct set_qboost_params *param) |
| 12203 | { |
| 12204 | WMI_QBOOST_CFG_CMD_fixed_param *cmd; |
| 12205 | wmi_buf_t buf; |
| 12206 | int32_t len; |
| 12207 | QDF_STATUS ret; |
| 12208 | |
| 12209 | len = sizeof(*cmd); |
| 12210 | |
| 12211 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12212 | if (!buf) { |
| 12213 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12214 | return QDF_STATUS_E_FAILURE; |
| 12215 | } |
| 12216 | |
| 12217 | cmd = (WMI_QBOOST_CFG_CMD_fixed_param *)wmi_buf_data(buf); |
| 12218 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12219 | WMITLV_TAG_STRUC_WMI_QBOOST_CFG_CMD_fixed_param, |
| 12220 | WMITLV_GET_STRUCT_TLVLEN( |
| 12221 | WMI_QBOOST_CFG_CMD_fixed_param)); |
| 12222 | cmd->vdev_id = param->vdev_id; |
| 12223 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 12224 | cmd->qb_enable = param->value; |
| 12225 | |
| 12226 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 12227 | WMI_QBOOST_CFG_CMDID); |
| 12228 | |
| 12229 | if (ret != 0) { |
| 12230 | WMI_LOGE("Setting qboost cmd failed\n"); |
| 12231 | wmi_buf_free(buf); |
| 12232 | } |
| 12233 | |
| 12234 | return ret; |
| 12235 | } |
| 12236 | |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 12237 | /** |
| 12238 | * send_gpio_config_cmd_tlv() - send gpio config to fw |
| 12239 | * @wmi_handle: wmi handle |
| 12240 | * @param: pointer to hold gpio config param |
| 12241 | * |
| 12242 | * Return: 0 for success or error code |
| 12243 | */ |
| 12244 | static QDF_STATUS |
| 12245 | send_gpio_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 12246 | struct gpio_config_params *param) |
| 12247 | { |
| 12248 | wmi_gpio_config_cmd_fixed_param *cmd; |
| 12249 | wmi_buf_t buf; |
| 12250 | int32_t len; |
| 12251 | QDF_STATUS ret; |
| 12252 | |
| 12253 | len = sizeof(*cmd); |
| 12254 | |
| 12255 | /* Sanity Checks */ |
| 12256 | if (param->pull_type > WMI_GPIO_PULL_DOWN || |
| 12257 | param->intr_mode > WMI_GPIO_INTTYPE_LEVEL_HIGH) { |
| 12258 | return QDF_STATUS_E_FAILURE; |
| 12259 | } |
| 12260 | |
| 12261 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12262 | if (!buf) { |
| 12263 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12264 | return QDF_STATUS_E_FAILURE; |
| 12265 | } |
| 12266 | |
| 12267 | cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 12268 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12269 | WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param, |
| 12270 | WMITLV_GET_STRUCT_TLVLEN( |
| 12271 | wmi_gpio_config_cmd_fixed_param)); |
| 12272 | cmd->gpio_num = param->gpio_num; |
| 12273 | cmd->input = param->input; |
| 12274 | cmd->pull_type = param->pull_type; |
| 12275 | cmd->intr_mode = param->intr_mode; |
| 12276 | |
| 12277 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 12278 | WMI_GPIO_CONFIG_CMDID); |
| 12279 | |
| 12280 | if (ret != 0) { |
| 12281 | WMI_LOGE("Sending GPIO config cmd failed\n"); |
| 12282 | wmi_buf_free(buf); |
| 12283 | } |
| 12284 | |
| 12285 | return ret; |
| 12286 | } |
| 12287 | |
| 12288 | /** |
| 12289 | * send_gpio_output_cmd_tlv() - send gpio output to fw |
| 12290 | * @wmi_handle: wmi handle |
| 12291 | * @param: pointer to hold gpio output param |
| 12292 | * |
| 12293 | * Return: 0 for success or error code |
| 12294 | */ |
| 12295 | static QDF_STATUS |
| 12296 | send_gpio_output_cmd_tlv(wmi_unified_t wmi_handle, |
| 12297 | struct gpio_output_params *param) |
| 12298 | { |
| 12299 | wmi_gpio_output_cmd_fixed_param *cmd; |
| 12300 | wmi_buf_t buf; |
| 12301 | int32_t len; |
| 12302 | QDF_STATUS ret; |
| 12303 | |
| 12304 | len = sizeof(*cmd); |
| 12305 | |
| 12306 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12307 | if (!buf) { |
| 12308 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12309 | return QDF_STATUS_E_FAILURE; |
| 12310 | } |
| 12311 | |
| 12312 | cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf); |
| 12313 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12314 | WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param, |
| 12315 | WMITLV_GET_STRUCT_TLVLEN( |
| 12316 | wmi_gpio_output_cmd_fixed_param)); |
| 12317 | cmd->gpio_num = param->gpio_num; |
| 12318 | cmd->set = param->set; |
| 12319 | |
| 12320 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 12321 | WMI_GPIO_OUTPUT_CMDID); |
| 12322 | |
| 12323 | if (ret != 0) { |
| 12324 | WMI_LOGE("Sending GPIO output cmd failed\n"); |
| 12325 | wmi_buf_free(buf); |
| 12326 | } |
| 12327 | |
| 12328 | return ret; |
| 12329 | |
| 12330 | } |
| 12331 | |
| 12332 | /** |
| 12333 | * send_phyerr_disable_cmd_tlv() - WMI phyerr disable function |
| 12334 | * |
| 12335 | * @param wmi_handle : handle to WMI. |
| 12336 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 12337 | */ |
| 12338 | static QDF_STATUS send_phyerr_disable_cmd_tlv(wmi_unified_t wmi_handle) |
| 12339 | { |
| 12340 | wmi_pdev_dfs_disable_cmd_fixed_param *cmd; |
| 12341 | wmi_buf_t buf; |
| 12342 | QDF_STATUS ret; |
| 12343 | int32_t len; |
| 12344 | |
| 12345 | len = sizeof(*cmd); |
| 12346 | |
| 12347 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12348 | if (!buf) { |
| 12349 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12350 | return QDF_STATUS_E_FAILURE; |
| 12351 | } |
| 12352 | |
| 12353 | cmd = (wmi_pdev_dfs_disable_cmd_fixed_param *)wmi_buf_data(buf); |
| 12354 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12355 | WMITLV_TAG_STRUC_wmi_pdev_dfs_disable_cmd_fixed_param, |
| 12356 | WMITLV_GET_STRUCT_TLVLEN( |
| 12357 | wmi_pdev_dfs_disable_cmd_fixed_param)); |
| 12358 | /* Filling it with WMI_PDEV_ID_SOC for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12359 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12360 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 12361 | |
| 12362 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 12363 | WMI_PDEV_DFS_DISABLE_CMDID); |
| 12364 | |
| 12365 | if (ret != 0) { |
| 12366 | WMI_LOGE("Sending PDEV DFS disable cmd failed\n"); |
| 12367 | wmi_buf_free(buf); |
| 12368 | } |
| 12369 | |
| 12370 | return ret; |
| 12371 | } |
| 12372 | |
| 12373 | /** |
| 12374 | * send_phyerr_enable_cmd_tlv() - WMI phyerr disable function |
| 12375 | * |
| 12376 | * @param wmi_handle : handle to WMI. |
| 12377 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 12378 | */ |
| 12379 | static QDF_STATUS send_phyerr_enable_cmd_tlv(wmi_unified_t wmi_handle) |
| 12380 | { |
| 12381 | wmi_pdev_dfs_enable_cmd_fixed_param *cmd; |
| 12382 | wmi_buf_t buf; |
| 12383 | QDF_STATUS ret; |
| 12384 | int32_t len; |
| 12385 | |
| 12386 | len = sizeof(*cmd); |
| 12387 | |
| 12388 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12389 | if (!buf) { |
| 12390 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12391 | return QDF_STATUS_E_FAILURE; |
| 12392 | } |
| 12393 | |
| 12394 | cmd = (wmi_pdev_dfs_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 12395 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12396 | WMITLV_TAG_STRUC_wmi_pdev_dfs_enable_cmd_fixed_param, |
| 12397 | WMITLV_GET_STRUCT_TLVLEN( |
| 12398 | wmi_pdev_dfs_enable_cmd_fixed_param)); |
| 12399 | /* Reserved for future use */ |
| 12400 | cmd->reserved0 = 0; |
| 12401 | |
| 12402 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 12403 | WMI_PDEV_DFS_ENABLE_CMDID); |
| 12404 | |
| 12405 | if (ret != 0) { |
| 12406 | WMI_LOGE("Sending PDEV DFS enable cmd failed\n"); |
| 12407 | wmi_buf_free(buf); |
| 12408 | } |
| 12409 | |
| 12410 | return ret; |
| 12411 | } |
| 12412 | |
| 12413 | /** |
Sathish Kumar | 0ff69e4 | 2017-11-02 10:44:39 +0530 | [diff] [blame] | 12414 | * send_periodic_chan_stats_config_cmd_tlv() - send periodic chan stats cmd |
| 12415 | * to fw |
| 12416 | * @wmi_handle: wmi handle |
| 12417 | * @param: pointer to hold periodic chan stats param |
| 12418 | * |
| 12419 | * Return: 0 for success or error code |
| 12420 | */ |
| 12421 | static QDF_STATUS |
| 12422 | send_periodic_chan_stats_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 12423 | struct periodic_chan_stats_params *param) |
| 12424 | { |
| 12425 | wmi_set_periodic_channel_stats_config_fixed_param *cmd; |
| 12426 | wmi_buf_t buf; |
| 12427 | QDF_STATUS ret; |
| 12428 | int32_t len; |
| 12429 | |
| 12430 | len = sizeof(*cmd); |
| 12431 | |
| 12432 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12433 | if (!buf) { |
| 12434 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12435 | return QDF_STATUS_E_FAILURE; |
| 12436 | } |
| 12437 | |
| 12438 | cmd = (wmi_set_periodic_channel_stats_config_fixed_param *) |
| 12439 | wmi_buf_data(buf); |
| 12440 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12441 | WMITLV_TAG_STRUC_wmi_set_periodic_channel_stats_config_fixed_param, |
| 12442 | WMITLV_GET_STRUCT_TLVLEN( |
| 12443 | wmi_set_periodic_channel_stats_config_fixed_param)); |
| 12444 | cmd->enable = param->enable; |
| 12445 | cmd->stats_period = param->stats_period; |
| 12446 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12447 | param->pdev_id); |
| 12448 | |
| 12449 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 12450 | WMI_SET_PERIODIC_CHANNEL_STATS_CONFIG_CMDID); |
| 12451 | |
| 12452 | if (ret != 0) { |
| 12453 | WMI_LOGE("Sending periodic chan stats config failed"); |
| 12454 | wmi_buf_free(buf); |
| 12455 | } |
| 12456 | |
| 12457 | return ret; |
| 12458 | } |
| 12459 | |
| 12460 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 12461 | * send_nf_dbr_dbm_info_get_cmd_tlv() - send request to get nf to fw |
| 12462 | * @wmi_handle: wmi handle |
| 12463 | * |
| 12464 | * Return: 0 for success or error code |
| 12465 | */ |
| 12466 | static QDF_STATUS |
| 12467 | send_nf_dbr_dbm_info_get_cmd_tlv(wmi_unified_t wmi_handle) |
| 12468 | { |
| 12469 | wmi_buf_t buf; |
| 12470 | QDF_STATUS ret; |
| 12471 | |
| 12472 | buf = wmi_buf_alloc(wmi_handle, 0); |
| 12473 | if (buf == NULL) |
| 12474 | return QDF_STATUS_E_NOMEM; |
| 12475 | |
| 12476 | ret = wmi_unified_cmd_send(wmi_handle, buf, 0, |
| 12477 | WMI_PDEV_GET_NFCAL_POWER_CMDID); |
| 12478 | if (ret != 0) { |
| 12479 | WMI_LOGE("Sending get nfcal power cmd failed\n"); |
| 12480 | wmi_buf_free(buf); |
| 12481 | } |
| 12482 | |
| 12483 | return ret; |
| 12484 | } |
| 12485 | |
| 12486 | /** |
| 12487 | * send_set_ht_ie_cmd_tlv() - send ht ie command to fw |
| 12488 | * @wmi_handle: wmi handle |
| 12489 | * @param: pointer to ht ie param |
| 12490 | * |
| 12491 | * Return: 0 for success or error code |
| 12492 | */ |
| 12493 | static QDF_STATUS |
| 12494 | send_set_ht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 12495 | struct ht_ie_params *param) |
| 12496 | { |
| 12497 | wmi_pdev_set_ht_ie_cmd_fixed_param *cmd; |
| 12498 | wmi_buf_t buf; |
| 12499 | QDF_STATUS ret; |
| 12500 | int32_t len; |
| 12501 | uint8_t *buf_ptr; |
| 12502 | |
| 12503 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 12504 | roundup(param->ie_len, sizeof(uint32_t)); |
| 12505 | |
| 12506 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12507 | if (!buf) { |
| 12508 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12509 | return QDF_STATUS_E_FAILURE; |
| 12510 | } |
| 12511 | |
| 12512 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 12513 | cmd = (wmi_pdev_set_ht_ie_cmd_fixed_param *)buf_ptr; |
| 12514 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12515 | WMITLV_TAG_STRUC_wmi_pdev_set_ht_ie_cmd_fixed_param, |
| 12516 | WMITLV_GET_STRUCT_TLVLEN( |
| 12517 | wmi_pdev_set_ht_ie_cmd_fixed_param)); |
| 12518 | cmd->reserved0 = 0; |
| 12519 | cmd->ie_len = param->ie_len; |
| 12520 | cmd->tx_streams = param->tx_streams; |
| 12521 | cmd->rx_streams = param->rx_streams; |
| 12522 | |
| 12523 | buf_ptr += sizeof(*cmd); |
| 12524 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 12525 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12526 | if (param->ie_len) |
| 12527 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 12528 | cmd->ie_len); |
| 12529 | |
| 12530 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12531 | WMI_PDEV_SET_HT_CAP_IE_CMDID); |
| 12532 | |
| 12533 | if (ret != 0) { |
| 12534 | WMI_LOGE("Sending set ht ie cmd failed\n"); |
| 12535 | wmi_buf_free(buf); |
| 12536 | } |
| 12537 | |
| 12538 | return ret; |
| 12539 | } |
| 12540 | |
| 12541 | /** |
| 12542 | * send_set_vht_ie_cmd_tlv() - send vht ie command to fw |
| 12543 | * @wmi_handle: wmi handle |
| 12544 | * @param: pointer to vht ie param |
| 12545 | * |
| 12546 | * Return: 0 for success or error code |
| 12547 | */ |
| 12548 | static QDF_STATUS |
| 12549 | send_set_vht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 12550 | struct vht_ie_params *param) |
| 12551 | { |
| 12552 | wmi_pdev_set_vht_ie_cmd_fixed_param *cmd; |
| 12553 | wmi_buf_t buf; |
| 12554 | QDF_STATUS ret; |
| 12555 | int32_t len; |
| 12556 | uint8_t *buf_ptr; |
| 12557 | |
| 12558 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 12559 | roundup(param->ie_len, sizeof(uint32_t)); |
| 12560 | |
| 12561 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12562 | if (!buf) { |
| 12563 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12564 | return QDF_STATUS_E_FAILURE; |
| 12565 | } |
| 12566 | |
| 12567 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 12568 | cmd = (wmi_pdev_set_vht_ie_cmd_fixed_param *)buf_ptr; |
| 12569 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12570 | WMITLV_TAG_STRUC_wmi_pdev_set_vht_ie_cmd_fixed_param, |
| 12571 | WMITLV_GET_STRUCT_TLVLEN( |
| 12572 | wmi_pdev_set_vht_ie_cmd_fixed_param)); |
| 12573 | cmd->reserved0 = 0; |
| 12574 | cmd->ie_len = param->ie_len; |
| 12575 | cmd->tx_streams = param->tx_streams; |
| 12576 | cmd->rx_streams = param->rx_streams; |
| 12577 | |
| 12578 | buf_ptr += sizeof(*cmd); |
| 12579 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 12580 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12581 | if (param->ie_len) |
| 12582 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 12583 | cmd->ie_len); |
| 12584 | |
| 12585 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12586 | WMI_PDEV_SET_VHT_CAP_IE_CMDID); |
| 12587 | |
| 12588 | if (ret != 0) { |
| 12589 | WMI_LOGE("Sending set vht ie cmd failed\n"); |
| 12590 | wmi_buf_free(buf); |
| 12591 | } |
| 12592 | |
| 12593 | return ret; |
| 12594 | } |
| 12595 | |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12596 | /** |
| 12597 | * send_set_quiet_mode_cmd_tlv() - send set quiet mode command to fw |
| 12598 | * @wmi_handle: wmi handle |
| 12599 | * @param: pointer to quiet mode params |
| 12600 | * |
| 12601 | * Return: 0 for success or error code |
| 12602 | */ |
| 12603 | static QDF_STATUS |
| 12604 | send_set_quiet_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 12605 | struct set_quiet_mode_params *param) |
| 12606 | { |
| 12607 | wmi_pdev_set_quiet_cmd_fixed_param *quiet_cmd; |
| 12608 | wmi_buf_t buf; |
| 12609 | QDF_STATUS ret; |
| 12610 | int32_t len; |
| 12611 | |
| 12612 | len = sizeof(*quiet_cmd); |
| 12613 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12614 | if (!buf) { |
| 12615 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12616 | return QDF_STATUS_E_FAILURE; |
| 12617 | } |
| 12618 | |
| 12619 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 12620 | WMITLV_SET_HDR(&quiet_cmd->tlv_header, |
| 12621 | WMITLV_TAG_STRUC_wmi_pdev_set_quiet_cmd_fixed_param, |
| 12622 | WMITLV_GET_STRUCT_TLVLEN( |
| 12623 | wmi_pdev_set_quiet_cmd_fixed_param)); |
| 12624 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 12625 | quiet_cmd->enabled = param->enabled; |
| 12626 | quiet_cmd->period = (param->period)*(param->intval); |
| 12627 | quiet_cmd->duration = param->duration; |
| 12628 | quiet_cmd->next_start = param->offset; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12629 | quiet_cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12630 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12631 | |
| 12632 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12633 | WMI_PDEV_SET_QUIET_MODE_CMDID); |
| 12634 | |
| 12635 | if (ret != 0) { |
| 12636 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 12637 | wmi_buf_free(buf); |
| 12638 | } |
| 12639 | |
| 12640 | return ret; |
| 12641 | } |
| 12642 | |
| 12643 | /** |
| 12644 | * send_set_bwf_cmd_tlv() - send set bwf command to fw |
| 12645 | * @wmi_handle: wmi handle |
| 12646 | * @param: pointer to set bwf param |
| 12647 | * |
| 12648 | * Return: 0 for success or error code |
| 12649 | */ |
| 12650 | static QDF_STATUS |
| 12651 | send_set_bwf_cmd_tlv(wmi_unified_t wmi_handle, |
| 12652 | struct set_bwf_params *param) |
| 12653 | { |
| 12654 | wmi_bwf_peer_info *peer_info; |
| 12655 | wmi_peer_bwf_request_fixed_param *cmd; |
| 12656 | wmi_buf_t buf; |
| 12657 | QDF_STATUS retval; |
| 12658 | int32_t len; |
| 12659 | uint8_t *buf_ptr; |
| 12660 | int i; |
| 12661 | |
| 12662 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 12663 | len += param->num_peers * sizeof(wmi_bwf_peer_info); |
| 12664 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12665 | if (!buf) { |
| 12666 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 12667 | return QDF_STATUS_E_FAILURE; |
| 12668 | } |
| 12669 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 12670 | cmd = (wmi_peer_bwf_request_fixed_param *)buf_ptr; |
| 12671 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12672 | WMITLV_TAG_STRUC_wmi_peer_bwf_request_fixed_param, |
| 12673 | WMITLV_GET_STRUCT_TLVLEN( |
| 12674 | wmi_peer_bwf_request_fixed_param)); |
| 12675 | cmd->num_peers = param->num_peers; |
| 12676 | |
| 12677 | buf_ptr += sizeof(*cmd); |
| 12678 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12679 | sizeof(wmi_bwf_peer_info) * |
| 12680 | cmd->num_peers); |
| 12681 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12682 | peer_info = (wmi_bwf_peer_info *)buf_ptr; |
| 12683 | |
| 12684 | for (i = 0; i < cmd->num_peers; i++) { |
| 12685 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 12686 | WMITLV_TAG_STRUC_wmi_bwf_peer_info, |
| 12687 | WMITLV_GET_STRUCT_TLVLEN(wmi_bwf_peer_info)); |
| 12688 | peer_info->bwf_guaranteed_bandwidth = |
| 12689 | param->peer_info[i].throughput; |
| 12690 | peer_info->bwf_max_airtime = |
| 12691 | param->peer_info[i].max_airtime; |
| 12692 | peer_info->bwf_peer_priority = |
| 12693 | param->peer_info[i].priority; |
| 12694 | qdf_mem_copy(&peer_info->peer_macaddr, |
| 12695 | ¶m->peer_info[i].peer_macaddr, |
| 12696 | sizeof(param->peer_info[i].peer_macaddr)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 12697 | peer_info->vdev_id = |
| 12698 | param->peer_info[i].vdev_id; |
| 12699 | peer_info->pdev_id = |
| 12700 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12701 | param->peer_info[i].pdev_id); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12702 | peer_info++; |
| 12703 | } |
| 12704 | |
| 12705 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12706 | WMI_PEER_BWF_REQUEST_CMDID); |
| 12707 | |
| 12708 | if (retval != QDF_STATUS_SUCCESS) { |
| 12709 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 12710 | wmi_buf_free(buf); |
| 12711 | } |
| 12712 | |
| 12713 | return retval; |
| 12714 | } |
| 12715 | |
| 12716 | /** |
| 12717 | * send_mcast_group_update_cmd_tlv() - send mcast group update cmd to fw |
| 12718 | * @wmi_handle: wmi handle |
| 12719 | * @param: pointer to hold mcast update param |
| 12720 | * |
| 12721 | * Return: 0 for success or error code |
| 12722 | */ |
| 12723 | static QDF_STATUS |
| 12724 | send_mcast_group_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 12725 | struct mcast_group_update_params *param) |
| 12726 | { |
| 12727 | wmi_peer_mcast_group_cmd_fixed_param *cmd; |
| 12728 | wmi_buf_t buf; |
| 12729 | QDF_STATUS ret; |
| 12730 | int32_t len; |
| 12731 | int offset = 0; |
| 12732 | static char dummymask[4] = { 0xFF, 0xFF, 0xFF, 0xFF}; |
| 12733 | |
| 12734 | len = sizeof(*cmd); |
| 12735 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12736 | if (!buf) { |
| 12737 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12738 | return QDF_STATUS_E_FAILURE; |
| 12739 | } |
| 12740 | cmd = (wmi_peer_mcast_group_cmd_fixed_param *)wmi_buf_data(buf); |
| 12741 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12742 | WMITLV_TAG_STRUC_wmi_peer_mcast_group_cmd_fixed_param, |
| 12743 | WMITLV_GET_STRUCT_TLVLEN( |
| 12744 | wmi_peer_mcast_group_cmd_fixed_param)); |
| 12745 | /* confirm the buffer is 4-byte aligned */ |
| 12746 | QDF_ASSERT((((size_t) cmd) & 0x3) == 0); |
| 12747 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 12748 | |
| 12749 | cmd->vdev_id = param->vap_id; |
| 12750 | /* construct the message assuming our endianness matches the target */ |
| 12751 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_ACTION_M & |
| 12752 | (param->action << WMI_PEER_MCAST_GROUP_FLAG_ACTION_S); |
| 12753 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_M & |
| 12754 | (param->wildcard << WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_S); |
| 12755 | if (param->is_action_delete) |
| 12756 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_DELETEALL_M; |
| 12757 | |
| 12758 | if (param->is_mcast_addr_len) |
| 12759 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_IPV6_M; |
| 12760 | |
| 12761 | if (param->is_filter_mode_snoop) |
| 12762 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_SRC_FILTER_EXCLUDE_M; |
| 12763 | |
| 12764 | /* unicast address spec only applies for non-wildcard cases */ |
| 12765 | if (!param->wildcard && param->ucast_mac_addr) { |
| 12766 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->ucast_mac_addr, |
| 12767 | &cmd->ucast_mac_addr); |
| 12768 | } |
Amar Singhal | 5593c90 | 2017-10-03 13:00:29 -0700 | [diff] [blame] | 12769 | |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12770 | if (param->mcast_ip_addr) { |
| 12771 | QDF_ASSERT(param->mcast_ip_addr_bytes <= |
| 12772 | sizeof(cmd->mcast_ip_addr)); |
| 12773 | offset = sizeof(cmd->mcast_ip_addr) - |
| 12774 | param->mcast_ip_addr_bytes; |
| 12775 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_addr) + offset, |
| 12776 | param->mcast_ip_addr, |
| 12777 | param->mcast_ip_addr_bytes); |
| 12778 | } |
| 12779 | if (!param->mask) |
| 12780 | param->mask = &dummymask[0]; |
| 12781 | |
| 12782 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_mask) + offset, |
| 12783 | param->mask, |
| 12784 | param->mcast_ip_addr_bytes); |
| 12785 | |
| 12786 | if (param->srcs && param->nsrcs) { |
| 12787 | cmd->num_filter_addr = param->nsrcs; |
| 12788 | QDF_ASSERT((param->nsrcs * param->mcast_ip_addr_bytes) <= |
| 12789 | sizeof(cmd->filter_addr)); |
| 12790 | |
| 12791 | qdf_mem_copy(((uint8_t *) &cmd->filter_addr), param->srcs, |
| 12792 | param->nsrcs * param->mcast_ip_addr_bytes); |
| 12793 | } |
| 12794 | |
| 12795 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12796 | WMI_PEER_MCAST_GROUP_CMDID); |
| 12797 | |
| 12798 | if (ret != QDF_STATUS_SUCCESS) { |
| 12799 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 12800 | wmi_buf_free(buf); |
| 12801 | } |
| 12802 | |
| 12803 | return ret; |
| 12804 | } |
| 12805 | |
| 12806 | /** |
| 12807 | * send_vdev_spectral_configure_cmd_tlv() - send VDEV spectral configure |
| 12808 | * command to fw |
| 12809 | * @wmi_handle: wmi handle |
| 12810 | * @param: pointer to hold spectral config parameter |
| 12811 | * |
| 12812 | * Return: 0 for success or error code |
| 12813 | */ |
| 12814 | static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle, |
| 12815 | struct vdev_spectral_configure_params *param) |
| 12816 | { |
| 12817 | wmi_vdev_spectral_configure_cmd_fixed_param *cmd; |
| 12818 | wmi_buf_t buf; |
| 12819 | QDF_STATUS ret; |
| 12820 | int32_t len; |
| 12821 | |
| 12822 | len = sizeof(*cmd); |
| 12823 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12824 | if (!buf) { |
| 12825 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12826 | return QDF_STATUS_E_FAILURE; |
| 12827 | } |
| 12828 | |
| 12829 | cmd = (wmi_vdev_spectral_configure_cmd_fixed_param *)wmi_buf_data(buf); |
| 12830 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12831 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param, |
| 12832 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 12833 | wmi_vdev_spectral_configure_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12834 | |
| 12835 | cmd->vdev_id = param->vdev_id; |
| 12836 | cmd->spectral_scan_count = param->count; |
| 12837 | cmd->spectral_scan_period = param->period; |
| 12838 | cmd->spectral_scan_priority = param->spectral_pri; |
| 12839 | cmd->spectral_scan_fft_size = param->fft_size; |
| 12840 | cmd->spectral_scan_gc_ena = param->gc_enable; |
| 12841 | cmd->spectral_scan_restart_ena = param->restart_enable; |
| 12842 | cmd->spectral_scan_noise_floor_ref = param->noise_floor_ref; |
| 12843 | cmd->spectral_scan_init_delay = param->init_delay; |
| 12844 | cmd->spectral_scan_nb_tone_thr = param->nb_tone_thr; |
| 12845 | cmd->spectral_scan_str_bin_thr = param->str_bin_thr; |
| 12846 | cmd->spectral_scan_wb_rpt_mode = param->wb_rpt_mode; |
| 12847 | cmd->spectral_scan_rssi_rpt_mode = param->rssi_rpt_mode; |
| 12848 | cmd->spectral_scan_rssi_thr = param->rssi_thr; |
| 12849 | cmd->spectral_scan_pwr_format = param->pwr_format; |
| 12850 | cmd->spectral_scan_rpt_mode = param->rpt_mode; |
| 12851 | cmd->spectral_scan_bin_scale = param->bin_scale; |
Shiva Krishna Pittala | 90ccf6c | 2017-12-18 16:39:20 +0530 | [diff] [blame] | 12852 | cmd->spectral_scan_dBm_adj = param->dbm_adj; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12853 | cmd->spectral_scan_chn_mask = param->chn_mask; |
| 12854 | |
| 12855 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12856 | WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID); |
| 12857 | |
| 12858 | if (ret != 0) { |
| 12859 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 12860 | wmi_buf_free(buf); |
| 12861 | } |
| 12862 | |
| 12863 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID\n", |
| 12864 | __func__); |
| 12865 | |
| 12866 | WMI_LOGI("vdev_id = %u\n" |
| 12867 | "spectral_scan_count = %u\n" |
| 12868 | "spectral_scan_period = %u\n" |
| 12869 | "spectral_scan_priority = %u\n" |
| 12870 | "spectral_scan_fft_size = %u\n" |
| 12871 | "spectral_scan_gc_ena = %u\n" |
| 12872 | "spectral_scan_restart_ena = %u\n" |
| 12873 | "spectral_scan_noise_floor_ref = %u\n" |
| 12874 | "spectral_scan_init_delay = %u\n" |
| 12875 | "spectral_scan_nb_tone_thr = %u\n" |
| 12876 | "spectral_scan_str_bin_thr = %u\n" |
| 12877 | "spectral_scan_wb_rpt_mode = %u\n" |
| 12878 | "spectral_scan_rssi_rpt_mode = %u\n" |
| 12879 | "spectral_scan_rssi_thr = %u\n" |
| 12880 | "spectral_scan_pwr_format = %u\n" |
| 12881 | "spectral_scan_rpt_mode = %u\n" |
| 12882 | "spectral_scan_bin_scale = %u\n" |
| 12883 | "spectral_scan_dBm_adj = %u\n" |
| 12884 | "spectral_scan_chn_mask = %u\n", |
| 12885 | param->vdev_id, |
| 12886 | param->count, |
| 12887 | param->period, |
| 12888 | param->spectral_pri, |
| 12889 | param->fft_size, |
| 12890 | param->gc_enable, |
| 12891 | param->restart_enable, |
| 12892 | param->noise_floor_ref, |
| 12893 | param->init_delay, |
| 12894 | param->nb_tone_thr, |
| 12895 | param->str_bin_thr, |
| 12896 | param->wb_rpt_mode, |
| 12897 | param->rssi_rpt_mode, |
| 12898 | param->rssi_thr, |
| 12899 | param->pwr_format, |
| 12900 | param->rpt_mode, |
| 12901 | param->bin_scale, |
Shiva Krishna Pittala | 90ccf6c | 2017-12-18 16:39:20 +0530 | [diff] [blame] | 12902 | param->dbm_adj, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12903 | param->chn_mask); |
| 12904 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 12905 | |
| 12906 | return ret; |
| 12907 | } |
| 12908 | |
| 12909 | /** |
| 12910 | * send_vdev_spectral_enable_cmd_tlv() - send VDEV spectral configure |
| 12911 | * command to fw |
| 12912 | * @wmi_handle: wmi handle |
| 12913 | * @param: pointer to hold spectral enable parameter |
| 12914 | * |
| 12915 | * Return: 0 for success or error code |
| 12916 | */ |
| 12917 | static QDF_STATUS send_vdev_spectral_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 12918 | struct vdev_spectral_enable_params *param) |
| 12919 | { |
| 12920 | wmi_vdev_spectral_enable_cmd_fixed_param *cmd; |
| 12921 | wmi_buf_t buf; |
| 12922 | QDF_STATUS ret; |
| 12923 | int32_t len; |
| 12924 | |
| 12925 | len = sizeof(*cmd); |
| 12926 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12927 | if (!buf) { |
| 12928 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12929 | return QDF_STATUS_E_FAILURE; |
| 12930 | } |
| 12931 | |
| 12932 | cmd = (wmi_vdev_spectral_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 12933 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12934 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param, |
| 12935 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 12936 | wmi_vdev_spectral_enable_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12937 | |
| 12938 | cmd->vdev_id = param->vdev_id; |
| 12939 | |
| 12940 | if (param->active_valid) { |
| 12941 | cmd->trigger_cmd = param->active ? 1 : 2; |
| 12942 | /* 1: Trigger, 2: Clear Trigger */ |
| 12943 | } else { |
| 12944 | cmd->trigger_cmd = 0; /* 0: Ignore */ |
| 12945 | } |
| 12946 | |
| 12947 | if (param->enabled_valid) { |
| 12948 | cmd->enable_cmd = param->enabled ? 1 : 2; |
| 12949 | /* 1: Enable 2: Disable */ |
| 12950 | } else { |
| 12951 | cmd->enable_cmd = 0; /* 0: Ignore */ |
| 12952 | } |
| 12953 | |
| 12954 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12955 | WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID); |
| 12956 | |
| 12957 | if (ret != 0) { |
| 12958 | WMI_LOGE("Sending scan enable CMD failed\n"); |
| 12959 | wmi_buf_free(buf); |
| 12960 | } |
| 12961 | |
| 12962 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID\n", __func__); |
| 12963 | |
| 12964 | WMI_LOGI("vdev_id = %u\n" |
| 12965 | "trigger_cmd = %u\n" |
| 12966 | "enable_cmd = %u\n", |
| 12967 | cmd->vdev_id, |
| 12968 | cmd->trigger_cmd, |
| 12969 | cmd->enable_cmd); |
| 12970 | |
| 12971 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 12972 | |
| 12973 | return ret; |
| 12974 | } |
| 12975 | |
| 12976 | /** |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 12977 | * send_thermal_mitigation_param_cmd_tlv() - configure thermal mitigation params |
| 12978 | * @param wmi_handle : handle to WMI. |
| 12979 | * @param param : pointer to hold thermal mitigation param |
| 12980 | * |
| 12981 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 12982 | */ |
| 12983 | static QDF_STATUS send_thermal_mitigation_param_cmd_tlv( |
| 12984 | wmi_unified_t wmi_handle, |
| 12985 | struct thermal_mitigation_params *param) |
| 12986 | { |
| 12987 | wmi_therm_throt_config_request_fixed_param *tt_conf = NULL; |
| 12988 | wmi_therm_throt_level_config_info *lvl_conf = NULL; |
| 12989 | wmi_buf_t buf = NULL; |
| 12990 | uint8_t *buf_ptr = NULL; |
| 12991 | int error; |
| 12992 | int32_t len; |
| 12993 | int i; |
| 12994 | |
| 12995 | len = sizeof(*tt_conf) + WMI_TLV_HDR_SIZE + |
| 12996 | THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info); |
| 12997 | |
| 12998 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12999 | if (!buf) { |
| 13000 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 13001 | return QDF_STATUS_E_NOMEM; |
| 13002 | } |
| 13003 | tt_conf = (wmi_therm_throt_config_request_fixed_param *) wmi_buf_data(buf); |
| 13004 | |
| 13005 | /* init fixed params */ |
| 13006 | WMITLV_SET_HDR(tt_conf, |
| 13007 | WMITLV_TAG_STRUC_wmi_therm_throt_config_request_fixed_param, |
| 13008 | (WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_config_request_fixed_param))); |
| 13009 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13010 | tt_conf->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13011 | param->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 13012 | tt_conf->enable = param->enable; |
| 13013 | tt_conf->dc = param->dc; |
| 13014 | tt_conf->dc_per_event = param->dc_per_event; |
| 13015 | tt_conf->therm_throt_levels = THERMAL_LEVELS; |
| 13016 | |
| 13017 | buf_ptr = (uint8_t *) ++tt_conf; |
| 13018 | /* init TLV params */ |
| 13019 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13020 | (THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info))); |
| 13021 | |
| 13022 | lvl_conf = (wmi_therm_throt_level_config_info *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 13023 | for (i = 0; i < THERMAL_LEVELS; i++) { |
| 13024 | WMITLV_SET_HDR(&lvl_conf->tlv_header, |
| 13025 | WMITLV_TAG_STRUC_wmi_therm_throt_level_config_info, |
| 13026 | WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_level_config_info)); |
| 13027 | lvl_conf->temp_lwm = param->levelconf[i].tmplwm; |
| 13028 | lvl_conf->temp_hwm = param->levelconf[i].tmphwm; |
| 13029 | lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; |
| 13030 | lvl_conf->prio = param->levelconf[i].priority; |
| 13031 | lvl_conf++; |
| 13032 | } |
| 13033 | |
| 13034 | error = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13035 | WMI_THERM_THROT_SET_CONF_CMDID); |
| 13036 | if (QDF_IS_STATUS_ERROR(error)) { |
| 13037 | wmi_buf_free(buf); |
| 13038 | WMI_LOGE("Failed to send WMI_THERM_THROT_SET_CONF_CMDID command"); |
| 13039 | } |
| 13040 | |
| 13041 | return error; |
| 13042 | } |
| 13043 | |
| 13044 | /** |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 13045 | * send_pdev_qvit_cmd_tlv() - send qvit command to fw |
| 13046 | * @wmi_handle: wmi handle |
| 13047 | * @param: pointer to pdev_qvit_params |
| 13048 | * |
| 13049 | * Return: 0 for success or error code |
| 13050 | */ |
| 13051 | static QDF_STATUS |
| 13052 | send_pdev_qvit_cmd_tlv(wmi_unified_t wmi_handle, |
| 13053 | struct pdev_qvit_params *param) |
| 13054 | { |
| 13055 | wmi_buf_t buf; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13056 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 13057 | uint8_t *cmd; |
| 13058 | static uint8_t msgref = 1; |
| 13059 | uint8_t segnumber = 0, seginfo, numsegments; |
| 13060 | uint16_t chunk_len, total_bytes; |
| 13061 | uint8_t *bufpos; |
| 13062 | QVIT_SEG_HDR_INFO_STRUCT seghdrinfo; |
| 13063 | |
| 13064 | bufpos = param->utf_payload; |
| 13065 | total_bytes = param->len; |
| 13066 | ASSERT(total_bytes / MAX_WMI_QVIT_LEN == |
| 13067 | (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN)); |
| 13068 | numsegments = (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN); |
| 13069 | |
| 13070 | if (param->len - (numsegments * MAX_WMI_QVIT_LEN)) |
| 13071 | numsegments++; |
| 13072 | |
| 13073 | while (param->len) { |
| 13074 | if (param->len > MAX_WMI_QVIT_LEN) |
| 13075 | chunk_len = MAX_WMI_QVIT_LEN; /* MAX messsage */ |
| 13076 | else |
| 13077 | chunk_len = param->len; |
| 13078 | |
| 13079 | buf = wmi_buf_alloc(wmi_handle, |
| 13080 | (chunk_len + sizeof(seghdrinfo) + |
| 13081 | WMI_TLV_HDR_SIZE)); |
| 13082 | if (!buf) { |
| 13083 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 13084 | return QDF_STATUS_E_NOMEM; |
| 13085 | } |
| 13086 | |
| 13087 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 13088 | |
| 13089 | seghdrinfo.len = total_bytes; |
| 13090 | seghdrinfo.msgref = msgref; |
| 13091 | seginfo = ((numsegments << 4) & 0xF0) | (segnumber & 0xF); |
| 13092 | seghdrinfo.segmentInfo = seginfo; |
| 13093 | |
| 13094 | segnumber++; |
| 13095 | |
| 13096 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 13097 | (chunk_len + sizeof(seghdrinfo))); |
| 13098 | cmd += WMI_TLV_HDR_SIZE; |
| 13099 | qdf_mem_copy(cmd, &seghdrinfo, sizeof(seghdrinfo)); |
| 13100 | qdf_mem_copy(&cmd[sizeof(seghdrinfo)], bufpos, chunk_len); |
| 13101 | |
| 13102 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 13103 | (chunk_len + sizeof(seghdrinfo) + |
| 13104 | WMI_TLV_HDR_SIZE), |
| 13105 | WMI_PDEV_QVIT_CMDID); |
| 13106 | |
| 13107 | if (ret != 0) { |
| 13108 | WMI_LOGE("Failed to send WMI_PDEV_QVIT_CMDID command"); |
| 13109 | wmi_buf_free(buf); |
| 13110 | break; |
| 13111 | } |
| 13112 | |
| 13113 | param->len -= chunk_len; |
| 13114 | bufpos += chunk_len; |
| 13115 | } |
| 13116 | msgref++; |
| 13117 | |
| 13118 | return ret; |
| 13119 | } |
| 13120 | |
| 13121 | /** |
| 13122 | * send_wmm_update_cmd_tlv() - send wmm update command to fw |
| 13123 | * @wmi_handle: wmi handle |
| 13124 | * @param: pointer to wmm update param |
| 13125 | * |
| 13126 | * Return: 0 for success or error code |
| 13127 | */ |
| 13128 | static QDF_STATUS |
| 13129 | send_wmm_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 13130 | struct wmm_update_params *param) |
| 13131 | { |
| 13132 | wmi_pdev_set_wmm_params_cmd_fixed_param *cmd; |
| 13133 | wmi_wmm_params *wmm_param; |
| 13134 | wmi_buf_t buf; |
| 13135 | QDF_STATUS ret; |
| 13136 | int32_t len; |
| 13137 | int ac = 0; |
| 13138 | struct wmi_host_wmeParams *wmep; |
| 13139 | uint8_t *buf_ptr; |
| 13140 | |
| 13141 | len = sizeof(*cmd) + (WME_NUM_AC * sizeof(*wmm_param)); |
| 13142 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13143 | if (!buf) { |
| 13144 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 13145 | return QDF_STATUS_E_FAILURE; |
| 13146 | } |
| 13147 | |
| 13148 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13149 | cmd = (wmi_pdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 13150 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13151 | WMITLV_TAG_STRUC_wmi_pdev_set_wmm_params_cmd_fixed_param, |
| 13152 | WMITLV_GET_STRUCT_TLVLEN |
| 13153 | (wmi_pdev_set_wmm_params_cmd_fixed_param)); |
| 13154 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13155 | cmd->reserved0 = WMI_HOST_PDEV_ID_SOC; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 13156 | |
| 13157 | buf_ptr += sizeof(wmi_pdev_set_wmm_params_cmd_fixed_param); |
| 13158 | |
| 13159 | for (ac = 0; ac < WME_NUM_AC; ac++) { |
| 13160 | wmep = ¶m->wmep_array[ac]; |
| 13161 | wmm_param = (wmi_wmm_params *)buf_ptr; |
| 13162 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 13163 | WMITLV_TAG_STRUC_wmi_wmm_params, |
| 13164 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_params)); |
| 13165 | wmm_param->aifs = wmep->wmep_aifsn; |
| 13166 | wmm_param->cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin); |
| 13167 | wmm_param->cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax); |
| 13168 | wmm_param->txoplimit = ATH_TXOP_TO_US(wmep->wmep_txopLimit); |
| 13169 | wmm_param->acm = wmep->wmep_acm; |
| 13170 | wmm_param->no_ack = wmep->wmep_noackPolicy; |
| 13171 | buf_ptr += sizeof(wmi_wmm_params); |
| 13172 | } |
| 13173 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13174 | WMI_PDEV_SET_WMM_PARAMS_CMDID); |
| 13175 | |
| 13176 | if (ret != 0) { |
| 13177 | WMI_LOGE("Sending WMM update CMD failed\n"); |
| 13178 | wmi_buf_free(buf); |
| 13179 | } |
| 13180 | |
| 13181 | return ret; |
| 13182 | } |
| 13183 | |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 13184 | /** |
| 13185 | * send_coex_config_cmd_tlv() - send coex config command to fw |
| 13186 | * @wmi_handle: wmi handle |
| 13187 | * @param: pointer to coex config param |
| 13188 | * |
| 13189 | * Return: 0 for success or error code |
| 13190 | */ |
| 13191 | static QDF_STATUS |
| 13192 | send_coex_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 13193 | struct coex_config_params *param) |
| 13194 | { |
| 13195 | WMI_COEX_CONFIG_CMD_fixed_param *cmd; |
| 13196 | wmi_buf_t buf; |
| 13197 | QDF_STATUS ret; |
| 13198 | int32_t len; |
| 13199 | |
| 13200 | len = sizeof(*cmd); |
| 13201 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13202 | if (!buf) { |
| 13203 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 13204 | return QDF_STATUS_E_FAILURE; |
| 13205 | } |
| 13206 | |
| 13207 | cmd = (WMI_COEX_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 13208 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13209 | WMITLV_TAG_STRUC_WMI_COEX_CONFIG_CMD_fixed_param, |
| 13210 | WMITLV_GET_STRUCT_TLVLEN( |
Sathish Kumar | 8458a05 | 2017-05-12 15:52:00 +0530 | [diff] [blame] | 13211 | WMI_COEX_CONFIG_CMD_fixed_param)); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 13212 | |
| 13213 | cmd->vdev_id = param->vdev_id; |
| 13214 | cmd->config_type = param->config_type; |
| 13215 | cmd->config_arg1 = param->config_arg1; |
| 13216 | cmd->config_arg2 = param->config_arg2; |
| 13217 | cmd->config_arg3 = param->config_arg3; |
| 13218 | cmd->config_arg4 = param->config_arg4; |
| 13219 | cmd->config_arg5 = param->config_arg5; |
| 13220 | cmd->config_arg6 = param->config_arg6; |
| 13221 | |
| 13222 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13223 | WMI_COEX_CONFIG_CMDID); |
| 13224 | |
| 13225 | if (ret != 0) { |
| 13226 | WMI_LOGE("Sending COEX CONFIG CMD failed\n"); |
| 13227 | wmi_buf_free(buf); |
| 13228 | } |
| 13229 | |
| 13230 | return ret; |
| 13231 | } |
| 13232 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 13233 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13234 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13235 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13236 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13237 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13238 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 13239 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 13240 | resource_cfg->num_offload_reorder_buffs = |
| 13241 | tgt_res_cfg->num_offload_reorder_buffs; |
| 13242 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 13243 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 13244 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 13245 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 13246 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 13247 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 13248 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 13249 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 13250 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 13251 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 13252 | resource_cfg->scan_max_pending_req = |
| 13253 | tgt_res_cfg->scan_max_pending_req; |
| 13254 | resource_cfg->bmiss_offload_max_vdev = |
| 13255 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 13256 | resource_cfg->roam_offload_max_vdev = |
| 13257 | tgt_res_cfg->roam_offload_max_vdev; |
| 13258 | resource_cfg->roam_offload_max_ap_profiles = |
| 13259 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 13260 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 13261 | resource_cfg->num_mcast_table_elems = |
| 13262 | tgt_res_cfg->num_mcast_table_elems; |
| 13263 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 13264 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 13265 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 13266 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 13267 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 13268 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 13269 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 13270 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 13271 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 13272 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 13273 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 13274 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 13275 | resource_cfg->num_tdls_conn_table_entries = |
| 13276 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 13277 | resource_cfg->beacon_tx_offload_max_vdev = |
| 13278 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 13279 | resource_cfg->num_multicast_filter_entries = |
| 13280 | tgt_res_cfg->num_multicast_filter_entries; |
| 13281 | resource_cfg->num_wow_filters = |
| 13282 | tgt_res_cfg->num_wow_filters; |
| 13283 | resource_cfg->num_keep_alive_pattern = |
| 13284 | tgt_res_cfg->num_keep_alive_pattern; |
| 13285 | resource_cfg->keep_alive_pattern_size = |
| 13286 | tgt_res_cfg->keep_alive_pattern_size; |
| 13287 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 13288 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 13289 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 13290 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 13291 | resource_cfg->wmi_send_separate = |
| 13292 | tgt_res_cfg->wmi_send_separate; |
| 13293 | resource_cfg->num_ocb_vdevs = |
| 13294 | tgt_res_cfg->num_ocb_vdevs; |
| 13295 | resource_cfg->num_ocb_channels = |
| 13296 | tgt_res_cfg->num_ocb_channels; |
| 13297 | resource_cfg->num_ocb_schedules = |
| 13298 | tgt_res_cfg->num_ocb_schedules; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 13299 | resource_cfg->bpf_instruction_size = tgt_res_cfg->bpf_instruction_size; |
| 13300 | resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters; |
| 13301 | resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id; |
Mukul Sharma | d7c9e33 | 2017-11-02 17:42:36 +0530 | [diff] [blame] | 13302 | resource_cfg->max_num_dbs_scan_duty_cycle = |
| 13303 | tgt_res_cfg->max_num_dbs_scan_duty_cycle; |
Kris Muthusamy | 3c2c76a | 2017-11-30 01:40:46 -0800 | [diff] [blame] | 13304 | resource_cfg->sched_params = tgt_res_cfg->scheduler_params; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 13305 | |
Mukul Sharma | d7c9e33 | 2017-11-02 17:42:36 +0530 | [diff] [blame] | 13306 | if (tgt_res_cfg->atf_config) |
| 13307 | WMI_RSRC_CFG_FLAG_ATF_CONFIG_ENABLE_SET(resource_cfg->flag1, 1); |
| 13308 | if (tgt_res_cfg->mgmt_comp_evt_bundle_support) |
| 13309 | WMI_RSRC_CFG_FLAG_MGMT_COMP_EVT_BUNDLE_SUPPORT_SET( |
| 13310 | resource_cfg->flag1, 1); |
| 13311 | if (tgt_res_cfg->tx_msdu_new_partition_id_support) |
| 13312 | WMI_RSRC_CFG_FLAG_TX_MSDU_ID_NEW_PARTITION_SUPPORT_SET( |
| 13313 | resource_cfg->flag1, 1); |
Ruchi, Agrawal | 0a40ba1 | 2017-11-21 14:39:02 +0530 | [diff] [blame] | 13314 | if (tgt_res_cfg->cce_disable) |
| 13315 | WMI_RSRC_CFG_FLAG_TCL_CCE_DISABLE_SET(resource_cfg->flag1, 1); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13316 | } |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 13317 | |
| 13318 | /* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd |
| 13319 | * @wmi_handle: pointer to wmi handle |
| 13320 | * @buf_ptr: pointer to current position in init command buffer |
| 13321 | * @len: pointer to length. This will be updated with current lenght of cmd |
| 13322 | * @param: point host parameters for init command |
| 13323 | * |
| 13324 | * Return: Updated pointer of buf_ptr. |
| 13325 | */ |
| 13326 | static inline uint8_t *copy_hw_mode_in_init_cmd(struct wmi_unified *wmi_handle, |
| 13327 | uint8_t *buf_ptr, int *len, struct wmi_init_cmd_param *param) |
| 13328 | { |
| 13329 | uint16_t idx; |
| 13330 | |
| 13331 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { |
| 13332 | wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode; |
| 13333 | wmi_pdev_band_to_mac *band_to_mac; |
| 13334 | |
| 13335 | hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *) |
| 13336 | (buf_ptr + sizeof(wmi_init_cmd_fixed_param) + |
| 13337 | sizeof(wmi_resource_config) + |
| 13338 | WMI_TLV_HDR_SIZE + (param->num_mem_chunks * |
| 13339 | sizeof(wlan_host_memory_chunk))); |
| 13340 | |
| 13341 | WMITLV_SET_HDR(&hw_mode->tlv_header, |
| 13342 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 13343 | (WMITLV_GET_STRUCT_TLVLEN |
| 13344 | (wmi_pdev_set_hw_mode_cmd_fixed_param))); |
| 13345 | |
| 13346 | hw_mode->hw_mode_index = param->hw_mode_id; |
| 13347 | hw_mode->num_band_to_mac = param->num_band_to_mac; |
| 13348 | |
| 13349 | buf_ptr = (uint8_t *) (hw_mode + 1); |
| 13350 | band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr + |
| 13351 | WMI_TLV_HDR_SIZE); |
| 13352 | for (idx = 0; idx < param->num_band_to_mac; idx++) { |
| 13353 | WMITLV_SET_HDR(&band_to_mac[idx].tlv_header, |
| 13354 | WMITLV_TAG_STRUC_wmi_pdev_band_to_mac, |
| 13355 | WMITLV_GET_STRUCT_TLVLEN |
| 13356 | (wmi_pdev_band_to_mac)); |
| 13357 | band_to_mac[idx].pdev_id = |
| 13358 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13359 | param->band_to_mac[idx].pdev_id); |
| 13360 | band_to_mac[idx].start_freq = |
| 13361 | param->band_to_mac[idx].start_freq; |
| 13362 | band_to_mac[idx].end_freq = |
| 13363 | param->band_to_mac[idx].end_freq; |
| 13364 | } |
| 13365 | *len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 13366 | (param->num_band_to_mac * |
| 13367 | sizeof(wmi_pdev_band_to_mac)) + |
| 13368 | WMI_TLV_HDR_SIZE; |
| 13369 | |
| 13370 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13371 | (param->num_band_to_mac * |
| 13372 | sizeof(wmi_pdev_band_to_mac))); |
| 13373 | } |
| 13374 | |
| 13375 | return buf_ptr; |
| 13376 | } |
| 13377 | |
| 13378 | static inline void copy_fw_abi_version_tlv(wmi_unified_t wmi_handle, |
| 13379 | wmi_init_cmd_fixed_param *cmd) |
| 13380 | { |
| 13381 | int num_whitelist; |
| 13382 | wmi_abi_version my_vers; |
| 13383 | |
| 13384 | num_whitelist = sizeof(version_whitelist) / |
| 13385 | sizeof(wmi_whitelist_version_info); |
| 13386 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 13387 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 13388 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 13389 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 13390 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 13391 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 13392 | |
| 13393 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 13394 | &my_vers, |
| 13395 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 13396 | &cmd->host_abi_vers); |
| 13397 | |
| 13398 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 13399 | __func__, |
| 13400 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 13401 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 13402 | cmd->host_abi_vers.abi_version_ns_0, |
| 13403 | cmd->host_abi_vers.abi_version_ns_1, |
| 13404 | cmd->host_abi_vers.abi_version_ns_2, |
| 13405 | cmd->host_abi_vers.abi_version_ns_3); |
| 13406 | |
| 13407 | /* Save version sent from host - |
| 13408 | * Will be used to check ready event |
| 13409 | */ |
| 13410 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 13411 | sizeof(wmi_abi_version)); |
| 13412 | } |
| 13413 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13414 | 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] | 13415 | { |
| 13416 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 13417 | wmi_service_ready_event_fixed_param *ev; |
| 13418 | |
| 13419 | |
| 13420 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 13421 | |
| 13422 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 13423 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13424 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13425 | |
| 13426 | /*Save fw version from service ready message */ |
| 13427 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13428 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13429 | sizeof(wmi_handle->fw_abi_version)); |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 13430 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13431 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13432 | } |
| 13433 | |
| 13434 | /** |
| 13435 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 13436 | * @wmi_handle: pointer to wmi handle |
| 13437 | * @res_cfg: resource config |
| 13438 | * @num_mem_chunks: no of mem chunck |
| 13439 | * @mem_chunk: pointer to mem chunck structure |
| 13440 | * |
| 13441 | * This function sends IE information to firmware |
| 13442 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13443 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13444 | * |
| 13445 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13446 | 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] | 13447 | void *evt_buf) |
| 13448 | { |
| 13449 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 13450 | wmi_ready_event_fixed_param *ev = NULL; |
| 13451 | |
| 13452 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 13453 | ev = param_buf->fixed_param; |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 13454 | if (!wmi_versions_are_compatible((struct _wmi_abi_version *) |
| 13455 | &wmi_handle->final_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13456 | &ev->fw_abi_vers)) { |
| 13457 | /* |
| 13458 | * Error: Our host version and the given firmware version |
| 13459 | * are incompatible. |
| 13460 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13461 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13462 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 13463 | __func__, |
| 13464 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 13465 | abi_version_0), |
| 13466 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 13467 | abi_version_0), |
| 13468 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 13469 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 13470 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 13471 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 13472 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 13473 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 13474 | ev->fw_abi_vers.abi_version_ns_0, |
| 13475 | ev->fw_abi_vers.abi_version_ns_1, |
| 13476 | ev->fw_abi_vers.abi_version_ns_2, |
| 13477 | ev->fw_abi_vers.abi_version_ns_3); |
| 13478 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13479 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13480 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13481 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13482 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13483 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13484 | sizeof(wmi_abi_version)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13485 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13486 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13487 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13488 | |
| 13489 | /** |
| 13490 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 13491 | * @wmi_handle: wmi handle |
| 13492 | * @custom_addr: base mac address |
| 13493 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13494 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13495 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13496 | static QDF_STATUS send_set_base_macaddr_indicate_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13497 | uint8_t *custom_addr) |
| 13498 | { |
| 13499 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 13500 | wmi_buf_t buf; |
| 13501 | int err; |
| 13502 | |
| 13503 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13504 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13505 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13506 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13507 | } |
| 13508 | |
| 13509 | cmd = (wmi_pdev_set_base_macaddr_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13510 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13511 | |
| 13512 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13513 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 13514 | WMITLV_GET_STRUCT_TLVLEN |
| 13515 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 13516 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13517 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13518 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13519 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 13520 | sizeof(*cmd), |
| 13521 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 13522 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13523 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13524 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13525 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13526 | } |
| 13527 | |
| 13528 | return 0; |
| 13529 | } |
| 13530 | |
| 13531 | /** |
| 13532 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 13533 | * @handle: wmi handle |
| 13534 | * @event: Event received from FW |
| 13535 | * @len: Length of the event |
| 13536 | * |
| 13537 | * Enables the low frequency events and disables the high frequency |
| 13538 | * events. Bit 17 indicates if the event if low/high frequency. |
| 13539 | * 1 - high frequency, 0 - low frequency |
| 13540 | * |
| 13541 | * Return: 0 on successfully enabling/disabling the events |
| 13542 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13543 | 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] | 13544 | uint8_t *event, |
| 13545 | uint32_t len) |
| 13546 | { |
| 13547 | uint32_t num_of_diag_events_logs; |
| 13548 | wmi_diag_event_log_config_fixed_param *cmd; |
| 13549 | wmi_buf_t buf; |
| 13550 | uint8_t *buf_ptr; |
| 13551 | uint32_t *cmd_args, *evt_args; |
| 13552 | uint32_t buf_len, i; |
| 13553 | |
| 13554 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 13555 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 13556 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13557 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13558 | |
| 13559 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 13560 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13561 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13562 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13563 | } |
| 13564 | wmi_event = param_buf->fixed_param; |
| 13565 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
Amar Singhal | 5593c90 | 2017-10-03 13:00:29 -0700 | [diff] [blame] | 13566 | |
| 13567 | if (num_of_diag_events_logs > |
| 13568 | param_buf->num_diag_events_logs_list) { |
| 13569 | WMI_LOGE("message number of events %d is more than tlv hdr content %d", |
| 13570 | num_of_diag_events_logs, |
| 13571 | param_buf->num_diag_events_logs_list); |
| 13572 | return QDF_STATUS_E_INVAL; |
| 13573 | } |
| 13574 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13575 | evt_args = param_buf->diag_events_logs_list; |
| 13576 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13577 | 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] | 13578 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13579 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13580 | } |
| 13581 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13582 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13583 | __func__, num_of_diag_events_logs); |
| 13584 | |
| 13585 | /* Free any previous allocation */ |
| 13586 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13587 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13588 | |
Varun Reddy Yeturu | c799752 | 2017-08-20 13:41:02 -0700 | [diff] [blame] | 13589 | if (num_of_diag_events_logs > |
| 13590 | (WMI_SVC_MSG_MAX_SIZE / sizeof(uint32_t))) { |
| 13591 | WMI_LOGE("%s: excess num of logs:%d", __func__, |
| 13592 | num_of_diag_events_logs); |
| 13593 | QDF_ASSERT(0); |
| 13594 | return QDF_STATUS_E_INVAL; |
| 13595 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13596 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13597 | 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] | 13598 | sizeof(uint32_t)); |
| 13599 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13600 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13601 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13602 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13603 | } |
| 13604 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 13605 | |
| 13606 | /* Prepare the send buffer */ |
| 13607 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 13608 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 13609 | |
| 13610 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 13611 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13612 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13613 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13614 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13615 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13616 | } |
| 13617 | |
| 13618 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 13619 | buf_ptr = (uint8_t *) cmd; |
| 13620 | |
| 13621 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13622 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 13623 | WMITLV_GET_STRUCT_TLVLEN( |
| 13624 | wmi_diag_event_log_config_fixed_param)); |
| 13625 | |
| 13626 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 13627 | |
| 13628 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 13629 | |
| 13630 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13631 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 13632 | |
| 13633 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 13634 | |
| 13635 | /* Populate the events */ |
| 13636 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 13637 | /* Low freq (0) - Enable (1) the event |
| 13638 | * High freq (1) - Disable (0) the event |
| 13639 | */ |
| 13640 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 13641 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 13642 | /* Set the event ID */ |
| 13643 | WMI_DIAG_ID_SET(cmd_args[i], |
| 13644 | WMI_DIAG_ID_GET(evt_args[i])); |
| 13645 | /* Set the type */ |
| 13646 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 13647 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13648 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13649 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 13650 | } |
| 13651 | |
| 13652 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 13653 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13654 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13655 | __func__); |
| 13656 | wmi_buf_free(buf); |
| 13657 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 13658 | * Host can still have this list |
| 13659 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13660 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13661 | } |
| 13662 | |
| 13663 | return 0; |
| 13664 | } |
| 13665 | |
| 13666 | /** |
| 13667 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 13668 | * @wmi_handle: wmi handle |
| 13669 | * @start_log: Start logging related parameters |
| 13670 | * |
| 13671 | * Send the command to the FW based on which specific logging of diag |
| 13672 | * event/log id can be started/stopped |
| 13673 | * |
| 13674 | * Return: None |
| 13675 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13676 | 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] | 13677 | struct wmi_wifi_start_log *start_log) |
| 13678 | { |
| 13679 | wmi_diag_event_log_config_fixed_param *cmd; |
| 13680 | wmi_buf_t buf; |
| 13681 | uint8_t *buf_ptr; |
| 13682 | uint32_t len, count, log_level, i; |
| 13683 | uint32_t *cmd_args; |
| 13684 | uint32_t total_len; |
| 13685 | count = 0; |
| 13686 | |
| 13687 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13688 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13689 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13690 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13691 | } |
| 13692 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 13693 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 13694 | */ |
| 13695 | total_len = 0; |
| 13696 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 13697 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 13698 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 13699 | total_len++; |
| 13700 | } |
| 13701 | |
| 13702 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 13703 | (total_len * sizeof(uint32_t)); |
| 13704 | |
| 13705 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13706 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13707 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13708 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13709 | } |
| 13710 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 13711 | buf_ptr = (uint8_t *) cmd; |
| 13712 | |
| 13713 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13714 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 13715 | WMITLV_GET_STRUCT_TLVLEN( |
| 13716 | wmi_diag_event_log_config_fixed_param)); |
| 13717 | |
| 13718 | cmd->num_of_diag_events_logs = total_len; |
| 13719 | |
| 13720 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 13721 | |
| 13722 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13723 | (total_len * sizeof(uint32_t))); |
| 13724 | |
| 13725 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 13726 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 13727 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13728 | log_level = 1; |
| 13729 | else |
| 13730 | log_level = 0; |
| 13731 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13732 | 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] | 13733 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 13734 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 13735 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 13736 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 13737 | |
| 13738 | WMI_DIAG_ID_SET(cmd_args[count], |
| 13739 | WMI_DIAG_ID_GET(val)); |
| 13740 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 13741 | WMI_DIAG_TYPE_GET(val)); |
| 13742 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 13743 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13744 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13745 | count++; |
| 13746 | } |
| 13747 | } |
| 13748 | |
| 13749 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13750 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13751 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13752 | __func__); |
| 13753 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13754 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13755 | } |
| 13756 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13757 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13758 | } |
| 13759 | |
| 13760 | /** |
| 13761 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 13762 | * @wmi_handle: WMI handle |
| 13763 | * |
| 13764 | * This function is used to send the flush command to the FW, |
| 13765 | * that will flush the fw logs that are residue in the FW |
| 13766 | * |
| 13767 | * Return: None |
| 13768 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13769 | 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] | 13770 | { |
| 13771 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 13772 | wmi_buf_t buf; |
| 13773 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13774 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13775 | |
| 13776 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13777 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13778 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13779 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13780 | } |
| 13781 | |
| 13782 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 13783 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13784 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 13785 | WMITLV_GET_STRUCT_TLVLEN( |
| 13786 | wmi_debug_mesg_flush_fixed_param)); |
| 13787 | cmd->reserved0 = 0; |
| 13788 | |
| 13789 | ret = wmi_unified_cmd_send(wmi_handle, |
| 13790 | buf, |
| 13791 | len, |
| 13792 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13793 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13794 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13795 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13796 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13797 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13798 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13799 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13800 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13801 | } |
| 13802 | |
| 13803 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13804 | * send_pdev_set_pcl_cmd_tlv() - Send WMI_SOC_SET_PCL_CMDID to FW |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13805 | * @wmi_handle: wmi handle |
| 13806 | * @msg: PCL structure containing the PCL and the number of channels |
| 13807 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13808 | * WMI_PDEV_SET_PCL_CMDID provides a Preferred Channel List (PCL) to the WLAN |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13809 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 13810 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 13811 | * to migrate to a new channel without host driver involvement. An example of |
| 13812 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 13813 | * manage the channel selection without firmware involvement. |
| 13814 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13815 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 13816 | * channel list. The weights corresponds to the channels sent in |
| 13817 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 13818 | * weightage compared to the non PCL channels. |
| 13819 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13820 | * Return: Success if the cmd is sent successfully to the firmware |
| 13821 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13822 | static QDF_STATUS send_pdev_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13823 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13824 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13825 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13826 | wmi_buf_t buf; |
| 13827 | uint8_t *buf_ptr; |
| 13828 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13829 | uint32_t chan_len; |
| 13830 | |
| 13831 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13832 | |
| 13833 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13834 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13835 | |
| 13836 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13837 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13838 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13839 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13840 | } |
| 13841 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13842 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13843 | buf_ptr = (uint8_t *) cmd; |
| 13844 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13845 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 13846 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13847 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13848 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13849 | WMI_HOST_PDEV_ID_SOC); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13850 | cmd->num_chan = chan_len; |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 13851 | WMI_LOGD("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13852 | |
| 13853 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13854 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13855 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13856 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13857 | for (i = 0; i < chan_len ; i++) { |
| 13858 | cmd_args[i] = msg->weighed_valid_list[i]; |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 13859 | WMI_LOGD("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13860 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13861 | } |
| 13862 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13863 | WMI_PDEV_SET_PCL_CMDID)) { |
| 13864 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13865 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13866 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13867 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13868 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13869 | } |
| 13870 | |
| 13871 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13872 | * send_pdev_set_hw_mode_cmd_tlv() - Send WMI_PDEV_SET_HW_MODE_CMDID to FW |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13873 | * @wmi_handle: wmi handle |
| 13874 | * @msg: Structure containing the following parameters |
| 13875 | * |
| 13876 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 13877 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 13878 | * |
| 13879 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 13880 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 13881 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 13882 | * |
| 13883 | * Return: Success if the cmd is sent successfully to the firmware |
| 13884 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13885 | static QDF_STATUS send_pdev_set_hw_mode_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13886 | uint32_t hw_mode_index) |
| 13887 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13888 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13889 | wmi_buf_t buf; |
| 13890 | uint32_t len; |
| 13891 | |
| 13892 | len = sizeof(*cmd); |
| 13893 | |
| 13894 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13895 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13896 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13897 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13898 | } |
| 13899 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13900 | cmd = (wmi_pdev_set_hw_mode_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13901 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13902 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 13903 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 13904 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13905 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13906 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13907 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13908 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13909 | |
| 13910 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13911 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 13912 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13913 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13914 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13915 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13916 | } |
| 13917 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13918 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13919 | } |
| 13920 | |
| 13921 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13922 | * send_pdev_set_dual_mac_config_cmd_tlv() - Set dual mac config to FW |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13923 | * @wmi_handle: wmi handle |
| 13924 | * @msg: Dual MAC config parameters |
| 13925 | * |
| 13926 | * Configures WLAN firmware with the dual MAC features |
| 13927 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13928 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13929 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 13930 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13931 | QDF_STATUS send_pdev_set_dual_mac_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13932 | struct wmi_dual_mac_config *msg) |
| 13933 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13934 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13935 | wmi_buf_t buf; |
| 13936 | uint32_t len; |
| 13937 | |
| 13938 | len = sizeof(*cmd); |
| 13939 | |
| 13940 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13941 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13942 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13943 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13944 | } |
| 13945 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13946 | cmd = (wmi_pdev_set_mac_config_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13947 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13948 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13949 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13950 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 13951 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13952 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13953 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13954 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 13955 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13956 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13957 | __func__, msg->scan_config, msg->fw_mode_config); |
| 13958 | |
| 13959 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13960 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 13961 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13962 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13963 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13964 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13965 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13966 | } |
| 13967 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13968 | #ifdef BIG_ENDIAN_HOST |
| 13969 | /** |
| 13970 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 13971 | * @param data_len - data length |
| 13972 | * @param data - pointer to data |
| 13973 | * |
| 13974 | * Return: QDF_STATUS - success or error status |
| 13975 | */ |
| 13976 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 13977 | struct fips_params *param) |
| 13978 | { |
| 13979 | unsigned char *key_unaligned, *data_unaligned; |
| 13980 | int c; |
| 13981 | u_int8_t *key_aligned = NULL; |
| 13982 | u_int8_t *data_aligned = NULL; |
| 13983 | |
| 13984 | /* Assigning unaligned space to copy the key */ |
| 13985 | key_unaligned = qdf_mem_malloc( |
| 13986 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 13987 | data_unaligned = qdf_mem_malloc( |
| 13988 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 13989 | |
| 13990 | /* Checking if kmalloc is succesful to allocate space */ |
| 13991 | if (key_unaligned == NULL) |
| 13992 | return QDF_STATUS_SUCCESS; |
| 13993 | /* Checking if space is aligned */ |
| 13994 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 13995 | /* align to 4 */ |
| 13996 | key_aligned = |
| 13997 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 13998 | FIPS_ALIGN); |
| 13999 | } else { |
| 14000 | key_aligned = (u_int8_t *)key_unaligned; |
| 14001 | } |
| 14002 | |
| 14003 | /* memset and copy content from key to key aligned */ |
| 14004 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 14005 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 14006 | |
| 14007 | /* print a hexdump for host debug */ |
| 14008 | print_hex_dump(KERN_DEBUG, |
| 14009 | "\t Aligned and Copied Key:@@@@ ", |
| 14010 | DUMP_PREFIX_NONE, |
| 14011 | 16, 1, key_aligned, param->key_len, true); |
| 14012 | |
| 14013 | /* Checking if kmalloc is succesful to allocate space */ |
| 14014 | if (data_unaligned == NULL) |
| 14015 | return QDF_STATUS_SUCCESS; |
| 14016 | /* Checking of space is aligned */ |
| 14017 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 14018 | /* align to 4 */ |
| 14019 | data_aligned = |
| 14020 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 14021 | FIPS_ALIGN); |
| 14022 | } else { |
| 14023 | data_aligned = (u_int8_t *)data_unaligned; |
| 14024 | } |
| 14025 | |
| 14026 | /* memset and copy content from data to data aligned */ |
| 14027 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 14028 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 14029 | |
| 14030 | /* print a hexdump for host debug */ |
| 14031 | print_hex_dump(KERN_DEBUG, |
| 14032 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 14033 | DUMP_PREFIX_NONE, |
| 14034 | 16, 1, data_aligned, param->data_len, true); |
| 14035 | |
| 14036 | /* converting to little Endian both key_aligned and |
| 14037 | * data_aligned*/ |
| 14038 | for (c = 0; c < param->key_len/4; c++) { |
| 14039 | *((u_int32_t *)key_aligned+c) = |
| 14040 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 14041 | } |
| 14042 | for (c = 0; c < param->data_len/4; c++) { |
| 14043 | *((u_int32_t *)data_aligned+c) = |
| 14044 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 14045 | } |
| 14046 | |
| 14047 | /* update endian data to key and data vectors */ |
| 14048 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 14049 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 14050 | |
| 14051 | /* clean up allocated spaces */ |
| 14052 | qdf_mem_free(key_unaligned); |
| 14053 | key_unaligned = NULL; |
| 14054 | key_aligned = NULL; |
| 14055 | |
| 14056 | qdf_mem_free(data_unaligned); |
| 14057 | data_unaligned = NULL; |
| 14058 | data_aligned = NULL; |
| 14059 | |
| 14060 | return QDF_STATUS_SUCCESS; |
| 14061 | } |
| 14062 | #else |
| 14063 | /** |
| 14064 | * fips_align_data_be() - DUMMY for LE platform |
| 14065 | * |
| 14066 | * Return: QDF_STATUS - success |
| 14067 | */ |
| 14068 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 14069 | struct fips_params *param) |
| 14070 | { |
| 14071 | return QDF_STATUS_SUCCESS; |
| 14072 | } |
| 14073 | #endif |
| 14074 | |
| 14075 | |
| 14076 | /** |
| 14077 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 14078 | * @wmi_handle: wmi handle |
| 14079 | * @param: pointer to hold pdev fips param |
| 14080 | * |
| 14081 | * Return: 0 for success or error code |
| 14082 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14083 | static QDF_STATUS |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 14084 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 14085 | struct fips_params *param) |
| 14086 | { |
| 14087 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 14088 | wmi_buf_t buf; |
| 14089 | uint8_t *buf_ptr; |
| 14090 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 14091 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 14092 | |
| 14093 | /* Length TLV placeholder for array of bytes */ |
| 14094 | len += WMI_TLV_HDR_SIZE; |
| 14095 | if (param->data_len) |
| 14096 | len += (param->data_len*sizeof(uint8_t)); |
| 14097 | |
| 14098 | /* |
| 14099 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 14100 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 14101 | * wmi_pdev_fips_cmd structure |
| 14102 | */ |
| 14103 | |
| 14104 | /* do sanity on the input */ |
| 14105 | if (!(((param->data_len & 0xF) == 0) && |
| 14106 | ((param->data_len > 0) && |
| 14107 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 14108 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 14109 | return QDF_STATUS_E_INVAL; |
| 14110 | } |
| 14111 | |
| 14112 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14113 | if (!buf) { |
| 14114 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 14115 | return QDF_STATUS_E_FAILURE; |
| 14116 | } |
| 14117 | |
| 14118 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14119 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 14120 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14121 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 14122 | WMITLV_GET_STRUCT_TLVLEN |
| 14123 | (wmi_pdev_fips_cmd_fixed_param)); |
| 14124 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14125 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 14126 | param->pdev_id); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 14127 | if (param->key != NULL && param->data != NULL) { |
| 14128 | cmd->key_len = param->key_len; |
| 14129 | cmd->data_len = param->data_len; |
| 14130 | cmd->fips_cmd = !!(param->op); |
| 14131 | |
| 14132 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 14133 | return QDF_STATUS_E_FAILURE; |
| 14134 | |
| 14135 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 14136 | |
| 14137 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 14138 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 14139 | cmd->mode = param->mode; |
| 14140 | } else { |
| 14141 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 14142 | } |
| 14143 | qdf_print(KERN_ERR "Key len = %d, Data len = %d\n", |
| 14144 | cmd->key_len, cmd->data_len); |
| 14145 | |
| 14146 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 14147 | cmd->key, cmd->key_len, true); |
| 14148 | buf_ptr += sizeof(*cmd); |
| 14149 | |
| 14150 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 14151 | |
| 14152 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14153 | if (param->data_len) |
| 14154 | qdf_mem_copy(buf_ptr, |
| 14155 | (uint8_t *) param->data, param->data_len); |
| 14156 | |
| 14157 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 14158 | 16, 1, buf_ptr, cmd->data_len, true); |
| 14159 | |
| 14160 | buf_ptr += param->data_len; |
| 14161 | |
| 14162 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14163 | WMI_PDEV_FIPS_CMDID); |
| 14164 | qdf_print("%s return value %d\n", __func__, retval); |
| 14165 | } else { |
| 14166 | qdf_print("\n%s:%d Key or Data is NULL\n", __func__, __LINE__); |
| 14167 | wmi_buf_free(buf); |
| 14168 | retval = -QDF_STATUS_E_BADMSG; |
| 14169 | } |
| 14170 | |
| 14171 | return retval; |
| 14172 | } |
| 14173 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14174 | #ifdef WLAN_PMO_ENABLE |
| 14175 | /** |
| 14176 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 14177 | * @wmi_handle: wmi handle |
| 14178 | * @vdev_id: vdev id |
| 14179 | * @bitmap: Event bitmap |
| 14180 | * @enable: enable/disable |
| 14181 | * |
| 14182 | * Return: CDF status |
| 14183 | */ |
| 14184 | static QDF_STATUS send_add_wow_wakeup_event_cmd_tlv(wmi_unified_t wmi_handle, |
| 14185 | uint32_t vdev_id, |
Ravi Kumar Bokka | ce4ac39 | 2017-03-23 17:20:31 +0530 | [diff] [blame] | 14186 | uint32_t *bitmap, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14187 | bool enable) |
| 14188 | { |
| 14189 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 14190 | uint16_t len; |
| 14191 | wmi_buf_t buf; |
| 14192 | int ret; |
| 14193 | |
| 14194 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 14195 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14196 | if (!buf) { |
| 14197 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 14198 | return QDF_STATUS_E_NOMEM; |
| 14199 | } |
| 14200 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 14201 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14202 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 14203 | WMITLV_GET_STRUCT_TLVLEN |
| 14204 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 14205 | cmd->vdev_id = vdev_id; |
| 14206 | cmd->is_add = enable; |
Ravi Kumar Bokka | ce4ac39 | 2017-03-23 17:20:31 +0530 | [diff] [blame] | 14207 | qdf_mem_copy(&(cmd->event_bitmaps[0]), bitmap, sizeof(uint32_t) * |
| 14208 | WMI_WOW_MAX_EVENT_BM_LEN); |
| 14209 | |
| 14210 | WMI_LOGD("Wakeup pattern 0x%x%x%x%x %s in fw", cmd->event_bitmaps[0], |
| 14211 | cmd->event_bitmaps[1], cmd->event_bitmaps[2], |
| 14212 | cmd->event_bitmaps[3], enable ? "enabled" : "disabled"); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14213 | |
| 14214 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14215 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 14216 | if (ret) { |
| 14217 | WMI_LOGE("Failed to config wow wakeup event"); |
| 14218 | wmi_buf_free(buf); |
| 14219 | return QDF_STATUS_E_FAILURE; |
| 14220 | } |
| 14221 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14222 | return QDF_STATUS_SUCCESS; |
| 14223 | } |
| 14224 | |
| 14225 | /** |
| 14226 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 14227 | * @wmi_handle: wmi handle |
| 14228 | * @vdev_id: vdev id |
| 14229 | * @ptrn_id: pattern id |
| 14230 | * @ptrn: pattern |
| 14231 | * @ptrn_len: pattern length |
| 14232 | * @ptrn_offset: pattern offset |
| 14233 | * @mask: mask |
| 14234 | * @mask_len: mask length |
| 14235 | * @user: true for user configured pattern and false for default pattern |
| 14236 | * @default_patterns: default patterns |
| 14237 | * |
| 14238 | * Return: CDF status |
| 14239 | */ |
| 14240 | static QDF_STATUS send_wow_patterns_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
| 14241 | uint8_t vdev_id, uint8_t ptrn_id, |
| 14242 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 14243 | uint8_t ptrn_offset, const uint8_t *mask, |
| 14244 | uint8_t mask_len, bool user, |
| 14245 | uint8_t default_patterns) |
| 14246 | { |
| 14247 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 14248 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 14249 | wmi_buf_t buf; |
| 14250 | uint8_t *buf_ptr; |
| 14251 | int32_t len; |
| 14252 | int ret; |
| 14253 | |
| 14254 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 14255 | WMI_TLV_HDR_SIZE + |
| 14256 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 14257 | WMI_TLV_HDR_SIZE + |
| 14258 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 14259 | WMI_TLV_HDR_SIZE + |
| 14260 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 14261 | WMI_TLV_HDR_SIZE + |
| 14262 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 14263 | WMI_TLV_HDR_SIZE + |
| 14264 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 14265 | |
| 14266 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14267 | if (!buf) { |
| 14268 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 14269 | return QDF_STATUS_E_NOMEM; |
| 14270 | } |
| 14271 | |
| 14272 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 14273 | buf_ptr = (uint8_t *) cmd; |
| 14274 | |
| 14275 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14276 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 14277 | WMITLV_GET_STRUCT_TLVLEN |
| 14278 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 14279 | cmd->vdev_id = vdev_id; |
| 14280 | cmd->pattern_id = ptrn_id; |
| 14281 | |
| 14282 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 14283 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 14284 | |
| 14285 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 14286 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 14287 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14288 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 14289 | |
| 14290 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 14291 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 14292 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 14293 | |
| 14294 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 14295 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
| 14296 | |
| 14297 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 14298 | bitmap_pattern->pattern_len = ptrn_len; |
| 14299 | |
| 14300 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 14301 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 14302 | |
| 14303 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 14304 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 14305 | |
| 14306 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 14307 | bitmap_pattern->pattern_id = ptrn_id; |
| 14308 | |
| 14309 | WMI_LOGI("vdev: %d, ptrn id: %d, ptrn len: %d, ptrn offset: %d user %d", |
| 14310 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 14311 | bitmap_pattern->pattern_offset, user); |
| 14312 | WMI_LOGI("Pattern : "); |
| 14313 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 14314 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 14315 | |
| 14316 | WMI_LOGI("Mask : "); |
| 14317 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 14318 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
| 14319 | |
| 14320 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 14321 | |
| 14322 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 14323 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 14324 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14325 | |
| 14326 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 14327 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 14328 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14329 | |
| 14330 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 14331 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 14332 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14333 | |
| 14334 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 14335 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 14336 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14337 | |
| 14338 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 14339 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 14340 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14341 | *(A_UINT32 *) buf_ptr = 0; |
| 14342 | |
| 14343 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14344 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 14345 | if (ret) { |
| 14346 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
| 14347 | wmi_buf_free(buf); |
| 14348 | return QDF_STATUS_E_FAILURE; |
| 14349 | } |
| 14350 | |
| 14351 | return QDF_STATUS_SUCCESS; |
| 14352 | } |
| 14353 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14354 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14355 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 14356 | * @wmi_handle: wmi handle |
| 14357 | * @offload_req: offload request |
| 14358 | * @buf_ptr: buffer pointer |
| 14359 | * |
| 14360 | * To fill ARP offload data to firmware |
| 14361 | * when target goes to wow mode. |
| 14362 | * |
| 14363 | * Return: None |
| 14364 | */ |
| 14365 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14366 | struct pmo_arp_offload_params *offload_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14367 | { |
| 14368 | |
| 14369 | int i; |
| 14370 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14371 | bool enable_or_disable = offload_req->enable; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14372 | |
| 14373 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 14374 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 14375 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 14376 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 14377 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 14378 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 14379 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 14380 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 14381 | |
| 14382 | /* Fill data for ARP and NS in the first tupple for LA */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14383 | if ((enable_or_disable & PMO_OFFLOAD_ENABLE) && (i == 0)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14384 | /* Copy the target ip addr and flags */ |
| 14385 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 14386 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14387 | offload_req->host_ipv4_addr, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14388 | WMI_IPV4_ADDR_LEN); |
| 14389 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14390 | offload_req->host_ipv4_addr); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14391 | } |
| 14392 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 14393 | } |
| 14394 | } |
| 14395 | |
| 14396 | #ifdef WLAN_NS_OFFLOAD |
| 14397 | /** |
| 14398 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 14399 | * @wmi|_handle: wmi handle |
| 14400 | * @offload_req: offload request |
| 14401 | * @buf_ptr: buffer pointer |
| 14402 | * |
| 14403 | * To fill NS offload data to firmware |
| 14404 | * when target goes to wow mode. |
| 14405 | * |
| 14406 | * Return: None |
| 14407 | */ |
| 14408 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14409 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14410 | { |
| 14411 | |
| 14412 | int i; |
| 14413 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14414 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14415 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 14416 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 14417 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 14418 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 14419 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 14420 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 14421 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 14422 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 14423 | |
| 14424 | /* |
| 14425 | * Fill data only for NS offload in the first ARP tuple for LA |
| 14426 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14427 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14428 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 14429 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14430 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14431 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14432 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14433 | sizeof(WMI_IPV6_ADDR)); |
| 14434 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14435 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14436 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14437 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14438 | ns_tuple->flags |= |
| 14439 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 14440 | } |
| 14441 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14442 | i, &ns_req->self_ipv6_addr[i], |
| 14443 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14444 | |
| 14445 | /* target MAC is optional, check if it is valid, |
| 14446 | * if this is not valid, the target will use the known |
| 14447 | * local MAC address rather than the tuple |
| 14448 | */ |
| 14449 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14450 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14451 | &ns_tuple->target_mac); |
| 14452 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 14453 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 14454 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 14455 | } |
| 14456 | } |
| 14457 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 14458 | } |
| 14459 | } |
| 14460 | |
| 14461 | |
| 14462 | /** |
| 14463 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 14464 | * @wmi: wmi handle |
| 14465 | * @offload_req: offload request |
| 14466 | * @buf_ptr: buffer pointer |
| 14467 | * |
| 14468 | * To fill extended NS offload extended data to firmware |
| 14469 | * when target goes to wow mode. |
| 14470 | * |
| 14471 | * Return: None |
| 14472 | */ |
| 14473 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14474 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14475 | { |
| 14476 | int i; |
| 14477 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 14478 | uint32_t count, num_ns_ext_tuples; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14479 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14480 | count = ns_req->num_ns_offload_count; |
| 14481 | num_ns_ext_tuples = ns_req->num_ns_offload_count - |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14482 | WMI_MAX_NS_OFFLOADS; |
| 14483 | |
| 14484 | /* Populate extended NS offload tuples */ |
| 14485 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 14486 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 14487 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 14488 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 14489 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 14490 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 14491 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 14492 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 14493 | |
| 14494 | /* |
| 14495 | * Fill data only for NS offload in the first ARP tuple for LA |
| 14496 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14497 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14498 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 14499 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14500 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14501 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14502 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14503 | sizeof(WMI_IPV6_ADDR)); |
| 14504 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14505 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14506 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14507 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14508 | ns_tuple->flags |= |
| 14509 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 14510 | } |
| 14511 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14512 | i, &ns_req->self_ipv6_addr[i], |
| 14513 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14514 | |
| 14515 | /* target MAC is optional, check if it is valid, |
| 14516 | * if this is not valid, the target will use the |
| 14517 | * known local MAC address rather than the tuple |
| 14518 | */ |
| 14519 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14520 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14521 | &ns_tuple->target_mac); |
| 14522 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 14523 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 14524 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 14525 | } |
| 14526 | } |
| 14527 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 14528 | } |
| 14529 | } |
| 14530 | #else |
| 14531 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14532 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14533 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14534 | } |
| 14535 | |
| 14536 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14537 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14538 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14539 | } |
| 14540 | #endif |
| 14541 | |
| 14542 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14543 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 14544 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14545 | * @arp_offload_req: arp offload request |
| 14546 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14547 | * @arp_only: flag |
| 14548 | * |
| 14549 | * To configure ARP NS off load data to firmware |
| 14550 | * when target goes to wow mode. |
| 14551 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14552 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14553 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14554 | static QDF_STATUS send_enable_arp_ns_offload_cmd_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14555 | struct pmo_arp_offload_params *arp_offload_req, |
| 14556 | struct pmo_ns_offload_params *ns_offload_req, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14557 | uint8_t vdev_id) |
| 14558 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14559 | int32_t res; |
| 14560 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14561 | A_UINT8 *buf_ptr; |
| 14562 | wmi_buf_t buf; |
| 14563 | int32_t len; |
| 14564 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 14565 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14566 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14567 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14568 | /* |
| 14569 | * TLV place holder size for array of NS tuples |
| 14570 | * TLV place holder size for array of ARP tuples |
| 14571 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14572 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 14573 | WMI_TLV_HDR_SIZE + |
| 14574 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 14575 | WMI_TLV_HDR_SIZE + |
| 14576 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14577 | |
| 14578 | /* |
| 14579 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 14580 | * extra length for extended NS offload tuples which follows ARP offload |
| 14581 | * tuples. Host needs to fill this structure in following format: |
| 14582 | * 2 NS ofload tuples |
| 14583 | * 2 ARP offload tuples |
| 14584 | * N numbers of extended NS offload tuples if HDD has given more than |
| 14585 | * 2 NS offload addresses |
| 14586 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14587 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14588 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14589 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 14590 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14591 | } |
| 14592 | |
| 14593 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14594 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14595 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14596 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14597 | } |
| 14598 | |
| 14599 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 14600 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 14601 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14602 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 14603 | WMITLV_GET_STRUCT_TLVLEN |
| 14604 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 14605 | cmd->flags = 0; |
| 14606 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14607 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14608 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14609 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14610 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14611 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 14612 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 14613 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 14614 | if (num_ns_ext_tuples) |
| 14615 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14616 | |
| 14617 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14618 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 14619 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14620 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14621 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14622 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14623 | } |
| 14624 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14625 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14626 | } |
| 14627 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14628 | /** |
| 14629 | * send_enable_enhance_multicast_offload_tlv() - send enhance multicast offload |
| 14630 | * @wmi_handle: wmi handle |
| 14631 | * @vdev_id: vdev id |
| 14632 | * @action: true for enable else false |
| 14633 | * |
| 14634 | * To enable enhance multicast offload to firmware |
| 14635 | * when target goes to wow mode. |
| 14636 | * |
| 14637 | * Return: QDF Status |
| 14638 | */ |
| 14639 | |
| 14640 | static |
| 14641 | QDF_STATUS send_enable_enhance_multicast_offload_tlv( |
| 14642 | wmi_unified_t wmi_handle, |
| 14643 | uint8_t vdev_id, bool action) |
| 14644 | { |
| 14645 | QDF_STATUS status; |
| 14646 | wmi_buf_t buf; |
| 14647 | wmi_config_enhanced_mcast_filter_cmd_fixed_param *cmd; |
| 14648 | |
| 14649 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 14650 | if (!buf) { |
| 14651 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 14652 | return QDF_STATUS_E_NOMEM; |
| 14653 | } |
| 14654 | |
| 14655 | cmd = (wmi_config_enhanced_mcast_filter_cmd_fixed_param *) |
| 14656 | wmi_buf_data(buf); |
| 14657 | |
| 14658 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14659 | WMITLV_TAG_STRUC_wmi_config_enhanced_mcast_filter_fixed_param, |
| 14660 | WMITLV_GET_STRUCT_TLVLEN( |
| 14661 | wmi_config_enhanced_mcast_filter_cmd_fixed_param)); |
| 14662 | |
| 14663 | cmd->vdev_id = vdev_id; |
| 14664 | cmd->enable = ((action == 0) ? ENHANCED_MCAST_FILTER_DISABLED : |
| 14665 | ENHANCED_MCAST_FILTER_ENABLED); |
| 14666 | WMI_LOGD("%s: config enhance multicast offload action %d for vdev %d", |
| 14667 | __func__, action, vdev_id); |
| 14668 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14669 | sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID); |
| 14670 | if (status != QDF_STATUS_SUCCESS) { |
| 14671 | qdf_nbuf_free(buf); |
| 14672 | WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID", |
| 14673 | __func__); |
| 14674 | } |
| 14675 | |
| 14676 | return status; |
| 14677 | } |
| 14678 | |
| 14679 | /** |
| 14680 | * extract_gtk_rsp_event_tlv() - extract gtk rsp params from event |
| 14681 | * @wmi_handle: wmi handle |
| 14682 | * @param evt_buf: pointer to event buffer |
| 14683 | * @param hdr: Pointer to hold header |
| 14684 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 14685 | * |
| 14686 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14687 | */ |
| 14688 | static QDF_STATUS extract_gtk_rsp_event_tlv(wmi_unified_t wmi_handle, |
| 14689 | void *evt_buf, struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len) |
| 14690 | { |
| 14691 | WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *fixed_param; |
| 14692 | WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *param_buf; |
| 14693 | |
| 14694 | param_buf = (WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *)evt_buf; |
| 14695 | if (!param_buf) { |
| 14696 | WMI_LOGE("gtk param_buf is NULL"); |
| 14697 | return QDF_STATUS_E_INVAL; |
| 14698 | } |
| 14699 | |
| 14700 | if (len < sizeof(WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param)) { |
| 14701 | WMI_LOGE("Invalid length for GTK status"); |
| 14702 | return QDF_STATUS_E_INVAL; |
| 14703 | } |
| 14704 | |
| 14705 | fixed_param = (WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *) |
| 14706 | param_buf->fixed_param; |
| 14707 | gtk_rsp_param->vdev_id = fixed_param->vdev_id; |
| 14708 | gtk_rsp_param->status_flag = QDF_STATUS_SUCCESS; |
| 14709 | gtk_rsp_param->refresh_cnt = fixed_param->refresh_cnt; |
| 14710 | qdf_mem_copy(>k_rsp_param->replay_counter, |
| 14711 | &fixed_param->replay_counter, |
| 14712 | GTK_REPLAY_COUNTER_BYTES); |
| 14713 | |
| 14714 | return QDF_STATUS_SUCCESS; |
| 14715 | |
| 14716 | } |
| 14717 | |
| 14718 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 14719 | /** |
| 14720 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 14721 | * @wmi_handle: wmi handle |
| 14722 | * @vdev_id: vdev id |
| 14723 | * |
| 14724 | * Return: CDF status |
| 14725 | */ |
| 14726 | static QDF_STATUS send_wow_sta_ra_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14727 | uint8_t vdev_id, uint8_t default_pattern, |
| 14728 | uint16_t rate_limit_interval) |
| 14729 | { |
| 14730 | |
| 14731 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 14732 | wmi_buf_t buf; |
| 14733 | uint8_t *buf_ptr; |
| 14734 | int32_t len; |
| 14735 | int ret; |
| 14736 | |
| 14737 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 14738 | WMI_TLV_HDR_SIZE + |
| 14739 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 14740 | WMI_TLV_HDR_SIZE + |
| 14741 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 14742 | WMI_TLV_HDR_SIZE + |
| 14743 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 14744 | WMI_TLV_HDR_SIZE + |
| 14745 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 14746 | WMI_TLV_HDR_SIZE + |
| 14747 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 14748 | |
| 14749 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14750 | if (!buf) { |
| 14751 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 14752 | return QDF_STATUS_E_NOMEM; |
| 14753 | } |
| 14754 | |
| 14755 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 14756 | buf_ptr = (uint8_t *) cmd; |
| 14757 | |
| 14758 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14759 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 14760 | WMITLV_GET_STRUCT_TLVLEN |
| 14761 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 14762 | cmd->vdev_id = vdev_id; |
| 14763 | cmd->pattern_id = default_pattern, |
| 14764 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 14765 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 14766 | |
| 14767 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 14768 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 14769 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14770 | |
| 14771 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 14772 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 14773 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14774 | |
| 14775 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 14776 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 14777 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14778 | |
| 14779 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 14780 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 14781 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14782 | |
| 14783 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 14784 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 14785 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14786 | |
| 14787 | /* Fill TLV for ra_ratelimit_interval. */ |
| 14788 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 14789 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14790 | |
| 14791 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 14792 | |
| 14793 | WMI_LOGD("%s: send RA rate limit [%d] to fw vdev = %d", __func__, |
| 14794 | rate_limit_interval, vdev_id); |
| 14795 | |
| 14796 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14797 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 14798 | if (ret) { |
| 14799 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
| 14800 | wmi_buf_free(buf); |
| 14801 | return QDF_STATUS_E_FAILURE; |
| 14802 | } |
| 14803 | |
| 14804 | return QDF_STATUS_SUCCESS; |
| 14805 | |
| 14806 | } |
| 14807 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 14808 | |
| 14809 | /** |
| 14810 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 14811 | * @wmi_handle: wmi handle |
| 14812 | * @vdev_id: vdev id |
| 14813 | * @multicastAddr: mcast address |
| 14814 | * @clearList: clear list flag |
| 14815 | * |
| 14816 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14817 | */ |
| 14818 | static QDF_STATUS send_add_clear_mcbc_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14819 | uint8_t vdev_id, |
| 14820 | struct qdf_mac_addr multicast_addr, |
| 14821 | bool clearList) |
| 14822 | { |
| 14823 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 14824 | wmi_buf_t buf; |
| 14825 | int err; |
| 14826 | |
| 14827 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 14828 | if (!buf) { |
| 14829 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 14830 | return QDF_STATUS_E_NOMEM; |
| 14831 | } |
| 14832 | |
| 14833 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
| 14834 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 14835 | |
| 14836 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14837 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 14838 | WMITLV_GET_STRUCT_TLVLEN |
| 14839 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 14840 | cmd->action = |
| 14841 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 14842 | cmd->vdev_id = vdev_id; |
| 14843 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
| 14844 | |
| 14845 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 14846 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 14847 | |
| 14848 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 14849 | sizeof(*cmd), |
| 14850 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 14851 | if (err) { |
| 14852 | WMI_LOGE("Failed to send set_param cmd"); |
| 14853 | wmi_buf_free(buf); |
| 14854 | return QDF_STATUS_E_FAILURE; |
| 14855 | } |
| 14856 | |
| 14857 | return QDF_STATUS_SUCCESS; |
| 14858 | } |
| 14859 | |
| 14860 | /** |
Poddar, Siddarth | 79ba820 | 2017-09-28 17:14:01 +0530 | [diff] [blame] | 14861 | * send_multiple_add_clear_mcbc_filter_cmd_tlv() - send multiple mcast filter |
| 14862 | * command to fw |
| 14863 | * @wmi_handle: wmi handle |
| 14864 | * @vdev_id: vdev id |
| 14865 | * @mcast_filter_params: mcast filter params |
| 14866 | * |
| 14867 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14868 | */ |
| 14869 | static QDF_STATUS send_multiple_add_clear_mcbc_filter_cmd_tlv( |
| 14870 | wmi_unified_t wmi_handle, |
| 14871 | uint8_t vdev_id, |
| 14872 | struct pmo_mcast_filter_params *filter_param) |
| 14873 | |
| 14874 | { |
| 14875 | WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param *cmd; |
| 14876 | uint8_t *buf_ptr; |
| 14877 | wmi_buf_t buf; |
| 14878 | int err; |
| 14879 | int i; |
| 14880 | uint8_t *mac_addr_src_ptr = NULL; |
| 14881 | wmi_mac_addr *mac_addr_dst_ptr; |
| 14882 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 14883 | sizeof(wmi_mac_addr) * filter_param->multicast_addr_cnt; |
| 14884 | |
| 14885 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14886 | if (!buf) { |
| 14887 | WMI_LOGE("Failed to allocate memory"); |
| 14888 | return QDF_STATUS_E_NOMEM; |
| 14889 | } |
| 14890 | |
| 14891 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 14892 | cmd = (WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param *) |
| 14893 | wmi_buf_data(buf); |
| 14894 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 14895 | |
| 14896 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14897 | WMITLV_TAG_STRUC_wmi_set_multiple_mcast_filter_cmd_fixed_param, |
| 14898 | WMITLV_GET_STRUCT_TLVLEN |
| 14899 | (WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param)); |
| 14900 | cmd->operation = |
| 14901 | ((filter_param->action == 0) ? WMI_MULTIPLE_MCAST_FILTER_DELETE |
| 14902 | : WMI_MULTIPLE_MCAST_FILTER_ADD); |
| 14903 | cmd->vdev_id = vdev_id; |
| 14904 | cmd->num_mcastaddrs = filter_param->multicast_addr_cnt; |
| 14905 | |
| 14906 | buf_ptr += sizeof(*cmd); |
| 14907 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 14908 | sizeof(wmi_mac_addr) * |
| 14909 | filter_param->multicast_addr_cnt); |
| 14910 | |
| 14911 | if (filter_param->multicast_addr_cnt == 0) |
| 14912 | goto send_cmd; |
| 14913 | |
| 14914 | mac_addr_src_ptr = (uint8_t *)&filter_param->multicast_addr; |
| 14915 | mac_addr_dst_ptr = (wmi_mac_addr *) |
| 14916 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 14917 | |
| 14918 | for (i = 0; i < filter_param->multicast_addr_cnt; i++) { |
| 14919 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mac_addr_src_ptr, mac_addr_dst_ptr); |
| 14920 | mac_addr_src_ptr += ATH_MAC_LEN; |
| 14921 | mac_addr_dst_ptr++; |
| 14922 | } |
| 14923 | |
| 14924 | send_cmd: |
| 14925 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 14926 | len, |
| 14927 | WMI_SET_MULTIPLE_MCAST_FILTER_CMDID); |
| 14928 | if (err) { |
| 14929 | WMI_LOGE("Failed to send set_param cmd"); |
| 14930 | wmi_buf_free(buf); |
| 14931 | return QDF_STATUS_E_FAILURE; |
| 14932 | } |
| 14933 | |
| 14934 | return QDF_STATUS_SUCCESS; |
| 14935 | } |
| 14936 | |
| 14937 | |
| 14938 | /** |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14939 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 14940 | * @wmi_handle: wmi handle |
| 14941 | * @vdev_id: vdev id |
| 14942 | * @params: GTK offload parameters |
| 14943 | * |
| 14944 | * Return: CDF status |
| 14945 | */ |
| 14946 | static |
| 14947 | QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
| 14948 | struct pmo_gtk_req *params, |
| 14949 | bool enable_offload, |
| 14950 | uint32_t gtk_offload_opcode) |
| 14951 | { |
| 14952 | int len; |
| 14953 | wmi_buf_t buf; |
| 14954 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14955 | wmi_gtk_offload_fils_tlv_param *ext_param; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14956 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14957 | uint8_t *buf_ptr; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14958 | |
| 14959 | WMI_LOGD("%s Enter", __func__); |
| 14960 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14961 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*ext_param); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14962 | |
| 14963 | /* alloc wmi buffer */ |
| 14964 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14965 | if (!buf) { |
| 14966 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 14967 | status = QDF_STATUS_E_NOMEM; |
| 14968 | goto out; |
| 14969 | } |
| 14970 | |
| 14971 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14972 | buf_ptr = (uint8_t *)cmd; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14973 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14974 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 14975 | WMITLV_GET_STRUCT_TLVLEN |
| 14976 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 14977 | |
| 14978 | cmd->vdev_id = vdev_id; |
| 14979 | |
| 14980 | /* Request target to enable GTK offload */ |
| 14981 | if (enable_offload == PMO_GTK_OFFLOAD_ENABLE) { |
| 14982 | cmd->flags = gtk_offload_opcode; |
| 14983 | |
| 14984 | /* Copy the keys and replay counter */ |
| 14985 | qdf_mem_copy(cmd->KCK, params->kck, PMO_KCK_LEN); |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14986 | qdf_mem_copy(cmd->KEK, params->kek, PMO_KEK_LEN_LEGACY); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14987 | qdf_mem_copy(cmd->replay_counter, ¶ms->replay_counter, |
| 14988 | GTK_REPLAY_COUNTER_BYTES); |
| 14989 | } else { |
| 14990 | cmd->flags = gtk_offload_opcode; |
| 14991 | } |
| 14992 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14993 | buf_ptr += sizeof(*cmd); |
| 14994 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(*ext_param)); |
| 14995 | buf_ptr += WMI_TLV_HDR_SIZE; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14996 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14997 | ext_param = (wmi_gtk_offload_fils_tlv_param *)buf_ptr; |
| 14998 | WMITLV_SET_HDR(&ext_param->tlv_header, |
| 14999 | WMITLV_TAG_STRUC_wmi_gtk_offload_extended_tlv_param, |
| 15000 | WMITLV_GET_STRUCT_TLVLEN( |
| 15001 | wmi_gtk_offload_fils_tlv_param)); |
| 15002 | ext_param->vdev_id = vdev_id; |
| 15003 | ext_param->flags = cmd->flags; |
| 15004 | ext_param->kek_len = params->kek_len; |
| 15005 | qdf_mem_copy(ext_param->KEK, params->kek, params->kek_len); |
| 15006 | qdf_mem_copy(ext_param->KCK, params->kck, WMI_GTK_OFFLOAD_KCK_BYTES); |
| 15007 | qdf_mem_copy(ext_param->replay_counter, ¶ms->replay_counter, |
| 15008 | GTK_REPLAY_COUNTER_BYTES); |
| 15009 | |
| 15010 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x kek len %d", vdev_id, cmd->flags, params->kek_len); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 15011 | /* send the wmi command */ |
| 15012 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15013 | WMI_GTK_OFFLOAD_CMDID)) { |
| 15014 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
| 15015 | wmi_buf_free(buf); |
| 15016 | status = QDF_STATUS_E_FAILURE; |
| 15017 | } |
| 15018 | |
| 15019 | out: |
| 15020 | WMI_LOGD("%s Exit", __func__); |
| 15021 | return status; |
| 15022 | } |
| 15023 | |
| 15024 | /** |
| 15025 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 15026 | * @wmi_handle: wmi handle |
| 15027 | * @params: GTK offload params |
| 15028 | * |
| 15029 | * Return: CDF status |
| 15030 | */ |
| 15031 | static QDF_STATUS send_process_gtk_offload_getinfo_cmd_tlv( |
| 15032 | wmi_unified_t wmi_handle, |
| 15033 | uint8_t vdev_id, |
| 15034 | uint64_t offload_req_opcode) |
| 15035 | { |
| 15036 | int len; |
| 15037 | wmi_buf_t buf; |
| 15038 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 15039 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15040 | |
| 15041 | len = sizeof(*cmd); |
| 15042 | |
| 15043 | /* alloc wmi buffer */ |
| 15044 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15045 | if (!buf) { |
| 15046 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 15047 | status = QDF_STATUS_E_NOMEM; |
| 15048 | goto out; |
| 15049 | } |
| 15050 | |
| 15051 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 15052 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15053 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 15054 | WMITLV_GET_STRUCT_TLVLEN |
| 15055 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 15056 | |
| 15057 | /* Request for GTK offload status */ |
| 15058 | cmd->flags = offload_req_opcode; |
| 15059 | cmd->vdev_id = vdev_id; |
| 15060 | |
| 15061 | /* send the wmi command */ |
| 15062 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15063 | WMI_GTK_OFFLOAD_CMDID)) { |
| 15064 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
| 15065 | wmi_buf_free(buf); |
| 15066 | status = QDF_STATUS_E_FAILURE; |
| 15067 | } |
| 15068 | |
| 15069 | out: |
| 15070 | return status; |
| 15071 | } |
| 15072 | |
| 15073 | /** |
| 15074 | * send_action_frame_patterns_cmd_tlv() - send wmi cmd of action filter params |
| 15075 | * @wmi_handle: wmi handler |
| 15076 | * @action_params: pointer to action_params |
| 15077 | * |
| 15078 | * Return: 0 for success, otherwise appropriate error code |
| 15079 | */ |
| 15080 | static QDF_STATUS send_action_frame_patterns_cmd_tlv(wmi_unified_t wmi_handle, |
| 15081 | struct pmo_action_wakeup_set_params *action_params) |
| 15082 | { |
| 15083 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *cmd; |
| 15084 | wmi_buf_t buf; |
| 15085 | int i; |
| 15086 | int32_t err; |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 15087 | uint32_t len = 0, *cmd_args; |
| 15088 | uint8_t *buf_ptr; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 15089 | |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 15090 | len = (PMO_SUPPORTED_ACTION_CATE * sizeof(A_UINT32)) |
| 15091 | + WMI_TLV_HDR_SIZE + sizeof(*cmd); |
| 15092 | buf = wmi_buf_alloc(wmi_handle, len); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 15093 | if (!buf) { |
| 15094 | WMI_LOGE("Failed to allocate buffer to send action filter cmd"); |
| 15095 | return QDF_STATUS_E_NOMEM; |
| 15096 | } |
| 15097 | cmd = (WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *) wmi_buf_data(buf); |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 15098 | buf_ptr = (uint8_t *)cmd; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 15099 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15100 | WMITLV_TAG_STRUC_wmi_wow_set_action_wake_up_cmd_fixed_param, |
| 15101 | WMITLV_GET_STRUCT_TLVLEN( |
| 15102 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param)); |
| 15103 | |
| 15104 | cmd->vdev_id = action_params->vdev_id; |
| 15105 | cmd->operation = action_params->operation; |
| 15106 | |
| 15107 | for (i = 0; i < MAX_SUPPORTED_ACTION_CATEGORY_ELE_LIST; i++) |
| 15108 | cmd->action_category_map[i] = |
| 15109 | action_params->action_category_map[i]; |
| 15110 | |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 15111 | buf_ptr += sizeof(WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param); |
| 15112 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15113 | (PMO_SUPPORTED_ACTION_CATE * sizeof(A_UINT32))); |
| 15114 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 15115 | cmd_args = (uint32_t *) buf_ptr; |
| 15116 | for (i = 0; i < PMO_SUPPORTED_ACTION_CATE; i++) |
| 15117 | cmd_args[i] = action_params->action_per_category[i]; |
| 15118 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 15119 | err = wmi_unified_cmd_send(wmi_handle, buf, |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 15120 | len, WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 15121 | if (err) { |
| 15122 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
| 15123 | wmi_buf_free(buf); |
| 15124 | return QDF_STATUS_E_FAILURE; |
| 15125 | } |
| 15126 | |
| 15127 | return QDF_STATUS_SUCCESS; |
| 15128 | } |
| 15129 | |
| 15130 | #ifdef FEATURE_WLAN_LPHB |
| 15131 | |
| 15132 | /** |
| 15133 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 15134 | * @wmi_handle: wmi handle |
| 15135 | * @lphb_conf_req: configuration info |
| 15136 | * |
| 15137 | * Return: CDF status |
| 15138 | */ |
| 15139 | static QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle, |
| 15140 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 15141 | { |
| 15142 | QDF_STATUS status; |
| 15143 | wmi_buf_t buf = NULL; |
| 15144 | uint8_t *buf_ptr; |
| 15145 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 15146 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 15147 | |
| 15148 | |
| 15149 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15150 | if (!buf) { |
| 15151 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15152 | return QDF_STATUS_E_NOMEM; |
| 15153 | } |
| 15154 | |
| 15155 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15156 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 15157 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 15158 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 15159 | WMITLV_GET_STRUCT_TLVLEN |
| 15160 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 15161 | |
| 15162 | /* fill in values */ |
| 15163 | hb_enable_fp->vdev_id = params->session; |
| 15164 | hb_enable_fp->enable = params->enable; |
| 15165 | hb_enable_fp->item = params->item; |
| 15166 | hb_enable_fp->session = params->session; |
| 15167 | |
| 15168 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15169 | len, WMI_HB_SET_ENABLE_CMDID); |
| 15170 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15171 | WMI_LOGE("cmd_send WMI_HB_SET_ENABLE returned Error %d", |
| 15172 | status); |
| 15173 | wmi_buf_free(buf); |
| 15174 | } |
| 15175 | |
| 15176 | return status; |
| 15177 | } |
| 15178 | |
| 15179 | /** |
| 15180 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 15181 | * @wmi_handle: wmi handle |
| 15182 | * @lphb_conf_req: lphb config request |
| 15183 | * |
| 15184 | * Return: CDF status |
| 15185 | */ |
| 15186 | static QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 15187 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 15188 | { |
| 15189 | QDF_STATUS status; |
| 15190 | wmi_buf_t buf = NULL; |
| 15191 | uint8_t *buf_ptr; |
| 15192 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 15193 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 15194 | |
| 15195 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15196 | if (!buf) { |
| 15197 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15198 | return QDF_STATUS_E_NOMEM; |
| 15199 | } |
| 15200 | |
| 15201 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15202 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 15203 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 15204 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 15205 | WMITLV_GET_STRUCT_TLVLEN |
| 15206 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 15207 | |
| 15208 | /* fill in values */ |
| 15209 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 15210 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 15211 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 15212 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 15213 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 15214 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 15215 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 15216 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 15217 | hb_tcp_params_fp->session = lphb_conf_req->session; |
| 15218 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
| 15219 | &lphb_conf_req->gateway_mac, |
| 15220 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 15221 | |
| 15222 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15223 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
| 15224 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15225 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", |
| 15226 | status); |
| 15227 | wmi_buf_free(buf); |
| 15228 | } |
| 15229 | |
| 15230 | return status; |
| 15231 | } |
| 15232 | |
| 15233 | /** |
| 15234 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 15235 | * @wmi_handle: wmi handle |
| 15236 | * @lphb_conf_req: lphb config request |
| 15237 | * |
| 15238 | * Return: CDF status |
| 15239 | */ |
| 15240 | static |
| 15241 | QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 15242 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 15243 | { |
| 15244 | QDF_STATUS status; |
| 15245 | wmi_buf_t buf = NULL; |
| 15246 | uint8_t *buf_ptr; |
| 15247 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 15248 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 15249 | |
| 15250 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15251 | if (!buf) { |
| 15252 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15253 | return QDF_STATUS_E_NOMEM; |
| 15254 | } |
| 15255 | |
| 15256 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15257 | hb_tcp_filter_fp = |
| 15258 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 15259 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 15260 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 15261 | WMITLV_GET_STRUCT_TLVLEN |
| 15262 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 15263 | |
| 15264 | /* fill in values */ |
| 15265 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 15266 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 15267 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 15268 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 15269 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 15270 | (void *)&g_hb_tcp_filter_fp->filter, |
| 15271 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 15272 | |
| 15273 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15274 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 15275 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15276 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", |
| 15277 | status); |
| 15278 | wmi_buf_free(buf); |
| 15279 | } |
| 15280 | |
| 15281 | return status; |
| 15282 | } |
| 15283 | |
| 15284 | /** |
| 15285 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 15286 | * @wmi_handle: wmi handle |
| 15287 | * @lphb_conf_req: lphb config request |
| 15288 | * |
| 15289 | * Return: CDF status |
| 15290 | */ |
| 15291 | static QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 15292 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 15293 | { |
| 15294 | QDF_STATUS status; |
| 15295 | wmi_buf_t buf = NULL; |
| 15296 | uint8_t *buf_ptr; |
| 15297 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 15298 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 15299 | |
| 15300 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15301 | if (!buf) { |
| 15302 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15303 | return QDF_STATUS_E_NOMEM; |
| 15304 | } |
| 15305 | |
| 15306 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15307 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 15308 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 15309 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 15310 | WMITLV_GET_STRUCT_TLVLEN |
| 15311 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 15312 | |
| 15313 | /* fill in values */ |
| 15314 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 15315 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 15316 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 15317 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 15318 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 15319 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 15320 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 15321 | hb_udp_params_fp->session = lphb_conf_req->session; |
| 15322 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
| 15323 | &lphb_conf_req->gateway_mac, |
| 15324 | sizeof(lphb_conf_req->gateway_mac)); |
| 15325 | |
| 15326 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15327 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
| 15328 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15329 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", |
| 15330 | status); |
| 15331 | wmi_buf_free(buf); |
| 15332 | } |
| 15333 | |
| 15334 | return status; |
| 15335 | } |
| 15336 | |
| 15337 | /** |
| 15338 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 15339 | * @wmi_handle: wmi handle |
| 15340 | * @lphb_conf_req: lphb config request |
| 15341 | * |
| 15342 | * Return: CDF status |
| 15343 | */ |
| 15344 | static |
| 15345 | QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 15346 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 15347 | { |
| 15348 | QDF_STATUS status; |
| 15349 | wmi_buf_t buf = NULL; |
| 15350 | uint8_t *buf_ptr; |
| 15351 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 15352 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 15353 | |
| 15354 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15355 | if (!buf) { |
| 15356 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15357 | return QDF_STATUS_E_NOMEM; |
| 15358 | } |
| 15359 | |
| 15360 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15361 | hb_udp_filter_fp = |
| 15362 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 15363 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 15364 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 15365 | WMITLV_GET_STRUCT_TLVLEN |
| 15366 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 15367 | |
| 15368 | /* fill in values */ |
| 15369 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 15370 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 15371 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 15372 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 15373 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 15374 | (void *)&lphb_conf_req->filter, |
| 15375 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 15376 | |
| 15377 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15378 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 15379 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15380 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", |
| 15381 | status); |
| 15382 | wmi_buf_free(buf); |
| 15383 | } |
| 15384 | |
| 15385 | return status; |
| 15386 | } |
| 15387 | #endif /* FEATURE_WLAN_LPHB */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 15388 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15389 | static QDF_STATUS send_conf_hw_filter_cmd_tlv(wmi_unified_t wmi, |
| 15390 | struct pmo_hw_filter_params *req) |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15391 | { |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15392 | QDF_STATUS status; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15393 | wmi_hw_data_filter_cmd_fixed_param *cmd; |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15394 | wmi_buf_t wmi_buf; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15395 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15396 | if (!req) { |
| 15397 | WMI_LOGE("req is null"); |
| 15398 | return QDF_STATUS_E_INVAL; |
| 15399 | } |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15400 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15401 | wmi_buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 15402 | if (!wmi_buf) { |
| 15403 | WMI_LOGE(FL("Out of memory")); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15404 | return QDF_STATUS_E_NOMEM; |
| 15405 | } |
| 15406 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15407 | cmd = (wmi_hw_data_filter_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15408 | WMITLV_SET_HDR(&cmd->tlv_header, |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15409 | WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param, |
| 15410 | WMITLV_GET_STRUCT_TLVLEN(wmi_hw_data_filter_cmd_fixed_param)); |
| 15411 | cmd->vdev_id = req->vdev_id; |
| 15412 | cmd->enable = req->mode != PMO_HW_FILTER_DISABLED; |
| 15413 | cmd->hw_filter_bitmap = req->mode; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15414 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15415 | WMI_LOGD("configure hw filter (vdev_id: %d, mode: %d)", |
| 15416 | req->vdev_id, req->mode); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15417 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15418 | status = wmi_unified_cmd_send(wmi, wmi_buf, sizeof(*cmd), |
| 15419 | WMI_HW_DATA_FILTER_CMDID); |
| 15420 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15421 | WMI_LOGE("Failed to configure hw filter"); |
| 15422 | wmi_buf_free(wmi_buf); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15423 | } |
| 15424 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 15425 | return status; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15426 | } |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame] | 15427 | |
| 15428 | /** |
| 15429 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter |
| 15430 | * @wmi_handle: wmi handle |
| 15431 | * @vdev_id: vdev id |
| 15432 | * @enable: Flag to enable/disable packet filter |
| 15433 | * |
| 15434 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15435 | */ |
| 15436 | static QDF_STATUS send_enable_disable_packet_filter_cmd_tlv( |
| 15437 | wmi_unified_t wmi_handle, uint8_t vdev_id, bool enable) |
| 15438 | { |
| 15439 | int32_t len; |
| 15440 | int ret = 0; |
| 15441 | wmi_buf_t buf; |
| 15442 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 15443 | |
| 15444 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 15445 | |
| 15446 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15447 | if (!buf) { |
| 15448 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 15449 | return QDF_STATUS_E_NOMEM; |
| 15450 | } |
| 15451 | |
| 15452 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 15453 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15454 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 15455 | WMITLV_GET_STRUCT_TLVLEN( |
| 15456 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 15457 | |
| 15458 | cmd->vdev_id = vdev_id; |
| 15459 | if (enable) |
| 15460 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 15461 | else |
| 15462 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 15463 | |
| 15464 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
| 15465 | __func__, cmd->enable, vdev_id); |
| 15466 | |
| 15467 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15468 | WMI_PACKET_FILTER_ENABLE_CMDID); |
| 15469 | if (ret) { |
| 15470 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
| 15471 | wmi_buf_free(buf); |
| 15472 | } |
| 15473 | |
| 15474 | return ret; |
| 15475 | } |
| 15476 | |
| 15477 | /** |
| 15478 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 15479 | * @wmi_handle: wmi handle |
| 15480 | * @vdev_id: vdev id |
| 15481 | * @rcv_filter_param: Packet filter parameters |
| 15482 | * @filter_id: Filter id |
| 15483 | * @enable: Flag to add/delete packet filter configuration |
| 15484 | * |
| 15485 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15486 | */ |
| 15487 | static QDF_STATUS send_config_packet_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 15488 | uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param, |
| 15489 | uint8_t filter_id, bool enable) |
| 15490 | { |
| 15491 | int len, i; |
| 15492 | int err = 0; |
| 15493 | wmi_buf_t buf; |
| 15494 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 15495 | |
| 15496 | |
| 15497 | /* allocate the memory */ |
| 15498 | len = sizeof(*cmd); |
| 15499 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15500 | if (!buf) { |
| 15501 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 15502 | return QDF_STATUS_E_NOMEM; |
| 15503 | } |
| 15504 | |
| 15505 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 15506 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15507 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 15508 | WMITLV_GET_STRUCT_TLVLEN |
| 15509 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 15510 | |
| 15511 | cmd->vdev_id = vdev_id; |
| 15512 | cmd->filter_id = filter_id; |
| 15513 | if (enable) |
| 15514 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 15515 | else |
| 15516 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 15517 | |
| 15518 | if (enable) { |
| 15519 | cmd->num_params = QDF_MIN( |
| 15520 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 15521 | rcv_filter_param->num_params); |
| 15522 | cmd->filter_type = rcv_filter_param->filter_type; |
| 15523 | cmd->coalesce_time = rcv_filter_param->coalesce_time; |
| 15524 | |
| 15525 | for (i = 0; i < cmd->num_params; i++) { |
| 15526 | cmd->paramsData[i].proto_type = |
| 15527 | rcv_filter_param->params_data[i].protocol_layer; |
| 15528 | cmd->paramsData[i].cmp_type = |
| 15529 | rcv_filter_param->params_data[i].compare_flag; |
| 15530 | cmd->paramsData[i].data_length = |
| 15531 | rcv_filter_param->params_data[i].data_length; |
| 15532 | cmd->paramsData[i].data_offset = |
| 15533 | rcv_filter_param->params_data[i].data_offset; |
| 15534 | memcpy(&cmd->paramsData[i].compareData, |
| 15535 | rcv_filter_param->params_data[i].compare_data, |
| 15536 | sizeof(cmd->paramsData[i].compareData)); |
| 15537 | memcpy(&cmd->paramsData[i].dataMask, |
| 15538 | rcv_filter_param->params_data[i].data_mask, |
| 15539 | sizeof(cmd->paramsData[i].dataMask)); |
| 15540 | } |
| 15541 | } |
| 15542 | |
| 15543 | WMI_LOGE("Packet filter action %d filter with id: %d, num_params=%d", |
| 15544 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 15545 | /* send the command along with data */ |
| 15546 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15547 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 15548 | if (err) { |
| 15549 | WMI_LOGE("Failed to send pkt_filter cmd"); |
| 15550 | wmi_buf_free(buf); |
| 15551 | return QDF_STATUS_E_FAILURE; |
| 15552 | } |
| 15553 | |
| 15554 | return QDF_STATUS_SUCCESS; |
| 15555 | } |
Ravi Kumar Bokka | 8f2c92f | 2017-03-23 15:22:51 +0530 | [diff] [blame] | 15556 | #endif /* End of WLAN_PMO_ENABLE */ |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 15557 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15558 | /** |
| 15559 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 15560 | * @wmi_handle: wmi handle |
| 15561 | * @request: SSID hotlist set request |
| 15562 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15563 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15564 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15565 | static QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15566 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 15567 | struct ssid_hotlist_request_params *request) |
| 15568 | { |
| 15569 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 15570 | wmi_buf_t wmi_buf; |
| 15571 | uint32_t len; |
| 15572 | uint32_t array_size; |
| 15573 | uint8_t *buf_ptr; |
| 15574 | |
| 15575 | /* length of fixed portion */ |
| 15576 | len = sizeof(*cmd); |
| 15577 | |
| 15578 | /* length of variable portion */ |
| 15579 | array_size = |
| 15580 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 15581 | len += WMI_TLV_HDR_SIZE + array_size; |
| 15582 | |
| 15583 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 15584 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15585 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 15586 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15587 | } |
| 15588 | |
| 15589 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 15590 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 15591 | buf_ptr; |
| 15592 | WMITLV_SET_HDR |
| 15593 | (&cmd->tlv_header, |
| 15594 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 15595 | WMITLV_GET_STRUCT_TLVLEN |
| 15596 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 15597 | |
| 15598 | cmd->request_id = request->request_id; |
| 15599 | cmd->requestor_id = 0; |
| 15600 | cmd->vdev_id = request->session_id; |
| 15601 | cmd->table_id = 0; |
| 15602 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 15603 | cmd->total_entries = request->ssid_count; |
| 15604 | cmd->num_entries_in_page = request->ssid_count; |
| 15605 | cmd->first_entry_index = 0; |
| 15606 | |
| 15607 | buf_ptr += sizeof(*cmd); |
| 15608 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 15609 | |
| 15610 | if (request->ssid_count) { |
| 15611 | wmi_extscan_hotlist_ssid_entry *entry; |
| 15612 | int i; |
| 15613 | |
| 15614 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 15615 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 15616 | for (i = 0; i < request->ssid_count; i++) { |
| 15617 | WMITLV_SET_HDR |
| 15618 | (entry, |
| 15619 | WMITLV_TAG_ARRAY_STRUC, |
| 15620 | WMITLV_GET_STRUCT_TLVLEN |
| 15621 | (wmi_extscan_hotlist_ssid_entry)); |
| 15622 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15623 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15624 | request->ssids[i].ssid.mac_ssid, |
| 15625 | request->ssids[i].ssid.length); |
| 15626 | entry->band = request->ssids[i].band; |
| 15627 | entry->min_rssi = request->ssids[i].rssi_low; |
| 15628 | entry->max_rssi = request->ssids[i].rssi_high; |
| 15629 | entry++; |
| 15630 | } |
| 15631 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 15632 | } else { |
| 15633 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 15634 | } |
| 15635 | |
| 15636 | if (wmi_unified_cmd_send |
| 15637 | (wmi_handle, wmi_buf, len, |
| 15638 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15639 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15640 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15641 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15642 | } |
| 15643 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15644 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15645 | } |
| 15646 | |
| 15647 | /** |
| 15648 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 15649 | * @wmi_handle: wmi handle |
| 15650 | * @vdev_id: vdev id |
| 15651 | * |
| 15652 | * This function sends roam synch complete event to fw. |
| 15653 | * |
| 15654 | * Return: CDF STATUS |
| 15655 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15656 | static QDF_STATUS send_process_roam_synch_complete_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15657 | uint8_t vdev_id) |
| 15658 | { |
| 15659 | wmi_roam_synch_complete_fixed_param *cmd; |
| 15660 | wmi_buf_t wmi_buf; |
| 15661 | uint8_t *buf_ptr; |
| 15662 | uint16_t len; |
| 15663 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 15664 | |
| 15665 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 15666 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15667 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 15668 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15669 | } |
| 15670 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 15671 | buf_ptr = (uint8_t *) cmd; |
| 15672 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15673 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 15674 | WMITLV_GET_STRUCT_TLVLEN |
| 15675 | (wmi_roam_synch_complete_fixed_param)); |
| 15676 | cmd->vdev_id = vdev_id; |
| 15677 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 15678 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15679 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15680 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15681 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15682 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15683 | } |
| 15684 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15685 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15686 | } |
| 15687 | |
| 15688 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 15689 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 15690 | * @wmi_handle: wmi handle |
| 15691 | * @wmi_fwtest: fw test command |
| 15692 | * |
| 15693 | * This function sends fw test command to fw. |
| 15694 | * |
| 15695 | * Return: CDF STATUS |
| 15696 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 15697 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 15698 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 15699 | struct set_fwtest_params *wmi_fwtest) |
| 15700 | { |
| 15701 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 15702 | wmi_buf_t wmi_buf; |
| 15703 | uint16_t len; |
| 15704 | |
| 15705 | len = sizeof(*cmd); |
| 15706 | |
| 15707 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 15708 | if (!wmi_buf) { |
| 15709 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 15710 | return QDF_STATUS_E_NOMEM; |
| 15711 | } |
| 15712 | |
| 15713 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 15714 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15715 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 15716 | WMITLV_GET_STRUCT_TLVLEN( |
| 15717 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 15718 | cmd->param_id = wmi_fwtest->arg; |
| 15719 | cmd->param_value = wmi_fwtest->value; |
| 15720 | |
| 15721 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 15722 | WMI_FWTEST_CMDID)) { |
| 15723 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 15724 | qdf_nbuf_free(wmi_buf); |
| 15725 | return QDF_STATUS_E_FAILURE; |
| 15726 | } |
| 15727 | |
| 15728 | return QDF_STATUS_SUCCESS; |
| 15729 | } |
| 15730 | |
| 15731 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15732 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 15733 | * @wmi_handle: wmi handle |
| 15734 | * @wmi_utest: unit test command |
| 15735 | * |
| 15736 | * This function send unit test command to fw. |
| 15737 | * |
| 15738 | * Return: CDF STATUS |
| 15739 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15740 | 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] | 15741 | struct wmi_unit_test_cmd *wmi_utest) |
| 15742 | { |
| 15743 | wmi_unit_test_cmd_fixed_param *cmd; |
| 15744 | wmi_buf_t wmi_buf; |
| 15745 | uint8_t *buf_ptr; |
| 15746 | int i; |
| 15747 | uint16_t len, args_tlv_len; |
| 15748 | A_UINT32 *unit_test_cmd_args; |
| 15749 | |
| 15750 | args_tlv_len = |
| 15751 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 15752 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 15753 | |
| 15754 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 15755 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15756 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 15757 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15758 | } |
| 15759 | |
| 15760 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 15761 | buf_ptr = (uint8_t *) cmd; |
| 15762 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15763 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 15764 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 15765 | cmd->vdev_id = wmi_utest->vdev_id; |
| 15766 | cmd->module_id = wmi_utest->module_id; |
| 15767 | cmd->num_args = wmi_utest->num_args; |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 15768 | cmd->diag_token = wmi_utest->diag_token; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15769 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 15770 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15771 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 15772 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 15773 | WMI_LOGI("%s: VDEV ID: %d\n", __func__, cmd->vdev_id); |
| 15774 | WMI_LOGI("%s: MODULE ID: %d\n", __func__, cmd->module_id); |
| 15775 | WMI_LOGI("%s: TOKEN: %d\n", __func__, cmd->diag_token); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15776 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Shaakir Mohamed | 66ebeca | 2018-01-19 15:49:23 -0800 | [diff] [blame] | 15777 | 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] | 15778 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15779 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15780 | } |
| 15781 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 15782 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15783 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15784 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15785 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15786 | } |
| 15787 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15788 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15789 | } |
| 15790 | |
| 15791 | /** |
| 15792 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 15793 | * @wmi_handle: wma handle |
| 15794 | * @roaminvoke: roam invoke command |
| 15795 | * |
| 15796 | * Send roam invoke command to fw for fastreassoc. |
| 15797 | * |
| 15798 | * Return: CDF STATUS |
| 15799 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15800 | static QDF_STATUS send_roam_invoke_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15801 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 15802 | uint32_t ch_hz) |
| 15803 | { |
| 15804 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 15805 | wmi_buf_t wmi_buf; |
| 15806 | u_int8_t *buf_ptr; |
| 15807 | u_int16_t len, args_tlv_len; |
| 15808 | A_UINT32 *channel_list; |
| 15809 | wmi_mac_addr *bssid_list; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15810 | wmi_tlv_buf_len_param *buf_len_tlv; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15811 | |
| 15812 | /* Host sends only one channel and one bssid */ |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15813 | args_tlv_len = (4 * WMI_TLV_HDR_SIZE) + sizeof(A_UINT32) + |
| 15814 | sizeof(wmi_mac_addr) + sizeof(wmi_tlv_buf_len_param) + |
| 15815 | roundup(roaminvoke->frame_len, sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15816 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 15817 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 15818 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15819 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 15820 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15821 | } |
| 15822 | |
| 15823 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 15824 | buf_ptr = (u_int8_t *) cmd; |
| 15825 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15826 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 15827 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 15828 | cmd->vdev_id = roaminvoke->vdev_id; |
Arif Hussain | 7698b6d | 2016-12-15 20:05:36 -0800 | [diff] [blame] | 15829 | cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_REPORT_FAILURE); |
Krunal Soni | 7544a40 | 2017-07-25 11:23:44 -0700 | [diff] [blame] | 15830 | if (roaminvoke->is_same_bssid) |
| 15831 | cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_NO_NULL_FRAME_TO_AP); |
| 15832 | WMI_LOGD(FL("is_same_bssid flag: %d"), roaminvoke->is_same_bssid); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15833 | |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 15834 | if (roaminvoke->frame_len) { |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15835 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_SKIP; |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 15836 | /* packing 1 beacon/probe_rsp frame with WMI cmd */ |
| 15837 | cmd->num_buf = 1; |
| 15838 | } else { |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15839 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_FIXED_CH; |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 15840 | cmd->num_buf = 0; |
| 15841 | } |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15842 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15843 | cmd->roam_ap_sel_mode = 0; |
| 15844 | cmd->roam_delay = 0; |
| 15845 | cmd->num_chan = 1; |
| 15846 | cmd->num_bssid = 1; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15847 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15848 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 15849 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15850 | (sizeof(u_int32_t))); |
| 15851 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15852 | *channel_list = ch_hz; |
| 15853 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 15854 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 15855 | (sizeof(wmi_mac_addr))); |
| 15856 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15857 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15858 | |
| 15859 | /* move to next tlv i.e. bcn_prb_buf_list */ |
| 15860 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_mac_addr); |
| 15861 | |
| 15862 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 15863 | sizeof(wmi_tlv_buf_len_param)); |
| 15864 | |
| 15865 | buf_len_tlv = (wmi_tlv_buf_len_param *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15866 | buf_len_tlv->buf_len = roaminvoke->frame_len; |
| 15867 | |
| 15868 | /* move to next tlv i.e. bcn_prb_frm */ |
| 15869 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_tlv_buf_len_param); |
| 15870 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 15871 | roundup(roaminvoke->frame_len, sizeof(uint32_t))); |
| 15872 | |
| 15873 | /* copy frame after the header */ |
| 15874 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
| 15875 | roaminvoke->frame_buf, |
| 15876 | roaminvoke->frame_len); |
| 15877 | |
| 15878 | WMI_LOGD(FL("bcn/prb_rsp frame, length: %d"), roaminvoke->frame_len); |
| 15879 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 15880 | buf_ptr + WMI_TLV_HDR_SIZE, |
| 15881 | roaminvoke->frame_len); |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 15882 | WMI_LOGD(FL("flag:%d, MODE scn:%d, ap:%d, dly:%d, n_ch:%d, n_bssid:%d"), |
| 15883 | cmd->flags, cmd->roam_scan_mode, |
| 15884 | cmd->roam_ap_sel_mode, cmd->roam_delay, |
| 15885 | cmd->num_chan, cmd->num_bssid); |
| 15886 | WMI_LOGD(FL("BSSID: %pM, channel: %d"), roaminvoke->bssid, ch_hz); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15887 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15888 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 15889 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15890 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15891 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15892 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15893 | } |
| 15894 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15895 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15896 | } |
| 15897 | |
| 15898 | /** |
| 15899 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 15900 | * @wmi_handle: wmi handle |
| 15901 | * @command: command |
| 15902 | * @vdev_id: vdev id |
| 15903 | * |
| 15904 | * This function set roam offload command to fw. |
| 15905 | * |
| 15906 | * Return: CDF status |
| 15907 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15908 | static QDF_STATUS send_roam_scan_offload_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15909 | uint32_t command, uint32_t vdev_id) |
| 15910 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15911 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15912 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 15913 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15914 | int len; |
| 15915 | uint8_t *buf_ptr; |
| 15916 | |
| 15917 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 15918 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15919 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15920 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15921 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15922 | } |
| 15923 | |
| 15924 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15925 | |
| 15926 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 15927 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 15928 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 15929 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 15930 | cmd_fp->vdev_id = vdev_id; |
| 15931 | cmd_fp->command_arg = command; |
| 15932 | |
| 15933 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15934 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15935 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15936 | WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_CMD returned Error %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15937 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15938 | goto error; |
| 15939 | } |
| 15940 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15941 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 15942 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15943 | |
| 15944 | error: |
| 15945 | wmi_buf_free(buf); |
| 15946 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15947 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15948 | } |
| 15949 | |
| 15950 | /** |
| 15951 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 15952 | * @wmi_handle: wmi handle |
| 15953 | * @ap_profile_p: ap profile |
| 15954 | * @vdev_id: vdev id |
| 15955 | * |
| 15956 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 15957 | * |
| 15958 | * Return: CDF status |
| 15959 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15960 | static QDF_STATUS send_roam_scan_offload_ap_profile_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15961 | struct ap_profile_params *ap_profile) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15962 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15963 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15964 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15965 | int len; |
| 15966 | uint8_t *buf_ptr; |
| 15967 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15968 | wmi_roam_cnd_scoring_param *score_param; |
| 15969 | wmi_ap_profile *profile; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15970 | |
| 15971 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15972 | len += sizeof(*score_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15973 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15974 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15975 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15976 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15977 | } |
| 15978 | |
| 15979 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15980 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 15981 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 15982 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 15983 | WMITLV_GET_STRUCT_TLVLEN |
| 15984 | (wmi_roam_ap_profile_fixed_param)); |
| 15985 | /* fill in threshold values */ |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15986 | roam_ap_profile_fp->vdev_id = ap_profile->vdev_id; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15987 | roam_ap_profile_fp->id = 0; |
| 15988 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 15989 | |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15990 | profile = (wmi_ap_profile *)buf_ptr; |
| 15991 | WMITLV_SET_HDR(&profile->tlv_header, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15992 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 15993 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15994 | profile->flags = ap_profile->profile.flags; |
| 15995 | profile->rssi_threshold = ap_profile->profile.rssi_threshold; |
| 15996 | profile->ssid.ssid_len = ap_profile->profile.ssid.length; |
| 15997 | qdf_mem_copy(profile->ssid.ssid, ap_profile->profile.ssid.mac_ssid, |
| 15998 | profile->ssid.ssid_len); |
| 15999 | profile->rsn_authmode = ap_profile->profile.rsn_authmode; |
| 16000 | profile->rsn_ucastcipherset = ap_profile->profile.rsn_ucastcipherset; |
| 16001 | profile->rsn_mcastcipherset = ap_profile->profile.rsn_mcastcipherset; |
| 16002 | profile->rsn_mcastmgmtcipherset = |
| 16003 | ap_profile->profile.rsn_mcastmgmtcipherset; |
| 16004 | profile->rssi_abs_thresh = ap_profile->profile.rssi_abs_thresh; |
| 16005 | |
| 16006 | WMI_LOGD("AP profile: flags %x rssi_threshold %d ssid:%.*s authmode %d uc cipher %d mc cipher %d mc mgmt cipher %d rssi abs thresh %d", |
| 16007 | profile->flags, profile->rssi_threshold, |
| 16008 | profile->ssid.ssid_len, ap_profile->profile.ssid.mac_ssid, |
| 16009 | profile->rsn_authmode, profile->rsn_ucastcipherset, |
| 16010 | profile->rsn_mcastcipherset, profile->rsn_mcastmgmtcipherset, |
| 16011 | profile->rssi_abs_thresh); |
| 16012 | |
| 16013 | buf_ptr += sizeof(wmi_ap_profile); |
| 16014 | |
| 16015 | score_param = (wmi_roam_cnd_scoring_param *)buf_ptr; |
| 16016 | WMITLV_SET_HDR(&score_param->tlv_header, |
| 16017 | WMITLV_TAG_STRUC_wmi_roam_cnd_scoring_param, |
| 16018 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_cnd_scoring_param)); |
| 16019 | score_param->disable_bitmap = ap_profile->param.disable_bitmap; |
| 16020 | score_param->rssi_weightage_pcnt = |
| 16021 | ap_profile->param.rssi_weightage; |
| 16022 | score_param->ht_weightage_pcnt = ap_profile->param.ht_weightage; |
| 16023 | score_param->vht_weightage_pcnt = ap_profile->param.vht_weightage; |
| 16024 | score_param->he_weightage_pcnt = ap_profile->param.he_weightage; |
| 16025 | score_param->bw_weightage_pcnt = ap_profile->param.bw_weightage; |
| 16026 | score_param->band_weightage_pcnt = ap_profile->param.band_weightage; |
| 16027 | score_param->nss_weightage_pcnt = ap_profile->param.nss_weightage; |
| 16028 | score_param->esp_qbss_weightage_pcnt = |
| 16029 | ap_profile->param.esp_qbss_weightage; |
| 16030 | score_param->beamforming_weightage_pcnt = |
| 16031 | ap_profile->param.beamforming_weightage; |
| 16032 | score_param->pcl_weightage_pcnt = ap_profile->param.pcl_weightage; |
| 16033 | score_param->oce_wan_weightage_pcnt = |
| 16034 | ap_profile->param.oce_wan_weightage; |
| 16035 | |
| 16036 | WMI_LOGD("Score params weightage: disable_bitmap %x rssi %d ht %d vht %d he %d BW %d band %d NSS %d ESP %d BF %d PCL %d OCE WAN %d", |
| 16037 | score_param->disable_bitmap, score_param->rssi_weightage_pcnt, |
| 16038 | score_param->ht_weightage_pcnt, |
| 16039 | score_param->vht_weightage_pcnt, |
| 16040 | score_param->he_weightage_pcnt, score_param->bw_weightage_pcnt, |
| 16041 | score_param->band_weightage_pcnt, |
| 16042 | score_param->nss_weightage_pcnt, |
| 16043 | score_param->esp_qbss_weightage_pcnt, |
| 16044 | score_param->beamforming_weightage_pcnt, |
| 16045 | score_param->pcl_weightage_pcnt, |
| 16046 | score_param->oce_wan_weightage_pcnt); |
| 16047 | |
| 16048 | score_param->bw_scoring.score_pcnt = ap_profile->param.bw_index_score; |
| 16049 | score_param->band_scoring.score_pcnt = |
| 16050 | ap_profile->param.band_index_score; |
| 16051 | score_param->nss_scoring.score_pcnt = |
| 16052 | ap_profile->param.nss_index_score; |
| 16053 | |
| 16054 | WMI_LOGD("Params index score bitmask: bw_index_score %x band_index_score %x nss_index_score %x", |
| 16055 | score_param->bw_scoring.score_pcnt, |
| 16056 | score_param->band_scoring.score_pcnt, |
| 16057 | score_param->nss_scoring.score_pcnt); |
| 16058 | |
| 16059 | score_param->rssi_scoring.best_rssi_threshold = |
| 16060 | (-1) * ap_profile->param.rssi_scoring.best_rssi_threshold; |
| 16061 | score_param->rssi_scoring.good_rssi_threshold = |
| 16062 | (-1) * ap_profile->param.rssi_scoring.good_rssi_threshold; |
| 16063 | score_param->rssi_scoring.bad_rssi_threshold = |
| 16064 | (-1) * ap_profile->param.rssi_scoring.bad_rssi_threshold; |
| 16065 | score_param->rssi_scoring.good_rssi_pcnt = |
| 16066 | ap_profile->param.rssi_scoring.good_rssi_pcnt; |
| 16067 | score_param->rssi_scoring.bad_rssi_pcnt = |
| 16068 | ap_profile->param.rssi_scoring.bad_rssi_pcnt; |
| 16069 | score_param->rssi_scoring.good_bucket_size = |
| 16070 | ap_profile->param.rssi_scoring.good_bucket_size; |
| 16071 | score_param->rssi_scoring.bad_bucket_size = |
| 16072 | ap_profile->param.rssi_scoring.bad_bucket_size; |
| 16073 | score_param->rssi_scoring.rssi_pref_5g_rssi_thresh = |
| 16074 | (-1) * ap_profile->param.rssi_scoring.rssi_pref_5g_rssi_thresh; |
| 16075 | |
| 16076 | WMI_LOGD("Rssi scoring threshold: best RSSI %d good RSSI %d bad RSSI %d prefer 5g threshold %d", |
| 16077 | score_param->rssi_scoring.best_rssi_threshold, |
| 16078 | score_param->rssi_scoring.good_rssi_threshold, |
| 16079 | score_param->rssi_scoring.bad_rssi_threshold, |
| 16080 | score_param->rssi_scoring.rssi_pref_5g_rssi_thresh); |
| 16081 | WMI_LOGD("Good RSSI score for each slot %d bad RSSI score for each slot %d good bucket %d bad bucket %d", |
| 16082 | score_param->rssi_scoring.good_rssi_pcnt, |
| 16083 | score_param->rssi_scoring.bad_rssi_pcnt, |
| 16084 | score_param->rssi_scoring.good_bucket_size, |
| 16085 | score_param->rssi_scoring.bad_bucket_size); |
| 16086 | |
| 16087 | score_param->esp_qbss_scoring.num_slot = |
| 16088 | ap_profile->param.esp_qbss_scoring.num_slot; |
| 16089 | score_param->esp_qbss_scoring.score_pcnt3_to_0 = |
| 16090 | ap_profile->param.esp_qbss_scoring.score_pcnt3_to_0; |
| 16091 | score_param->esp_qbss_scoring.score_pcnt7_to_4 = |
| 16092 | ap_profile->param.esp_qbss_scoring.score_pcnt7_to_4; |
| 16093 | score_param->esp_qbss_scoring.score_pcnt11_to_8 = |
| 16094 | ap_profile->param.esp_qbss_scoring.score_pcnt11_to_8; |
| 16095 | score_param->esp_qbss_scoring.score_pcnt15_to_12 = |
| 16096 | ap_profile->param.esp_qbss_scoring.score_pcnt15_to_12; |
| 16097 | |
| 16098 | WMI_LOGD("ESP QBSS index weight: slots %d weight 0to3 %x weight 4to7 %x weight 8to11 %x weight 12to15 %x", |
| 16099 | score_param->esp_qbss_scoring.num_slot, |
| 16100 | score_param->esp_qbss_scoring.score_pcnt3_to_0, |
| 16101 | score_param->esp_qbss_scoring.score_pcnt7_to_4, |
| 16102 | score_param->esp_qbss_scoring.score_pcnt11_to_8, |
| 16103 | score_param->esp_qbss_scoring.score_pcnt15_to_12); |
| 16104 | |
| 16105 | score_param->oce_wan_scoring.num_slot = |
| 16106 | ap_profile->param.oce_wan_scoring.num_slot; |
| 16107 | score_param->oce_wan_scoring.score_pcnt3_to_0 = |
| 16108 | ap_profile->param.oce_wan_scoring.score_pcnt3_to_0; |
| 16109 | score_param->oce_wan_scoring.score_pcnt7_to_4 = |
| 16110 | ap_profile->param.oce_wan_scoring.score_pcnt7_to_4; |
| 16111 | score_param->oce_wan_scoring.score_pcnt11_to_8 = |
| 16112 | ap_profile->param.oce_wan_scoring.score_pcnt11_to_8; |
| 16113 | score_param->oce_wan_scoring.score_pcnt15_to_12 = |
| 16114 | ap_profile->param.oce_wan_scoring.score_pcnt15_to_12; |
| 16115 | |
| 16116 | WMI_LOGD("OCE WAN index weight: slots %d weight 0to3 %x weight 4to7 %x weight 8to11 %x weight 12to15 %x", |
| 16117 | score_param->oce_wan_scoring.num_slot, |
| 16118 | score_param->oce_wan_scoring.score_pcnt3_to_0, |
| 16119 | score_param->oce_wan_scoring.score_pcnt7_to_4, |
| 16120 | score_param->oce_wan_scoring.score_pcnt11_to_8, |
| 16121 | score_param->oce_wan_scoring.score_pcnt15_to_12); |
| 16122 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16123 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 16124 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16125 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16126 | WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_AP_PROFILE returned Error %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16127 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16128 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16129 | } |
| 16130 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16131 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16132 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16133 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16134 | } |
| 16135 | |
| 16136 | /** |
| 16137 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 16138 | * @wmi_handle: wmi handle |
| 16139 | * @scan_period: scan period |
| 16140 | * @scan_age: scan age |
| 16141 | * @vdev_id: vdev id |
| 16142 | * |
| 16143 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 16144 | * |
| 16145 | * Return: CDF status |
| 16146 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 16147 | static QDF_STATUS send_roam_scan_offload_scan_period_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16148 | uint32_t scan_period, |
| 16149 | uint32_t scan_age, |
| 16150 | uint32_t vdev_id) |
| 16151 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16152 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16153 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16154 | int len; |
| 16155 | uint8_t *buf_ptr; |
| 16156 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 16157 | |
| 16158 | /* Send scan period values */ |
| 16159 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 16160 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16161 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16162 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16163 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16164 | } |
| 16165 | |
| 16166 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 16167 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 16168 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 16169 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 16170 | WMITLV_GET_STRUCT_TLVLEN |
| 16171 | (wmi_roam_scan_period_fixed_param)); |
| 16172 | /* fill in scan period values */ |
| 16173 | scan_period_fp->vdev_id = vdev_id; |
| 16174 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 16175 | scan_period_fp->roam_scan_age = scan_age; |
| 16176 | |
| 16177 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 16178 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16179 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16180 | WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_PERIOD returned Error %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16181 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16182 | goto error; |
| 16183 | } |
| 16184 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16185 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_PERIOD roam_scan_period=%d, roam_scan_age=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16186 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16187 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16188 | error: |
| 16189 | wmi_buf_free(buf); |
| 16190 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16191 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16192 | } |
| 16193 | |
| 16194 | /** |
| 16195 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 16196 | * @wmi_handle: wmi handle |
| 16197 | * @chan_count: channel count |
| 16198 | * @chan_list: channel list |
| 16199 | * @list_type: list type |
| 16200 | * @vdev_id: vdev id |
| 16201 | * |
| 16202 | * Set roam offload channel list. |
| 16203 | * |
| 16204 | * Return: CDF status |
| 16205 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 16206 | static QDF_STATUS send_roam_scan_offload_chan_list_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16207 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 16208 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16209 | uint8_t list_type, uint32_t vdev_id) |
| 16210 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16211 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16212 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16213 | int len, list_tlv_len; |
| 16214 | int i; |
| 16215 | uint8_t *buf_ptr; |
| 16216 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 16217 | A_UINT32 *roam_chan_list_array; |
| 16218 | |
| 16219 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16220 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16221 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16222 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16223 | } |
| 16224 | /* Channel list is a table of 2 TLV's */ |
| 16225 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 16226 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 16227 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16228 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16229 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16230 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16231 | } |
| 16232 | |
| 16233 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 16234 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 16235 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 16236 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 16237 | WMITLV_GET_STRUCT_TLVLEN |
| 16238 | (wmi_roam_chan_list_fixed_param)); |
| 16239 | chan_list_fp->vdev_id = vdev_id; |
| 16240 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 16241 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16242 | /* external app is controlling channel list */ |
| 16243 | chan_list_fp->chan_list_type = |
| 16244 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 16245 | } else { |
| 16246 | /* umac supplied occupied channel list in LFR */ |
| 16247 | chan_list_fp->chan_list_type = |
| 16248 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 16249 | } |
| 16250 | |
| 16251 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 16252 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 16253 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 16254 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 16255 | WMI_LOGD("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16256 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 16257 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 16258 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16259 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16260 | } |
| 16261 | |
| 16262 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 16263 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16264 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16265 | WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_CHAN_LIST returned Error %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16266 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16267 | goto error; |
| 16268 | } |
| 16269 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 16270 | WMI_LOGD("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16271 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16272 | error: |
| 16273 | wmi_buf_free(buf); |
| 16274 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16275 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16276 | } |
| 16277 | |
| 16278 | /** |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 16279 | * send_per_roam_config_cmd_tlv() - set per roaming config to FW |
| 16280 | * @wmi_handle: wmi handle |
| 16281 | * @req_buf: per roam config buffer |
| 16282 | * |
| 16283 | * Return: QDF status |
| 16284 | */ |
| 16285 | static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 16286 | struct wmi_per_roam_config_req *req_buf) |
| 16287 | { |
| 16288 | wmi_buf_t buf = NULL; |
| 16289 | QDF_STATUS status; |
| 16290 | int len; |
| 16291 | uint8_t *buf_ptr; |
| 16292 | wmi_roam_per_config_fixed_param *wmi_per_config; |
| 16293 | |
| 16294 | len = sizeof(wmi_roam_per_config_fixed_param); |
| 16295 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16296 | if (!buf) { |
| 16297 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16298 | return QDF_STATUS_E_NOMEM; |
| 16299 | } |
| 16300 | |
| 16301 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 16302 | wmi_per_config = |
| 16303 | (wmi_roam_per_config_fixed_param *) buf_ptr; |
| 16304 | WMITLV_SET_HDR(&wmi_per_config->tlv_header, |
| 16305 | WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param, |
| 16306 | WMITLV_GET_STRUCT_TLVLEN |
| 16307 | (wmi_roam_per_config_fixed_param)); |
| 16308 | |
| 16309 | /* fill in per roam config values */ |
| 16310 | wmi_per_config->vdev_id = req_buf->vdev_id; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 16311 | |
| 16312 | wmi_per_config->enable = req_buf->per_config.enable; |
| 16313 | wmi_per_config->high_rate_thresh = |
| 16314 | (req_buf->per_config.tx_high_rate_thresh << 16) | |
| 16315 | (req_buf->per_config.rx_high_rate_thresh & 0x0000ffff); |
| 16316 | wmi_per_config->low_rate_thresh = |
| 16317 | (req_buf->per_config.tx_low_rate_thresh << 16) | |
| 16318 | (req_buf->per_config.rx_low_rate_thresh & 0x0000ffff); |
| 16319 | wmi_per_config->pkt_err_rate_thresh_pct = |
| 16320 | (req_buf->per_config.tx_rate_thresh_percnt << 16) | |
| 16321 | (req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff); |
| 16322 | wmi_per_config->per_rest_time = req_buf->per_config.per_rest_time; |
Kapil Gupta | 071b155 | 2017-02-13 15:51:52 +0530 | [diff] [blame] | 16323 | wmi_per_config->pkt_err_rate_mon_time = |
| 16324 | (req_buf->per_config.tx_per_mon_time << 16) | |
| 16325 | (req_buf->per_config.rx_per_mon_time & 0x0000ffff); |
Selvaraj, Sridhar | ba7e361 | 2017-05-17 16:05:15 +0530 | [diff] [blame] | 16326 | wmi_per_config->min_candidate_rssi = |
| 16327 | req_buf->per_config.min_candidate_rssi; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 16328 | |
| 16329 | /* Send per roam config parameters */ |
| 16330 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 16331 | len, WMI_ROAM_PER_CONFIG_CMDID); |
| 16332 | if (QDF_IS_STATUS_ERROR(status)) { |
| 16333 | WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d", |
| 16334 | status); |
| 16335 | wmi_buf_free(buf); |
| 16336 | return status; |
| 16337 | } |
| 16338 | |
| 16339 | WMI_LOGI(FL("per roam enable=%d, vdev=%d"), |
| 16340 | req_buf->per_config.enable, req_buf->vdev_id); |
| 16341 | return QDF_STATUS_SUCCESS; |
| 16342 | } |
| 16343 | |
| 16344 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16345 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 16346 | * @wmi_handle: wmi handle |
| 16347 | * @rssi_change_thresh: RSSI Change threshold |
| 16348 | * @bcn_rssi_weight: beacon RSSI weight |
| 16349 | * @vdev_id: vdev id |
| 16350 | * |
| 16351 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 16352 | * |
| 16353 | * Return: CDF status |
| 16354 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 16355 | static QDF_STATUS send_roam_scan_offload_rssi_change_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16356 | uint32_t vdev_id, |
| 16357 | int32_t rssi_change_thresh, |
| 16358 | uint32_t bcn_rssi_weight, |
| 16359 | uint32_t hirssi_delay_btw_scans) |
| 16360 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16361 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16362 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16363 | int len; |
| 16364 | uint8_t *buf_ptr; |
| 16365 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 16366 | |
| 16367 | /* Send rssi change parameters */ |
| 16368 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 16369 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16370 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16371 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16372 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16373 | } |
| 16374 | |
| 16375 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 16376 | rssi_change_fp = |
| 16377 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 16378 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 16379 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 16380 | WMITLV_GET_STRUCT_TLVLEN |
| 16381 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 16382 | /* fill in rssi change threshold (hysteresis) values */ |
| 16383 | rssi_change_fp->vdev_id = vdev_id; |
| 16384 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 16385 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 16386 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 16387 | |
| 16388 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 16389 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16390 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16391 | WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD returned Error %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16392 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16393 | goto error; |
| 16394 | } |
| 16395 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16396 | WMI_LOGI(FL("roam_scan_rssi_change_thresh=%d, bcn_rssi_weight=%d"), |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16397 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16398 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 16399 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16400 | error: |
| 16401 | wmi_buf_free(buf); |
| 16402 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 16403 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16404 | } |
| 16405 | |
| 16406 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 16407 | * @wmi_handle: wmi handle. |
| 16408 | * @cmd: size of command structure. |
| 16409 | * @per_entry_size: per entry size. |
| 16410 | * |
| 16411 | * This utility function calculates how many hotlist entries can |
| 16412 | * fit in one page. |
| 16413 | * |
| 16414 | * Return: number of entries |
| 16415 | */ |
| 16416 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 16417 | size_t cmd_size, |
| 16418 | size_t per_entry_size) |
| 16419 | { |
| 16420 | uint32_t avail_space = 0; |
| 16421 | int num_entries = 0; |
| 16422 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 16423 | |
| 16424 | /* Calculate number of hotlist entries that can |
| 16425 | * be passed in wma message request. |
| 16426 | */ |
| 16427 | avail_space = max_msg_len - cmd_size; |
| 16428 | num_entries = avail_space / per_entry_size; |
| 16429 | return num_entries; |
| 16430 | } |
| 16431 | |
| 16432 | /** |
| 16433 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 16434 | * @wmi_handle: wmi handle |
| 16435 | * @photlist: hotlist command params |
| 16436 | * @buf_len: buffer length |
| 16437 | * |
| 16438 | * This function fills individual elements for hotlist request and |
| 16439 | * TLV for bssid entries |
| 16440 | * |
| 16441 | * Return: CDF Status. |
| 16442 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 16443 | static QDF_STATUS send_get_buf_extscan_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16444 | struct ext_scan_setbssi_hotlist_params * |
| 16445 | photlist, int *buf_len) |
| 16446 | { |
| 16447 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 16448 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 16449 | struct ap_threshold_params *src_ap = photlist->ap; |
| 16450 | wmi_buf_t buf; |
| 16451 | uint8_t *buf_ptr; |
| 16452 | |
| 16453 | int j, index = 0; |
| 16454 | int cmd_len = 0; |
| 16455 | int num_entries; |
| 16456 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 16457 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16458 | int len = sizeof(*cmd); |
| 16459 | |
| 16460 | len += WMI_TLV_HDR_SIZE; |
| 16461 | cmd_len = len; |
| 16462 | |
| 16463 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 16464 | cmd_len, |
| 16465 | sizeof(*dest_hotlist)); |
| 16466 | /* setbssid hotlist expects the bssid list |
| 16467 | * to be non zero value |
| 16468 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 16469 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 16470 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16471 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16472 | } |
| 16473 | |
| 16474 | /* Split the hot list entry pages and send multiple command |
| 16475 | * requests if the buffer reaches the maximum request size |
| 16476 | */ |
| 16477 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16478 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16479 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 16480 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16481 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16482 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 16483 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16484 | } |
| 16485 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 16486 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 16487 | buf_ptr; |
| 16488 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16489 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 16490 | WMITLV_GET_STRUCT_TLVLEN |
| 16491 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 16492 | |
| 16493 | /* Multiple requests are sent until the num_entries_in_page |
| 16494 | * matches the total_entries |
| 16495 | */ |
| 16496 | cmd->request_id = photlist->requestId; |
| 16497 | cmd->vdev_id = photlist->sessionId; |
| 16498 | cmd->total_entries = numap; |
| 16499 | cmd->mode = 1; |
| 16500 | cmd->num_entries_in_page = min_entries; |
| 16501 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 16502 | cmd->first_entry_index = index; |
| 16503 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16504 | WMI_LOGD("%s: vdev id:%d total_entries: %d num_entries: %d lost_ap_sample_size: %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16505 | __func__, cmd->vdev_id, cmd->total_entries, |
| 16506 | cmd->num_entries_in_page, |
| 16507 | cmd->lost_ap_scan_count); |
| 16508 | |
| 16509 | buf_ptr += sizeof(*cmd); |
| 16510 | WMITLV_SET_HDR(buf_ptr, |
| 16511 | WMITLV_TAG_ARRAY_STRUC, |
| 16512 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 16513 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 16514 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 16515 | |
| 16516 | /* Populate bssid, channel info and rssi |
| 16517 | * for the bssid's that are sent as hotlists. |
| 16518 | */ |
| 16519 | for (j = 0; j < min_entries; j++) { |
| 16520 | WMITLV_SET_HDR(dest_hotlist, |
| 16521 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 16522 | WMITLV_GET_STRUCT_TLVLEN |
| 16523 | (wmi_extscan_hotlist_entry)); |
| 16524 | |
| 16525 | dest_hotlist->min_rssi = src_ap->low; |
| 16526 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 16527 | &dest_hotlist->bssid); |
| 16528 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16529 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16530 | __func__, dest_hotlist->channel, |
| 16531 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16532 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16533 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 16534 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 16535 | dest_hotlist->bssid.mac_addr47to32); |
| 16536 | dest_hotlist++; |
| 16537 | src_ap++; |
| 16538 | } |
| 16539 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 16540 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 16541 | |
| 16542 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 16543 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16544 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 16545 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16546 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16547 | } |
| 16548 | index = index + min_entries; |
| 16549 | num_entries = numap - min_entries; |
| 16550 | len = cmd_len; |
| 16551 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 16552 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16553 | } |
| 16554 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 16555 | /** |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 16556 | * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW |
| 16557 | * @wmi_handle: the WMI handle |
| 16558 | * @vdev_id: the Id of the vdev to apply the configuration to |
| 16559 | * @ucast_mode: the active BPF mode to configure for unicast packets |
| 16560 | * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast |
| 16561 | * packets |
| 16562 | * |
| 16563 | * Return: QDF status |
| 16564 | */ |
| 16565 | static QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 16566 | uint8_t vdev_id, |
| 16567 | enum wmi_host_active_bpf_mode ucast_mode, |
| 16568 | enum wmi_host_active_bpf_mode mcast_bcast_mode) |
| 16569 | { |
| 16570 | const WMITLV_TAG_ID tag_id = |
| 16571 | WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; |
| 16572 | const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( |
| 16573 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param); |
| 16574 | QDF_STATUS status; |
| 16575 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; |
| 16576 | wmi_buf_t buf; |
| 16577 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 16578 | WMI_LOGD("Sending WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)", |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 16579 | vdev_id, ucast_mode, mcast_bcast_mode); |
| 16580 | |
| 16581 | /* allocate command buffer */ |
| 16582 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 16583 | if (!buf) { |
| 16584 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 16585 | return QDF_STATUS_E_NOMEM; |
| 16586 | } |
| 16587 | |
| 16588 | /* set TLV header */ |
| 16589 | cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); |
| 16590 | WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); |
| 16591 | |
| 16592 | /* populate data */ |
| 16593 | cmd->vdev_id = vdev_id; |
| 16594 | cmd->uc_mode = ucast_mode; |
| 16595 | cmd->mcbc_mode = mcast_bcast_mode; |
| 16596 | |
| 16597 | /* send to FW */ |
| 16598 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 16599 | WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); |
| 16600 | if (QDF_IS_STATUS_ERROR(status)) { |
| 16601 | WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", |
| 16602 | status); |
| 16603 | wmi_buf_free(buf); |
| 16604 | return status; |
| 16605 | } |
| 16606 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 16607 | WMI_LOGD("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 16608 | |
| 16609 | return QDF_STATUS_SUCCESS; |
| 16610 | } |
| 16611 | |
| 16612 | /** |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 16613 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 16614 | * @wmi_handle: wmi handle |
| 16615 | * @param: wmi power debug parameter |
| 16616 | * |
| 16617 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 16618 | * |
| 16619 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 16620 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 16621 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 16622 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 16623 | { |
| 16624 | wmi_buf_t buf = NULL; |
| 16625 | QDF_STATUS status; |
| 16626 | int len, args_tlv_len; |
| 16627 | uint8_t *buf_ptr; |
| 16628 | uint8_t i; |
| 16629 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 16630 | uint32_t *cmd_args; |
| 16631 | |
| 16632 | /* Prepare and send power debug cmd parameters */ |
| 16633 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 16634 | len = sizeof(*cmd) + args_tlv_len; |
| 16635 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16636 | if (!buf) { |
| 16637 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16638 | return QDF_STATUS_E_NOMEM; |
| 16639 | } |
| 16640 | |
| 16641 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 16642 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 16643 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16644 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 16645 | WMITLV_GET_STRUCT_TLVLEN |
| 16646 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 16647 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16648 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 16649 | param->pdev_id); |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 16650 | cmd->module_id = param->module_id; |
| 16651 | cmd->num_args = param->num_args; |
| 16652 | buf_ptr += sizeof(*cmd); |
| 16653 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 16654 | (param->num_args * sizeof(uint32_t))); |
| 16655 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 16656 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
Shaakir Mohamed | 66ebeca | 2018-01-19 15:49:23 -0800 | [diff] [blame] | 16657 | for (i = 0; (i < param->num_args && i < WMI_UNIT_TEST_MAX_NUM_ARGS); i++) { |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 16658 | cmd_args[i] = param->args[i]; |
| 16659 | WMI_LOGI("%d,", param->args[i]); |
| 16660 | } |
| 16661 | |
| 16662 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 16663 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 16664 | if (QDF_IS_STATUS_ERROR(status)) { |
| 16665 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 16666 | status); |
| 16667 | goto error; |
| 16668 | } |
| 16669 | |
| 16670 | return QDF_STATUS_SUCCESS; |
| 16671 | error: |
| 16672 | wmi_buf_free(buf); |
| 16673 | |
| 16674 | return status; |
| 16675 | } |
| 16676 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16677 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16678 | * send_multiple_vdev_restart_req_cmd_tlv() - send multiple vdev restart req |
| 16679 | * @wmi_handle: wmi handle |
| 16680 | * @param: wmi multiple vdev restart req param |
| 16681 | * |
| 16682 | * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw. |
| 16683 | * |
| 16684 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 16685 | */ |
| 16686 | static QDF_STATUS send_multiple_vdev_restart_req_cmd_tlv( |
| 16687 | wmi_unified_t wmi_handle, |
| 16688 | struct multiple_vdev_restart_params *param) |
| 16689 | { |
| 16690 | wmi_buf_t buf; |
| 16691 | QDF_STATUS qdf_status; |
| 16692 | wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *cmd; |
| 16693 | int i; |
| 16694 | uint8_t *buf_ptr; |
| 16695 | uint32_t *vdev_ids; |
| 16696 | wmi_channel *chan_info; |
| 16697 | struct channel_param *tchan_info; |
| 16698 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 16699 | |
| 16700 | len += sizeof(wmi_channel); |
| 16701 | if (param->num_vdevs) |
| 16702 | len += sizeof(uint32_t) * param->num_vdevs; |
| 16703 | |
| 16704 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16705 | if (!buf) { |
| 16706 | WMI_LOGE("Failed to allocate memory\n"); |
| 16707 | qdf_status = QDF_STATUS_E_NOMEM; |
| 16708 | goto end; |
| 16709 | } |
| 16710 | |
| 16711 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 16712 | cmd = (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *) |
| 16713 | buf_ptr; |
| 16714 | |
| 16715 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16716 | WMITLV_TAG_STRUC_wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param, |
| 16717 | WMITLV_GET_STRUCT_TLVLEN |
| 16718 | (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16719 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 16720 | param->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16721 | cmd->requestor_id = param->requestor_id; |
| 16722 | cmd->disable_hw_ack = param->disable_hw_ack; |
| 16723 | cmd->cac_duration_ms = param->cac_duration_ms; |
| 16724 | cmd->num_vdevs = param->num_vdevs; |
| 16725 | |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 16726 | WMI_LOGI("%s:cmd->pdev_id: %d ,cmd->requestor_id: %d ," |
| 16727 | "cmd->disable_hw_ack: %d , cmd->cac_duration_ms:%d ," |
| 16728 | " cmd->num_vdevs: %d ", |
| 16729 | __func__, cmd->pdev_id, cmd->requestor_id, |
| 16730 | cmd->disable_hw_ack, cmd->cac_duration_ms, cmd->num_vdevs); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16731 | buf_ptr += sizeof(*cmd); |
| 16732 | |
| 16733 | WMITLV_SET_HDR(buf_ptr, |
| 16734 | WMITLV_TAG_ARRAY_UINT32, |
| 16735 | sizeof(A_UINT32) * param->num_vdevs); |
| 16736 | vdev_ids = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 16737 | for (i = 0; i < param->num_vdevs; i++) { |
| 16738 | vdev_ids[i] = param->vdev_ids[i]; |
| 16739 | } |
| 16740 | |
| 16741 | buf_ptr += (sizeof(A_UINT32) * param->num_vdevs) + WMI_TLV_HDR_SIZE; |
| 16742 | |
| 16743 | WMITLV_SET_HDR(buf_ptr, |
| 16744 | WMITLV_TAG_STRUC_wmi_channel, |
| 16745 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
Sathish Kumar | 3e28e00 | 2017-03-07 15:53:04 +0530 | [diff] [blame] | 16746 | chan_info = (wmi_channel *)buf_ptr; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16747 | tchan_info = &(param->ch_param); |
| 16748 | chan_info->mhz = tchan_info->mhz; |
| 16749 | chan_info->band_center_freq1 = tchan_info->cfreq1; |
| 16750 | chan_info->band_center_freq2 = tchan_info->cfreq2; |
| 16751 | if (tchan_info->is_chan_passive) |
| 16752 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 16753 | WMI_CHAN_FLAG_PASSIVE); |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 16754 | if (tchan_info->dfs_set) |
| 16755 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_DFS); |
| 16756 | |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16757 | if (tchan_info->allow_vht) |
| 16758 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 16759 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 16760 | else if (tchan_info->allow_ht) |
| 16761 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 16762 | WMI_CHAN_FLAG_ALLOW_HT); |
| 16763 | WMI_SET_CHANNEL_MODE(chan_info, tchan_info->phy_mode); |
| 16764 | WMI_SET_CHANNEL_MIN_POWER(chan_info, tchan_info->minpower); |
| 16765 | WMI_SET_CHANNEL_MAX_POWER(chan_info, tchan_info->maxpower); |
| 16766 | WMI_SET_CHANNEL_REG_POWER(chan_info, tchan_info->maxregpower); |
| 16767 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, tchan_info->antennamax); |
| 16768 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, tchan_info->reg_class_id); |
Kai Chen | 4710d46 | 2017-12-15 14:06:06 -0800 | [diff] [blame] | 16769 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, tchan_info->maxregpower); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16770 | |
Shaakir Mohamed | 9fbf00a | 2018-02-12 14:00:22 -0800 | [diff] [blame] | 16771 | WMI_LOGI("%s:tchan_info->is_chan_passive: %d ," |
| 16772 | "tchan_info->dfs_set : %d ,tchan_info->allow_vht:%d ," |
| 16773 | "tchan_info->allow_ht: %d ,tchan_info->antennamax: %d ," |
| 16774 | "tchan_info->phy_mode: %d ,tchan_info->minpower: %d," |
| 16775 | "tchan_info->maxpower: %d ,tchan_info->maxregpower: %d ," |
| 16776 | "tchan_info->reg_class_id: %d ," |
| 16777 | "tchan_info->maxregpower : %d ", __func__, |
| 16778 | tchan_info->is_chan_passive, tchan_info->dfs_set, |
| 16779 | tchan_info->allow_vht, tchan_info->allow_ht, |
| 16780 | tchan_info->antennamax, tchan_info->phy_mode, |
| 16781 | tchan_info->minpower, tchan_info->maxpower, |
| 16782 | tchan_info->maxregpower, tchan_info->reg_class_id, |
| 16783 | tchan_info->maxregpower); |
| 16784 | |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16785 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 16786 | WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID); |
| 16787 | |
| 16788 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 16789 | WMI_LOGE("%s: Failed to send\n", __func__); |
| 16790 | wmi_buf_free(buf); |
| 16791 | } |
| 16792 | |
| 16793 | end: |
| 16794 | return qdf_status; |
| 16795 | } |
| 16796 | |
| 16797 | /** |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 16798 | * send_dfs_phyerr_offload_en_cmd_tlv() - send dfs phyerr offload enable cmd |
| 16799 | * @wmi_handle: wmi handle |
| 16800 | * @pdev_id: pdev id |
| 16801 | * |
| 16802 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID command to firmware. |
| 16803 | * |
| 16804 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 16805 | */ |
| 16806 | static QDF_STATUS send_dfs_phyerr_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 16807 | uint32_t pdev_id) |
| 16808 | { |
| 16809 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *cmd; |
| 16810 | wmi_buf_t buf; |
| 16811 | uint16_t len; |
| 16812 | QDF_STATUS ret; |
| 16813 | |
| 16814 | len = sizeof(*cmd); |
| 16815 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16816 | |
| 16817 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 16818 | |
| 16819 | if (!buf) { |
| 16820 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16821 | return QDF_STATUS_E_NOMEM; |
| 16822 | } |
| 16823 | |
| 16824 | cmd = (wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *) |
| 16825 | wmi_buf_data(buf); |
| 16826 | |
| 16827 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16828 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param, |
| 16829 | WMITLV_GET_STRUCT_TLVLEN( |
| 16830 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param)); |
| 16831 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16832 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 16833 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 16834 | WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 16835 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 16836 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 16837 | __func__, ret, pdev_id); |
| 16838 | wmi_buf_free(buf); |
| 16839 | return QDF_STATUS_E_FAILURE; |
| 16840 | } |
| 16841 | |
| 16842 | return QDF_STATUS_SUCCESS; |
| 16843 | } |
| 16844 | |
| 16845 | /** |
| 16846 | * send_dfs_phyerr_offload_dis_cmd_tlv() - send dfs phyerr offload disable cmd |
| 16847 | * @wmi_handle: wmi handle |
| 16848 | * @pdev_id: pdev id |
| 16849 | * |
| 16850 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID command to firmware. |
| 16851 | * |
| 16852 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 16853 | */ |
| 16854 | static QDF_STATUS send_dfs_phyerr_offload_dis_cmd_tlv(wmi_unified_t wmi_handle, |
| 16855 | uint32_t pdev_id) |
| 16856 | { |
| 16857 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *cmd; |
| 16858 | wmi_buf_t buf; |
| 16859 | uint16_t len; |
| 16860 | QDF_STATUS ret; |
| 16861 | |
| 16862 | len = sizeof(*cmd); |
| 16863 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16864 | |
| 16865 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 16866 | |
| 16867 | if (!buf) { |
| 16868 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16869 | return QDF_STATUS_E_NOMEM; |
| 16870 | } |
| 16871 | |
| 16872 | cmd = (wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *) |
| 16873 | wmi_buf_data(buf); |
| 16874 | |
| 16875 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16876 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param, |
| 16877 | WMITLV_GET_STRUCT_TLVLEN( |
| 16878 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param)); |
| 16879 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16880 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 16881 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 16882 | WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 16883 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 16884 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 16885 | __func__, ret, pdev_id); |
| 16886 | wmi_buf_free(buf); |
| 16887 | return QDF_STATUS_E_FAILURE; |
| 16888 | } |
| 16889 | |
| 16890 | return QDF_STATUS_SUCCESS; |
| 16891 | } |
| 16892 | |
| 16893 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16894 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 16895 | * @wmi_handle: wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16896 | * @param param: pointer to wmi init param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16897 | * |
| 16898 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16899 | */ |
| 16900 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16901 | struct wmi_init_cmd_param *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16902 | { |
| 16903 | wmi_buf_t buf; |
| 16904 | wmi_init_cmd_fixed_param *cmd; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16905 | uint8_t *buf_ptr; |
| 16906 | wmi_resource_config *resource_cfg; |
| 16907 | wlan_host_memory_chunk *host_mem_chunks; |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16908 | uint32_t mem_chunk_len = 0, hw_mode_len = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16909 | uint16_t idx; |
| 16910 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 16911 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16912 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16913 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + |
| 16914 | WMI_TLV_HDR_SIZE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16915 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16916 | |
| 16917 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) |
| 16918 | hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 16919 | WMI_TLV_HDR_SIZE + |
| 16920 | (param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac)); |
| 16921 | |
| 16922 | 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] | 16923 | if (!buf) { |
| 16924 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16925 | return QDF_STATUS_E_FAILURE; |
| 16926 | } |
| 16927 | |
| 16928 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 16929 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 16930 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 16931 | |
| 16932 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 16933 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 16934 | + WMI_TLV_HDR_SIZE); |
| 16935 | |
| 16936 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16937 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 16938 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 16939 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16940 | wmi_copy_resource_config(resource_cfg, param->res_cfg); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16941 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 16942 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 16943 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 16944 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16945 | for (idx = 0; idx < param->num_mem_chunks; ++idx) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16946 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 16947 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 16948 | WMITLV_GET_STRUCT_TLVLEN |
| 16949 | (wlan_host_memory_chunk)); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16950 | host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr; |
| 16951 | host_mem_chunks[idx].size = param->mem_chunks[idx].len; |
| 16952 | host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id; |
Vivek | f85a42b | 2017-06-21 11:38:28 +0530 | [diff] [blame] | 16953 | QDF_TRACE(QDF_MODULE_ID_ANY, QDF_TRACE_LEVEL_DEBUG, |
| 16954 | "chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16955 | idx, host_mem_chunks[idx].size, |
| 16956 | host_mem_chunks[idx].ptr); |
| 16957 | } |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16958 | cmd->num_host_mem_chunks = param->num_mem_chunks; |
| 16959 | len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 16960 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16961 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 16962 | WMITLV_TAG_ARRAY_STRUC, |
| 16963 | (sizeof(wlan_host_memory_chunk) * |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16964 | param->num_mem_chunks)); |
| 16965 | |
| 16966 | /* Fill hw mode id config */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16967 | 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] | 16968 | |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 16969 | /* Fill fw_abi_vers */ |
| 16970 | copy_fw_abi_version_tlv(wmi_handle, cmd); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16971 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 16972 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 16973 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 16974 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 16975 | ret); |
| 16976 | wmi_buf_free(buf); |
| 16977 | } |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 16978 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 16979 | return ret; |
| 16980 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16981 | } |
| 16982 | |
| 16983 | /** |
Gyanranjan Hazarika | 3f3b471 | 2018-01-12 13:27:43 -0800 | [diff] [blame] | 16984 | * send_addba_send_cmd_tlv() - send addba send command to fw |
| 16985 | * @wmi_handle: wmi handle |
| 16986 | * @param: pointer to delba send params |
| 16987 | * @macaddr: peer mac address |
| 16988 | * |
| 16989 | * Send WMI_ADDBA_SEND_CMDID command to firmware |
| 16990 | * Return: QDF_STATUS_SUCCESS on success. QDF_STATUS_E** on error |
| 16991 | */ |
| 16992 | static QDF_STATUS |
| 16993 | send_addba_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 16994 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 16995 | struct addba_send_params *param) |
| 16996 | { |
| 16997 | wmi_addba_send_cmd_fixed_param *cmd; |
| 16998 | wmi_buf_t buf; |
| 16999 | uint16_t len; |
| 17000 | QDF_STATUS ret; |
| 17001 | |
| 17002 | len = sizeof(*cmd); |
| 17003 | |
| 17004 | buf = wmi_buf_alloc(wmi_handle, len); |
| 17005 | if (!buf) { |
| 17006 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 17007 | return QDF_STATUS_E_NOMEM; |
| 17008 | } |
| 17009 | |
| 17010 | cmd = (wmi_addba_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 17011 | |
| 17012 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 17013 | WMITLV_TAG_STRUC_wmi_addba_send_cmd_fixed_param, |
| 17014 | WMITLV_GET_STRUCT_TLVLEN(wmi_addba_send_cmd_fixed_param)); |
| 17015 | |
| 17016 | cmd->vdev_id = param->vdev_id; |
| 17017 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 17018 | cmd->tid = param->tidno; |
| 17019 | cmd->buffersize = param->buffersize; |
| 17020 | |
| 17021 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_ADDBA_SEND_CMDID); |
| 17022 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 17023 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d", __func__, ret); |
| 17024 | wmi_buf_free(buf); |
| 17025 | return QDF_STATUS_E_FAILURE; |
| 17026 | } |
| 17027 | |
| 17028 | return QDF_STATUS_SUCCESS; |
| 17029 | } |
| 17030 | |
| 17031 | /** |
| 17032 | * send_delba_send_cmd_tlv() - send delba send command to fw |
| 17033 | * @wmi_handle: wmi handle |
| 17034 | * @param: pointer to delba send params |
| 17035 | * @macaddr: peer mac address |
| 17036 | * |
| 17037 | * Send WMI_DELBA_SEND_CMDID command to firmware |
| 17038 | * Return: QDF_STATUS_SUCCESS on success. QDF_STATUS_E** on error |
| 17039 | */ |
| 17040 | static QDF_STATUS |
| 17041 | send_delba_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 17042 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 17043 | struct delba_send_params *param) |
| 17044 | { |
| 17045 | wmi_delba_send_cmd_fixed_param *cmd; |
| 17046 | wmi_buf_t buf; |
| 17047 | uint16_t len; |
| 17048 | QDF_STATUS ret; |
| 17049 | |
| 17050 | len = sizeof(*cmd); |
| 17051 | |
| 17052 | buf = wmi_buf_alloc(wmi_handle, len); |
| 17053 | if (!buf) { |
| 17054 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 17055 | return QDF_STATUS_E_NOMEM; |
| 17056 | } |
| 17057 | |
| 17058 | cmd = (wmi_delba_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 17059 | |
| 17060 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 17061 | WMITLV_TAG_STRUC_wmi_delba_send_cmd_fixed_param, |
| 17062 | WMITLV_GET_STRUCT_TLVLEN(wmi_delba_send_cmd_fixed_param)); |
| 17063 | |
| 17064 | cmd->vdev_id = param->vdev_id; |
| 17065 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 17066 | cmd->tid = param->tidno; |
| 17067 | cmd->initiator = param->initiator; |
| 17068 | cmd->reasoncode = param->reasoncode; |
| 17069 | |
| 17070 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_DELBA_SEND_CMDID); |
| 17071 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 17072 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d", __func__, ret); |
| 17073 | wmi_buf_free(buf); |
| 17074 | return QDF_STATUS_E_FAILURE; |
| 17075 | } |
| 17076 | |
| 17077 | return QDF_STATUS_SUCCESS; |
| 17078 | } |
| 17079 | |
| 17080 | /** |
Gyanranjan Hazarika | cd535f9 | 2018-01-17 19:29:45 -0800 | [diff] [blame] | 17081 | * send_addba_clearresponse_cmd_tlv() - send addba clear response command |
| 17082 | * to fw |
| 17083 | * @wmi_handle: wmi handle |
| 17084 | * @param: pointer to addba clearresp params |
| 17085 | * @macaddr: peer mac address |
| 17086 | * Return: 0 for success or error code |
| 17087 | */ |
| 17088 | static QDF_STATUS |
| 17089 | send_addba_clearresponse_cmd_tlv(wmi_unified_t wmi_handle, |
| 17090 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 17091 | struct addba_clearresponse_params *param) |
| 17092 | { |
| 17093 | wmi_addba_clear_resp_cmd_fixed_param *cmd; |
| 17094 | wmi_buf_t buf; |
| 17095 | uint16_t len; |
| 17096 | QDF_STATUS ret; |
| 17097 | |
| 17098 | len = sizeof(*cmd); |
| 17099 | |
| 17100 | buf = wmi_buf_alloc(wmi_handle, len); |
| 17101 | if (!buf) { |
| 17102 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 17103 | return QDF_STATUS_E_FAILURE; |
| 17104 | } |
| 17105 | cmd = (wmi_addba_clear_resp_cmd_fixed_param *)wmi_buf_data(buf); |
| 17106 | |
| 17107 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 17108 | WMITLV_TAG_STRUC_wmi_addba_clear_resp_cmd_fixed_param, |
| 17109 | WMITLV_GET_STRUCT_TLVLEN(wmi_addba_clear_resp_cmd_fixed_param)); |
| 17110 | |
| 17111 | cmd->vdev_id = param->vdev_id; |
| 17112 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 17113 | |
| 17114 | ret = wmi_unified_cmd_send(wmi_handle, |
| 17115 | buf, len, WMI_ADDBA_CLEAR_RESP_CMDID); |
| 17116 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 17117 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d", __func__, ret); |
| 17118 | wmi_buf_free(buf); |
| 17119 | return QDF_STATUS_E_FAILURE; |
| 17120 | } |
| 17121 | |
| 17122 | return QDF_STATUS_SUCCESS; |
| 17123 | } |
| 17124 | |
| 17125 | /** |
Kiran Venkatappa | 7fe3afc | 2017-11-08 19:32:23 +0530 | [diff] [blame] | 17126 | * send_bcn_offload_control_cmd_tlv - send beacon ofload control cmd to fw |
| 17127 | * @wmi_handle: wmi handle |
| 17128 | * @bcn_ctrl_param: pointer to bcn_offload_control param |
| 17129 | * |
| 17130 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17131 | */ |
| 17132 | static |
| 17133 | QDF_STATUS send_bcn_offload_control_cmd_tlv(wmi_unified_t wmi_handle, |
| 17134 | struct bcn_offload_control *bcn_ctrl_param) |
| 17135 | { |
| 17136 | wmi_buf_t buf; |
| 17137 | wmi_bcn_offload_ctrl_cmd_fixed_param *cmd; |
| 17138 | QDF_STATUS ret; |
| 17139 | uint32_t len; |
| 17140 | |
| 17141 | len = sizeof(*cmd); |
| 17142 | |
| 17143 | buf = wmi_buf_alloc(wmi_handle, len); |
| 17144 | if (!buf) { |
| 17145 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 17146 | return QDF_STATUS_E_FAILURE; |
| 17147 | } |
| 17148 | |
| 17149 | cmd = (wmi_bcn_offload_ctrl_cmd_fixed_param *) wmi_buf_data(buf); |
| 17150 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 17151 | WMITLV_TAG_STRUC_wmi_bcn_offload_ctrl_cmd_fixed_param, |
| 17152 | WMITLV_GET_STRUCT_TLVLEN |
| 17153 | (wmi_bcn_offload_ctrl_cmd_fixed_param)); |
| 17154 | cmd->vdev_id = bcn_ctrl_param->vdev_id; |
| 17155 | if (bcn_ctrl_param->bcn_tx_enable) |
| 17156 | cmd->bcn_ctrl_op = WMI_BEACON_CTRL_TX_ENABLE; |
| 17157 | else |
| 17158 | cmd->bcn_ctrl_op = WMI_BEACON_CTRL_TX_DISABLE; |
| 17159 | |
| 17160 | |
| 17161 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 17162 | WMI_BCN_OFFLOAD_CTRL_CMDID); |
| 17163 | |
| 17164 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 17165 | WMI_LOGE("WMI_BCN_OFFLOAD_CTRL_CMDID send returned Error %d", |
| 17166 | ret); |
| 17167 | wmi_buf_free(buf); |
| 17168 | } |
| 17169 | |
| 17170 | return ret; |
| 17171 | } |
| 17172 | |
Naveen Rawat | 4f1e2ac | 2017-12-14 13:24:31 -0800 | [diff] [blame] | 17173 | #ifdef WLAN_FEATURE_NAN_CONVERGENCE |
| 17174 | static QDF_STATUS nan_ndp_initiator_req_tlv(wmi_unified_t wmi_handle, |
| 17175 | struct nan_datapath_initiator_req *ndp_req) |
| 17176 | { |
| 17177 | uint16_t len; |
| 17178 | wmi_buf_t buf; |
| 17179 | uint8_t *tlv_ptr; |
| 17180 | QDF_STATUS status; |
| 17181 | wmi_channel *ch_tlv; |
| 17182 | wmi_ndp_initiator_req_fixed_param *cmd; |
| 17183 | uint32_t passphrase_len, service_name_len; |
| 17184 | uint32_t ndp_cfg_len, ndp_app_info_len, pmk_len; |
| 17185 | |
| 17186 | /* |
| 17187 | * WMI command expects 4 byte alligned len: |
| 17188 | * round up ndp_cfg_len and ndp_app_info_len to 4 bytes |
| 17189 | */ |
| 17190 | ndp_cfg_len = qdf_roundup(ndp_req->ndp_config.ndp_cfg_len, 4); |
| 17191 | ndp_app_info_len = qdf_roundup(ndp_req->ndp_info.ndp_app_info_len, 4); |
| 17192 | pmk_len = qdf_roundup(ndp_req->pmk.pmk_len, 4); |
| 17193 | passphrase_len = qdf_roundup(ndp_req->passphrase.passphrase_len, 4); |
| 17194 | service_name_len = |
| 17195 | qdf_roundup(ndp_req->service_name.service_name_len, 4); |
| 17196 | /* allocated memory for fixed params as well as variable size data */ |
| 17197 | len = sizeof(*cmd) + sizeof(*ch_tlv) + (5 * WMI_TLV_HDR_SIZE) |
| 17198 | + ndp_cfg_len + ndp_app_info_len + pmk_len |
| 17199 | + passphrase_len + service_name_len; |
| 17200 | |
| 17201 | buf = wmi_buf_alloc(wmi_handle, len); |
| 17202 | if (!buf) { |
| 17203 | WMI_LOGE("wmi_buf_alloc failed"); |
| 17204 | return QDF_STATUS_E_NOMEM; |
| 17205 | } |
| 17206 | |
| 17207 | cmd = (wmi_ndp_initiator_req_fixed_param *) wmi_buf_data(buf); |
| 17208 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 17209 | WMITLV_TAG_STRUC_wmi_ndp_initiator_req_fixed_param, |
| 17210 | WMITLV_GET_STRUCT_TLVLEN( |
| 17211 | wmi_ndp_initiator_req_fixed_param)); |
| 17212 | cmd->vdev_id = wlan_vdev_get_id(ndp_req->vdev); |
| 17213 | cmd->transaction_id = ndp_req->transaction_id; |
| 17214 | cmd->service_instance_id = ndp_req->service_instance_id; |
| 17215 | WMI_CHAR_ARRAY_TO_MAC_ADDR(ndp_req->peer_discovery_mac_addr.bytes, |
| 17216 | &cmd->peer_discovery_mac_addr); |
| 17217 | |
| 17218 | cmd->ndp_cfg_len = ndp_req->ndp_config.ndp_cfg_len; |
| 17219 | cmd->ndp_app_info_len = ndp_req->ndp_info.ndp_app_info_len; |
| 17220 | cmd->ndp_channel_cfg = ndp_req->channel_cfg; |
| 17221 | cmd->nan_pmk_len = ndp_req->pmk.pmk_len; |
| 17222 | cmd->nan_csid = ndp_req->ncs_sk_type; |
| 17223 | cmd->nan_passphrase_len = ndp_req->passphrase.passphrase_len; |
| 17224 | cmd->nan_servicename_len = ndp_req->service_name.service_name_len; |
| 17225 | |
| 17226 | ch_tlv = (wmi_channel *)&cmd[1]; |
| 17227 | WMITLV_SET_HDR(ch_tlv, WMITLV_TAG_STRUC_wmi_channel, |
| 17228 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 17229 | ch_tlv->mhz = ndp_req->channel; |
| 17230 | tlv_ptr = (uint8_t *)&ch_tlv[1]; |
| 17231 | |
| 17232 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_cfg_len); |
| 17233 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], |
| 17234 | ndp_req->ndp_config.ndp_cfg, cmd->ndp_cfg_len); |
| 17235 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + ndp_cfg_len; |
| 17236 | |
| 17237 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_app_info_len); |
| 17238 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], |
| 17239 | ndp_req->ndp_info.ndp_app_info, cmd->ndp_app_info_len); |
| 17240 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + ndp_app_info_len; |
| 17241 | |
| 17242 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, pmk_len); |
| 17243 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], ndp_req->pmk.pmk, |
| 17244 | cmd->nan_pmk_len); |
| 17245 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + pmk_len; |
| 17246 | |
| 17247 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, passphrase_len); |
| 17248 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], ndp_req->passphrase.passphrase, |
| 17249 | cmd->nan_passphrase_len); |
| 17250 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + passphrase_len; |
| 17251 | |
| 17252 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, service_name_len); |
| 17253 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], |
| 17254 | ndp_req->service_name.service_name, |
| 17255 | cmd->nan_servicename_len); |
| 17256 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + service_name_len; |
| 17257 | |
| 17258 | WMI_LOGD("vdev_id = %d, transaction_id: %d, service_instance_id: %d, ch: %d, ch_cfg: %d, csid: %d", |
| 17259 | cmd->vdev_id, cmd->transaction_id, cmd->service_instance_id, |
| 17260 | ch_tlv->mhz, cmd->ndp_channel_cfg, cmd->nan_csid); |
| 17261 | WMI_LOGD("peer mac addr: mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 17262 | cmd->peer_discovery_mac_addr.mac_addr31to0, |
| 17263 | cmd->peer_discovery_mac_addr.mac_addr47to32); |
| 17264 | |
| 17265 | WMI_LOGD("ndp_config len: %d", cmd->ndp_cfg_len); |
| 17266 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17267 | ndp_req->ndp_config.ndp_cfg, |
| 17268 | ndp_req->ndp_config.ndp_cfg_len); |
| 17269 | |
| 17270 | WMI_LOGD("ndp_app_info len: %d", cmd->ndp_app_info_len); |
| 17271 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17272 | ndp_req->ndp_info.ndp_app_info, |
| 17273 | ndp_req->ndp_info.ndp_app_info_len); |
| 17274 | |
| 17275 | WMI_LOGD("pmk len: %d", cmd->nan_pmk_len); |
| 17276 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17277 | ndp_req->pmk.pmk, cmd->nan_pmk_len); |
| 17278 | |
| 17279 | WMI_LOGD("pass phrase len: %d", cmd->nan_passphrase_len); |
| 17280 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17281 | ndp_req->passphrase.passphrase, |
| 17282 | cmd->nan_passphrase_len); |
| 17283 | |
| 17284 | WMI_LOGD("service name len: %d", cmd->nan_servicename_len); |
| 17285 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17286 | ndp_req->service_name.service_name, |
| 17287 | cmd->nan_servicename_len); |
| 17288 | |
| 17289 | WMI_LOGD("sending WMI_NDP_INITIATOR_REQ_CMDID(0x%X)", |
| 17290 | WMI_NDP_INITIATOR_REQ_CMDID); |
| 17291 | |
| 17292 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 17293 | WMI_NDP_INITIATOR_REQ_CMDID); |
| 17294 | if (QDF_IS_STATUS_ERROR(status)) { |
| 17295 | WMI_LOGE("WMI_NDP_INITIATOR_REQ_CMDID failed, ret: %d", status); |
| 17296 | wmi_buf_free(buf); |
| 17297 | } |
| 17298 | |
| 17299 | return status; |
| 17300 | } |
| 17301 | |
| 17302 | static QDF_STATUS nan_ndp_responder_req_tlv(wmi_unified_t wmi_handle, |
| 17303 | struct nan_datapath_responder_req *req) |
| 17304 | { |
| 17305 | uint16_t len; |
| 17306 | wmi_buf_t buf; |
| 17307 | uint8_t *tlv_ptr; |
| 17308 | QDF_STATUS status; |
| 17309 | wmi_ndp_responder_req_fixed_param *cmd; |
| 17310 | uint32_t passphrase_len, service_name_len; |
| 17311 | uint32_t vdev_id = 0, ndp_cfg_len, ndp_app_info_len, pmk_len; |
| 17312 | |
| 17313 | vdev_id = wlan_vdev_get_id(req->vdev); |
| 17314 | WMI_LOGD("vdev_id: %d, transaction_id: %d, ndp_rsp %d, ndp_instance_id: %d, ndp_app_info_len: %d", |
| 17315 | vdev_id, req->transaction_id, |
| 17316 | req->ndp_rsp, |
| 17317 | req->ndp_instance_id, |
| 17318 | req->ndp_info.ndp_app_info_len); |
| 17319 | |
| 17320 | /* |
| 17321 | * WMI command expects 4 byte alligned len: |
| 17322 | * round up ndp_cfg_len and ndp_app_info_len to 4 bytes |
| 17323 | */ |
| 17324 | ndp_cfg_len = qdf_roundup(req->ndp_config.ndp_cfg_len, 4); |
| 17325 | ndp_app_info_len = qdf_roundup(req->ndp_info.ndp_app_info_len, 4); |
| 17326 | pmk_len = qdf_roundup(req->pmk.pmk_len, 4); |
| 17327 | passphrase_len = qdf_roundup(req->passphrase.passphrase_len, 4); |
| 17328 | service_name_len = |
| 17329 | qdf_roundup(req->service_name.service_name_len, 4); |
| 17330 | |
| 17331 | /* allocated memory for fixed params as well as variable size data */ |
| 17332 | len = sizeof(*cmd) + 5*WMI_TLV_HDR_SIZE + ndp_cfg_len + ndp_app_info_len |
| 17333 | + pmk_len + passphrase_len + service_name_len; |
| 17334 | |
| 17335 | buf = wmi_buf_alloc(wmi_handle, len); |
| 17336 | if (!buf) { |
| 17337 | WMI_LOGE("wmi_buf_alloc failed"); |
| 17338 | return QDF_STATUS_E_NOMEM; |
| 17339 | } |
| 17340 | cmd = (wmi_ndp_responder_req_fixed_param *) wmi_buf_data(buf); |
| 17341 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 17342 | WMITLV_TAG_STRUC_wmi_ndp_responder_req_fixed_param, |
| 17343 | WMITLV_GET_STRUCT_TLVLEN( |
| 17344 | wmi_ndp_responder_req_fixed_param)); |
| 17345 | cmd->vdev_id = vdev_id; |
| 17346 | cmd->transaction_id = req->transaction_id; |
| 17347 | cmd->ndp_instance_id = req->ndp_instance_id; |
| 17348 | cmd->rsp_code = req->ndp_rsp; |
| 17349 | cmd->ndp_cfg_len = req->ndp_config.ndp_cfg_len; |
| 17350 | cmd->ndp_app_info_len = req->ndp_info.ndp_app_info_len; |
| 17351 | cmd->nan_pmk_len = req->pmk.pmk_len; |
| 17352 | cmd->nan_csid = req->ncs_sk_type; |
| 17353 | cmd->nan_passphrase_len = req->passphrase.passphrase_len; |
| 17354 | cmd->nan_servicename_len = req->service_name.service_name_len; |
| 17355 | |
| 17356 | tlv_ptr = (uint8_t *)&cmd[1]; |
| 17357 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_cfg_len); |
| 17358 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], |
| 17359 | req->ndp_config.ndp_cfg, cmd->ndp_cfg_len); |
| 17360 | |
| 17361 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + ndp_cfg_len; |
| 17362 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_app_info_len); |
| 17363 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], |
| 17364 | req->ndp_info.ndp_app_info, |
| 17365 | req->ndp_info.ndp_app_info_len); |
| 17366 | |
| 17367 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + ndp_app_info_len; |
| 17368 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, pmk_len); |
| 17369 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], req->pmk.pmk, |
| 17370 | cmd->nan_pmk_len); |
| 17371 | |
| 17372 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + pmk_len; |
| 17373 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, passphrase_len); |
| 17374 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], |
| 17375 | req->passphrase.passphrase, |
| 17376 | cmd->nan_passphrase_len); |
| 17377 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + passphrase_len; |
| 17378 | |
| 17379 | WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, service_name_len); |
| 17380 | qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], |
| 17381 | req->service_name.service_name, |
| 17382 | cmd->nan_servicename_len); |
| 17383 | |
| 17384 | tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + service_name_len; |
| 17385 | |
| 17386 | WMI_LOGD("vdev_id = %d, transaction_id: %d, csid: %d", |
| 17387 | cmd->vdev_id, cmd->transaction_id, cmd->nan_csid); |
| 17388 | |
| 17389 | WMI_LOGD("ndp_config len: %d", |
| 17390 | req->ndp_config.ndp_cfg_len); |
| 17391 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17392 | req->ndp_config.ndp_cfg, |
| 17393 | req->ndp_config.ndp_cfg_len); |
| 17394 | |
| 17395 | WMI_LOGD("ndp_app_info len: %d", |
| 17396 | req->ndp_info.ndp_app_info_len); |
| 17397 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17398 | req->ndp_info.ndp_app_info, |
| 17399 | req->ndp_info.ndp_app_info_len); |
| 17400 | |
| 17401 | WMI_LOGD("pmk len: %d", cmd->nan_pmk_len); |
| 17402 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17403 | req->pmk.pmk, cmd->nan_pmk_len); |
| 17404 | |
| 17405 | WMI_LOGD("pass phrase len: %d", cmd->nan_passphrase_len); |
| 17406 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17407 | req->passphrase.passphrase, |
| 17408 | cmd->nan_passphrase_len); |
| 17409 | |
| 17410 | WMI_LOGD("service name len: %d", cmd->nan_servicename_len); |
| 17411 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17412 | req->service_name.service_name, |
| 17413 | cmd->nan_servicename_len); |
| 17414 | |
| 17415 | WMI_LOGD("sending WMI_NDP_RESPONDER_REQ_CMDID(0x%X)", |
| 17416 | WMI_NDP_RESPONDER_REQ_CMDID); |
| 17417 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 17418 | WMI_NDP_RESPONDER_REQ_CMDID); |
| 17419 | if (QDF_IS_STATUS_ERROR(status)) { |
| 17420 | WMI_LOGE("WMI_NDP_RESPONDER_REQ_CMDID failed, ret: %d", status); |
| 17421 | wmi_buf_free(buf); |
| 17422 | } |
| 17423 | return status; |
| 17424 | } |
| 17425 | |
| 17426 | static QDF_STATUS nan_ndp_end_req_tlv(wmi_unified_t wmi_handle, |
| 17427 | struct nan_datapath_end_req *req) |
| 17428 | { |
| 17429 | uint16_t len; |
| 17430 | wmi_buf_t buf; |
| 17431 | QDF_STATUS status; |
| 17432 | uint32_t ndp_end_req_len, i; |
| 17433 | wmi_ndp_end_req *ndp_end_req_lst; |
| 17434 | wmi_ndp_end_req_fixed_param *cmd; |
| 17435 | |
| 17436 | /* len of tlv following fixed param */ |
| 17437 | ndp_end_req_len = sizeof(wmi_ndp_end_req) * req->num_ndp_instances; |
| 17438 | /* above comes out to 4 byte alligned already, no need of padding */ |
| 17439 | len = sizeof(*cmd) + ndp_end_req_len + WMI_TLV_HDR_SIZE; |
| 17440 | buf = wmi_buf_alloc(wmi_handle, len); |
| 17441 | if (!buf) { |
| 17442 | WMI_LOGE("Malloc failed"); |
| 17443 | return QDF_STATUS_E_NOMEM; |
| 17444 | } |
| 17445 | |
| 17446 | cmd = (wmi_ndp_end_req_fixed_param *) wmi_buf_data(buf); |
| 17447 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 17448 | WMITLV_TAG_STRUC_wmi_ndp_end_req_fixed_param, |
| 17449 | WMITLV_GET_STRUCT_TLVLEN(wmi_ndp_end_req_fixed_param)); |
| 17450 | |
| 17451 | cmd->transaction_id = req->transaction_id; |
| 17452 | |
| 17453 | /* set tlv pointer to end of fixed param */ |
| 17454 | WMITLV_SET_HDR((uint8_t *)&cmd[1], WMITLV_TAG_ARRAY_STRUC, |
| 17455 | ndp_end_req_len); |
| 17456 | |
| 17457 | ndp_end_req_lst = (wmi_ndp_end_req *)((uint8_t *)&cmd[1] + |
| 17458 | WMI_TLV_HDR_SIZE); |
| 17459 | for (i = 0; i < req->num_ndp_instances; i++) { |
| 17460 | WMITLV_SET_HDR(&ndp_end_req_lst[i], |
| 17461 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 17462 | (sizeof(*ndp_end_req_lst) - WMI_TLV_HDR_SIZE)); |
| 17463 | |
| 17464 | ndp_end_req_lst[i].ndp_instance_id = req->ndp_ids[i]; |
| 17465 | } |
| 17466 | |
| 17467 | WMI_LOGD("Sending WMI_NDP_END_REQ_CMDID to FW"); |
| 17468 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 17469 | WMI_NDP_END_REQ_CMDID); |
| 17470 | if (QDF_IS_STATUS_ERROR(status)) { |
| 17471 | WMI_LOGE("WMI_NDP_END_REQ_CMDID failed, ret: %d", status); |
| 17472 | wmi_buf_free(buf); |
| 17473 | } |
| 17474 | |
| 17475 | return status; |
| 17476 | } |
| 17477 | |
| 17478 | static QDF_STATUS extract_ndp_initiator_rsp_tlv(wmi_unified_t wmi_handle, |
| 17479 | uint8_t *data, struct nan_datapath_initiator_rsp **rsp) |
| 17480 | { |
| 17481 | WMI_NDP_INITIATOR_RSP_EVENTID_param_tlvs *event; |
| 17482 | wmi_ndp_initiator_rsp_event_fixed_param *fixed_params; |
| 17483 | |
| 17484 | event = (WMI_NDP_INITIATOR_RSP_EVENTID_param_tlvs *)data; |
| 17485 | fixed_params = event->fixed_param; |
| 17486 | |
| 17487 | *rsp = qdf_mem_malloc(sizeof(**rsp)); |
| 17488 | if (!(*rsp)) { |
| 17489 | WMI_LOGE("malloc failed"); |
| 17490 | return QDF_STATUS_E_NOMEM; |
| 17491 | } |
| 17492 | |
| 17493 | (*rsp)->vdev = |
| 17494 | wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc, |
| 17495 | fixed_params->vdev_id, |
| 17496 | WLAN_NAN_ID); |
| 17497 | if (!(*rsp)->vdev) { |
| 17498 | WMI_LOGE("vdev is null"); |
| 17499 | qdf_mem_free(*rsp); |
| 17500 | return QDF_STATUS_E_INVAL; |
| 17501 | } |
| 17502 | |
| 17503 | (*rsp)->transaction_id = fixed_params->transaction_id; |
| 17504 | (*rsp)->ndp_instance_id = fixed_params->ndp_instance_id; |
| 17505 | (*rsp)->status = fixed_params->rsp_status; |
| 17506 | (*rsp)->reason = fixed_params->reason_code; |
| 17507 | |
| 17508 | return QDF_STATUS_SUCCESS; |
| 17509 | } |
| 17510 | |
| 17511 | static QDF_STATUS extract_ndp_ind_tlv(wmi_unified_t wmi_handle, |
| 17512 | uint8_t *data, struct nan_datapath_indication_event **rsp) |
| 17513 | { |
| 17514 | WMI_NDP_INDICATION_EVENTID_param_tlvs *event; |
| 17515 | wmi_ndp_indication_event_fixed_param *fixed_params; |
| 17516 | |
| 17517 | event = (WMI_NDP_INDICATION_EVENTID_param_tlvs *)data; |
| 17518 | fixed_params = |
| 17519 | (wmi_ndp_indication_event_fixed_param *)event->fixed_param; |
| 17520 | |
Vignesh Viswanathan | 376834c | 2018-01-23 14:54:18 +0530 | [diff] [blame] | 17521 | if (fixed_params->ndp_cfg_len > event->num_ndp_cfg) { |
| 17522 | WMI_LOGE("FW message ndp cfg length %d larger than TLV hdr %d", |
| 17523 | fixed_params->ndp_cfg_len, event->num_ndp_cfg); |
| 17524 | return QDF_STATUS_E_INVAL; |
| 17525 | } |
| 17526 | |
| 17527 | if (fixed_params->ndp_app_info_len > event->num_ndp_app_info) { |
| 17528 | WMI_LOGE("FW message ndp app info length %d more than TLV hdr %d", |
| 17529 | fixed_params->ndp_app_info_len, |
| 17530 | event->num_ndp_app_info); |
| 17531 | return QDF_STATUS_E_INVAL; |
| 17532 | } |
| 17533 | |
Naveen Rawat | 4f1e2ac | 2017-12-14 13:24:31 -0800 | [diff] [blame] | 17534 | *rsp = qdf_mem_malloc(sizeof(**rsp)); |
| 17535 | if (!(*rsp)) { |
| 17536 | WMI_LOGE("malloc failed"); |
| 17537 | return QDF_STATUS_E_NOMEM; |
| 17538 | } |
| 17539 | |
| 17540 | (*rsp)->vdev = |
| 17541 | wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc, |
| 17542 | fixed_params->vdev_id, |
| 17543 | WLAN_NAN_ID); |
| 17544 | if (!(*rsp)->vdev) { |
| 17545 | WMI_LOGE("vdev is null"); |
| 17546 | qdf_mem_free(*rsp); |
| 17547 | return QDF_STATUS_E_INVAL; |
| 17548 | } |
| 17549 | (*rsp)->service_instance_id = fixed_params->service_instance_id; |
| 17550 | (*rsp)->ndp_instance_id = fixed_params->ndp_instance_id; |
| 17551 | (*rsp)->role = fixed_params->self_ndp_role; |
| 17552 | (*rsp)->policy = fixed_params->accept_policy; |
| 17553 | |
| 17554 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_ndi_mac_addr, |
| 17555 | (*rsp)->peer_mac_addr.bytes); |
| 17556 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_discovery_mac_addr, |
| 17557 | (*rsp)->peer_discovery_mac_addr.bytes); |
| 17558 | |
| 17559 | WMI_LOGD("WMI_NDP_INDICATION_EVENTID(0x%X) received. vdev %d,\n" |
| 17560 | "service_instance %d, ndp_instance %d, role %d, policy %d,\n" |
| 17561 | "csid: %d, scid_len: %d, peer_addr: %pM, peer_disc_addr: %pM", |
| 17562 | WMI_NDP_INDICATION_EVENTID, fixed_params->vdev_id, |
| 17563 | fixed_params->service_instance_id, |
| 17564 | fixed_params->ndp_instance_id, fixed_params->self_ndp_role, |
| 17565 | fixed_params->accept_policy, |
| 17566 | fixed_params->nan_csid, fixed_params->nan_scid_len, |
| 17567 | (*rsp)->peer_mac_addr.bytes, |
| 17568 | (*rsp)->peer_discovery_mac_addr.bytes); |
| 17569 | |
| 17570 | WMI_LOGD("ndp_cfg - %d bytes", fixed_params->ndp_cfg_len); |
| 17571 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17572 | &event->ndp_cfg, fixed_params->ndp_cfg_len); |
| 17573 | |
| 17574 | WMI_LOGD("ndp_app_info - %d bytes", |
| 17575 | fixed_params->ndp_app_info_len); |
| 17576 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17577 | &event->ndp_app_info, fixed_params->ndp_app_info_len); |
| 17578 | |
| 17579 | (*rsp)->ndp_config.ndp_cfg_len = fixed_params->ndp_cfg_len; |
| 17580 | (*rsp)->ndp_info.ndp_app_info_len = fixed_params->ndp_app_info_len; |
| 17581 | (*rsp)->ncs_sk_type = fixed_params->nan_csid; |
| 17582 | (*rsp)->scid.scid_len = fixed_params->nan_scid_len; |
| 17583 | qdf_mem_copy((*rsp)->ndp_config.ndp_cfg, event->ndp_cfg, |
| 17584 | (*rsp)->ndp_config.ndp_cfg_len); |
| 17585 | qdf_mem_copy((*rsp)->ndp_info.ndp_app_info, event->ndp_app_info, |
| 17586 | (*rsp)->ndp_info.ndp_app_info_len); |
| 17587 | qdf_mem_copy((*rsp)->scid.scid, event->ndp_scid, (*rsp)->scid.scid_len); |
| 17588 | WMI_LOGD("scid hex dump:"); |
| 17589 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17590 | (*rsp)->scid.scid, (*rsp)->scid.scid_len); |
| 17591 | |
| 17592 | return QDF_STATUS_SUCCESS; |
| 17593 | } |
| 17594 | |
| 17595 | static QDF_STATUS extract_ndp_confirm_tlv(wmi_unified_t wmi_handle, |
| 17596 | uint8_t *data, struct nan_datapath_confirm_event **rsp) |
| 17597 | { |
| 17598 | WMI_NDP_CONFIRM_EVENTID_param_tlvs *event; |
| 17599 | wmi_ndp_confirm_event_fixed_param *fixed_params; |
| 17600 | |
| 17601 | event = (WMI_NDP_CONFIRM_EVENTID_param_tlvs *) data; |
| 17602 | fixed_params = (wmi_ndp_confirm_event_fixed_param *)event->fixed_param; |
| 17603 | WMI_LOGD("WMI_NDP_CONFIRM_EVENTID(0x%X) recieved. vdev %d, ndp_instance %d, rsp_code %d, reason_code: %d, num_active_ndps_on_peer: %d", |
| 17604 | WMI_NDP_CONFIRM_EVENTID, fixed_params->vdev_id, |
| 17605 | fixed_params->ndp_instance_id, fixed_params->rsp_code, |
| 17606 | fixed_params->reason_code, |
| 17607 | fixed_params->num_active_ndps_on_peer); |
Vignesh Viswanathan | 376834c | 2018-01-23 14:54:18 +0530 | [diff] [blame] | 17608 | |
| 17609 | if (fixed_params->ndp_cfg_len > event->num_ndp_cfg) { |
| 17610 | WMI_LOGE("FW message ndp cfg length %d larger than TLV hdr %d", |
| 17611 | fixed_params->ndp_cfg_len, event->num_ndp_cfg); |
| 17612 | return QDF_STATUS_E_INVAL; |
| 17613 | } |
| 17614 | |
Naveen Rawat | 4f1e2ac | 2017-12-14 13:24:31 -0800 | [diff] [blame] | 17615 | WMI_LOGD("ndp_cfg - %d bytes", fixed_params->ndp_cfg_len); |
| 17616 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17617 | &event->ndp_cfg, fixed_params->ndp_cfg_len); |
| 17618 | |
Vignesh Viswanathan | 376834c | 2018-01-23 14:54:18 +0530 | [diff] [blame] | 17619 | if (fixed_params->ndp_app_info_len > event->num_ndp_app_info) { |
| 17620 | WMI_LOGE("FW message ndp app info length %d more than TLV hdr %d", |
| 17621 | fixed_params->ndp_app_info_len, |
| 17622 | event->num_ndp_app_info); |
| 17623 | return QDF_STATUS_E_INVAL; |
| 17624 | } |
| 17625 | |
Naveen Rawat | 4f1e2ac | 2017-12-14 13:24:31 -0800 | [diff] [blame] | 17626 | WMI_LOGD("ndp_app_info - %d bytes", |
| 17627 | fixed_params->ndp_app_info_len); |
| 17628 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 17629 | &event->ndp_app_info, fixed_params->ndp_app_info_len); |
| 17630 | |
| 17631 | *rsp = qdf_mem_malloc(sizeof(**rsp)); |
| 17632 | if (!(*rsp)) { |
| 17633 | WMI_LOGE("malloc failed"); |
| 17634 | return QDF_STATUS_E_NOMEM; |
| 17635 | } |
| 17636 | |
| 17637 | (*rsp)->vdev = |
| 17638 | wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc, |
| 17639 | fixed_params->vdev_id, |
| 17640 | WLAN_NAN_ID); |
| 17641 | if (!(*rsp)->vdev) { |
| 17642 | WMI_LOGE("vdev is null"); |
| 17643 | qdf_mem_free(*rsp); |
| 17644 | return QDF_STATUS_E_INVAL; |
| 17645 | } |
| 17646 | (*rsp)->ndp_instance_id = fixed_params->ndp_instance_id; |
| 17647 | (*rsp)->rsp_code = fixed_params->rsp_code; |
| 17648 | (*rsp)->reason_code = fixed_params->reason_code; |
| 17649 | (*rsp)->num_active_ndps_on_peer = fixed_params->num_active_ndps_on_peer; |
| 17650 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_ndi_mac_addr, |
| 17651 | (*rsp)->peer_ndi_mac_addr.bytes); |
| 17652 | (*rsp)->ndp_info.ndp_app_info_len = fixed_params->ndp_app_info_len; |
| 17653 | qdf_mem_copy((*rsp)->ndp_info.ndp_app_info, event->ndp_app_info, |
| 17654 | (*rsp)->ndp_info.ndp_app_info_len); |
| 17655 | |
| 17656 | return QDF_STATUS_SUCCESS; |
| 17657 | } |
| 17658 | |
| 17659 | static QDF_STATUS extract_ndp_responder_rsp_tlv(wmi_unified_t wmi_handle, |
| 17660 | uint8_t *data, struct nan_datapath_responder_rsp **rsp) |
| 17661 | { |
| 17662 | WMI_NDP_RESPONDER_RSP_EVENTID_param_tlvs *event; |
| 17663 | wmi_ndp_responder_rsp_event_fixed_param *fixed_params; |
| 17664 | |
| 17665 | event = (WMI_NDP_RESPONDER_RSP_EVENTID_param_tlvs *)data; |
| 17666 | fixed_params = event->fixed_param; |
| 17667 | |
| 17668 | WMI_LOGD("WMI_NDP_RESPONDER_RSP_EVENTID(0x%X) received. vdev_id: %d, peer_mac_addr: %pM,transaction_id: %d, status_code %d, reason_code: %d, create_peer: %d", |
| 17669 | WMI_NDP_RESPONDER_RSP_EVENTID, fixed_params->vdev_id, |
| 17670 | (*rsp)->peer_mac_addr.bytes, (*rsp)->transaction_id, |
| 17671 | (*rsp)->status, (*rsp)->reason, (*rsp)->create_peer); |
| 17672 | |
| 17673 | *rsp = qdf_mem_malloc(sizeof(**rsp)); |
| 17674 | if (!(*rsp)) { |
| 17675 | WMI_LOGE("malloc failed"); |
| 17676 | return QDF_STATUS_E_NOMEM; |
| 17677 | } |
| 17678 | |
| 17679 | (*rsp)->vdev = |
| 17680 | wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc, |
| 17681 | fixed_params->vdev_id, |
| 17682 | WLAN_NAN_ID); |
| 17683 | if (!(*rsp)->vdev) { |
| 17684 | WMI_LOGE("vdev is null"); |
| 17685 | qdf_mem_free(*rsp); |
| 17686 | return QDF_STATUS_E_INVAL; |
| 17687 | } |
| 17688 | (*rsp)->transaction_id = fixed_params->transaction_id; |
| 17689 | (*rsp)->reason = fixed_params->reason_code; |
| 17690 | (*rsp)->status = fixed_params->rsp_status; |
| 17691 | (*rsp)->create_peer = fixed_params->create_peer; |
| 17692 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_ndi_mac_addr, |
| 17693 | (*rsp)->peer_mac_addr.bytes); |
| 17694 | |
| 17695 | return QDF_STATUS_SUCCESS; |
| 17696 | } |
| 17697 | |
| 17698 | static QDF_STATUS extract_ndp_end_rsp_tlv(wmi_unified_t wmi_handle, |
| 17699 | uint8_t *data, struct nan_datapath_end_rsp_event **rsp) |
| 17700 | { |
| 17701 | WMI_NDP_END_RSP_EVENTID_param_tlvs *event; |
| 17702 | wmi_ndp_end_rsp_event_fixed_param *fixed_params = NULL; |
| 17703 | |
| 17704 | event = (WMI_NDP_END_RSP_EVENTID_param_tlvs *) data; |
| 17705 | fixed_params = (wmi_ndp_end_rsp_event_fixed_param *)event->fixed_param; |
| 17706 | WMI_LOGD("WMI_NDP_END_RSP_EVENTID(0x%X) recieved. transaction_id: %d, rsp_status: %d, reason_code: %d", |
| 17707 | WMI_NDP_END_RSP_EVENTID, fixed_params->transaction_id, |
| 17708 | fixed_params->rsp_status, fixed_params->reason_code); |
| 17709 | |
| 17710 | *rsp = qdf_mem_malloc(sizeof(**rsp)); |
| 17711 | if (!(*rsp)) { |
| 17712 | WMI_LOGE("malloc failed"); |
| 17713 | return QDF_STATUS_E_NOMEM; |
| 17714 | } |
| 17715 | |
| 17716 | (*rsp)->vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc( |
| 17717 | wmi_handle->soc->wmi_psoc, QDF_NDI_MODE, WLAN_NAN_ID); |
| 17718 | if (!(*rsp)->vdev) { |
| 17719 | WMI_LOGE("vdev is null"); |
| 17720 | qdf_mem_free(*rsp); |
| 17721 | return QDF_STATUS_E_INVAL; |
| 17722 | } |
| 17723 | (*rsp)->transaction_id = fixed_params->transaction_id; |
| 17724 | (*rsp)->reason = fixed_params->reason_code; |
| 17725 | (*rsp)->status = fixed_params->rsp_status; |
| 17726 | |
| 17727 | return QDF_STATUS_SUCCESS; |
| 17728 | } |
| 17729 | |
| 17730 | static QDF_STATUS extract_ndp_end_ind_tlv(wmi_unified_t wmi_handle, |
| 17731 | uint8_t *data, struct nan_datapath_end_indication_event **rsp) |
| 17732 | { |
| 17733 | uint32_t i, buf_size; |
| 17734 | wmi_ndp_end_indication *ind; |
| 17735 | struct qdf_mac_addr peer_addr; |
| 17736 | WMI_NDP_END_INDICATION_EVENTID_param_tlvs *event; |
| 17737 | |
| 17738 | event = (WMI_NDP_END_INDICATION_EVENTID_param_tlvs *) data; |
| 17739 | ind = event->ndp_end_indication_list; |
| 17740 | |
| 17741 | if (event->num_ndp_end_indication_list == 0) { |
| 17742 | WMI_LOGE("Error: Event ignored, 0 ndp instances"); |
| 17743 | return -EINVAL; |
| 17744 | } |
| 17745 | |
| 17746 | (*rsp)->vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc( |
| 17747 | wmi_handle->soc->wmi_psoc, QDF_NDI_MODE, WLAN_NAN_ID); |
| 17748 | if (!(*rsp)->vdev) { |
| 17749 | WMI_LOGE("vdev is null"); |
| 17750 | qdf_mem_free(*rsp); |
| 17751 | return QDF_STATUS_E_INVAL; |
| 17752 | } |
| 17753 | |
| 17754 | WMI_LOGD("number of ndp instances = %d", |
| 17755 | event->num_ndp_end_indication_list); |
| 17756 | buf_size = sizeof(*rsp) + event->num_ndp_end_indication_list * |
| 17757 | sizeof((*rsp)->ndp_map[0]); |
| 17758 | *rsp = qdf_mem_malloc(buf_size); |
| 17759 | if (!(*rsp)) { |
| 17760 | WMI_LOGE("Failed to allocate memory"); |
| 17761 | return -ENOMEM; |
| 17762 | } |
| 17763 | |
| 17764 | (*rsp)->num_ndp_ids = event->num_ndp_end_indication_list; |
| 17765 | for (i = 0; i < (*rsp)->num_ndp_ids; i++) { |
| 17766 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ind[i].peer_ndi_mac_addr, |
| 17767 | peer_addr.bytes); |
| 17768 | WMI_LOGD("ind[%d]: type %d, reason_code %d, instance_id %d num_active %d ", |
| 17769 | i, ind[i].type, ind[i].reason_code, |
| 17770 | ind[i].ndp_instance_id, |
| 17771 | ind[i].num_active_ndps_on_peer); |
| 17772 | /* Add each instance entry to the list */ |
| 17773 | (*rsp)->ndp_map[i].ndp_instance_id = ind[i].ndp_instance_id; |
| 17774 | (*rsp)->ndp_map[i].vdev_id = ind[i].vdev_id; |
| 17775 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ind[i].peer_ndi_mac_addr, |
| 17776 | (*rsp)->ndp_map[i].peer_ndi_mac_addr.bytes); |
| 17777 | (*rsp)->ndp_map[i].num_active_ndp_sessions = |
| 17778 | ind[i].num_active_ndps_on_peer; |
| 17779 | (*rsp)->ndp_map[i].type = ind[i].type; |
| 17780 | (*rsp)->ndp_map[i].reason_code = ind[i].reason_code; |
| 17781 | } |
| 17782 | |
| 17783 | return QDF_STATUS_SUCCESS; |
| 17784 | } |
| 17785 | #endif |
| 17786 | |
Kiran Venkatappa | 7fe3afc | 2017-11-08 19:32:23 +0530 | [diff] [blame] | 17787 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17788 | * save_service_bitmap_tlv() - save service bitmap |
| 17789 | * @wmi_handle: wmi handle |
| 17790 | * @param evt_buf: pointer to event buffer |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 17791 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17792 | * |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17793 | * Return: QDF_STATUS |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17794 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 17795 | static |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17796 | 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] | 17797 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17798 | { |
| 17799 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17800 | struct wmi_soc *soc = wmi_handle->soc; |
| 17801 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17802 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 17803 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17804 | /* If it is already allocated, use that buffer. This can happen |
| 17805 | * during target stop/start scenarios where host allocation is skipped. |
| 17806 | */ |
| 17807 | if (!soc->wmi_service_bitmap) { |
| 17808 | soc->wmi_service_bitmap = |
| 17809 | qdf_mem_malloc(WMI_SERVICE_BM_SIZE * sizeof(uint32_t)); |
| 17810 | if (!soc->wmi_service_bitmap) { |
| 17811 | WMI_LOGE("Failed memory allocation for service bitmap"); |
| 17812 | return QDF_STATUS_E_NOMEM; |
| 17813 | } |
| 17814 | } |
| 17815 | |
| 17816 | qdf_mem_copy(soc->wmi_service_bitmap, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17817 | param_buf->wmi_service_bitmap, |
| 17818 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 17819 | |
| 17820 | if (bitmap_buf) |
| 17821 | qdf_mem_copy(bitmap_buf, |
| 17822 | param_buf->wmi_service_bitmap, |
| 17823 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17824 | |
| 17825 | return QDF_STATUS_SUCCESS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17826 | } |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17827 | |
| 17828 | /** |
| 17829 | * save_ext_service_bitmap_tlv() - save extendend service bitmap |
| 17830 | * @wmi_handle: wmi handle |
| 17831 | * @param evt_buf: pointer to event buffer |
| 17832 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
| 17833 | * |
| 17834 | * Return: QDF_STATUS |
| 17835 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 17836 | static |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17837 | 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] | 17838 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17839 | { |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17840 | WMI_SERVICE_AVAILABLE_EVENTID_param_tlvs *param_buf; |
| 17841 | wmi_service_available_event_fixed_param *ev; |
| 17842 | struct wmi_soc *soc = wmi_handle->soc; |
| 17843 | |
| 17844 | param_buf = (WMI_SERVICE_AVAILABLE_EVENTID_param_tlvs *) evt_buf; |
| 17845 | |
| 17846 | ev = param_buf->fixed_param; |
| 17847 | |
| 17848 | /* If it is already allocated, use that buffer. This can happen |
| 17849 | * during target stop/start scenarios where host allocation is skipped. |
| 17850 | */ |
| 17851 | if (!soc->wmi_ext_service_bitmap) { |
| 17852 | soc->wmi_ext_service_bitmap = qdf_mem_malloc( |
| 17853 | WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t)); |
| 17854 | if (!soc->wmi_ext_service_bitmap) { |
| 17855 | WMI_LOGE("Failed memory allocation for service bitmap"); |
| 17856 | return QDF_STATUS_E_NOMEM; |
| 17857 | } |
| 17858 | } |
| 17859 | |
| 17860 | qdf_mem_copy(soc->wmi_ext_service_bitmap, |
| 17861 | ev->wmi_service_segment_bitmap, |
| 17862 | (WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17863 | |
Om Prakash Tripathi | 3bfb50c | 2017-11-07 14:37:22 +0530 | [diff] [blame] | 17864 | WMI_LOGD("wmi_ext_service_bitmap 0:0x%x, 1:0x%x, 2:0x%x, 3:0x%x\n", |
| 17865 | soc->wmi_ext_service_bitmap[0], soc->wmi_ext_service_bitmap[1], |
| 17866 | soc->wmi_ext_service_bitmap[2], soc->wmi_ext_service_bitmap[3]); |
| 17867 | |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 17868 | if (bitmap_buf) |
| 17869 | qdf_mem_copy(bitmap_buf, |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17870 | soc->wmi_ext_service_bitmap, |
| 17871 | (WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17872 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17873 | return QDF_STATUS_SUCCESS; |
| 17874 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17875 | /** |
| 17876 | * is_service_enabled_tlv() - Check if service enabled |
| 17877 | * @param wmi_handle: wmi handle |
| 17878 | * @param service_id: service identifier |
| 17879 | * |
| 17880 | * Return: 1 enabled, 0 disabled |
| 17881 | */ |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17882 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 17883 | uint32_t service_id) |
| 17884 | { |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17885 | struct wmi_soc *soc = wmi_handle->soc; |
| 17886 | |
| 17887 | if (!soc->wmi_service_bitmap) { |
| 17888 | WMI_LOGE("WMI service bit map is not saved yet\n"); |
| 17889 | return false; |
| 17890 | } |
| 17891 | |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 17892 | /* if wmi_service_enabled was received with extended bitmap, |
| 17893 | * use WMI_SERVICE_EXT_IS_ENABLED to check the services. |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 17894 | */ |
| 17895 | if (soc->wmi_ext_service_bitmap) |
| 17896 | return WMI_SERVICE_EXT_IS_ENABLED(soc->wmi_service_bitmap, |
| 17897 | soc->wmi_ext_service_bitmap, |
| 17898 | service_id); |
| 17899 | |
| 17900 | return WMI_SERVICE_IS_ENABLED(soc->wmi_service_bitmap, |
| 17901 | service_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17902 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17903 | |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 17904 | static inline void copy_ht_cap_info(uint32_t ev_target_cap, |
| 17905 | struct wlan_psoc_target_capability_info *cap) |
| 17906 | { |
| 17907 | /* except LDPC all flags are common betwen legacy and here |
| 17908 | * also IBFEER is not defined for TLV |
| 17909 | */ |
| 17910 | cap->ht_cap_info |= ev_target_cap & ( |
| 17911 | WMI_HT_CAP_ENABLED |
| 17912 | | WMI_HT_CAP_HT20_SGI |
| 17913 | | WMI_HT_CAP_DYNAMIC_SMPS |
| 17914 | | WMI_HT_CAP_TX_STBC |
| 17915 | | WMI_HT_CAP_TX_STBC_MASK_SHIFT |
| 17916 | | WMI_HT_CAP_RX_STBC |
| 17917 | | WMI_HT_CAP_RX_STBC_MASK_SHIFT |
| 17918 | | WMI_HT_CAP_LDPC |
| 17919 | | WMI_HT_CAP_L_SIG_TXOP_PROT |
| 17920 | | WMI_HT_CAP_MPDU_DENSITY |
| 17921 | | WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT |
| 17922 | | WMI_HT_CAP_HT40_SGI); |
| 17923 | if (ev_target_cap & WMI_HT_CAP_LDPC) |
| 17924 | cap->ht_cap_info |= WMI_HOST_HT_CAP_RX_LDPC | |
| 17925 | WMI_HOST_HT_CAP_TX_LDPC; |
| 17926 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17927 | /** |
| 17928 | * extract_service_ready_tlv() - extract service ready event |
| 17929 | * @wmi_handle: wmi handle |
| 17930 | * @param evt_buf: pointer to received event buffer |
| 17931 | * @param cap: pointer to hold target capability information extracted from even |
| 17932 | * |
| 17933 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17934 | */ |
| 17935 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 17936 | void *evt_buf, struct wlan_psoc_target_capability_info *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17937 | { |
| 17938 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 17939 | wmi_service_ready_event_fixed_param *ev; |
| 17940 | |
| 17941 | |
| 17942 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 17943 | |
| 17944 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 17945 | if (!ev) { |
| 17946 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 17947 | return QDF_STATUS_E_FAILURE; |
| 17948 | } |
| 17949 | |
| 17950 | cap->phy_capability = ev->phy_capability; |
| 17951 | cap->max_frag_entry = ev->max_frag_entry; |
| 17952 | cap->num_rf_chains = ev->num_rf_chains; |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 17953 | copy_ht_cap_info(ev->ht_cap_info, cap); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17954 | cap->vht_cap_info = ev->vht_cap_info; |
| 17955 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 17956 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 17957 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 17958 | cap->sys_cap_info = ev->sys_cap_info; |
| 17959 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 17960 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 17961 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 17962 | cap->max_supported_macs = ev->max_supported_macs; |
| 17963 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 17964 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 17965 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 17966 | cap->num_msdu_desc = ev->num_msdu_desc; |
Kiran Venkatappa | 59d6e1f | 2017-10-12 15:04:22 +0530 | [diff] [blame] | 17967 | cap->fw_version = ev->fw_build_vers; |
| 17968 | /* fw_version_1 is not available in TLV. */ |
| 17969 | cap->fw_version_1 = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17970 | |
| 17971 | return QDF_STATUS_SUCCESS; |
| 17972 | } |
| 17973 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 17974 | /* convert_wireless_modes_tlv() - Convert REGDMN_MODE values sent by target |
| 17975 | * to host internal WMI_HOST_REGDMN_MODE values. |
| 17976 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 17977 | * host currently. Add this in the future if required. |
| 17978 | * 11AX (Phase II) : 11ax related values are not currently |
| 17979 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 17980 | * finalize the advertisement mechanism. |
| 17981 | * @target_wireless_mode: target wireless mode received in message |
| 17982 | * |
| 17983 | * Return: returns the host internal wireless mode. |
| 17984 | */ |
| 17985 | static inline uint32_t convert_wireless_modes_tlv(uint32_t target_wireless_mode) |
| 17986 | { |
| 17987 | |
| 17988 | uint32_t wireless_modes = 0; |
| 17989 | |
| 17990 | if (target_wireless_mode & REGDMN_MODE_11A) |
| 17991 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 17992 | |
| 17993 | if (target_wireless_mode & REGDMN_MODE_TURBO) |
| 17994 | wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 17995 | |
| 17996 | if (target_wireless_mode & REGDMN_MODE_11B) |
| 17997 | wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 17998 | |
| 17999 | if (target_wireless_mode & REGDMN_MODE_PUREG) |
| 18000 | wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 18001 | |
| 18002 | if (target_wireless_mode & REGDMN_MODE_11G) |
| 18003 | wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 18004 | |
| 18005 | if (target_wireless_mode & REGDMN_MODE_108G) |
| 18006 | wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 18007 | |
| 18008 | if (target_wireless_mode & REGDMN_MODE_108A) |
| 18009 | wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 18010 | |
| 18011 | if (target_wireless_mode & REGDMN_MODE_XR) |
| 18012 | wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 18013 | |
| 18014 | if (target_wireless_mode & REGDMN_MODE_11A_HALF_RATE) |
| 18015 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 18016 | |
| 18017 | if (target_wireless_mode & REGDMN_MODE_11A_QUARTER_RATE) |
| 18018 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 18019 | |
| 18020 | if (target_wireless_mode & REGDMN_MODE_11NG_HT20) |
| 18021 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 18022 | |
| 18023 | if (target_wireless_mode & REGDMN_MODE_11NA_HT20) |
| 18024 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 18025 | |
| 18026 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40PLUS) |
| 18027 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 18028 | |
| 18029 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40MINUS) |
| 18030 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 18031 | |
| 18032 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40PLUS) |
| 18033 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 18034 | |
| 18035 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40MINUS) |
| 18036 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 18037 | |
| 18038 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT20) |
| 18039 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 18040 | |
| 18041 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40PLUS) |
| 18042 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 18043 | |
| 18044 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40MINUS) |
| 18045 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 18046 | |
| 18047 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80) |
| 18048 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 18049 | |
| 18050 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT160) |
| 18051 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 18052 | |
| 18053 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80_80) |
| 18054 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 18055 | |
| 18056 | return wireless_modes; |
| 18057 | } |
| 18058 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18059 | /** |
| 18060 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 18061 | * @wmi_handle: wmi handle |
| 18062 | * @param evt_buf: Pointer to event buffer |
| 18063 | * @param cap: pointer to hold HAL reg capabilities |
| 18064 | * |
| 18065 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18066 | */ |
| 18067 | 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] | 18068 | void *evt_buf, struct wlan_psoc_hal_reg_capability *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18069 | { |
| 18070 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 18071 | |
| 18072 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 18073 | |
| 18074 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 18075 | sizeof(uint32_t)), |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 18076 | sizeof(struct wlan_psoc_hal_reg_capability)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18077 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 18078 | cap->wireless_modes = convert_wireless_modes_tlv( |
| 18079 | param_buf->hal_reg_capabilities->wireless_modes); |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 18080 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18081 | return QDF_STATUS_SUCCESS; |
| 18082 | } |
| 18083 | |
| 18084 | /** |
| 18085 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 18086 | * @wmi_handle: wmi handle |
| 18087 | * @param evt_buf: pointer to event buffer |
| 18088 | * @param num_entries: pointer to hold number of entries requested |
| 18089 | * |
| 18090 | * Return: Number of entries requested |
| 18091 | */ |
| 18092 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 18093 | void *evt_buf, uint8_t *num_entries) |
| 18094 | { |
| 18095 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 18096 | wmi_service_ready_event_fixed_param *ev; |
| 18097 | |
| 18098 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 18099 | |
| 18100 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 18101 | if (!ev) { |
| 18102 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 18103 | return NULL; |
| 18104 | } |
| 18105 | |
| 18106 | *num_entries = ev->num_mem_reqs; |
| 18107 | |
| 18108 | return (host_mem_req *)param_buf->mem_reqs; |
| 18109 | } |
| 18110 | |
| 18111 | /** |
| 18112 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 18113 | * ready function |
| 18114 | * @wmi_handle: wmi handle |
| 18115 | * @param evt_buf: pointer to event buffer |
| 18116 | * |
| 18117 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18118 | */ |
| 18119 | static QDF_STATUS |
| 18120 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 18121 | { |
| 18122 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 18123 | wmi_service_ready_event_fixed_param *ev; |
| 18124 | |
| 18125 | |
| 18126 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 18127 | |
| 18128 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 18129 | if (!ev) { |
| 18130 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 18131 | return QDF_STATUS_E_FAILURE; |
| 18132 | } |
| 18133 | |
| 18134 | /*Save fw version from service ready message */ |
| 18135 | /*This will be used while sending INIT message */ |
| 18136 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 18137 | sizeof(wmi_handle->fw_abi_version)); |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 18138 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18139 | return QDF_STATUS_SUCCESS; |
| 18140 | } |
| 18141 | |
| 18142 | /** |
| 18143 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 18144 | * @wmi_handle: wmi handle |
| 18145 | * @param evt_buf: Pointer to event buffer |
| 18146 | * |
| 18147 | * Return: ready status |
| 18148 | */ |
| 18149 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 18150 | void *evt_buf) |
| 18151 | { |
| 18152 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 18153 | wmi_ready_event_fixed_param *ev = NULL; |
| 18154 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18155 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 18156 | ev = param_buf->fixed_param; |
| 18157 | |
| 18158 | qdf_print("%s:%d\n", __func__, ev->status); |
| 18159 | |
| 18160 | return ev->status; |
| 18161 | } |
| 18162 | |
| 18163 | /** |
| 18164 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 18165 | * @wmi_handle: wmi handle |
| 18166 | * @param evt_buf: pointer to event buffer |
| 18167 | * @param macaddr: Pointer to hold MAC address |
| 18168 | * |
| 18169 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18170 | */ |
| 18171 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 18172 | void *evt_buf, uint8_t *macaddr) |
| 18173 | { |
| 18174 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 18175 | wmi_ready_event_fixed_param *ev = NULL; |
| 18176 | |
| 18177 | |
| 18178 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 18179 | ev = param_buf->fixed_param; |
| 18180 | |
| 18181 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 18182 | |
| 18183 | return QDF_STATUS_SUCCESS; |
| 18184 | } |
| 18185 | |
| 18186 | /** |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 18187 | * ready_extract_mac_addr_list_tlv() - extract MAC address list from ready event |
| 18188 | * @wmi_handle: wmi handle |
| 18189 | * @param evt_buf: pointer to event buffer |
| 18190 | * @param macaddr: Pointer to hold number of MAC addresses |
| 18191 | * |
| 18192 | * Return: Pointer to addr list |
| 18193 | */ |
| 18194 | static wmi_host_mac_addr *ready_extract_mac_addr_list_tlv(wmi_unified_t wmi_hamdle, |
| 18195 | void *evt_buf, uint8_t *num_mac) |
| 18196 | { |
| 18197 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 18198 | wmi_ready_event_fixed_param *ev = NULL; |
| 18199 | |
| 18200 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 18201 | ev = param_buf->fixed_param; |
| 18202 | |
| 18203 | *num_mac = ev->num_extra_mac_addr; |
| 18204 | |
| 18205 | return (wmi_host_mac_addr *) param_buf->mac_addr_list; |
| 18206 | } |
| 18207 | |
| 18208 | /** |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 18209 | * extract_ready_params_tlv() - Extract data from ready event apart from |
| 18210 | * status, macaddr and version. |
| 18211 | * @wmi_handle: Pointer to WMI handle. |
| 18212 | * @evt_buf: Pointer to Ready event buffer. |
| 18213 | * @ev_param: Pointer to host defined struct to copy the data from event. |
| 18214 | * |
| 18215 | * Return: QDF_STATUS_SUCCESS on success. |
| 18216 | */ |
| 18217 | static QDF_STATUS extract_ready_event_params_tlv(wmi_unified_t wmi_handle, |
| 18218 | void *evt_buf, struct wmi_host_ready_ev_param *ev_param) |
| 18219 | { |
| 18220 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 18221 | wmi_ready_event_fixed_param *ev = NULL; |
| 18222 | |
| 18223 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 18224 | ev = param_buf->fixed_param; |
| 18225 | |
Kiran Venkatappa | b458a1c | 2017-11-28 12:23:24 +0530 | [diff] [blame] | 18226 | ev_param->status = ev->status; |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 18227 | ev_param->num_dscp_table = ev->num_dscp_table; |
| 18228 | ev_param->num_extra_mac_addr = ev->num_extra_mac_addr; |
| 18229 | ev_param->num_total_peer = ev->num_total_peers; |
Kiran Venkatappa | b458a1c | 2017-11-28 12:23:24 +0530 | [diff] [blame] | 18230 | ev_param->num_extra_peer = ev->num_extra_peers; |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 18231 | /* Agile_cap in ready event is not supported in TLV target */ |
| 18232 | ev_param->agile_capability = false; |
| 18233 | |
| 18234 | return QDF_STATUS_SUCCESS; |
| 18235 | } |
| 18236 | |
| 18237 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18238 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 18239 | * @wmi_handle: wmi handle |
| 18240 | * @param evt_buf: pointer to event buffer |
| 18241 | * |
| 18242 | * Return: length |
| 18243 | */ |
| 18244 | 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] | 18245 | void *evt_buf, uint32_t *len) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18246 | { |
| 18247 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 18248 | |
| 18249 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 18250 | |
| 18251 | *len = param_buf->num_bufp; |
| 18252 | |
| 18253 | return param_buf->bufp; |
| 18254 | } |
| 18255 | |
| 18256 | /** |
| 18257 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 18258 | * @wmi_handle: wmi handle |
| 18259 | * @param evt_buf: pointer to event buffer |
| 18260 | * @param vdev_rsp: Pointer to hold vdev response |
| 18261 | * |
| 18262 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18263 | */ |
| 18264 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 18265 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 18266 | { |
| 18267 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 18268 | wmi_vdev_start_response_event_fixed_param *ev; |
| 18269 | |
| 18270 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 18271 | if (!param_buf) { |
| 18272 | qdf_print("Invalid start response event buffer\n"); |
| 18273 | return QDF_STATUS_E_INVAL; |
| 18274 | } |
| 18275 | |
| 18276 | ev = param_buf->fixed_param; |
| 18277 | if (!ev) { |
| 18278 | qdf_print("Invalid start response event buffer\n"); |
| 18279 | return QDF_STATUS_E_INVAL; |
| 18280 | } |
| 18281 | |
| 18282 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 18283 | |
| 18284 | vdev_rsp->vdev_id = ev->vdev_id; |
| 18285 | vdev_rsp->requestor_id = ev->requestor_id; |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 18286 | switch (ev->resp_type) { |
| 18287 | case WMI_VDEV_START_RESP_EVENT: |
| 18288 | vdev_rsp->resp_type = WMI_HOST_VDEV_START_RESP_EVENT; |
| 18289 | break; |
| 18290 | case WMI_VDEV_RESTART_RESP_EVENT: |
| 18291 | vdev_rsp->resp_type = WMI_HOST_VDEV_RESTART_RESP_EVENT; |
| 18292 | break; |
| 18293 | default: |
| 18294 | qdf_print("Invalid start response event buffer\n"); |
| 18295 | break; |
| 18296 | }; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18297 | vdev_rsp->status = ev->status; |
| 18298 | vdev_rsp->chain_mask = ev->chain_mask; |
| 18299 | vdev_rsp->smps_mode = ev->smps_mode; |
| 18300 | vdev_rsp->mac_id = ev->mac_id; |
| 18301 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 18302 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 18303 | |
| 18304 | return QDF_STATUS_SUCCESS; |
| 18305 | } |
| 18306 | |
| 18307 | /** |
Om Prakash Tripathi | f3ef42d | 2017-11-24 16:53:07 +0530 | [diff] [blame] | 18308 | * extract_vdev_delete_resp_tlv() - extract vdev delete response |
| 18309 | * @wmi_handle: wmi handle |
| 18310 | * @param evt_buf: pointer to event buffer |
| 18311 | * @param delete_rsp: Pointer to hold vdev delete response |
| 18312 | * |
| 18313 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18314 | */ |
| 18315 | static QDF_STATUS extract_vdev_delete_resp_tlv(wmi_unified_t wmi_handle, |
| 18316 | void *evt_buf, struct wmi_host_vdev_delete_resp *delete_rsp) |
| 18317 | { |
| 18318 | WMI_VDEV_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 18319 | wmi_vdev_delete_resp_event_fixed_param *ev; |
| 18320 | |
| 18321 | param_buf = (WMI_VDEV_DELETE_RESP_EVENTID_param_tlvs *) evt_buf; |
| 18322 | if (!param_buf) { |
| 18323 | WMI_LOGE("Invalid vdev delete response event buffer\n"); |
| 18324 | return QDF_STATUS_E_INVAL; |
| 18325 | } |
| 18326 | |
| 18327 | ev = param_buf->fixed_param; |
| 18328 | if (!ev) { |
| 18329 | WMI_LOGE("Invalid vdev delete response event\n"); |
| 18330 | return QDF_STATUS_E_INVAL; |
| 18331 | } |
| 18332 | |
| 18333 | qdf_mem_zero(delete_rsp, sizeof(*delete_rsp)); |
| 18334 | delete_rsp->vdev_id = ev->vdev_id; |
| 18335 | |
| 18336 | return QDF_STATUS_SUCCESS; |
| 18337 | } |
| 18338 | |
| 18339 | |
| 18340 | /** |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18341 | * extract_tbttoffset_num_vdevs_tlv() - extract tbtt offset num vdev |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18342 | * @wmi_handle: wmi handle |
| 18343 | * @param evt_buf: pointer to event buffer |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18344 | * @param num_vdevs: Pointer to hold num vdev |
| 18345 | * |
| 18346 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18347 | */ |
| 18348 | static QDF_STATUS extract_tbttoffset_num_vdevs_tlv(void *wmi_hdl, |
| 18349 | void *evt_buf, uint32_t *num_vdevs) |
| 18350 | { |
| 18351 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 18352 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 18353 | uint32_t vdev_map; |
| 18354 | |
| 18355 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 18356 | if (!param_buf) { |
| 18357 | qdf_print("Invalid tbtt update ext event buffer\n"); |
| 18358 | return QDF_STATUS_E_INVAL; |
| 18359 | } |
| 18360 | tbtt_offset_event = param_buf->fixed_param; |
| 18361 | vdev_map = tbtt_offset_event->vdev_map; |
| 18362 | *num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map); |
| 18363 | |
| 18364 | return QDF_STATUS_SUCCESS; |
| 18365 | } |
| 18366 | |
| 18367 | /** |
| 18368 | * extract_ext_tbttoffset_num_vdevs_tlv() - extract ext tbtt offset num vdev |
| 18369 | * @wmi_handle: wmi handle |
| 18370 | * @param evt_buf: pointer to event buffer |
| 18371 | * @param num_vdevs: Pointer to hold num vdev |
| 18372 | * |
| 18373 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18374 | */ |
| 18375 | static QDF_STATUS extract_ext_tbttoffset_num_vdevs_tlv(void *wmi_hdl, |
| 18376 | void *evt_buf, uint32_t *num_vdevs) |
| 18377 | { |
| 18378 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf; |
| 18379 | wmi_tbtt_offset_ext_event_fixed_param *tbtt_offset_ext_event; |
| 18380 | |
| 18381 | param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 18382 | if (!param_buf) { |
| 18383 | qdf_print("Invalid tbtt update ext event buffer\n"); |
| 18384 | return QDF_STATUS_E_INVAL; |
| 18385 | } |
| 18386 | tbtt_offset_ext_event = param_buf->fixed_param; |
| 18387 | |
| 18388 | *num_vdevs = tbtt_offset_ext_event->num_vdevs; |
| 18389 | |
| 18390 | return QDF_STATUS_SUCCESS; |
| 18391 | } |
| 18392 | |
| 18393 | /** |
| 18394 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset param |
| 18395 | * @wmi_handle: wmi handle |
| 18396 | * @param evt_buf: pointer to event buffer |
| 18397 | * @param idx: Index refering to a vdev |
| 18398 | * @param tbtt_param: Pointer to tbttoffset event param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18399 | * |
| 18400 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18401 | */ |
| 18402 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18403 | void *evt_buf, uint8_t idx, |
| 18404 | struct tbttoffset_params *tbtt_param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18405 | { |
| 18406 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 18407 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18408 | uint32_t vdev_map; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18409 | |
| 18410 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 18411 | if (!param_buf) { |
| 18412 | qdf_print("Invalid tbtt update event buffer\n"); |
| 18413 | return QDF_STATUS_E_INVAL; |
| 18414 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18415 | |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18416 | tbtt_offset_event = param_buf->fixed_param; |
| 18417 | vdev_map = tbtt_offset_event->vdev_map; |
| 18418 | tbtt_param->vdev_id = wmi_vdev_map_to_vdev_id(vdev_map, idx); |
| 18419 | if (tbtt_param->vdev_id == WLAN_INVALID_VDEV_ID) |
| 18420 | return QDF_STATUS_E_INVAL; |
| 18421 | tbtt_param->tbttoffset = |
| 18422 | param_buf->tbttoffset_list[tbtt_param->vdev_id]; |
| 18423 | |
| 18424 | return QDF_STATUS_SUCCESS; |
| 18425 | } |
| 18426 | |
| 18427 | /** |
| 18428 | * extract_ext_tbttoffset_update_params_tlv() - extract ext tbtt offset param |
| 18429 | * @wmi_handle: wmi handle |
| 18430 | * @param evt_buf: pointer to event buffer |
| 18431 | * @param idx: Index refering to a vdev |
| 18432 | * @param tbtt_param: Pointer to tbttoffset event param |
| 18433 | * |
| 18434 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18435 | */ |
| 18436 | static QDF_STATUS extract_ext_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 18437 | void *evt_buf, uint8_t idx, |
| 18438 | struct tbttoffset_params *tbtt_param) |
| 18439 | { |
| 18440 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf; |
| 18441 | wmi_tbtt_offset_info *tbtt_offset_info; |
| 18442 | |
| 18443 | param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 18444 | if (!param_buf) { |
| 18445 | qdf_print("Invalid tbtt update event buffer\n"); |
| 18446 | return QDF_STATUS_E_INVAL; |
| 18447 | } |
| 18448 | tbtt_offset_info = ¶m_buf->tbtt_offset_info[idx]; |
| 18449 | |
| 18450 | tbtt_param->vdev_id = tbtt_offset_info->vdev_id; |
| 18451 | tbtt_param->tbttoffset = tbtt_offset_info->tbttoffset; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18452 | |
| 18453 | return QDF_STATUS_SUCCESS; |
| 18454 | } |
| 18455 | |
| 18456 | /** |
| 18457 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 18458 | * @wmi_handle: wmi handle |
| 18459 | * @param evt_buf: pointer to event buffer |
| 18460 | * @param hdr: Pointer to hold header |
| 18461 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 18462 | * |
| 18463 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18464 | */ |
| 18465 | 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] | 18466 | void *evt_buf, struct mgmt_rx_event_params *hdr, |
| 18467 | uint8_t **bufp) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18468 | { |
| 18469 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 18470 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
gaurank kathpalia | 6a51f2b | 2018-01-29 18:09:06 +0530 | [diff] [blame] | 18471 | int i; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18472 | |
| 18473 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 18474 | if (!param_tlvs) { |
| 18475 | WMI_LOGE("Get NULL point message from FW"); |
| 18476 | return QDF_STATUS_E_INVAL; |
| 18477 | } |
| 18478 | |
| 18479 | ev_hdr = param_tlvs->hdr; |
| 18480 | if (!hdr) { |
| 18481 | WMI_LOGE("Rx event is NULL"); |
| 18482 | return QDF_STATUS_E_INVAL; |
| 18483 | } |
| 18484 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18485 | hdr->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18486 | ev_hdr->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18487 | |
| 18488 | hdr->channel = ev_hdr->channel; |
| 18489 | hdr->snr = ev_hdr->snr; |
| 18490 | hdr->rate = ev_hdr->rate; |
| 18491 | hdr->phy_mode = ev_hdr->phy_mode; |
| 18492 | hdr->buf_len = ev_hdr->buf_len; |
| 18493 | hdr->status = ev_hdr->status; |
| 18494 | hdr->flags = ev_hdr->flags; |
| 18495 | hdr->rssi = ev_hdr->rssi; |
| 18496 | hdr->tsf_delta = ev_hdr->tsf_delta; |
gaurank kathpalia | 6a51f2b | 2018-01-29 18:09:06 +0530 | [diff] [blame] | 18497 | for (i = 0; i < ATH_MAX_ANTENNA; i++) |
| 18498 | hdr->rssi_ctl[i] = ev_hdr->rssi_ctl[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18499 | |
| 18500 | *bufp = param_tlvs->bufp; |
| 18501 | |
| 18502 | return QDF_STATUS_SUCCESS; |
| 18503 | } |
| 18504 | |
| 18505 | /** |
| 18506 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 18507 | * @wmi_handle: wmi handle |
| 18508 | * @param evt_buf: pointer to event buffer |
| 18509 | * @param vdev_id: Pointer to hold vdev identifier |
| 18510 | * |
| 18511 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18512 | */ |
| 18513 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 18514 | void *evt_buf, uint32_t *vdev_id) |
| 18515 | { |
| 18516 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 18517 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 18518 | |
| 18519 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 18520 | if (!param_buf) { |
| 18521 | WMI_LOGE("Invalid event buffer"); |
| 18522 | return QDF_STATUS_E_INVAL; |
| 18523 | } |
| 18524 | resp_event = param_buf->fixed_param; |
| 18525 | *vdev_id = resp_event->vdev_id; |
| 18526 | |
| 18527 | return QDF_STATUS_SUCCESS; |
| 18528 | } |
| 18529 | |
| 18530 | /** |
| 18531 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 18532 | * @wmi_handle: wmi handle |
| 18533 | * @param evt_buf: pointer to event buffer |
| 18534 | * @param param: Pointer to hold roam param |
| 18535 | * |
| 18536 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18537 | */ |
| 18538 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 18539 | void *evt_buf, wmi_host_roam_event *param) |
| 18540 | { |
| 18541 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 18542 | wmi_roam_event_fixed_param *evt; |
| 18543 | |
| 18544 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 18545 | if (!param_buf) { |
| 18546 | WMI_LOGE("Invalid roam event buffer"); |
| 18547 | return QDF_STATUS_E_INVAL; |
| 18548 | } |
| 18549 | |
| 18550 | evt = param_buf->fixed_param; |
| 18551 | qdf_mem_zero(param, sizeof(*param)); |
| 18552 | |
| 18553 | param->vdev_id = evt->vdev_id; |
| 18554 | param->reason = evt->reason; |
| 18555 | param->rssi = evt->rssi; |
| 18556 | |
| 18557 | return QDF_STATUS_SUCCESS; |
| 18558 | } |
| 18559 | |
| 18560 | /** |
| 18561 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 18562 | * @wmi_handle: wmi handle |
| 18563 | * @param evt_buf: pointer to event buffer |
| 18564 | * @param param: Pointer to hold vdev scan param |
| 18565 | * |
| 18566 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18567 | */ |
| 18568 | 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] | 18569 | void *evt_buf, struct scan_event *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18570 | { |
| 18571 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 18572 | wmi_scan_event_fixed_param *evt = NULL; |
| 18573 | |
| 18574 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 18575 | evt = param_buf->fixed_param; |
| 18576 | |
| 18577 | qdf_mem_zero(param, sizeof(*param)); |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 18578 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18579 | switch (evt->event) { |
| 18580 | case WMI_SCAN_EVENT_STARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18581 | param->type = SCAN_EVENT_TYPE_STARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18582 | break; |
| 18583 | case WMI_SCAN_EVENT_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18584 | param->type = SCAN_EVENT_TYPE_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18585 | break; |
| 18586 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18587 | param->type = SCAN_EVENT_TYPE_BSS_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18588 | break; |
| 18589 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18590 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18591 | break; |
| 18592 | case WMI_SCAN_EVENT_DEQUEUED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18593 | param->type = SCAN_EVENT_TYPE_DEQUEUED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18594 | break; |
| 18595 | case WMI_SCAN_EVENT_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18596 | param->type = SCAN_EVENT_TYPE_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18597 | break; |
| 18598 | case WMI_SCAN_EVENT_START_FAILED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18599 | param->type = SCAN_EVENT_TYPE_START_FAILED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18600 | break; |
| 18601 | case WMI_SCAN_EVENT_RESTARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18602 | param->type = SCAN_EVENT_TYPE_RESTARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18603 | break; |
Sreelakshmi Konamki | 76d62af | 2017-05-25 18:11:03 +0530 | [diff] [blame] | 18604 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18605 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18606 | break; |
| 18607 | case WMI_SCAN_EVENT_MAX: |
| 18608 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18609 | param->type = SCAN_EVENT_TYPE_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18610 | break; |
| 18611 | }; |
| 18612 | |
| 18613 | switch (evt->reason) { |
| 18614 | case WMI_SCAN_REASON_NONE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18615 | param->reason = SCAN_REASON_NONE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18616 | break; |
| 18617 | case WMI_SCAN_REASON_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18618 | param->reason = SCAN_REASON_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18619 | break; |
| 18620 | case WMI_SCAN_REASON_CANCELLED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18621 | param->reason = SCAN_REASON_CANCELLED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18622 | break; |
| 18623 | case WMI_SCAN_REASON_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18624 | param->reason = SCAN_REASON_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18625 | break; |
| 18626 | case WMI_SCAN_REASON_TIMEDOUT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18627 | param->reason = SCAN_REASON_TIMEDOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18628 | break; |
| 18629 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18630 | param->reason = SCAN_REASON_INTERNAL_FAILURE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18631 | break; |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 18632 | case WMI_SCAN_REASON_SUSPENDED: |
| 18633 | param->reason = SCAN_REASON_SUSPENDED; |
| 18634 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18635 | case WMI_SCAN_REASON_MAX: |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 18636 | param->reason = SCAN_REASON_MAX; |
| 18637 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18638 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18639 | param->reason = SCAN_REASON_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18640 | break; |
| 18641 | }; |
| 18642 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 18643 | param->chan_freq = evt->channel_freq; |
| 18644 | param->requester = evt->requestor; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18645 | param->scan_id = evt->scan_id; |
| 18646 | param->vdev_id = evt->vdev_id; |
Sathish Kumar | b863315 | 2017-08-11 15:00:04 +0530 | [diff] [blame] | 18647 | param->timestamp = evt->tsf_timestamp; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18648 | |
| 18649 | return QDF_STATUS_SUCCESS; |
| 18650 | } |
| 18651 | |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 18652 | #ifdef CONVERGED_TDLS_ENABLE |
| 18653 | /** |
| 18654 | * extract_vdev_tdls_ev_param_tlv() - extract vdev tdls param from event |
| 18655 | * @wmi_handle: wmi handle |
| 18656 | * @param evt_buf: pointer to event buffer |
| 18657 | * @param param: Pointer to hold vdev tdls param |
| 18658 | * |
| 18659 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18660 | */ |
| 18661 | static QDF_STATUS extract_vdev_tdls_ev_param_tlv(wmi_unified_t wmi_handle, |
| 18662 | void *evt_buf, struct tdls_event_info *param) |
| 18663 | { |
| 18664 | WMI_TDLS_PEER_EVENTID_param_tlvs *param_buf; |
| 18665 | wmi_tdls_peer_event_fixed_param *evt; |
| 18666 | |
| 18667 | param_buf = (WMI_TDLS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 18668 | if (!param_buf) { |
| 18669 | WMI_LOGE("%s: NULL param_buf", __func__); |
| 18670 | return QDF_STATUS_E_NULL_VALUE; |
| 18671 | } |
| 18672 | |
| 18673 | evt = param_buf->fixed_param; |
| 18674 | |
| 18675 | qdf_mem_zero(param, sizeof(*param)); |
| 18676 | |
| 18677 | param->vdev_id = evt->vdev_id; |
| 18678 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&evt->peer_macaddr, |
| 18679 | param->peermac.bytes); |
| 18680 | switch (evt->peer_status) { |
| 18681 | case WMI_TDLS_SHOULD_DISCOVER: |
| 18682 | param->message_type = TDLS_SHOULD_DISCOVER; |
| 18683 | break; |
| 18684 | case WMI_TDLS_SHOULD_TEARDOWN: |
| 18685 | param->message_type = TDLS_SHOULD_TEARDOWN; |
| 18686 | break; |
| 18687 | case WMI_TDLS_PEER_DISCONNECTED: |
| 18688 | param->message_type = TDLS_PEER_DISCONNECTED; |
| 18689 | break; |
| 18690 | case WMI_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
| 18691 | param->message_type = TDLS_CONNECTION_TRACKER_NOTIFY; |
| 18692 | break; |
| 18693 | default: |
| 18694 | WMI_LOGE("%s: Discarding unknown tdls event %d from target", |
| 18695 | __func__, evt->peer_status); |
| 18696 | return QDF_STATUS_E_INVAL; |
| 18697 | }; |
| 18698 | |
| 18699 | switch (evt->peer_reason) { |
| 18700 | case WMI_TDLS_TEARDOWN_REASON_TX: |
| 18701 | param->peer_reason = TDLS_TEARDOWN_TX; |
| 18702 | break; |
| 18703 | case WMI_TDLS_TEARDOWN_REASON_RSSI: |
| 18704 | param->peer_reason = TDLS_TEARDOWN_RSSI; |
| 18705 | break; |
| 18706 | case WMI_TDLS_TEARDOWN_REASON_SCAN: |
| 18707 | param->peer_reason = TDLS_TEARDOWN_SCAN; |
| 18708 | break; |
| 18709 | case WMI_TDLS_DISCONNECTED_REASON_PEER_DELETE: |
| 18710 | param->peer_reason = TDLS_DISCONNECTED_PEER_DELETE; |
| 18711 | break; |
| 18712 | case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: |
| 18713 | param->peer_reason = TDLS_TEARDOWN_PTR_TIMEOUT; |
| 18714 | break; |
| 18715 | case WMI_TDLS_TEARDOWN_REASON_BAD_PTR: |
| 18716 | param->peer_reason = TDLS_TEARDOWN_BAD_PTR; |
| 18717 | break; |
| 18718 | case WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE: |
| 18719 | param->peer_reason = TDLS_TEARDOWN_NO_RSP; |
| 18720 | break; |
| 18721 | case WMI_TDLS_ENTER_BUF_STA: |
| 18722 | param->peer_reason = TDLS_PEER_ENTER_BUF_STA; |
| 18723 | break; |
| 18724 | case WMI_TDLS_EXIT_BUF_STA: |
| 18725 | param->peer_reason = TDLS_PEER_EXIT_BUF_STA; |
| 18726 | break; |
| 18727 | case WMI_TDLS_ENTER_BT_BUSY_MODE: |
| 18728 | param->peer_reason = TDLS_ENTER_BT_BUSY; |
| 18729 | break; |
| 18730 | case WMI_TDLS_EXIT_BT_BUSY_MODE: |
| 18731 | param->peer_reason = TDLS_EXIT_BT_BUSY; |
| 18732 | break; |
| 18733 | case WMI_TDLS_SCAN_STARTED_EVENT: |
| 18734 | param->peer_reason = TDLS_SCAN_STARTED; |
| 18735 | break; |
| 18736 | case WMI_TDLS_SCAN_COMPLETED_EVENT: |
| 18737 | param->peer_reason = TDLS_SCAN_COMPLETED; |
| 18738 | break; |
| 18739 | |
| 18740 | default: |
| 18741 | WMI_LOGE("%s: unknown reason %d in tdls event %d from target", |
| 18742 | __func__, evt->peer_reason, evt->peer_status); |
| 18743 | return QDF_STATUS_E_INVAL; |
| 18744 | }; |
| 18745 | |
| 18746 | WMI_LOGD("%s: tdls event, peer: %pM, type: 0x%x, reason: %d, vdev: %d", |
| 18747 | __func__, param->peermac.bytes, param->message_type, |
| 18748 | param->peer_reason, param->vdev_id); |
| 18749 | |
| 18750 | return QDF_STATUS_SUCCESS; |
| 18751 | } |
| 18752 | #endif |
| 18753 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18754 | /** |
| 18755 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 18756 | * @wmi_handle: wmi handle |
| 18757 | * @param evt_buf: pointer to event buffer |
| 18758 | * @param param: Pointer to hold MGMT TX completion params |
| 18759 | * |
| 18760 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18761 | */ |
| 18762 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 18763 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 18764 | { |
| 18765 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 18766 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 18767 | |
| 18768 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 18769 | evt_buf; |
| 18770 | if (!param_buf) { |
| 18771 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 18772 | return QDF_STATUS_E_INVAL; |
| 18773 | } |
| 18774 | cmpl_params = param_buf->fixed_param; |
| 18775 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18776 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18777 | cmpl_params->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18778 | param->desc_id = cmpl_params->desc_id; |
| 18779 | param->status = cmpl_params->status; |
| 18780 | |
| 18781 | return QDF_STATUS_SUCCESS; |
| 18782 | } |
| 18783 | |
| 18784 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 18785 | * extract_offchan_data_tx_compl_param_tlv() - |
| 18786 | * extract Offchan data tx completion event params |
| 18787 | * @wmi_handle: wmi handle |
| 18788 | * @param evt_buf: pointer to event buffer |
| 18789 | * @param param: Pointer to hold offchan data TX completion params |
| 18790 | * |
| 18791 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18792 | */ |
| 18793 | static QDF_STATUS extract_offchan_data_tx_compl_param_tlv( |
| 18794 | wmi_unified_t wmi_handle, void *evt_buf, |
| 18795 | struct wmi_host_offchan_data_tx_compl_event *param) |
| 18796 | { |
| 18797 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 18798 | wmi_offchan_data_tx_compl_event_fixed_param *cmpl_params; |
| 18799 | |
| 18800 | param_buf = (WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *) |
| 18801 | evt_buf; |
| 18802 | if (!param_buf) { |
| 18803 | WMI_LOGE("%s: Invalid offchan data Tx compl event", __func__); |
| 18804 | return QDF_STATUS_E_INVAL; |
| 18805 | } |
| 18806 | cmpl_params = param_buf->fixed_param; |
| 18807 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18808 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18809 | cmpl_params->pdev_id); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 18810 | param->desc_id = cmpl_params->desc_id; |
| 18811 | param->status = cmpl_params->status; |
| 18812 | |
| 18813 | return QDF_STATUS_SUCCESS; |
| 18814 | } |
| 18815 | |
| 18816 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 18817 | * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count |
| 18818 | * status tlv |
| 18819 | * @wmi_handle: wmi handle |
| 18820 | * @param evt_buf: pointer to event buffer |
| 18821 | * @param param: Pointer to hold csa switch count status event param |
| 18822 | * |
| 18823 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18824 | */ |
| 18825 | static QDF_STATUS extract_pdev_csa_switch_count_status_tlv( |
| 18826 | wmi_unified_t wmi_handle, |
| 18827 | void *evt_buf, |
| 18828 | struct pdev_csa_switch_count_status *param) |
| 18829 | { |
| 18830 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *param_buf; |
| 18831 | wmi_pdev_csa_switch_count_status_event_fixed_param *csa_status; |
| 18832 | |
| 18833 | param_buf = (WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *) |
| 18834 | evt_buf; |
| 18835 | if (!param_buf) { |
| 18836 | WMI_LOGE("%s: Invalid CSA status event\n", __func__); |
| 18837 | return QDF_STATUS_E_INVAL; |
| 18838 | } |
| 18839 | |
| 18840 | csa_status = param_buf->fixed_param; |
| 18841 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18842 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18843 | csa_status->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 18844 | param->current_switch_count = csa_status->current_switch_count; |
| 18845 | param->num_vdevs = csa_status->num_vdevs; |
| 18846 | param->vdev_ids = param_buf->vdev_ids; |
| 18847 | |
| 18848 | return QDF_STATUS_SUCCESS; |
| 18849 | } |
| 18850 | |
| 18851 | /** |
Shaakir Mohamed | 75208c3 | 2018-02-15 14:30:21 -0800 | [diff] [blame] | 18852 | * extract_pdev_tpc_config_ev_param_tlv() - extract pdev tpc configuration |
| 18853 | * param from event |
| 18854 | * @wmi_handle: wmi handle |
| 18855 | * @param evt_buf: pointer to event buffer |
| 18856 | * @param param: Pointer to hold tpc configuration |
| 18857 | * |
| 18858 | * Return: 0 for success or error code |
| 18859 | */ |
| 18860 | static QDF_STATUS extract_pdev_tpc_config_ev_param_tlv(wmi_unified_t wmi_handle, |
| 18861 | void *evt_buf, |
| 18862 | wmi_host_pdev_tpc_config_event *param) |
| 18863 | { |
| 18864 | wmi_pdev_tpc_config_event_fixed_param *event = |
| 18865 | (wmi_pdev_tpc_config_event_fixed_param *)evt_buf; |
| 18866 | |
| 18867 | if (!event) { |
| 18868 | WMI_LOGE("Invalid event buffer"); |
| 18869 | return QDF_STATUS_E_INVAL; |
| 18870 | } |
| 18871 | |
| 18872 | param->pdev_id = event->pdev_id; |
| 18873 | param->regDomain = event->regDomain; |
| 18874 | param->chanFreq = event->chanFreq; |
| 18875 | param->phyMode = event->phyMode; |
| 18876 | param->twiceAntennaReduction = event->twiceAntennaReduction; |
| 18877 | param->twiceMaxRDPower = event->twiceMaxRDPower; |
| 18878 | param->powerLimit = event->powerLimit; |
| 18879 | param->rateMax = event->rateMax; |
| 18880 | param->numTxChain = event->numTxChain; |
| 18881 | param->ctl = event->ctl; |
| 18882 | param->flags = event->flags; |
| 18883 | |
| 18884 | qdf_mem_copy(param->maxRegAllowedPower, event->maxRegAllowedPower, |
| 18885 | sizeof(param->maxRegAllowedPower)); |
| 18886 | qdf_mem_copy(param->maxRegAllowedPowerAGCDD, |
| 18887 | event->maxRegAllowedPowerAGCDD, |
| 18888 | sizeof(param->maxRegAllowedPowerAGCDD)); |
| 18889 | qdf_mem_copy(param->maxRegAllowedPowerAGSTBC, |
| 18890 | event->maxRegAllowedPowerAGSTBC, |
| 18891 | sizeof(param->maxRegAllowedPowerAGSTBC)); |
| 18892 | qdf_mem_copy(param->maxRegAllowedPowerAGTXBF, |
| 18893 | event->maxRegAllowedPowerAGTXBF, |
| 18894 | sizeof(param->maxRegAllowedPowerAGTXBF)); |
| 18895 | WMI_LOGD("%s:extract success", __func__); |
| 18896 | |
| 18897 | return QDF_STATUS_SUCCESS; |
| 18898 | } |
| 18899 | |
| 18900 | /** |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18901 | * extract_swba_num_vdevs_tlv() - extract swba num vdevs from event |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18902 | * @wmi_handle: wmi handle |
| 18903 | * @param evt_buf: pointer to event buffer |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18904 | * @param num_vdevs: Pointer to hold num vdevs |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18905 | * |
| 18906 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18907 | */ |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18908 | static QDF_STATUS extract_swba_num_vdevs_tlv(wmi_unified_t wmi_handle, |
| 18909 | void *evt_buf, uint32_t *num_vdevs) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18910 | { |
| 18911 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 18912 | wmi_host_swba_event_fixed_param *swba_event; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18913 | uint32_t vdev_map; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18914 | |
| 18915 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 18916 | if (!param_buf) { |
| 18917 | WMI_LOGE("Invalid swba event buffer"); |
| 18918 | return QDF_STATUS_E_INVAL; |
| 18919 | } |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18920 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18921 | swba_event = param_buf->fixed_param; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18922 | *num_vdevs = swba_event->num_vdevs; |
| 18923 | if (!(*num_vdevs)) { |
| 18924 | vdev_map = swba_event->vdev_map; |
| 18925 | *num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map); |
| 18926 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18927 | |
| 18928 | return QDF_STATUS_SUCCESS; |
| 18929 | } |
| 18930 | |
| 18931 | /** |
| 18932 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 18933 | * @wmi_handle: wmi handle |
| 18934 | * @param evt_buf: pointer to event buffer |
| 18935 | * @param idx: Index to bcn info |
| 18936 | * @param tim_info: Pointer to hold tim info |
| 18937 | * |
| 18938 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18939 | */ |
| 18940 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 18941 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 18942 | { |
| 18943 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 18944 | wmi_tim_info *tim_info_ev; |
| 18945 | |
| 18946 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 18947 | if (!param_buf) { |
| 18948 | WMI_LOGE("Invalid swba event buffer"); |
| 18949 | return QDF_STATUS_E_INVAL; |
| 18950 | } |
| 18951 | |
| 18952 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 18953 | |
| 18954 | tim_info->tim_len = tim_info_ev->tim_len; |
| 18955 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 18956 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 18957 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 18958 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 18959 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 18960 | tim_info->vdev_id = tim_info_ev->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18961 | |
| 18962 | return QDF_STATUS_SUCCESS; |
| 18963 | } |
| 18964 | |
| 18965 | /** |
| 18966 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 18967 | * @wmi_handle: wmi handle |
| 18968 | * @param evt_buf: pointer to event buffer |
| 18969 | * @param idx: Index to bcn info |
| 18970 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 18971 | * |
| 18972 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18973 | */ |
| 18974 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 18975 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 18976 | { |
| 18977 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 18978 | wmi_p2p_noa_info *p2p_noa_info; |
| 18979 | uint8_t i = 0; |
| 18980 | |
| 18981 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 18982 | if (!param_buf) { |
| 18983 | WMI_LOGE("Invalid swba event buffer"); |
| 18984 | return QDF_STATUS_E_INVAL; |
| 18985 | } |
| 18986 | |
| 18987 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 18988 | |
| 18989 | p2p_desc->modified = false; |
| 18990 | p2p_desc->num_descriptors = 0; |
| 18991 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 18992 | p2p_desc->modified = true; |
| 18993 | p2p_desc->index = |
| 18994 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 18995 | p2p_desc->oppPS = |
| 18996 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 18997 | p2p_desc->ctwindow = |
| 18998 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 18999 | p2p_desc->num_descriptors = |
| 19000 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 19001 | (p2p_noa_info); |
| 19002 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 19003 | p2p_desc->noa_descriptors[i].type_count = |
| 19004 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 19005 | type_count; |
| 19006 | p2p_desc->noa_descriptors[i].duration = |
| 19007 | p2p_noa_info->noa_descriptors[i].duration; |
| 19008 | p2p_desc->noa_descriptors[i].interval = |
| 19009 | p2p_noa_info->noa_descriptors[i].interval; |
| 19010 | p2p_desc->noa_descriptors[i].start_time = |
| 19011 | p2p_noa_info->noa_descriptors[i].start_time; |
| 19012 | } |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19013 | p2p_desc->vdev_id = p2p_noa_info->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19014 | } |
| 19015 | |
| 19016 | return QDF_STATUS_SUCCESS; |
| 19017 | } |
| 19018 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 19019 | #ifdef CONVERGED_P2P_ENABLE |
| 19020 | /** |
| 19021 | * extract_p2p_noa_ev_param_tlv() - extract p2p noa information from event |
| 19022 | * @wmi_handle: wmi handle |
| 19023 | * @param evt_buf: pointer to event buffer |
| 19024 | * @param param: Pointer to hold p2p noa info |
| 19025 | * |
| 19026 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19027 | */ |
| 19028 | static QDF_STATUS extract_p2p_noa_ev_param_tlv( |
| 19029 | wmi_unified_t wmi_handle, void *evt_buf, |
| 19030 | struct p2p_noa_info *param) |
| 19031 | { |
| 19032 | WMI_P2P_NOA_EVENTID_param_tlvs *param_tlvs; |
| 19033 | wmi_p2p_noa_event_fixed_param *fixed_param; |
| 19034 | uint8_t i; |
| 19035 | wmi_p2p_noa_info *wmi_noa_info; |
| 19036 | uint8_t *buf_ptr; |
| 19037 | uint32_t descriptors; |
| 19038 | |
| 19039 | param_tlvs = (WMI_P2P_NOA_EVENTID_param_tlvs *) evt_buf; |
| 19040 | if (!param_tlvs) { |
| 19041 | WMI_LOGE("%s: Invalid P2P NoA event buffer", __func__); |
| 19042 | return QDF_STATUS_E_INVAL; |
| 19043 | } |
| 19044 | |
| 19045 | if (!param) { |
| 19046 | WMI_LOGE("noa information param is null"); |
| 19047 | return QDF_STATUS_E_INVAL; |
| 19048 | } |
| 19049 | |
| 19050 | fixed_param = param_tlvs->fixed_param; |
| 19051 | buf_ptr = (uint8_t *) fixed_param; |
| 19052 | buf_ptr += sizeof(wmi_p2p_noa_event_fixed_param); |
| 19053 | wmi_noa_info = (wmi_p2p_noa_info *) (buf_ptr); |
| 19054 | |
| 19055 | if (!WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(wmi_noa_info)) { |
| 19056 | WMI_LOGE("%s: noa attr is not modified", __func__); |
| 19057 | return QDF_STATUS_E_INVAL; |
| 19058 | } |
| 19059 | |
| 19060 | param->vdev_id = fixed_param->vdev_id; |
| 19061 | param->index = |
| 19062 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(wmi_noa_info); |
| 19063 | param->opps_ps = |
| 19064 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(wmi_noa_info); |
| 19065 | param->ct_window = |
| 19066 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(wmi_noa_info); |
| 19067 | descriptors = WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET(wmi_noa_info); |
| 19068 | param->num_desc = (uint8_t) descriptors; |
| 19069 | |
| 19070 | WMI_LOGD("%s:index %u, opps_ps %u, ct_window %u, num_descriptors = %u", __func__, |
| 19071 | param->index, param->opps_ps, param->ct_window, |
| 19072 | param->num_desc); |
| 19073 | for (i = 0; i < param->num_desc; i++) { |
| 19074 | param->noa_desc[i].type_count = |
| 19075 | (uint8_t) wmi_noa_info->noa_descriptors[i]. |
| 19076 | type_count; |
| 19077 | param->noa_desc[i].duration = |
| 19078 | wmi_noa_info->noa_descriptors[i].duration; |
| 19079 | param->noa_desc[i].interval = |
| 19080 | wmi_noa_info->noa_descriptors[i].interval; |
| 19081 | param->noa_desc[i].start_time = |
| 19082 | wmi_noa_info->noa_descriptors[i].start_time; |
| 19083 | WMI_LOGD("%s:NoA descriptor[%d] type_count %u, duration %u, interval %u, start_time = %u", |
| 19084 | __func__, i, param->noa_desc[i].type_count, |
| 19085 | param->noa_desc[i].duration, |
| 19086 | param->noa_desc[i].interval, |
| 19087 | param->noa_desc[i].start_time); |
| 19088 | } |
| 19089 | |
| 19090 | return QDF_STATUS_SUCCESS; |
| 19091 | } |
| 19092 | |
| 19093 | /** |
| 19094 | * extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop |
| 19095 | * information from event |
| 19096 | * @wmi_handle: wmi handle |
| 19097 | * @param evt_buf: pointer to event buffer |
| 19098 | * @param param: Pointer to hold p2p lo stop event information |
| 19099 | * |
| 19100 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19101 | */ |
| 19102 | static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv( |
| 19103 | wmi_unified_t wmi_handle, void *evt_buf, |
| 19104 | struct p2p_lo_event *param) |
| 19105 | { |
| 19106 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *param_tlvs; |
| 19107 | wmi_p2p_lo_stopped_event_fixed_param *lo_param; |
| 19108 | |
| 19109 | param_tlvs = (WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *) |
| 19110 | evt_buf; |
| 19111 | if (!param_tlvs) { |
| 19112 | WMI_LOGE("%s: Invalid P2P lo stop event buffer", __func__); |
| 19113 | return QDF_STATUS_E_INVAL; |
| 19114 | } |
| 19115 | |
| 19116 | if (!param) { |
| 19117 | WMI_LOGE("lo stop event param is null"); |
| 19118 | return QDF_STATUS_E_INVAL; |
| 19119 | } |
| 19120 | |
| 19121 | lo_param = param_tlvs->fixed_param; |
| 19122 | param->vdev_id = lo_param->vdev_id; |
| 19123 | param->reason_code = lo_param->reason; |
| 19124 | WMI_LOGD("%s: vdev_id:%d, reason:%d", __func__, |
| 19125 | param->vdev_id, param->reason_code); |
| 19126 | |
| 19127 | return QDF_STATUS_SUCCESS; |
| 19128 | } |
| 19129 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 19130 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19131 | /** |
| 19132 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 19133 | * @wmi_handle: wmi handle |
| 19134 | * @param evt_buf: pointer to event buffer |
| 19135 | * @param ev: Pointer to hold peer param |
| 19136 | * |
| 19137 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19138 | */ |
| 19139 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 19140 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 19141 | { |
| 19142 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 19143 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 19144 | |
| 19145 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 19146 | kickout_event = param_buf->fixed_param; |
| 19147 | |
| 19148 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 19149 | ev->peer_macaddr); |
| 19150 | |
| 19151 | ev->reason = kickout_event->reason; |
| 19152 | ev->rssi = kickout_event->rssi; |
| 19153 | |
| 19154 | return QDF_STATUS_SUCCESS; |
| 19155 | } |
| 19156 | |
| 19157 | /** |
| 19158 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 19159 | * @wmi_handle: wmi handle |
| 19160 | * @param evt_buf: pointer to event buffer |
| 19161 | * @param stats_param: Pointer to hold stats count |
| 19162 | * |
| 19163 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19164 | */ |
| 19165 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 19166 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 19167 | { |
| 19168 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 19169 | wmi_stats_event_fixed_param *ev; |
| 19170 | |
| 19171 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 19172 | |
| 19173 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 19174 | if (!ev) { |
| 19175 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 19176 | return QDF_STATUS_E_FAILURE; |
| 19177 | } |
| 19178 | |
| 19179 | switch (ev->stats_id) { |
| 19180 | case WMI_REQUEST_PEER_STAT: |
| 19181 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 19182 | break; |
| 19183 | |
| 19184 | case WMI_REQUEST_AP_STAT: |
| 19185 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 19186 | break; |
| 19187 | |
| 19188 | case WMI_REQUEST_PDEV_STAT: |
| 19189 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 19190 | break; |
| 19191 | |
| 19192 | case WMI_REQUEST_VDEV_STAT: |
| 19193 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 19194 | break; |
| 19195 | |
| 19196 | case WMI_REQUEST_BCNFLT_STAT: |
| 19197 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 19198 | break; |
| 19199 | |
| 19200 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 19201 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 19202 | break; |
| 19203 | |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 19204 | case WMI_REQUEST_BCN_STAT: |
| 19205 | stats_param->stats_id |= WMI_HOST_REQUEST_BCN_STAT; |
| 19206 | break; |
| 19207 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19208 | default: |
| 19209 | stats_param->stats_id = 0; |
| 19210 | break; |
| 19211 | |
| 19212 | } |
| 19213 | |
| 19214 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 19215 | stats_param->num_pdev_ext_stats = 0; |
| 19216 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 19217 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 19218 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 19219 | stats_param->num_chan_stats = ev->num_chan_stats; |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 19220 | stats_param->num_bcn_stats = ev->num_bcn_stats; |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 19221 | stats_param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 19222 | ev->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19223 | |
| 19224 | return QDF_STATUS_SUCCESS; |
| 19225 | } |
| 19226 | |
| 19227 | /** |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 19228 | * extract_pdev_tx_stats() - extract pdev tx stats from event |
| 19229 | */ |
| 19230 | static void extract_pdev_tx_stats(wmi_host_dbg_tx_stats *tx, struct wlan_dbg_tx_stats *tx_stats) |
| 19231 | { |
| 19232 | /* Tx Stats */ |
| 19233 | tx->comp_queued = tx_stats->comp_queued; |
| 19234 | tx->comp_delivered = tx_stats->comp_delivered; |
| 19235 | tx->msdu_enqued = tx_stats->msdu_enqued; |
| 19236 | tx->mpdu_enqued = tx_stats->mpdu_enqued; |
| 19237 | tx->wmm_drop = tx_stats->wmm_drop; |
| 19238 | tx->local_enqued = tx_stats->local_enqued; |
| 19239 | tx->local_freed = tx_stats->local_freed; |
| 19240 | tx->hw_queued = tx_stats->hw_queued; |
| 19241 | tx->hw_reaped = tx_stats->hw_reaped; |
| 19242 | tx->underrun = tx_stats->underrun; |
| 19243 | tx->tx_abort = tx_stats->tx_abort; |
| 19244 | tx->mpdus_requed = tx_stats->mpdus_requed; |
| 19245 | tx->data_rc = tx_stats->data_rc; |
| 19246 | tx->self_triggers = tx_stats->self_triggers; |
| 19247 | tx->sw_retry_failure = tx_stats->sw_retry_failure; |
| 19248 | tx->illgl_rate_phy_err = tx_stats->illgl_rate_phy_err; |
| 19249 | tx->pdev_cont_xretry = tx_stats->pdev_cont_xretry; |
| 19250 | tx->pdev_tx_timeout = tx_stats->pdev_tx_timeout; |
| 19251 | tx->pdev_resets = tx_stats->pdev_resets; |
| 19252 | tx->stateless_tid_alloc_failure = tx_stats->stateless_tid_alloc_failure; |
| 19253 | tx->phy_underrun = tx_stats->phy_underrun; |
| 19254 | tx->txop_ovf = tx_stats->txop_ovf; |
| 19255 | |
| 19256 | return; |
| 19257 | } |
| 19258 | |
| 19259 | |
| 19260 | /** |
| 19261 | * extract_pdev_rx_stats() - extract pdev rx stats from event |
| 19262 | */ |
| 19263 | static void extract_pdev_rx_stats(wmi_host_dbg_rx_stats *rx, struct wlan_dbg_rx_stats *rx_stats) |
| 19264 | { |
| 19265 | /* Rx Stats */ |
| 19266 | rx->mid_ppdu_route_change = rx_stats->mid_ppdu_route_change; |
| 19267 | rx->status_rcvd = rx_stats->status_rcvd; |
| 19268 | rx->r0_frags = rx_stats->r0_frags; |
| 19269 | rx->r1_frags = rx_stats->r1_frags; |
| 19270 | rx->r2_frags = rx_stats->r2_frags; |
| 19271 | /* Only TLV */ |
| 19272 | rx->r3_frags = 0; |
| 19273 | rx->htt_msdus = rx_stats->htt_msdus; |
| 19274 | rx->htt_mpdus = rx_stats->htt_mpdus; |
| 19275 | rx->loc_msdus = rx_stats->loc_msdus; |
| 19276 | rx->loc_mpdus = rx_stats->loc_mpdus; |
| 19277 | rx->oversize_amsdu = rx_stats->oversize_amsdu; |
| 19278 | rx->phy_errs = rx_stats->phy_errs; |
| 19279 | rx->phy_err_drop = rx_stats->phy_err_drop; |
| 19280 | rx->mpdu_errs = rx_stats->mpdu_errs; |
| 19281 | |
| 19282 | return; |
| 19283 | } |
| 19284 | |
| 19285 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19286 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 19287 | * @wmi_handle: wmi handle |
| 19288 | * @param evt_buf: pointer to event buffer |
| 19289 | * @param index: Index into pdev stats |
| 19290 | * @param pdev_stats: Pointer to hold pdev stats |
| 19291 | * |
| 19292 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19293 | */ |
| 19294 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 19295 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 19296 | { |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 19297 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 19298 | wmi_stats_event_fixed_param *ev_param; |
| 19299 | uint8_t *data; |
| 19300 | |
| 19301 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 19302 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 19303 | |
| 19304 | data = param_buf->data; |
| 19305 | |
| 19306 | if (index < ev_param->num_pdev_stats) { |
| 19307 | wmi_pdev_stats *ev = (wmi_pdev_stats *) ((data) + |
| 19308 | (index * sizeof(wmi_pdev_stats))); |
| 19309 | |
| 19310 | pdev_stats->chan_nf = ev->chan_nf; |
| 19311 | pdev_stats->tx_frame_count = ev->tx_frame_count; |
| 19312 | pdev_stats->rx_frame_count = ev->rx_frame_count; |
| 19313 | pdev_stats->rx_clear_count = ev->rx_clear_count; |
| 19314 | pdev_stats->cycle_count = ev->cycle_count; |
| 19315 | pdev_stats->phy_err_count = ev->phy_err_count; |
| 19316 | pdev_stats->chan_tx_pwr = ev->chan_tx_pwr; |
| 19317 | |
| 19318 | extract_pdev_tx_stats(&(pdev_stats->pdev_stats.tx), |
| 19319 | &(ev->pdev_stats.tx)); |
| 19320 | extract_pdev_rx_stats(&(pdev_stats->pdev_stats.rx), |
| 19321 | &(ev->pdev_stats.rx)); |
| 19322 | } |
| 19323 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19324 | return QDF_STATUS_SUCCESS; |
| 19325 | } |
| 19326 | |
| 19327 | /** |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 19328 | * extract_unit_test_tlv() - extract unit test data |
| 19329 | * @wmi_handle: wmi handle |
| 19330 | * @param evt_buf: pointer to event buffer |
| 19331 | * @param unit_test: pointer to hold unit test data |
| 19332 | * @param maxspace: Amount of space in evt_buf |
| 19333 | * |
| 19334 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19335 | */ |
| 19336 | static QDF_STATUS extract_unit_test_tlv(wmi_unified_t wmi_handle, |
| 19337 | void *evt_buf, wmi_unit_test_event *unit_test, uint32_t maxspace) |
| 19338 | { |
| 19339 | WMI_UNIT_TEST_EVENTID_param_tlvs *param_buf; |
| 19340 | wmi_unit_test_event_fixed_param *ev_param; |
| 19341 | uint32_t num_bufp; |
| 19342 | uint32_t copy_size; |
| 19343 | uint8_t *bufp; |
| 19344 | |
| 19345 | param_buf = (WMI_UNIT_TEST_EVENTID_param_tlvs *) evt_buf; |
| 19346 | ev_param = param_buf->fixed_param; |
| 19347 | bufp = param_buf->bufp; |
| 19348 | num_bufp = param_buf->num_bufp; |
| 19349 | unit_test->vdev_id = ev_param->vdev_id; |
| 19350 | unit_test->module_id = ev_param->module_id; |
| 19351 | unit_test->diag_token = ev_param->diag_token; |
| 19352 | unit_test->flag = ev_param->flag; |
| 19353 | unit_test->payload_len = ev_param->payload_len; |
| 19354 | WMI_LOGI("%s:vdev_id:%d mod_id:%d diag_token:%d flag:%d\n", __func__, |
| 19355 | ev_param->vdev_id, |
| 19356 | ev_param->module_id, |
| 19357 | ev_param->diag_token, |
| 19358 | ev_param->flag); |
| 19359 | WMI_LOGD("%s: Unit-test data given below %d", __func__, num_bufp); |
| 19360 | qdf_trace_hex_dump(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG, |
| 19361 | bufp, num_bufp); |
| 19362 | copy_size = (num_bufp < maxspace) ? num_bufp : maxspace; |
| 19363 | qdf_mem_copy(unit_test->buffer, bufp, copy_size); |
| 19364 | unit_test->buffer_len = copy_size; |
| 19365 | |
| 19366 | return QDF_STATUS_SUCCESS; |
| 19367 | } |
| 19368 | |
| 19369 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19370 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 19371 | * @wmi_handle: wmi handle |
| 19372 | * @param evt_buf: pointer to event buffer |
| 19373 | * @param index: Index into extended pdev stats |
| 19374 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 19375 | * |
| 19376 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19377 | */ |
| 19378 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 19379 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 19380 | { |
| 19381 | return QDF_STATUS_SUCCESS; |
| 19382 | } |
| 19383 | |
| 19384 | /** |
| 19385 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 19386 | * @wmi_handle: wmi handle |
| 19387 | * @param evt_buf: pointer to event buffer |
| 19388 | * @param index: Index into vdev stats |
| 19389 | * @param vdev_stats: Pointer to hold vdev stats |
| 19390 | * |
| 19391 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19392 | */ |
| 19393 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 19394 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 19395 | { |
| 19396 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 19397 | wmi_stats_event_fixed_param *ev_param; |
| 19398 | uint8_t *data; |
| 19399 | |
| 19400 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 19401 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 19402 | data = (uint8_t *) param_buf->data; |
| 19403 | |
| 19404 | if (index < ev_param->num_vdev_stats) { |
| 19405 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 19406 | ((ev_param->num_pdev_stats) * |
| 19407 | sizeof(wmi_pdev_stats)) + |
| 19408 | (index * sizeof(wmi_vdev_stats))); |
| 19409 | |
| 19410 | vdev_stats->vdev_id = ev->vdev_id; |
| 19411 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 19412 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 19413 | |
| 19414 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 19415 | sizeof(ev->tx_frm_cnt)); |
| 19416 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 19417 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 19418 | ev->multiple_retry_cnt, |
| 19419 | sizeof(ev->multiple_retry_cnt)); |
| 19420 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 19421 | sizeof(ev->fail_cnt)); |
| 19422 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 19423 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 19424 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 19425 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 19426 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 19427 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 19428 | sizeof(ev->tx_rate_history)); |
| 19429 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 19430 | sizeof(ev->bcn_rssi_history)); |
| 19431 | |
| 19432 | } |
| 19433 | |
| 19434 | return QDF_STATUS_SUCCESS; |
| 19435 | } |
| 19436 | |
| 19437 | /** |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 19438 | * extract_bcn_stats_tlv() - extract bcn stats from event |
| 19439 | * @wmi_handle: wmi handle |
| 19440 | * @param evt_buf: pointer to event buffer |
| 19441 | * @param index: Index into vdev stats |
| 19442 | * @param bcn_stats: Pointer to hold bcn stats |
| 19443 | * |
| 19444 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19445 | */ |
| 19446 | static QDF_STATUS extract_bcn_stats_tlv(wmi_unified_t wmi_handle, |
| 19447 | void *evt_buf, uint32_t index, wmi_host_bcn_stats *bcn_stats) |
| 19448 | { |
| 19449 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 19450 | wmi_stats_event_fixed_param *ev_param; |
| 19451 | uint8_t *data; |
| 19452 | |
| 19453 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 19454 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 19455 | data = (uint8_t *) param_buf->data; |
| 19456 | |
| 19457 | if (index < ev_param->num_bcn_stats) { |
| 19458 | wmi_bcn_stats *ev = (wmi_bcn_stats *) ((data) + |
| 19459 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 19460 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 19461 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 19462 | ((ev_param->num_chan_stats) * sizeof(wmi_chan_stats)) + |
| 19463 | ((ev_param->num_mib_stats) * sizeof(wmi_mib_stats)) + |
| 19464 | (index * sizeof(wmi_bcn_stats))); |
| 19465 | |
| 19466 | bcn_stats->vdev_id = ev->vdev_id; |
| 19467 | bcn_stats->tx_bcn_succ_cnt = ev->tx_bcn_succ_cnt; |
| 19468 | bcn_stats->tx_bcn_outage_cnt = ev->tx_bcn_outage_cnt; |
| 19469 | } |
| 19470 | |
| 19471 | return QDF_STATUS_SUCCESS; |
| 19472 | } |
| 19473 | |
| 19474 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19475 | * extract_peer_stats_tlv() - extract peer stats from event |
| 19476 | * @wmi_handle: wmi handle |
| 19477 | * @param evt_buf: pointer to event buffer |
| 19478 | * @param index: Index into peer stats |
| 19479 | * @param peer_stats: Pointer to hold peer stats |
| 19480 | * |
| 19481 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19482 | */ |
| 19483 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 19484 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 19485 | { |
| 19486 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 19487 | wmi_stats_event_fixed_param *ev_param; |
| 19488 | uint8_t *data; |
| 19489 | |
| 19490 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 19491 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 19492 | data = (uint8_t *) param_buf->data; |
| 19493 | |
| 19494 | if (index < ev_param->num_peer_stats) { |
| 19495 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 19496 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 19497 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 19498 | (index * sizeof(wmi_peer_stats))); |
| 19499 | |
| 19500 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 19501 | |
| 19502 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 19503 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 19504 | |
| 19505 | peer_stats->peer_rssi = ev->peer_rssi; |
| 19506 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 19507 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 19508 | } |
| 19509 | |
| 19510 | return QDF_STATUS_SUCCESS; |
| 19511 | } |
| 19512 | |
| 19513 | /** |
| 19514 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 19515 | * @wmi_handle: wmi handle |
| 19516 | * @param evt_buf: pointer to event buffer |
| 19517 | * @param index: Index into bcn fault stats |
| 19518 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 19519 | * |
| 19520 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19521 | */ |
| 19522 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 19523 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 19524 | { |
| 19525 | return QDF_STATUS_SUCCESS; |
| 19526 | } |
| 19527 | |
| 19528 | /** |
| 19529 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 19530 | * @wmi_handle: wmi handle |
| 19531 | * @param evt_buf: pointer to event buffer |
| 19532 | * @param index: Index into extended peer stats |
| 19533 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 19534 | * |
| 19535 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19536 | */ |
| 19537 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 19538 | void *evt_buf, uint32_t index, |
| 19539 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 19540 | { |
| 19541 | return QDF_STATUS_SUCCESS; |
| 19542 | } |
| 19543 | |
| 19544 | /** |
| 19545 | * extract_chan_stats_tlv() - extract chan stats from event |
| 19546 | * @wmi_handle: wmi handle |
| 19547 | * @param evt_buf: pointer to event buffer |
| 19548 | * @param index: Index into chan stats |
| 19549 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 19550 | * |
| 19551 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19552 | */ |
| 19553 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 19554 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 19555 | { |
| 19556 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 19557 | wmi_stats_event_fixed_param *ev_param; |
| 19558 | uint8_t *data; |
| 19559 | |
| 19560 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 19561 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 19562 | data = (uint8_t *) param_buf->data; |
| 19563 | |
| 19564 | if (index < ev_param->num_chan_stats) { |
| 19565 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 19566 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 19567 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 19568 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 19569 | (index * sizeof(wmi_chan_stats))); |
| 19570 | |
| 19571 | |
| 19572 | /* Non-TLV doesnt have num_chan_stats */ |
| 19573 | chan_stats->chan_mhz = ev->chan_mhz; |
| 19574 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 19575 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 19576 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 19577 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 19578 | } |
| 19579 | |
| 19580 | return QDF_STATUS_SUCCESS; |
| 19581 | } |
| 19582 | |
| 19583 | /** |
| 19584 | * extract_profile_ctx_tlv() - extract profile context from event |
| 19585 | * @wmi_handle: wmi handle |
| 19586 | * @param evt_buf: pointer to event buffer |
| 19587 | * @idx: profile stats index to extract |
| 19588 | * @param profile_ctx: Pointer to hold profile context |
| 19589 | * |
| 19590 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19591 | */ |
| 19592 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 19593 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 19594 | { |
| 19595 | return QDF_STATUS_SUCCESS; |
| 19596 | } |
| 19597 | |
| 19598 | /** |
| 19599 | * extract_profile_data_tlv() - extract profile data from event |
| 19600 | * @wmi_handle: wmi handle |
| 19601 | * @param evt_buf: pointer to event buffer |
| 19602 | * @param profile_data: Pointer to hold profile data |
| 19603 | * |
| 19604 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19605 | */ |
| 19606 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 19607 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 19608 | { |
| 19609 | |
| 19610 | return QDF_STATUS_SUCCESS; |
| 19611 | } |
| 19612 | |
| 19613 | /** |
| 19614 | * extract_chan_info_event_tlv() - extract chan information from event |
| 19615 | * @wmi_handle: wmi handle |
| 19616 | * @param evt_buf: pointer to event buffer |
| 19617 | * @param chan_info: Pointer to hold chan information |
| 19618 | * |
| 19619 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19620 | */ |
| 19621 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 19622 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 19623 | { |
| 19624 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 19625 | wmi_chan_info_event_fixed_param *ev; |
| 19626 | |
| 19627 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 19628 | |
| 19629 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 19630 | if (!ev) { |
| 19631 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 19632 | return QDF_STATUS_E_FAILURE; |
| 19633 | } |
| 19634 | |
| 19635 | chan_info->err_code = ev->err_code; |
| 19636 | chan_info->freq = ev->freq; |
| 19637 | chan_info->cmd_flags = ev->cmd_flags; |
| 19638 | chan_info->noise_floor = ev->noise_floor; |
| 19639 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 19640 | chan_info->cycle_count = ev->cycle_count; |
Edayilliam Jayadev | 5d161a9 | 2017-09-22 13:21:03 +0530 | [diff] [blame] | 19641 | chan_info->tx_frame_cnt = ev->tx_frame_cnt; |
| 19642 | chan_info->mac_clk_mhz = ev->mac_clk_mhz; |
Sathish Kumar | 87db1bd | 2017-05-08 12:35:55 +0530 | [diff] [blame] | 19643 | chan_info->pdev_id = wlan_get_pdev_id_from_vdev_id( |
| 19644 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 19645 | ev->vdev_id, WLAN_SCAN_ID); |
Kiran Venkatappa | da3eae6 | 2017-08-10 17:48:37 +0530 | [diff] [blame] | 19646 | chan_info->chan_tx_pwr_range = ev->chan_tx_pwr_range; |
| 19647 | chan_info->chan_tx_pwr_tp = ev->chan_tx_pwr_tp; |
| 19648 | chan_info->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 19649 | chan_info->rx_11b_mode_data_duration = ev->rx_11b_mode_data_duration; |
| 19650 | chan_info->tx_frame_cnt = ev->tx_frame_cnt; |
| 19651 | chan_info->rx_frame_count = ev->rx_frame_count; |
| 19652 | chan_info->mac_clk_mhz = ev->mac_clk_mhz; |
| 19653 | chan_info->vdev_id = ev->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19654 | |
| 19655 | return QDF_STATUS_SUCCESS; |
| 19656 | } |
| 19657 | |
| 19658 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 19659 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 19660 | * @wmi_handle: WMI handle |
| 19661 | * @param evt_buf: Pointer to event buffer |
| 19662 | * @param param: Pointer to hold data |
| 19663 | * |
| 19664 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 19665 | */ |
| 19666 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 19667 | uint8_t *evt_buf, |
| 19668 | struct wmi_host_pdev_utf_event *event) |
| 19669 | { |
| 19670 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 19671 | struct wmi_host_utf_seg_header_info *seg_hdr; |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 19672 | |
| 19673 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 19674 | event->data = param_buf->data; |
| 19675 | event->datalen = param_buf->num_data; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 19676 | seg_hdr = (struct wmi_host_utf_seg_header_info *)param_buf->data; |
Kiran Venkatappa | 15978c6 | 2017-02-28 12:42:36 +0530 | [diff] [blame] | 19677 | /* Set pdev_id=1 until FW adds support to include pdev_id */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 19678 | event->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 19679 | seg_hdr->pdev_id); |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 19680 | |
| 19681 | return QDF_STATUS_SUCCESS; |
| 19682 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19683 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19684 | /** |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 19685 | * extract_chainmask_tables_tlv() - extract chain mask tables from event |
| 19686 | * @wmi_handle: wmi handle |
| 19687 | * @param evt_buf: pointer to event buffer |
| 19688 | * @param param: Pointer to hold evt buf |
| 19689 | * |
| 19690 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19691 | */ |
| 19692 | static QDF_STATUS extract_chainmask_tables_tlv(wmi_unified_t wmi_handle, |
| 19693 | uint8_t *event, struct wlan_psoc_host_chainmask_table *chainmask_table) |
| 19694 | { |
| 19695 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 19696 | WMI_MAC_PHY_CHAINMASK_CAPABILITY *chainmask_caps; |
| 19697 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 19698 | uint8_t i = 0, j = 0; |
| 19699 | |
| 19700 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 19701 | if (!param_buf) |
| 19702 | return QDF_STATUS_E_INVAL; |
| 19703 | |
| 19704 | hw_caps = param_buf->soc_hw_mode_caps; |
| 19705 | if (!hw_caps) |
| 19706 | return QDF_STATUS_E_INVAL; |
| 19707 | |
| 19708 | if (!hw_caps->num_chainmask_tables) |
| 19709 | return QDF_STATUS_E_INVAL; |
| 19710 | |
| 19711 | chainmask_caps = param_buf->mac_phy_chainmask_caps; |
| 19712 | |
| 19713 | if (chainmask_caps == NULL) |
| 19714 | return QDF_STATUS_E_INVAL; |
| 19715 | |
| 19716 | for (i = 0; i < hw_caps->num_chainmask_tables; i++) { |
| 19717 | |
| 19718 | qdf_print("Dumping chain mask combo data for table : %d\n", i); |
| 19719 | for (j = 0; j < chainmask_table[i].num_valid_chainmasks; j++) { |
| 19720 | |
| 19721 | chainmask_table[i].cap_list[j].chainmask = |
| 19722 | chainmask_caps->chainmask; |
| 19723 | |
| 19724 | chainmask_table[i].cap_list[j].supports_chan_width_20 = |
| 19725 | WMI_SUPPORT_CHAN_WIDTH_20_GET(chainmask_caps->supported_flags); |
| 19726 | |
| 19727 | chainmask_table[i].cap_list[j].supports_chan_width_40 = |
| 19728 | WMI_SUPPORT_CHAN_WIDTH_40_GET(chainmask_caps->supported_flags); |
| 19729 | |
| 19730 | chainmask_table[i].cap_list[j].supports_chan_width_80 = |
| 19731 | WMI_SUPPORT_CHAN_WIDTH_80_GET(chainmask_caps->supported_flags); |
| 19732 | |
| 19733 | chainmask_table[i].cap_list[j].supports_chan_width_160 = |
| 19734 | WMI_SUPPORT_CHAN_WIDTH_160_GET(chainmask_caps->supported_flags); |
| 19735 | |
| 19736 | chainmask_table[i].cap_list[j].supports_chan_width_80P80 = |
| 19737 | WMI_SUPPORT_CHAN_WIDTH_80P80_GET(chainmask_caps->supported_flags); |
| 19738 | |
| 19739 | chainmask_table[i].cap_list[j].chain_mask_2G = |
| 19740 | WMI_SUPPORT_CHAIN_MASK_2G_GET(chainmask_caps->supported_flags); |
| 19741 | |
| 19742 | chainmask_table[i].cap_list[j].chain_mask_5G = |
| 19743 | WMI_SUPPORT_CHAIN_MASK_5G_GET(chainmask_caps->supported_flags); |
| 19744 | |
| 19745 | chainmask_table[i].cap_list[j].chain_mask_tx = |
| 19746 | WMI_SUPPORT_CHAIN_MASK_TX_GET(chainmask_caps->supported_flags); |
| 19747 | |
| 19748 | chainmask_table[i].cap_list[j].chain_mask_rx = |
| 19749 | WMI_SUPPORT_CHAIN_MASK_RX_GET(chainmask_caps->supported_flags); |
| 19750 | |
| 19751 | chainmask_table[i].cap_list[j].supports_aDFS = |
| 19752 | WMI_SUPPORT_CHAIN_MASK_ADFS_GET(chainmask_caps->supported_flags); |
| 19753 | |
| 19754 | qdf_print("supported_flags: 0x%08x chainmasks: 0x%08x\n", |
| 19755 | chainmask_caps->supported_flags, |
| 19756 | chainmask_caps->chainmask |
| 19757 | ); |
| 19758 | chainmask_caps++; |
| 19759 | } |
| 19760 | } |
| 19761 | |
| 19762 | return QDF_STATUS_SUCCESS; |
| 19763 | } |
| 19764 | |
| 19765 | /** |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19766 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 19767 | * from event |
| 19768 | * @wmi_handle: wmi handle |
| 19769 | * @param evt_buf: pointer to event buffer |
| 19770 | * @param param: Pointer to hold evt buf |
| 19771 | * |
| 19772 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19773 | */ |
| 19774 | 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] | 19775 | uint8_t *event, struct wlan_psoc_host_service_ext_param *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19776 | { |
| 19777 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 19778 | wmi_service_ready_ext_event_fixed_param *ev; |
| 19779 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 19780 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 19781 | WMI_MAC_PHY_CHAINMASK_COMBO *chain_mask_combo; |
| 19782 | uint8_t i = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19783 | |
| 19784 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 19785 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19786 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19787 | |
| 19788 | ev = param_buf->fixed_param; |
| 19789 | if (!ev) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19790 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19791 | |
| 19792 | /* Move this to host based bitmap */ |
| 19793 | param->default_conc_scan_config_bits = |
| 19794 | ev->default_conc_scan_config_bits; |
| 19795 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 19796 | param->he_cap_info = ev->he_cap_info; |
| 19797 | param->mpdu_density = ev->mpdu_density; |
| 19798 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
Kiran Venkatappa | 59d6e1f | 2017-10-12 15:04:22 +0530 | [diff] [blame] | 19799 | param->fw_build_vers_ext = ev->fw_build_vers_ext; |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 19800 | param->num_dbr_ring_caps = param_buf->num_dma_ring_caps; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19801 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 19802 | |
| 19803 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19804 | if (hw_caps) |
| 19805 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 19806 | else |
| 19807 | param->num_hw_modes = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19808 | |
| 19809 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19810 | if (reg_caps) |
| 19811 | param->num_phy = reg_caps->num_phy; |
| 19812 | else |
| 19813 | param->num_phy = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19814 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 19815 | if (hw_caps) { |
| 19816 | param->num_chainmask_tables = hw_caps->num_chainmask_tables; |
| 19817 | qdf_print("Num chain mask tables: %d\n", hw_caps->num_chainmask_tables); |
| 19818 | } else |
| 19819 | param->num_chainmask_tables = 0; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 19820 | |
| 19821 | chain_mask_combo = param_buf->mac_phy_chainmask_combo; |
| 19822 | |
| 19823 | if (chain_mask_combo == NULL) |
| 19824 | return QDF_STATUS_SUCCESS; |
| 19825 | |
| 19826 | qdf_print("Dumping chain mask combo data\n"); |
| 19827 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 19828 | for (i = 0; i < param->num_chainmask_tables; i++) { |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 19829 | |
| 19830 | qdf_print("table_id : %d Num valid chainmasks: %d\n", |
| 19831 | chain_mask_combo->chainmask_table_id, |
| 19832 | chain_mask_combo->num_valid_chainmask |
| 19833 | ); |
| 19834 | |
| 19835 | param->chainmask_table[i].table_id = |
| 19836 | chain_mask_combo->chainmask_table_id; |
| 19837 | param->chainmask_table[i].num_valid_chainmasks = |
| 19838 | chain_mask_combo->num_valid_chainmask; |
| 19839 | chain_mask_combo++; |
| 19840 | } |
| 19841 | qdf_print("chain mask combo end\n"); |
| 19842 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19843 | return QDF_STATUS_SUCCESS; |
| 19844 | } |
| 19845 | |
| 19846 | /** |
| 19847 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 19848 | * extract HW mode cap from service ready event |
| 19849 | * @wmi_handle: wmi handle |
| 19850 | * @param evt_buf: pointer to event buffer |
| 19851 | * @param param: Pointer to hold evt buf |
| 19852 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 19853 | * |
| 19854 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19855 | */ |
| 19856 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 19857 | wmi_unified_t wmi_handle, |
| 19858 | uint8_t *event, uint8_t hw_mode_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 19859 | struct wlan_psoc_host_hw_mode_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19860 | { |
| 19861 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 19862 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 19863 | |
| 19864 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 19865 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19866 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19867 | |
| 19868 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19869 | if (!hw_caps) |
| 19870 | return QDF_STATUS_E_INVAL; |
| 19871 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19872 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19873 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19874 | |
| 19875 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 19876 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 19877 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 19878 | param->hw_mode_config_type = |
| 19879 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 19880 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19881 | return QDF_STATUS_SUCCESS; |
| 19882 | } |
| 19883 | |
| 19884 | /** |
| 19885 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 19886 | * extract MAC phy cap from service ready event |
| 19887 | * @wmi_handle: wmi handle |
| 19888 | * @param evt_buf: pointer to event buffer |
| 19889 | * @param param: Pointer to hold evt buf |
| 19890 | * @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] | 19891 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19892 | * |
| 19893 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19894 | */ |
| 19895 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 19896 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 19897 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 19898 | struct wlan_psoc_host_mac_phy_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19899 | { |
| 19900 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19901 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 19902 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 19903 | uint32_t phy_map; |
| 19904 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19905 | |
| 19906 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 19907 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19908 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19909 | |
| 19910 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19911 | if (!hw_caps) |
| 19912 | return QDF_STATUS_E_INVAL; |
| 19913 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 19914 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 19915 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 19916 | break; |
| 19917 | |
| 19918 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 19919 | while (phy_map) { |
| 19920 | phy_map >>= 1; |
| 19921 | phy_idx++; |
| 19922 | } |
| 19923 | } |
| 19924 | |
| 19925 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19926 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19927 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 19928 | phy_idx += phy_id; |
| 19929 | if (phy_idx >= param_buf->num_mac_phy_caps) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 19930 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 19931 | |
| 19932 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19933 | |
| 19934 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 19935 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 19936 | mac_phy_caps->pdev_id); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19937 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 19938 | param->supports_11b = |
| 19939 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 19940 | param->supports_11g = |
| 19941 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 19942 | param->supports_11a = |
| 19943 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 19944 | param->supports_11n = |
| 19945 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 19946 | param->supports_11ac = |
| 19947 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 19948 | param->supports_11ax = |
| 19949 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19950 | |
| 19951 | param->supported_bands = mac_phy_caps->supported_bands; |
| 19952 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 19953 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 19954 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 19955 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 19956 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 19957 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 19958 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 19959 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 19960 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 19961 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 19962 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 19963 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 19964 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 19965 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 19966 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 19967 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 19968 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
Kris Muthusamy | 61fe369 | 2017-02-20 02:35:47 -0800 | [diff] [blame] | 19969 | qdf_mem_copy(¶m->he_cap_phy_info_2G, |
| 19970 | &mac_phy_caps->he_cap_phy_info_2G, |
| 19971 | sizeof(param->he_cap_phy_info_2G)); |
| 19972 | qdf_mem_copy(¶m->he_cap_phy_info_5G, |
| 19973 | &mac_phy_caps->he_cap_phy_info_5G, |
| 19974 | sizeof(param->he_cap_phy_info_5G)); |
| 19975 | qdf_mem_copy(¶m->he_ppet2G, &mac_phy_caps->he_ppet2G, |
| 19976 | sizeof(param->he_ppet2G)); |
| 19977 | qdf_mem_copy(¶m->he_ppet5G, &mac_phy_caps->he_ppet5G, |
| 19978 | sizeof(param->he_ppet5G)); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 19979 | param->chainmask_table_id = mac_phy_caps->chainmask_table_id; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19980 | |
| 19981 | return QDF_STATUS_SUCCESS; |
| 19982 | } |
| 19983 | |
| 19984 | /** |
| 19985 | * extract_reg_cap_service_ready_ext_tlv() - |
| 19986 | * extract REG cap from service ready event |
| 19987 | * @wmi_handle: wmi handle |
| 19988 | * @param evt_buf: pointer to event buffer |
| 19989 | * @param param: Pointer to hold evt buf |
| 19990 | * @param phy_idx: phy idx should be less than num_mode |
| 19991 | * |
| 19992 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 19993 | */ |
| 19994 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 19995 | wmi_unified_t wmi_handle, |
| 19996 | uint8_t *event, uint8_t phy_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 19997 | struct wlan_psoc_host_hal_reg_capabilities_ext *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19998 | { |
| 19999 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 20000 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 20001 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 20002 | |
| 20003 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 20004 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 20005 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 20006 | |
| 20007 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 20008 | if (!reg_caps) |
| 20009 | return QDF_STATUS_E_INVAL; |
| 20010 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 20011 | if (phy_idx >= reg_caps->num_phy) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 20012 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 20013 | |
| 20014 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 20015 | |
| 20016 | param->phy_id = ext_reg_cap->phy_id; |
| 20017 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 20018 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 20019 | param->regcap1 = ext_reg_cap->regcap1; |
| 20020 | param->regcap2 = ext_reg_cap->regcap2; |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 20021 | param->wireless_modes = convert_wireless_modes_tlv( |
| 20022 | ext_reg_cap->wireless_modes); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 20023 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 20024 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 20025 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 20026 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 20027 | |
| 20028 | return QDF_STATUS_SUCCESS; |
| 20029 | } |
| 20030 | |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 20031 | static QDF_STATUS extract_dbr_ring_cap_service_ready_ext_tlv( |
| 20032 | wmi_unified_t wmi_handle, |
| 20033 | uint8_t *event, uint8_t idx, |
| 20034 | struct wlan_psoc_host_dbr_ring_caps *param) |
| 20035 | { |
| 20036 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 20037 | WMI_DMA_RING_CAPABILITIES *dbr_ring_caps; |
| 20038 | |
| 20039 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *)event; |
| 20040 | if (!param_buf) |
| 20041 | return QDF_STATUS_E_INVAL; |
| 20042 | |
| 20043 | dbr_ring_caps = ¶m_buf->dma_ring_caps[idx]; |
| 20044 | |
| 20045 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 20046 | dbr_ring_caps->pdev_id); |
| 20047 | param->mod_id = dbr_ring_caps->mod_id; |
| 20048 | param->ring_elems_min = dbr_ring_caps->ring_elems_min; |
| 20049 | param->min_buf_size = dbr_ring_caps->min_buf_size; |
| 20050 | param->min_buf_align = dbr_ring_caps->min_buf_align; |
| 20051 | |
| 20052 | return QDF_STATUS_SUCCESS; |
| 20053 | } |
| 20054 | |
| 20055 | static QDF_STATUS extract_dbr_buf_release_fixed_tlv(wmi_unified_t wmi_handle, |
| 20056 | uint8_t *event, struct direct_buf_rx_rsp *param) |
| 20057 | { |
| 20058 | WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *param_buf; |
| 20059 | wmi_dma_buf_release_fixed_param *ev; |
| 20060 | |
| 20061 | param_buf = (WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *)event; |
| 20062 | if (!param_buf) |
| 20063 | return QDF_STATUS_E_INVAL; |
| 20064 | |
| 20065 | ev = param_buf->fixed_param; |
| 20066 | if (!ev) |
| 20067 | return QDF_STATUS_E_INVAL; |
| 20068 | |
| 20069 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 20070 | ev->pdev_id); |
| 20071 | param->mod_id = ev->mod_id; |
| 20072 | param->num_buf_release_entry = ev->num_buf_release_entry; |
| 20073 | WMI_LOGD("%s:pdev id %d mod id %d num buf release entry %d\n", __func__, |
| 20074 | param->pdev_id, param->mod_id, param->num_buf_release_entry); |
| 20075 | |
| 20076 | return QDF_STATUS_SUCCESS; |
| 20077 | } |
| 20078 | |
| 20079 | static QDF_STATUS extract_dbr_buf_release_entry_tlv(wmi_unified_t wmi_handle, |
| 20080 | uint8_t *event, uint8_t idx, struct direct_buf_rx_entry *param) |
| 20081 | { |
| 20082 | WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *param_buf; |
| 20083 | wmi_dma_buf_release_entry *entry; |
| 20084 | |
| 20085 | param_buf = (WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *)event; |
| 20086 | if (!param_buf) |
| 20087 | return QDF_STATUS_E_INVAL; |
| 20088 | |
| 20089 | entry = ¶m_buf->entries[idx]; |
| 20090 | |
| 20091 | if (!entry) { |
| 20092 | WMI_LOGE("%s: Entry is NULL\n", __func__); |
| 20093 | return QDF_STATUS_E_FAILURE; |
| 20094 | } |
| 20095 | |
| 20096 | WMI_LOGD("%s: paddr_lo[%d] = %x\n", __func__, idx, entry->paddr_lo); |
| 20097 | |
| 20098 | param->paddr_lo = entry->paddr_lo; |
| 20099 | param->paddr_hi = entry->paddr_hi; |
| 20100 | |
| 20101 | return QDF_STATUS_SUCCESS; |
| 20102 | } |
| 20103 | |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 20104 | /** |
| 20105 | * extract_dcs_interference_type_tlv() - extract dcs interference type |
| 20106 | * from event |
| 20107 | * @wmi_handle: wmi handle |
| 20108 | * @param evt_buf: pointer to event buffer |
| 20109 | * @param param: Pointer to hold dcs interference param |
| 20110 | * |
| 20111 | * Return: 0 for success or error code |
| 20112 | */ |
| 20113 | static QDF_STATUS extract_dcs_interference_type_tlv( |
| 20114 | wmi_unified_t wmi_handle, |
| 20115 | void *evt_buf, struct wmi_host_dcs_interference_param *param) |
| 20116 | { |
| 20117 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 20118 | |
| 20119 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 20120 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 20121 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 20122 | |
| 20123 | param->interference_type = param_buf->fixed_param->interference_type; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 20124 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 20125 | param_buf->fixed_param->pdev_id); |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 20126 | |
| 20127 | return QDF_STATUS_SUCCESS; |
| 20128 | } |
| 20129 | |
| 20130 | /* |
| 20131 | * extract_dcs_cw_int_tlv() - extract dcs cw interference from event |
| 20132 | * @wmi_handle: wmi handle |
| 20133 | * @param evt_buf: pointer to event buffer |
| 20134 | * @param cw_int: Pointer to hold cw interference |
| 20135 | * |
| 20136 | * Return: 0 for success or error code |
| 20137 | */ |
| 20138 | static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle, |
| 20139 | void *evt_buf, |
| 20140 | wmi_host_ath_dcs_cw_int *cw_int) |
| 20141 | { |
| 20142 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 20143 | wlan_dcs_cw_int *ev; |
| 20144 | |
| 20145 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 20146 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 20147 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 20148 | |
| 20149 | ev = param_buf->cw_int; |
| 20150 | |
| 20151 | cw_int->channel = ev->channel; |
| 20152 | |
| 20153 | return QDF_STATUS_SUCCESS; |
| 20154 | } |
| 20155 | |
| 20156 | /** |
| 20157 | * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event |
| 20158 | * @wmi_handle: wmi handle |
| 20159 | * @param evt_buf: pointer to event buffer |
| 20160 | * @param wlan_stat: Pointer to hold wlan stats |
| 20161 | * |
| 20162 | * Return: 0 for success or error code |
| 20163 | */ |
| 20164 | static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle, |
| 20165 | void *evt_buf, |
| 20166 | wmi_host_dcs_im_tgt_stats_t *wlan_stat) |
| 20167 | { |
| 20168 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 20169 | wlan_dcs_im_tgt_stats_t *ev; |
| 20170 | |
| 20171 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 20172 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 20173 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 20174 | |
| 20175 | ev = param_buf->wlan_stat; |
| 20176 | wlan_stat->reg_tsf32 = ev->reg_tsf32; |
| 20177 | wlan_stat->last_ack_rssi = ev->last_ack_rssi; |
| 20178 | wlan_stat->tx_waste_time = ev->tx_waste_time; |
| 20179 | wlan_stat->rx_time = ev->rx_time; |
| 20180 | wlan_stat->phyerr_cnt = ev->phyerr_cnt; |
| 20181 | wlan_stat->mib_stats.listen_time = ev->listen_time; |
| 20182 | wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt; |
| 20183 | wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt; |
| 20184 | wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt; |
| 20185 | wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt; |
| 20186 | wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt; |
| 20187 | wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt; |
| 20188 | wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt; |
| 20189 | wlan_stat->chan_nf = ev->chan_nf; |
| 20190 | wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 20191 | |
| 20192 | return QDF_STATUS_SUCCESS; |
| 20193 | } |
| 20194 | |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 20195 | /** |
| 20196 | * extract_thermal_stats_tlv() - extract thermal stats from event |
| 20197 | * @wmi_handle: wmi handle |
| 20198 | * @param evt_buf: Pointer to event buffer |
| 20199 | * @param temp: Pointer to hold extracted temperature |
| 20200 | * @param level: Pointer to hold extracted level |
| 20201 | * |
| 20202 | * Return: 0 for success or error code |
| 20203 | */ |
| 20204 | static QDF_STATUS |
| 20205 | extract_thermal_stats_tlv(wmi_unified_t wmi_handle, |
| 20206 | void *evt_buf, uint32_t *temp, |
| 20207 | uint32_t *level, uint32_t *pdev_id) |
| 20208 | { |
| 20209 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 20210 | wmi_therm_throt_stats_event_fixed_param *tt_stats_event; |
| 20211 | |
| 20212 | param_buf = |
| 20213 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 20214 | if (!param_buf) |
| 20215 | return QDF_STATUS_E_INVAL; |
| 20216 | |
| 20217 | tt_stats_event = param_buf->fixed_param; |
| 20218 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 20219 | *pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 20220 | tt_stats_event->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 20221 | *temp = tt_stats_event->temp; |
| 20222 | *level = tt_stats_event->level; |
| 20223 | |
| 20224 | return QDF_STATUS_SUCCESS; |
| 20225 | } |
| 20226 | |
| 20227 | /** |
| 20228 | * extract_thermal_level_stats_tlv() - extract thermal level stats from event |
| 20229 | * @wmi_handle: wmi handle |
| 20230 | * @param evt_buf: pointer to event buffer |
| 20231 | * @param idx: Index to level stats |
| 20232 | * @param levelcount: Pointer to hold levelcount |
| 20233 | * @param dccount: Pointer to hold dccount |
| 20234 | * |
| 20235 | * Return: 0 for success or error code |
| 20236 | */ |
| 20237 | static QDF_STATUS |
| 20238 | extract_thermal_level_stats_tlv(wmi_unified_t wmi_handle, |
| 20239 | void *evt_buf, uint8_t idx, uint32_t *levelcount, |
| 20240 | uint32_t *dccount) |
| 20241 | { |
| 20242 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 20243 | wmi_therm_throt_level_stats_info *tt_level_info; |
| 20244 | |
| 20245 | param_buf = |
| 20246 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 20247 | if (!param_buf) |
| 20248 | return QDF_STATUS_E_INVAL; |
| 20249 | |
| 20250 | tt_level_info = param_buf->therm_throt_level_stats_info; |
| 20251 | |
| 20252 | if (idx < THERMAL_LEVELS) { |
| 20253 | *levelcount = tt_level_info[idx].level_count; |
| 20254 | *dccount = tt_level_info[idx].dc_count; |
| 20255 | return QDF_STATUS_SUCCESS; |
| 20256 | } |
| 20257 | |
| 20258 | return QDF_STATUS_E_FAILURE; |
| 20259 | } |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 20260 | #ifdef BIG_ENDIAN_HOST |
| 20261 | /** |
| 20262 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 20263 | * @param data_len - data length |
| 20264 | * @param data - pointer to data |
| 20265 | * |
| 20266 | * Return: QDF_STATUS - success or error status |
| 20267 | */ |
| 20268 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 20269 | { |
| 20270 | uint8_t *data_aligned = NULL; |
| 20271 | int c; |
| 20272 | unsigned char *data_unaligned; |
| 20273 | |
| 20274 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 20275 | FIPS_ALIGN)); |
| 20276 | /* Assigning unaligned space to copy the data */ |
| 20277 | /* Checking if kmalloc does succesful allocation */ |
| 20278 | if (data_unaligned == NULL) |
| 20279 | return QDF_STATUS_E_FAILURE; |
| 20280 | |
| 20281 | /* Checking if space is alligned */ |
| 20282 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 20283 | /* align the data space */ |
| 20284 | data_aligned = |
| 20285 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 20286 | } else { |
| 20287 | data_aligned = (u_int8_t *)data_unaligned; |
| 20288 | } |
| 20289 | |
| 20290 | /* memset and copy content from data to data aligned */ |
| 20291 | OS_MEMSET(data_aligned, 0, data_len); |
| 20292 | OS_MEMCPY(data_aligned, data, data_len); |
| 20293 | /* Endianness to LE */ |
| 20294 | for (c = 0; c < data_len/4; c++) { |
| 20295 | *((u_int32_t *)data_aligned + c) = |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 20296 | qdf_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 20297 | } |
| 20298 | |
| 20299 | /* Copy content to event->data */ |
| 20300 | OS_MEMCPY(data, data_aligned, data_len); |
| 20301 | |
| 20302 | /* clean up allocated space */ |
| 20303 | qdf_mem_free(data_unaligned); |
| 20304 | data_aligned = NULL; |
| 20305 | data_unaligned = NULL; |
| 20306 | |
| 20307 | /*************************************************************/ |
| 20308 | |
| 20309 | return QDF_STATUS_SUCCESS; |
| 20310 | } |
| 20311 | #else |
| 20312 | /** |
| 20313 | * fips_conv_data_be() - DUMMY for LE platform |
| 20314 | * |
| 20315 | * Return: QDF_STATUS - success |
| 20316 | */ |
| 20317 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 20318 | { |
| 20319 | return QDF_STATUS_SUCCESS; |
| 20320 | } |
| 20321 | #endif |
| 20322 | |
| 20323 | /** |
| 20324 | * extract_fips_event_data_tlv() - extract fips event data |
| 20325 | * @wmi_handle: wmi handle |
| 20326 | * @param evt_buf: pointer to event buffer |
| 20327 | * @param param: pointer FIPS event params |
| 20328 | * |
| 20329 | * Return: 0 for success or error code |
| 20330 | */ |
| 20331 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 20332 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 20333 | { |
| 20334 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 20335 | wmi_pdev_fips_event_fixed_param *event; |
| 20336 | |
| 20337 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 20338 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 20339 | |
| 20340 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 20341 | QDF_STATUS_SUCCESS) |
| 20342 | return QDF_STATUS_E_FAILURE; |
| 20343 | |
| 20344 | param->data = (uint32_t *)param_buf->data; |
| 20345 | param->data_len = event->data_len; |
| 20346 | param->error_status = event->error_status; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 20347 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 20348 | event->pdev_id); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 20349 | |
| 20350 | return QDF_STATUS_SUCCESS; |
| 20351 | } |
| 20352 | |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 20353 | /* |
| 20354 | * extract_peer_delete_response_event_tlv() - extract peer delete response event |
| 20355 | * @wmi_handle: wmi handle |
| 20356 | * @param evt_buf: pointer to event buffer |
| 20357 | * @param vdev_id: Pointer to hold vdev_id |
| 20358 | * @param mac_addr: Pointer to hold peer mac address |
| 20359 | * |
| 20360 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 20361 | */ |
| 20362 | static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl, |
| 20363 | void *evt_buf, struct wmi_host_peer_delete_response_event *param) |
| 20364 | { |
| 20365 | WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 20366 | wmi_peer_delete_resp_event_fixed_param *ev; |
| 20367 | |
| 20368 | param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf; |
| 20369 | |
| 20370 | ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param; |
| 20371 | if (!ev) { |
| 20372 | WMI_LOGE("%s: Invalid peer_delete response\n", __func__); |
| 20373 | return QDF_STATUS_E_FAILURE; |
| 20374 | } |
| 20375 | |
| 20376 | param->vdev_id = ev->vdev_id; |
| 20377 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr, |
| 20378 | ¶m->mac_address.bytes[0]); |
| 20379 | |
| 20380 | return QDF_STATUS_SUCCESS; |
| 20381 | } |
| 20382 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20383 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 20384 | { |
jiad | 36c94d2 | 2018-01-22 15:37:03 +0800 | [diff] [blame] | 20385 | if ((cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) || |
| 20386 | (cmd_id == WMI_MGMT_TX_SEND_CMDID) || |
| 20387 | (cmd_id == WMI_OFFCHAN_DATA_TX_SEND_CMDID)) { |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20388 | return true; |
jiad | 36c94d2 | 2018-01-22 15:37:03 +0800 | [diff] [blame] | 20389 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20390 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20391 | return false; |
| 20392 | } |
| 20393 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 20394 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 20395 | { |
| 20396 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 20397 | |
| 20398 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 20399 | |
| 20400 | switch (set_cmd->param_id) { |
| 20401 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 20402 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 20403 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 20404 | default: |
| 20405 | break; |
| 20406 | } |
| 20407 | |
| 20408 | return 0; |
| 20409 | } |
| 20410 | |
| 20411 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 20412 | { |
| 20413 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 20414 | |
| 20415 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 20416 | |
| 20417 | switch (ps_cmd->param) { |
| 20418 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 20419 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 20420 | case WMI_STA_PS_ENABLE_QPOWER: |
| 20421 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 20422 | default: |
| 20423 | break; |
| 20424 | } |
| 20425 | |
| 20426 | return 0; |
| 20427 | } |
| 20428 | |
| 20429 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 20430 | uint32_t cmd_id) |
| 20431 | { |
| 20432 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 20433 | return 0; |
| 20434 | |
| 20435 | switch (cmd_id) { |
| 20436 | case WMI_VDEV_SET_PARAM_CMDID: |
| 20437 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 20438 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 20439 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 20440 | default: |
| 20441 | break; |
| 20442 | } |
| 20443 | |
| 20444 | return 0; |
| 20445 | } |
| 20446 | |
| 20447 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 20448 | { |
| 20449 | uint16_t tag = 0; |
| 20450 | |
| 20451 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
| 20452 | pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", |
| 20453 | __func__); |
| 20454 | return tag; |
| 20455 | } |
| 20456 | |
| 20457 | if (wmi_handle->tag_crash_inject) |
| 20458 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 20459 | |
| 20460 | wmi_handle->tag_crash_inject = false; |
| 20461 | return tag; |
| 20462 | } |
| 20463 | |
| 20464 | /** |
| 20465 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 20466 | * @wmi_handle: WMI handle |
| 20467 | * @buf: WMI buffer |
| 20468 | * @cmd_id: WMI command Id |
| 20469 | * |
| 20470 | * Return htc_tx_tag |
| 20471 | */ |
| 20472 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 20473 | wmi_buf_t buf, |
| 20474 | uint32_t cmd_id) |
| 20475 | { |
| 20476 | uint16_t htc_tx_tag = 0; |
| 20477 | |
| 20478 | switch (cmd_id) { |
| 20479 | case WMI_WOW_ENABLE_CMDID: |
| 20480 | case WMI_PDEV_SUSPEND_CMDID: |
| 20481 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 20482 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 20483 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 20484 | case WMI_PDEV_RESUME_CMDID: |
| 20485 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 20486 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 20487 | #ifdef FEATURE_WLAN_D0WOW |
| 20488 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 20489 | #endif |
| 20490 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 20491 | break; |
| 20492 | case WMI_FORCE_FW_HANG_CMDID: |
| 20493 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 20494 | break; |
| 20495 | case WMI_VDEV_SET_PARAM_CMDID: |
| 20496 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 20497 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 20498 | default: |
| 20499 | break; |
| 20500 | } |
| 20501 | |
| 20502 | return htc_tx_tag; |
| 20503 | } |
| 20504 | |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 20505 | /** |
| 20506 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 20507 | * from event |
| 20508 | * @wmi_handle: wmi handle |
| 20509 | * @param evt_buf: pointer to event buffer |
| 20510 | * @param ch_hopping: Pointer to hold channel hopping param |
| 20511 | * |
| 20512 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 20513 | */ |
| 20514 | static QDF_STATUS extract_channel_hopping_event_tlv( |
| 20515 | wmi_unified_t wmi_handle, void *evt_buf, |
| 20516 | wmi_host_pdev_channel_hopping_event *ch_hopping) |
| 20517 | { |
| 20518 | WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *param_buf; |
| 20519 | wmi_pdev_channel_hopping_event_fixed_param *event; |
| 20520 | |
| 20521 | param_buf = (WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *)evt_buf; |
| 20522 | event = (wmi_pdev_channel_hopping_event_fixed_param *) |
| 20523 | param_buf->fixed_param; |
| 20524 | |
| 20525 | ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter; |
| 20526 | ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 20527 | ch_hopping->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 20528 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 20529 | |
| 20530 | return QDF_STATUS_SUCCESS; |
| 20531 | } |
| 20532 | |
| 20533 | /** |
| 20534 | * extract_pdev_tpc_ev_param_tlv() - extract tpc param from event |
| 20535 | * @wmi_handle: wmi handle |
| 20536 | * @param evt_buf: pointer to event buffer |
| 20537 | * @param param: Pointer to hold tpc param |
| 20538 | * |
| 20539 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 20540 | */ |
| 20541 | static QDF_STATUS extract_pdev_tpc_ev_param_tlv(wmi_unified_t wmi_handle, |
| 20542 | void *evt_buf, |
| 20543 | wmi_host_pdev_tpc_event *param) |
| 20544 | { |
| 20545 | WMI_PDEV_TPC_EVENTID_param_tlvs *param_buf; |
| 20546 | wmi_pdev_tpc_event_fixed_param *event; |
| 20547 | |
| 20548 | param_buf = (WMI_PDEV_TPC_EVENTID_param_tlvs *)evt_buf; |
| 20549 | event = (wmi_pdev_tpc_event_fixed_param *)param_buf->fixed_param; |
| 20550 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 20551 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 20552 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 20553 | qdf_mem_copy(param->tpc, param_buf->tpc, sizeof(param->tpc)); |
| 20554 | |
| 20555 | return QDF_STATUS_SUCCESS; |
| 20556 | } |
| 20557 | |
| 20558 | |
| 20559 | #ifdef BIG_ENDIAN_HOST |
| 20560 | /** |
| 20561 | * wds_addr_ev_conv_data_be() - LE to BE conversion of wds addr event |
| 20562 | * @param data_len - data length |
| 20563 | * @param data - pointer to data |
| 20564 | * |
| 20565 | * Return: QDF_STATUS - success or error status |
| 20566 | */ |
| 20567 | static QDF_STATUS wds_addr_ev_conv_data_be(uint16_t data_len, uint8_t *ev) |
| 20568 | { |
| 20569 | uint8_t *datap = (uint8_t *)ev; |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 20570 | int i; |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 20571 | /* Skip swapping the first word */ |
| 20572 | datap += sizeof(uint32_t); |
| 20573 | for (i = 0; i < ((data_len / sizeof(uint32_t))-1); |
| 20574 | i++, datap += sizeof(uint32_t)) { |
| 20575 | *(uint32_t *)datap = qdf_le32_to_cpu(*(uint32_t *)datap); |
| 20576 | } |
| 20577 | |
| 20578 | return QDF_STATUS_SUCCESS; |
| 20579 | } |
| 20580 | #else |
| 20581 | /** |
| 20582 | * wds_addr_ev_conv_data_be() - Dummy operation for LE platforms |
| 20583 | * @param data_len - data length |
| 20584 | * @param data - pointer to data |
| 20585 | * |
| 20586 | * Return: QDF_STATUS - success or error status |
| 20587 | */ |
| 20588 | static QDF_STATUS wds_addr_ev_conv_data_be(uint32_t data_len, uint8_t *ev) |
| 20589 | { |
| 20590 | return QDF_STATUS_SUCCESS; |
| 20591 | } |
| 20592 | #endif |
| 20593 | |
| 20594 | /** |
| 20595 | * extract_wds_addr_event_tlv() - extract wds address from event |
| 20596 | * @wmi_handle: wmi handle |
| 20597 | * @param evt_buf: pointer to event buffer |
| 20598 | * @param wds_ev: Pointer to hold wds address |
| 20599 | * |
| 20600 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 20601 | */ |
| 20602 | static QDF_STATUS extract_wds_addr_event_tlv(wmi_unified_t wmi_handle, |
| 20603 | void *evt_buf, |
| 20604 | uint16_t len, wds_addr_event_t *wds_ev) |
| 20605 | { |
| 20606 | WMI_WDS_PEER_EVENTID_param_tlvs *param_buf; |
| 20607 | wmi_wds_addr_event_fixed_param *ev; |
| 20608 | int i; |
| 20609 | |
| 20610 | param_buf = (WMI_WDS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 20611 | ev = (wmi_wds_addr_event_fixed_param *)param_buf->fixed_param; |
| 20612 | |
| 20613 | if (wds_addr_ev_conv_data_be(len, (uint8_t *)ev) != QDF_STATUS_SUCCESS) |
| 20614 | return QDF_STATUS_E_FAILURE; |
| 20615 | |
| 20616 | qdf_mem_copy(wds_ev->event_type, ev->event_type, |
| 20617 | sizeof(wds_ev->event_type)); |
| 20618 | for (i = 0; i < 4; i++) { |
| 20619 | wds_ev->peer_mac[i] = |
| 20620 | ((u_int8_t *)&(ev->peer_mac.mac_addr31to0))[i]; |
| 20621 | wds_ev->dest_mac[i] = |
| 20622 | ((u_int8_t *)&(ev->dest_mac.mac_addr31to0))[i]; |
| 20623 | } |
| 20624 | for (i = 0; i < 2; i++) { |
| 20625 | wds_ev->peer_mac[4+i] = |
| 20626 | ((u_int8_t *)&(ev->peer_mac.mac_addr47to32))[i]; |
| 20627 | wds_ev->dest_mac[4+i] = |
| 20628 | ((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i]; |
| 20629 | } |
| 20630 | return QDF_STATUS_SUCCESS; |
| 20631 | } |
| 20632 | |
| 20633 | /** |
| 20634 | * extract_peer_sta_ps_statechange_ev_tlv() - extract peer sta ps state |
| 20635 | * from event |
| 20636 | * @wmi_handle: wmi handle |
| 20637 | * @param evt_buf: pointer to event buffer |
| 20638 | * @param ev: Pointer to hold peer param and ps state |
| 20639 | * |
| 20640 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 20641 | */ |
| 20642 | static QDF_STATUS extract_peer_sta_ps_statechange_ev_tlv(wmi_unified_t wmi_handle, |
| 20643 | void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev) |
| 20644 | { |
| 20645 | WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf; |
| 20646 | wmi_peer_sta_ps_statechange_event_fixed_param *event; |
| 20647 | |
| 20648 | param_buf = (WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *)evt_buf; |
| 20649 | event = (wmi_peer_sta_ps_statechange_event_fixed_param *) |
| 20650 | param_buf->fixed_param; |
| 20651 | |
| 20652 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, ev->peer_macaddr); |
| 20653 | ev->peer_ps_state = event->peer_ps_state; |
| 20654 | |
| 20655 | return QDF_STATUS_SUCCESS; |
| 20656 | } |
| 20657 | |
| 20658 | /** |
| 20659 | * extract_inst_rssi_stats_event_tlv() - extract inst rssi stats from event |
| 20660 | * @wmi_handle: wmi handle |
| 20661 | * @param evt_buf: pointer to event buffer |
| 20662 | * @param inst_rssi_resp: Pointer to hold inst rssi response |
| 20663 | * |
| 20664 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 20665 | */ |
| 20666 | static QDF_STATUS extract_inst_rssi_stats_event_tlv( |
| 20667 | wmi_unified_t wmi_handle, void *evt_buf, |
| 20668 | wmi_host_inst_stats_resp *inst_rssi_resp) |
| 20669 | { |
| 20670 | WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf; |
| 20671 | wmi_inst_rssi_stats_resp_fixed_param *event; |
| 20672 | |
| 20673 | param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf; |
| 20674 | event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param; |
| 20675 | |
| 20676 | qdf_mem_copy(&(inst_rssi_resp->peer_macaddr), |
| 20677 | &(event->peer_macaddr), sizeof(wmi_mac_addr)); |
| 20678 | inst_rssi_resp->iRSSI = event->iRSSI; |
| 20679 | |
| 20680 | return QDF_STATUS_SUCCESS; |
| 20681 | } |
| 20682 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20683 | static struct cur_reg_rule |
| 20684 | *create_reg_rules_from_wmi(uint32_t num_reg_rules, |
| 20685 | wmi_regulatory_rule_struct *wmi_reg_rule) |
| 20686 | { |
| 20687 | struct cur_reg_rule *reg_rule_ptr; |
| 20688 | uint32_t count; |
| 20689 | |
| 20690 | reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); |
| 20691 | |
| 20692 | if (NULL == reg_rule_ptr) { |
| 20693 | WMI_LOGE("memory allocation failure"); |
| 20694 | return NULL; |
| 20695 | } |
| 20696 | |
| 20697 | for (count = 0; count < num_reg_rules; count++) { |
| 20698 | reg_rule_ptr[count].start_freq = |
| 20699 | WMI_REG_RULE_START_FREQ_GET( |
| 20700 | wmi_reg_rule[count].freq_info); |
| 20701 | reg_rule_ptr[count].end_freq = |
| 20702 | WMI_REG_RULE_END_FREQ_GET( |
| 20703 | wmi_reg_rule[count].freq_info); |
| 20704 | reg_rule_ptr[count].max_bw = |
| 20705 | WMI_REG_RULE_MAX_BW_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 20706 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20707 | reg_rule_ptr[count].reg_power = |
| 20708 | WMI_REG_RULE_REG_POWER_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 20709 | wmi_reg_rule[count].bw_pwr_info); |
Abhijit Pradhan | b5a1d24 | 2017-04-27 20:36:31 +0530 | [diff] [blame] | 20710 | reg_rule_ptr[count].ant_gain = |
| 20711 | WMI_REG_RULE_ANTENNA_GAIN_GET( |
| 20712 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20713 | reg_rule_ptr[count].flags = |
| 20714 | WMI_REG_RULE_FLAGS_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 20715 | wmi_reg_rule[count].flag_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20716 | } |
| 20717 | |
| 20718 | return reg_rule_ptr; |
| 20719 | } |
| 20720 | |
| 20721 | static QDF_STATUS extract_reg_chan_list_update_event_tlv( |
| 20722 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 20723 | struct cur_regulatory_info *reg_info, uint32_t len) |
| 20724 | { |
| 20725 | WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *param_buf; |
| 20726 | wmi_reg_chan_list_cc_event_fixed_param *chan_list_event_hdr; |
| 20727 | wmi_regulatory_rule_struct *wmi_reg_rule; |
| 20728 | uint32_t num_2g_reg_rules, num_5g_reg_rules; |
| 20729 | |
| 20730 | WMI_LOGD("processing regulatory channel list"); |
| 20731 | |
| 20732 | param_buf = (WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *)evt_buf; |
| 20733 | if (!param_buf) { |
| 20734 | WMI_LOGE("invalid channel list event buf"); |
| 20735 | return QDF_STATUS_E_FAILURE; |
| 20736 | } |
| 20737 | |
| 20738 | chan_list_event_hdr = param_buf->fixed_param; |
| 20739 | |
| 20740 | reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; |
| 20741 | reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; |
| 20742 | qdf_mem_copy(reg_info->alpha2, &(chan_list_event_hdr->alpha2), |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 20743 | REG_ALPHA2_LEN); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20744 | reg_info->dfs_region = chan_list_event_hdr->dfs_region; |
| 20745 | reg_info->phybitmap = chan_list_event_hdr->phybitmap; |
Amar Singhal | a2d575f | 2017-05-04 17:12:34 -0700 | [diff] [blame] | 20746 | reg_info->offload_enabled = true; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 20747 | reg_info->num_phy = chan_list_event_hdr->num_phy; |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 20748 | reg_info->phy_id = chan_list_event_hdr->phy_id; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 20749 | reg_info->ctry_code = chan_list_event_hdr->country_id; |
| 20750 | reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; |
| 20751 | if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS) |
| 20752 | reg_info->status_code = REG_SET_CC_STATUS_PASS; |
| 20753 | else if (chan_list_event_hdr->status_code == |
| 20754 | WMI_REG_CURRENT_ALPHA2_NOT_FOUND) |
| 20755 | reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND; |
| 20756 | else if (chan_list_event_hdr->status_code == |
| 20757 | WMI_REG_INIT_ALPHA2_NOT_FOUND) |
| 20758 | reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND; |
| 20759 | else if (chan_list_event_hdr->status_code == |
| 20760 | WMI_REG_SET_CC_CHANGE_NOT_ALLOWED) |
| 20761 | reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED; |
| 20762 | else if (chan_list_event_hdr->status_code == |
| 20763 | WMI_REG_SET_CC_STATUS_NO_MEMORY) |
| 20764 | reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY; |
| 20765 | else if (chan_list_event_hdr->status_code == |
| 20766 | WMI_REG_SET_CC_STATUS_FAIL) |
| 20767 | reg_info->status_code = REG_SET_CC_STATUS_FAIL; |
| 20768 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20769 | reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; |
| 20770 | reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; |
| 20771 | reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; |
| 20772 | reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; |
| 20773 | |
| 20774 | num_2g_reg_rules = reg_info->num_2g_reg_rules; |
| 20775 | num_5g_reg_rules = reg_info->num_5g_reg_rules; |
| 20776 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 20777 | WMI_LOGD("%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", |
| 20778 | __func__, reg_info->alpha2, reg_info->dfs_region, |
| 20779 | reg_info->min_bw_2g, reg_info->max_bw_2g, |
| 20780 | reg_info->min_bw_5g, reg_info->max_bw_5g); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20781 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 20782 | WMI_LOGD("%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__, |
| 20783 | num_2g_reg_rules, num_5g_reg_rules); |
Kiran Kumar Lokere | dd64e04 | 2017-03-31 15:50:26 -0700 | [diff] [blame] | 20784 | wmi_reg_rule = |
| 20785 | (wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr |
| 20786 | + sizeof(wmi_reg_chan_list_cc_event_fixed_param) |
| 20787 | + WMI_TLV_HDR_SIZE); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20788 | reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, |
| 20789 | wmi_reg_rule); |
| 20790 | wmi_reg_rule += num_2g_reg_rules; |
| 20791 | |
| 20792 | reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, |
| 20793 | wmi_reg_rule); |
| 20794 | |
| 20795 | WMI_LOGD("processed regulatory channel list"); |
| 20796 | |
| 20797 | return QDF_STATUS_SUCCESS; |
| 20798 | } |
| 20799 | |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 20800 | static QDF_STATUS extract_reg_11d_new_country_event_tlv( |
| 20801 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 20802 | struct reg_11d_new_country *reg_11d_country, uint32_t len) |
| 20803 | { |
| 20804 | wmi_11d_new_country_event_fixed_param *reg_11d_country_event; |
| 20805 | WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *param_buf; |
| 20806 | |
| 20807 | param_buf = (WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *)evt_buf; |
| 20808 | if (!param_buf) { |
| 20809 | WMI_LOGE("invalid 11d country event buf"); |
| 20810 | return QDF_STATUS_E_FAILURE; |
| 20811 | } |
| 20812 | |
| 20813 | reg_11d_country_event = param_buf->fixed_param; |
| 20814 | |
| 20815 | qdf_mem_copy(reg_11d_country->alpha2, |
| 20816 | ®_11d_country_event->new_alpha2, REG_ALPHA2_LEN); |
| 20817 | |
| 20818 | WMI_LOGD("processed 11d country event, new cc %s", |
| 20819 | reg_11d_country->alpha2); |
| 20820 | |
| 20821 | return QDF_STATUS_SUCCESS; |
| 20822 | } |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 20823 | |
| 20824 | static QDF_STATUS extract_reg_ch_avoid_event_tlv( |
| 20825 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 20826 | struct ch_avoid_ind_type *ch_avoid_ind, uint32_t len) |
| 20827 | { |
| 20828 | wmi_avoid_freq_ranges_event_fixed_param *afr_fixed_param; |
| 20829 | wmi_avoid_freq_range_desc *afr_desc; |
| 20830 | uint32_t num_freq_ranges, freq_range_idx; |
| 20831 | WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *param_buf = |
| 20832 | (WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *) evt_buf; |
| 20833 | |
| 20834 | if (!param_buf) { |
| 20835 | WMI_LOGE("Invalid channel avoid event buffer"); |
| 20836 | return QDF_STATUS_E_INVAL; |
| 20837 | } |
| 20838 | |
| 20839 | afr_fixed_param = param_buf->fixed_param; |
| 20840 | if (!afr_fixed_param) { |
| 20841 | WMI_LOGE("Invalid channel avoid event fixed param buffer"); |
| 20842 | return QDF_STATUS_E_INVAL; |
| 20843 | } |
| 20844 | |
| 20845 | if (!ch_avoid_ind) { |
| 20846 | WMI_LOGE("Invalid channel avoid indication buffer"); |
| 20847 | return QDF_STATUS_E_INVAL; |
| 20848 | } |
| 20849 | num_freq_ranges = (afr_fixed_param->num_freq_ranges > |
| 20850 | CH_AVOID_MAX_RANGE) ? CH_AVOID_MAX_RANGE : |
| 20851 | afr_fixed_param->num_freq_ranges; |
| 20852 | |
| 20853 | WMI_LOGD("Channel avoid event received with %d ranges", |
| 20854 | num_freq_ranges); |
| 20855 | |
| 20856 | ch_avoid_ind->ch_avoid_range_cnt = num_freq_ranges; |
| 20857 | afr_desc = (wmi_avoid_freq_range_desc *)(param_buf->avd_freq_range); |
| 20858 | for (freq_range_idx = 0; freq_range_idx < num_freq_ranges; |
| 20859 | freq_range_idx++) { |
| 20860 | ch_avoid_ind->avoid_freq_range[freq_range_idx].start_freq = |
| 20861 | afr_desc->start_freq; |
| 20862 | ch_avoid_ind->avoid_freq_range[freq_range_idx].end_freq = |
| 20863 | afr_desc->end_freq; |
| 20864 | WMI_LOGD("range %d tlv id %u, start freq %u, end freq %u", |
| 20865 | freq_range_idx, afr_desc->tlv_header, |
| 20866 | afr_desc->start_freq, afr_desc->end_freq); |
| 20867 | afr_desc++; |
| 20868 | } |
| 20869 | |
| 20870 | return QDF_STATUS_SUCCESS; |
| 20871 | } |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 20872 | #ifdef DFS_COMPONENT_ENABLE |
| 20873 | /** |
| 20874 | * extract_dfs_cac_complete_event_tlv() - extract cac complete event |
| 20875 | * @wmi_handle: wma handle |
| 20876 | * @evt_buf: event buffer |
| 20877 | * @vdev_id: vdev id |
| 20878 | * @len: length of buffer |
| 20879 | * |
| 20880 | * Return: 0 for success or error code |
| 20881 | */ |
| 20882 | static QDF_STATUS extract_dfs_cac_complete_event_tlv(wmi_unified_t wmi_handle, |
| 20883 | uint8_t *evt_buf, |
| 20884 | uint32_t *vdev_id, |
| 20885 | uint32_t len) |
| 20886 | { |
| 20887 | WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *param_tlvs; |
| 20888 | wmi_vdev_dfs_cac_complete_event_fixed_param *cac_event; |
| 20889 | |
| 20890 | param_tlvs = (WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *) evt_buf; |
| 20891 | if (!param_tlvs) { |
| 20892 | WMI_LOGE("invalid cac complete event buf"); |
| 20893 | return QDF_STATUS_E_FAILURE; |
| 20894 | } |
| 20895 | |
| 20896 | cac_event = param_tlvs->fixed_param; |
| 20897 | *vdev_id = cac_event->vdev_id; |
| 20898 | WMI_LOGD("processed cac complete event vdev %d", *vdev_id); |
| 20899 | |
| 20900 | return QDF_STATUS_SUCCESS; |
| 20901 | } |
| 20902 | |
| 20903 | /** |
| 20904 | * extract_dfs_radar_detection_event_tlv() - extract radar found event |
| 20905 | * @wmi_handle: wma handle |
| 20906 | * @evt_buf: event buffer |
| 20907 | * @radar_found: radar found event info |
| 20908 | * @len: length of buffer |
| 20909 | * |
| 20910 | * Return: 0 for success or error code |
| 20911 | */ |
| 20912 | static QDF_STATUS extract_dfs_radar_detection_event_tlv( |
| 20913 | wmi_unified_t wmi_handle, |
| 20914 | uint8_t *evt_buf, |
| 20915 | struct radar_found_info *radar_found, |
| 20916 | uint32_t len) |
| 20917 | { |
| 20918 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *param_tlv; |
| 20919 | wmi_pdev_dfs_radar_detection_event_fixed_param *radar_event; |
| 20920 | |
| 20921 | param_tlv = (WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *) evt_buf; |
| 20922 | if (!param_tlv) { |
| 20923 | WMI_LOGE("invalid radar detection event buf"); |
| 20924 | return QDF_STATUS_E_FAILURE; |
| 20925 | } |
| 20926 | |
| 20927 | radar_event = param_tlv->fixed_param; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 20928 | radar_found->pdev_id = wmi_handle->ops-> |
| 20929 | convert_pdev_id_target_to_host(radar_event->pdev_id); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 20930 | radar_found->detection_mode = radar_event->detection_mode; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 20931 | radar_found->chan_freq = radar_event->chan_freq; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 20932 | radar_found->chan_width = radar_event->chan_width; |
| 20933 | radar_found->detector_id = radar_event->detector_id; |
| 20934 | radar_found->segment_id = radar_event->segment_id; |
| 20935 | radar_found->timestamp = radar_event->timestamp; |
| 20936 | radar_found->is_chirp = radar_event->is_chirp; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 20937 | radar_found->freq_offset = radar_event->freq_offset; |
| 20938 | radar_found->sidx = radar_event->sidx; |
| 20939 | |
Shaakir Mohamed | 3a72d0a | 2017-11-30 14:36:16 -0800 | [diff] [blame] | 20940 | WMI_LOGI("processed radar found event pdev %d," |
| 20941 | "Radar Event Info:pdev_id %d,timestamp %d,chan_freq (dur) %d," |
| 20942 | "chan_width (RSSI) %d,detector_id (false_radar) %d," |
| 20943 | "freq_offset (radar_check) %d,segment_id %d,sidx %d," |
| 20944 | "is_chirp %d,detection mode %d\n", |
| 20945 | radar_event->pdev_id, radar_event->pdev_id, |
| 20946 | radar_event->timestamp, radar_event->chan_freq, |
| 20947 | radar_event->chan_width, radar_event->detector_id, |
| 20948 | radar_event->freq_offset, radar_event->segment_id, |
| 20949 | radar_event->sidx, radar_event->is_chirp, |
| 20950 | radar_event->detection_mode); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 20951 | |
| 20952 | return QDF_STATUS_SUCCESS; |
| 20953 | } |
bings | 1ea1253 | 2017-12-18 16:56:53 +0800 | [diff] [blame] | 20954 | |
| 20955 | #ifdef QCA_MCL_DFS_SUPPORT |
| 20956 | /** |
| 20957 | * extract_wlan_radar_event_info_tlv() - extract radar pulse event |
| 20958 | * @wmi_handle: wma handle |
| 20959 | * @evt_buf: event buffer |
| 20960 | * @wlan_radar_event: Pointer to struct radar_event_info |
| 20961 | * @len: length of buffer |
| 20962 | * |
| 20963 | * Return: QDF_STATUS |
| 20964 | */ |
| 20965 | static QDF_STATUS extract_wlan_radar_event_info_tlv( |
| 20966 | wmi_unified_t wmi_handle, |
| 20967 | uint8_t *evt_buf, |
| 20968 | struct radar_event_info *wlan_radar_event, |
| 20969 | uint32_t len) |
| 20970 | { |
| 20971 | WMI_DFS_RADAR_EVENTID_param_tlvs *param_tlv; |
| 20972 | wmi_dfs_radar_event_fixed_param *radar_event; |
| 20973 | |
| 20974 | param_tlv = (WMI_DFS_RADAR_EVENTID_param_tlvs *)evt_buf; |
| 20975 | if (!param_tlv) { |
| 20976 | WMI_LOGE("invalid wlan radar event buf"); |
| 20977 | return QDF_STATUS_E_FAILURE; |
| 20978 | } |
| 20979 | |
| 20980 | radar_event = param_tlv->fixed_param; |
| 20981 | wlan_radar_event->pulse_is_chirp = radar_event->pulse_is_chirp; |
| 20982 | wlan_radar_event->pulse_center_freq = radar_event->pulse_center_freq; |
| 20983 | wlan_radar_event->pulse_duration = radar_event->pulse_duration; |
| 20984 | wlan_radar_event->rssi = radar_event->rssi; |
| 20985 | wlan_radar_event->pulse_detect_ts = radar_event->pulse_detect_ts; |
| 20986 | wlan_radar_event->upload_fullts_high = radar_event->upload_fullts_high; |
| 20987 | wlan_radar_event->upload_fullts_low = radar_event->upload_fullts_low; |
| 20988 | wlan_radar_event->peak_sidx = radar_event->peak_sidx; |
bings | fd46164 | 2018-01-03 16:38:00 +0800 | [diff] [blame] | 20989 | wlan_radar_event->delta_peak = radar_event->pulse_delta_peak; |
| 20990 | wlan_radar_event->delta_diff = radar_event->pulse_delta_diff; |
bings | 1ea1253 | 2017-12-18 16:56:53 +0800 | [diff] [blame] | 20991 | wlan_radar_event->pdev_id = radar_event->pdev_id; |
| 20992 | |
| 20993 | return QDF_STATUS_SUCCESS; |
| 20994 | } |
| 20995 | #else |
| 20996 | static QDF_STATUS extract_wlan_radar_event_info_tlv( |
| 20997 | wmi_unified_t wmi_handle, |
| 20998 | uint8_t *evt_buf, |
| 20999 | struct radar_event_info *wlan_radar_event, |
| 21000 | uint32_t len) |
| 21001 | { |
| 21002 | return QDF_STATUS_SUCCESS; |
| 21003 | } |
| 21004 | #endif |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 21005 | #endif |
| 21006 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 21007 | /** |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 21008 | * send_get_rcpi_cmd_tlv() - send request for rcpi value |
| 21009 | * @wmi_handle: wmi handle |
| 21010 | * @get_rcpi_param: rcpi params |
| 21011 | * |
| 21012 | * Return: QDF status |
| 21013 | */ |
| 21014 | static QDF_STATUS send_get_rcpi_cmd_tlv(wmi_unified_t wmi_handle, |
| 21015 | struct rcpi_req *get_rcpi_param) |
| 21016 | { |
| 21017 | wmi_buf_t buf; |
| 21018 | wmi_request_rcpi_cmd_fixed_param *cmd; |
| 21019 | uint8_t len = sizeof(wmi_request_rcpi_cmd_fixed_param); |
| 21020 | |
| 21021 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21022 | if (!buf) { |
| 21023 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 21024 | return QDF_STATUS_E_NOMEM; |
| 21025 | } |
| 21026 | |
| 21027 | cmd = (wmi_request_rcpi_cmd_fixed_param *) wmi_buf_data(buf); |
| 21028 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21029 | WMITLV_TAG_STRUC_wmi_request_rcpi_cmd_fixed_param, |
| 21030 | WMITLV_GET_STRUCT_TLVLEN |
| 21031 | (wmi_request_rcpi_cmd_fixed_param)); |
| 21032 | |
| 21033 | cmd->vdev_id = get_rcpi_param->vdev_id; |
| 21034 | WMI_CHAR_ARRAY_TO_MAC_ADDR(get_rcpi_param->mac_addr, |
| 21035 | &cmd->peer_macaddr); |
| 21036 | cmd->measurement_type = get_rcpi_param->measurement_type; |
| 21037 | WMI_LOGD("RCPI REQ VDEV_ID:%d-->", cmd->vdev_id); |
| 21038 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21039 | WMI_REQUEST_RCPI_CMDID)) { |
| 21040 | |
| 21041 | WMI_LOGE("%s: Failed to send WMI_REQUEST_RCPI_CMDID", |
| 21042 | __func__); |
| 21043 | wmi_buf_free(buf); |
| 21044 | return QDF_STATUS_E_FAILURE; |
| 21045 | } |
| 21046 | |
| 21047 | return QDF_STATUS_SUCCESS; |
| 21048 | } |
| 21049 | |
| 21050 | /** |
| 21051 | * extract_rcpi_response_event_tlv() - Extract RCPI event params |
| 21052 | * @wmi_handle: wmi handle |
| 21053 | * @evt_buf: pointer to event buffer |
| 21054 | * @res: pointer to hold rcpi response from firmware |
| 21055 | * |
| 21056 | * Return: QDF_STATUS_SUCCESS for successful event parse |
| 21057 | * else QDF_STATUS_E_INVAL or QDF_STATUS_E_FAILURE |
| 21058 | */ |
| 21059 | static QDF_STATUS |
| 21060 | extract_rcpi_response_event_tlv(wmi_unified_t wmi_handle, |
| 21061 | void *evt_buf, struct rcpi_res *res) |
| 21062 | { |
| 21063 | WMI_UPDATE_RCPI_EVENTID_param_tlvs *param_buf; |
| 21064 | wmi_update_rcpi_event_fixed_param *event; |
| 21065 | |
| 21066 | param_buf = (WMI_UPDATE_RCPI_EVENTID_param_tlvs *)evt_buf; |
| 21067 | if (!param_buf) { |
| 21068 | WMI_LOGE(FL("Invalid rcpi event")); |
| 21069 | return QDF_STATUS_E_INVAL; |
| 21070 | } |
| 21071 | |
| 21072 | event = param_buf->fixed_param; |
| 21073 | res->vdev_id = event->vdev_id; |
| 21074 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, res->mac_addr); |
| 21075 | |
| 21076 | switch (event->measurement_type) { |
| 21077 | |
| 21078 | case WMI_RCPI_MEASUREMENT_TYPE_AVG_MGMT: |
| 21079 | res->measurement_type = RCPI_MEASUREMENT_TYPE_AVG_MGMT; |
| 21080 | break; |
| 21081 | |
| 21082 | case WMI_RCPI_MEASUREMENT_TYPE_AVG_DATA: |
| 21083 | res->measurement_type = RCPI_MEASUREMENT_TYPE_AVG_DATA; |
| 21084 | break; |
| 21085 | |
| 21086 | case WMI_RCPI_MEASUREMENT_TYPE_LAST_MGMT: |
| 21087 | res->measurement_type = RCPI_MEASUREMENT_TYPE_LAST_MGMT; |
| 21088 | break; |
| 21089 | |
| 21090 | case WMI_RCPI_MEASUREMENT_TYPE_LAST_DATA: |
| 21091 | res->measurement_type = RCPI_MEASUREMENT_TYPE_LAST_DATA; |
| 21092 | break; |
| 21093 | |
| 21094 | default: |
| 21095 | WMI_LOGE(FL("Invalid rcpi measurement type from firmware")); |
| 21096 | res->measurement_type = RCPI_MEASUREMENT_TYPE_INVALID; |
| 21097 | return QDF_STATUS_E_FAILURE; |
| 21098 | } |
| 21099 | |
| 21100 | if (event->status) |
| 21101 | return QDF_STATUS_E_FAILURE; |
| 21102 | else |
| 21103 | return QDF_STATUS_SUCCESS; |
| 21104 | } |
| 21105 | |
| 21106 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 21107 | * convert_host_pdev_id_to_target_pdev_id_legacy() - Convert pdev_id from |
| 21108 | * host to target defines. For legacy there is not conversion |
| 21109 | * required. Just return pdev_id as it is. |
| 21110 | * @param pdev_id: host pdev_id to be converted. |
| 21111 | * Return: target pdev_id after conversion. |
| 21112 | */ |
| 21113 | static uint32_t convert_host_pdev_id_to_target_pdev_id_legacy( |
| 21114 | uint32_t pdev_id) |
| 21115 | { |
| 21116 | if (pdev_id == WMI_HOST_PDEV_ID_SOC) |
| 21117 | return WMI_PDEV_ID_SOC; |
| 21118 | |
| 21119 | /*No conversion required*/ |
| 21120 | return pdev_id; |
| 21121 | } |
| 21122 | |
| 21123 | /** |
| 21124 | * convert_target_pdev_id_to_host_pdev_id_legacy() - Convert pdev_id from |
| 21125 | * target to host defines. For legacy there is not conversion |
| 21126 | * required. Just return pdev_id as it is. |
| 21127 | * @param pdev_id: target pdev_id to be converted. |
| 21128 | * Return: host pdev_id after conversion. |
| 21129 | */ |
| 21130 | static uint32_t convert_target_pdev_id_to_host_pdev_id_legacy( |
| 21131 | uint32_t pdev_id) |
| 21132 | { |
| 21133 | /*No conversion required*/ |
| 21134 | return pdev_id; |
| 21135 | } |
| 21136 | |
| 21137 | /** |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 21138 | * send_set_country_cmd_tlv() - WMI scan channel list function |
| 21139 | * @param wmi_handle : handle to WMI. |
| 21140 | * @param param : pointer to hold scan channel list parameter |
| 21141 | * |
| 21142 | * Return: 0 on success and -ve on failure. |
| 21143 | */ |
| 21144 | static QDF_STATUS send_set_country_cmd_tlv(wmi_unified_t wmi_handle, |
| 21145 | struct set_country *params) |
| 21146 | { |
| 21147 | wmi_buf_t buf; |
| 21148 | QDF_STATUS qdf_status; |
| 21149 | wmi_set_current_country_cmd_fixed_param *cmd; |
| 21150 | uint16_t len = sizeof(*cmd); |
| 21151 | |
| 21152 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21153 | if (!buf) { |
| 21154 | WMI_LOGE("Failed to allocate memory"); |
| 21155 | qdf_status = QDF_STATUS_E_NOMEM; |
| 21156 | goto end; |
| 21157 | } |
| 21158 | |
| 21159 | cmd = (wmi_set_current_country_cmd_fixed_param *)wmi_buf_data(buf); |
| 21160 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21161 | WMITLV_TAG_STRUC_wmi_set_current_country_cmd_fixed_param, |
| 21162 | WMITLV_GET_STRUCT_TLVLEN |
| 21163 | (wmi_set_current_country_cmd_fixed_param)); |
| 21164 | |
| 21165 | WMI_LOGD("setting cuurnet country to %s", params->country); |
| 21166 | |
| 21167 | qdf_mem_copy((uint8_t *)&cmd->new_alpha2, params->country, 3); |
| 21168 | |
| 21169 | cmd->pdev_id = params->pdev_id; |
| 21170 | |
| 21171 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 21172 | buf, len, WMI_SET_CURRENT_COUNTRY_CMDID); |
| 21173 | |
| 21174 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 21175 | WMI_LOGE("Failed to send WMI_SET_CURRENT_COUNTRY_CMDID"); |
| 21176 | wmi_buf_free(buf); |
| 21177 | } |
| 21178 | |
| 21179 | end: |
| 21180 | return qdf_status; |
| 21181 | } |
| 21182 | |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 21183 | #define WMI_REG_COUNTRY_ALPHA_SET(alpha, val0, val1, val2) do { \ |
| 21184 | WMI_SET_BITS(alpha, 0, 8, val0); \ |
| 21185 | WMI_SET_BITS(alpha, 8, 8, val1); \ |
| 21186 | WMI_SET_BITS(alpha, 16, 8, val2); \ |
| 21187 | } while (0) |
| 21188 | |
| 21189 | static QDF_STATUS send_user_country_code_cmd_tlv(wmi_unified_t wmi_handle, |
| 21190 | uint8_t pdev_id, struct cc_regdmn_s *rd) |
| 21191 | { |
| 21192 | wmi_set_init_country_cmd_fixed_param *cmd; |
| 21193 | uint16_t len; |
| 21194 | wmi_buf_t buf; |
| 21195 | int ret; |
| 21196 | |
| 21197 | len = sizeof(wmi_set_init_country_cmd_fixed_param); |
| 21198 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21199 | if (!buf) { |
| 21200 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 21201 | return QDF_STATUS_E_NOMEM; |
| 21202 | } |
| 21203 | cmd = (wmi_set_init_country_cmd_fixed_param *) wmi_buf_data(buf); |
| 21204 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21205 | WMITLV_TAG_STRUC_wmi_set_init_country_cmd_fixed_param, |
| 21206 | WMITLV_GET_STRUCT_TLVLEN |
| 21207 | (wmi_set_init_country_cmd_fixed_param)); |
| 21208 | |
| 21209 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
| 21210 | |
| 21211 | if (rd->flags == CC_IS_SET) { |
| 21212 | cmd->countrycode_type = WMI_COUNTRYCODE_COUNTRY_ID; |
| 21213 | cmd->country_code.country_id = rd->cc.country_code; |
| 21214 | } else if (rd->flags == ALPHA_IS_SET) { |
| 21215 | cmd->countrycode_type = WMI_COUNTRYCODE_ALPHA2; |
| 21216 | WMI_REG_COUNTRY_ALPHA_SET(cmd->country_code.alpha2, |
| 21217 | rd->cc.alpha[0], |
| 21218 | rd->cc.alpha[1], |
| 21219 | rd->cc.alpha[2]); |
| 21220 | } else if (rd->flags == REGDMN_IS_SET) { |
| 21221 | cmd->countrycode_type = WMI_COUNTRYCODE_DOMAIN_CODE; |
| 21222 | cmd->country_code.domain_code = rd->cc.regdmn_id; |
| 21223 | } |
| 21224 | |
| 21225 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21226 | WMI_SET_INIT_COUNTRY_CMDID); |
| 21227 | if (ret) { |
| 21228 | WMI_LOGE("Failed to config wow wakeup event"); |
| 21229 | wmi_buf_free(buf); |
| 21230 | return QDF_STATUS_E_FAILURE; |
| 21231 | } |
| 21232 | |
| 21233 | return QDF_STATUS_SUCCESS; |
| 21234 | } |
| 21235 | |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 21236 | /** |
| 21237 | * send_limit_off_chan_cmd_tlv() - send wmi cmd of limit off chan |
| 21238 | * configuration params |
| 21239 | * @wmi_handle: wmi handler |
| 21240 | * @limit_off_chan_param: pointer to wmi_off_chan_param |
| 21241 | * |
| 21242 | * Return: 0 for success and non zero for failure |
| 21243 | */ |
| 21244 | static |
| 21245 | QDF_STATUS send_limit_off_chan_cmd_tlv(wmi_unified_t wmi_handle, |
| 21246 | struct wmi_limit_off_chan_param *limit_off_chan_param) |
| 21247 | { |
| 21248 | wmi_vdev_limit_offchan_cmd_fixed_param *cmd; |
| 21249 | wmi_buf_t buf; |
| 21250 | uint32_t len = sizeof(*cmd); |
| 21251 | int err; |
| 21252 | |
| 21253 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21254 | if (!buf) { |
| 21255 | WMI_LOGP("%s: failed to allocate memory for limit off chan cmd", |
| 21256 | __func__); |
| 21257 | return QDF_STATUS_E_NOMEM; |
| 21258 | } |
| 21259 | |
| 21260 | cmd = (wmi_vdev_limit_offchan_cmd_fixed_param *)wmi_buf_data(buf); |
| 21261 | |
| 21262 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21263 | WMITLV_TAG_STRUC_wmi_vdev_limit_offchan_cmd_fixed_param, |
| 21264 | WMITLV_GET_STRUCT_TLVLEN( |
| 21265 | wmi_vdev_limit_offchan_cmd_fixed_param)); |
| 21266 | |
| 21267 | cmd->vdev_id = limit_off_chan_param->vdev_id; |
| 21268 | |
| 21269 | cmd->flags &= 0; |
| 21270 | if (limit_off_chan_param->status) |
| 21271 | cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_ENABLE; |
| 21272 | if (limit_off_chan_param->skip_dfs_chans) |
| 21273 | cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_SKIP_DFS; |
| 21274 | |
| 21275 | cmd->max_offchan_time = limit_off_chan_param->max_offchan_time; |
| 21276 | cmd->rest_time = limit_off_chan_param->rest_time; |
| 21277 | |
| 21278 | WMI_LOGE("%s: vdev_id=%d, flags =%x, max_offchan_time=%d, rest_time=%d", |
| 21279 | __func__, cmd->vdev_id, cmd->flags, cmd->max_offchan_time, |
| 21280 | cmd->rest_time); |
| 21281 | |
| 21282 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 21283 | len, WMI_VDEV_LIMIT_OFFCHAN_CMDID); |
| 21284 | if (QDF_IS_STATUS_ERROR(err)) { |
| 21285 | WMI_LOGE("Failed to send limit off chan cmd err=%d", err); |
| 21286 | wmi_buf_free(buf); |
| 21287 | return QDF_STATUS_E_FAILURE; |
| 21288 | } |
| 21289 | |
| 21290 | return QDF_STATUS_SUCCESS; |
| 21291 | } |
| 21292 | |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 21293 | /** |
| 21294 | * send_set_arp_stats_req_cmd_tlv() - send wmi cmd to set arp stats request |
| 21295 | * @wmi_handle: wmi handler |
| 21296 | * @req_buf: set arp stats request buffer |
| 21297 | * |
| 21298 | * Return: 0 for success and non zero for failure |
| 21299 | */ |
| 21300 | static QDF_STATUS send_set_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, |
| 21301 | struct set_arp_stats *req_buf) |
| 21302 | { |
| 21303 | wmi_buf_t buf = NULL; |
| 21304 | QDF_STATUS status; |
| 21305 | int len; |
| 21306 | uint8_t *buf_ptr; |
| 21307 | wmi_vdev_set_arp_stats_cmd_fixed_param *wmi_set_arp; |
| 21308 | |
| 21309 | len = sizeof(wmi_vdev_set_arp_stats_cmd_fixed_param); |
| 21310 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21311 | if (!buf) { |
| 21312 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 21313 | return QDF_STATUS_E_NOMEM; |
| 21314 | } |
| 21315 | |
| 21316 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 21317 | wmi_set_arp = |
| 21318 | (wmi_vdev_set_arp_stats_cmd_fixed_param *) buf_ptr; |
| 21319 | WMITLV_SET_HDR(&wmi_set_arp->tlv_header, |
| 21320 | WMITLV_TAG_STRUC_wmi_vdev_set_arp_stats_cmd_fixed_param, |
| 21321 | WMITLV_GET_STRUCT_TLVLEN |
| 21322 | (wmi_vdev_set_arp_stats_cmd_fixed_param)); |
| 21323 | |
| 21324 | /* fill in per roam config values */ |
| 21325 | wmi_set_arp->vdev_id = req_buf->vdev_id; |
| 21326 | |
| 21327 | wmi_set_arp->set_clr = req_buf->flag; |
| 21328 | wmi_set_arp->pkt_type = req_buf->pkt_type; |
| 21329 | wmi_set_arp->ipv4 = req_buf->ip_addr; |
| 21330 | |
| 21331 | /* Send per roam config parameters */ |
| 21332 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 21333 | len, WMI_VDEV_SET_ARP_STAT_CMDID); |
| 21334 | if (QDF_IS_STATUS_ERROR(status)) { |
| 21335 | WMI_LOGE("WMI_SET_ARP_STATS_CMDID failed, Error %d", |
| 21336 | status); |
| 21337 | goto error; |
| 21338 | } |
| 21339 | |
| 21340 | WMI_LOGI(FL("set arp stats flag=%d, vdev=%d"), |
| 21341 | req_buf->flag, req_buf->vdev_id); |
| 21342 | return QDF_STATUS_SUCCESS; |
| 21343 | error: |
| 21344 | wmi_buf_free(buf); |
| 21345 | |
| 21346 | return status; |
| 21347 | } |
| 21348 | |
| 21349 | /** |
| 21350 | * send_get_arp_stats_req_cmd_tlv() - send wmi cmd to get arp stats request |
| 21351 | * @wmi_handle: wmi handler |
| 21352 | * @req_buf: get arp stats request buffer |
| 21353 | * |
| 21354 | * Return: 0 for success and non zero for failure |
| 21355 | */ |
| 21356 | static QDF_STATUS send_get_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, |
| 21357 | struct get_arp_stats *req_buf) |
| 21358 | { |
| 21359 | wmi_buf_t buf = NULL; |
| 21360 | QDF_STATUS status; |
| 21361 | int len; |
| 21362 | uint8_t *buf_ptr; |
| 21363 | wmi_vdev_get_arp_stats_cmd_fixed_param *get_arp_stats; |
| 21364 | |
| 21365 | len = sizeof(wmi_vdev_get_arp_stats_cmd_fixed_param); |
| 21366 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21367 | if (!buf) { |
| 21368 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 21369 | return QDF_STATUS_E_NOMEM; |
| 21370 | } |
| 21371 | |
| 21372 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 21373 | get_arp_stats = |
| 21374 | (wmi_vdev_get_arp_stats_cmd_fixed_param *) buf_ptr; |
| 21375 | WMITLV_SET_HDR(&get_arp_stats->tlv_header, |
| 21376 | WMITLV_TAG_STRUC_wmi_vdev_get_arp_stats_cmd_fixed_param, |
| 21377 | WMITLV_GET_STRUCT_TLVLEN |
| 21378 | (wmi_vdev_get_arp_stats_cmd_fixed_param)); |
| 21379 | |
| 21380 | /* fill in arp stats req cmd values */ |
| 21381 | get_arp_stats->vdev_id = req_buf->vdev_id; |
| 21382 | |
| 21383 | WMI_LOGI(FL("vdev=%d"), req_buf->vdev_id); |
| 21384 | /* Send per roam config parameters */ |
| 21385 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 21386 | len, WMI_VDEV_GET_ARP_STAT_CMDID); |
| 21387 | if (QDF_IS_STATUS_ERROR(status)) { |
| 21388 | WMI_LOGE("WMI_GET_ARP_STATS_CMDID failed, Error %d", |
| 21389 | status); |
| 21390 | goto error; |
| 21391 | } |
| 21392 | |
| 21393 | return QDF_STATUS_SUCCESS; |
| 21394 | error: |
| 21395 | wmi_buf_free(buf); |
| 21396 | |
| 21397 | return status; |
| 21398 | } |
| 21399 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 21400 | /** |
| 21401 | * send_set_del_pmkid_cache_cmd_tlv() - send wmi cmd of set del pmkid |
| 21402 | * @wmi_handle: wmi handler |
| 21403 | * @pmk_info: pointer to PMK cache entry |
| 21404 | * @vdev_id: vdev id |
| 21405 | * |
| 21406 | * Return: 0 for success and non zero for failure |
| 21407 | */ |
| 21408 | static QDF_STATUS send_set_del_pmkid_cache_cmd_tlv(wmi_unified_t wmi_handle, |
| 21409 | struct wmi_unified_pmk_cache *pmk_info) |
| 21410 | { |
| 21411 | wmi_pdev_update_pmk_cache_cmd_fixed_param *cmd; |
| 21412 | wmi_buf_t buf; |
| 21413 | QDF_STATUS status; |
| 21414 | uint8_t *buf_ptr; |
| 21415 | wmi_pmk_cache *pmksa; |
Vignesh Viswanathan | 6ee66d3 | 2017-10-11 20:40:58 +0530 | [diff] [blame] | 21416 | uint32_t len = sizeof(*cmd); |
| 21417 | |
| 21418 | if (pmk_info->pmk_len) |
| 21419 | len += WMI_TLV_HDR_SIZE + sizeof(*pmksa); |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 21420 | |
| 21421 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21422 | if (!buf) { |
| 21423 | WMI_LOGP("%s: failed to allocate memory for set del pmkid cache", |
| 21424 | __func__); |
| 21425 | return QDF_STATUS_E_NOMEM; |
| 21426 | } |
| 21427 | |
| 21428 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 21429 | cmd = (wmi_pdev_update_pmk_cache_cmd_fixed_param *) buf_ptr; |
| 21430 | |
| 21431 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21432 | WMITLV_TAG_STRUC_wmi_pdev_update_pmk_cache_cmd_fixed_param, |
| 21433 | WMITLV_GET_STRUCT_TLVLEN( |
| 21434 | wmi_pdev_update_pmk_cache_cmd_fixed_param)); |
| 21435 | |
| 21436 | cmd->vdev_id = pmk_info->session_id; |
Vignesh Viswanathan | 6ee66d3 | 2017-10-11 20:40:58 +0530 | [diff] [blame] | 21437 | |
| 21438 | /* If pmk_info->pmk_len is 0, this is a flush request */ |
| 21439 | if (!pmk_info->pmk_len) { |
| 21440 | cmd->op_flag = WMI_PMK_CACHE_OP_FLAG_FLUSH_ALL; |
| 21441 | cmd->num_cache = 0; |
| 21442 | goto send_cmd; |
| 21443 | } |
| 21444 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 21445 | cmd->num_cache = 1; |
| 21446 | buf_ptr += sizeof(*cmd); |
| 21447 | |
| 21448 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 21449 | sizeof(*pmksa)); |
| 21450 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 21451 | |
| 21452 | pmksa = (wmi_pmk_cache *)buf_ptr; |
| 21453 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_pmk_cache, |
| 21454 | WMITLV_GET_STRUCT_TLVLEN |
| 21455 | (wmi_pmk_cache)); |
| 21456 | pmksa->pmk_len = pmk_info->pmk_len; |
| 21457 | qdf_mem_copy(pmksa->pmk, pmk_info->pmk, pmksa->pmk_len); |
| 21458 | pmksa->pmkid_len = pmk_info->pmkid_len; |
| 21459 | qdf_mem_copy(pmksa->pmkid, pmk_info->pmkid, pmksa->pmkid_len); |
| 21460 | qdf_mem_copy(&(pmksa->bssid), &(pmk_info->bssid), sizeof(wmi_mac_addr)); |
| 21461 | pmksa->ssid.ssid_len = pmk_info->ssid.length; |
| 21462 | qdf_mem_copy(&(pmksa->ssid.ssid), &(pmk_info->ssid.mac_ssid), |
| 21463 | pmksa->ssid.ssid_len); |
| 21464 | pmksa->cache_id = pmk_info->cache_id; |
| 21465 | pmksa->cat_flag = pmk_info->cat_flag; |
| 21466 | pmksa->action_flag = pmk_info->action_flag; |
| 21467 | |
Vignesh Viswanathan | 6ee66d3 | 2017-10-11 20:40:58 +0530 | [diff] [blame] | 21468 | send_cmd: |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 21469 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21470 | WMI_PDEV_UPDATE_PMK_CACHE_CMDID); |
| 21471 | if (status != QDF_STATUS_SUCCESS) { |
| 21472 | WMI_LOGE("%s: failed to send set del pmkid cache command %d", |
| 21473 | __func__, status); |
| 21474 | wmi_buf_free(buf); |
| 21475 | } |
| 21476 | |
| 21477 | return status; |
| 21478 | } |
| 21479 | |
Balamurugan Mahalingam | f209829 | 2017-10-26 15:14:57 +0530 | [diff] [blame] | 21480 | /** |
| 21481 | * send_pdev_caldata_version_check_cmd_tlv() - send caldata check cmd to fw |
| 21482 | * @wmi_handle: wmi handle |
| 21483 | * @param: reserved param |
| 21484 | * |
| 21485 | * Return: 0 for success or error code |
| 21486 | */ |
| 21487 | static QDF_STATUS |
| 21488 | send_pdev_caldata_version_check_cmd_tlv(wmi_unified_t wmi_handle, |
| 21489 | uint32_t param) |
| 21490 | { |
| 21491 | wmi_pdev_check_cal_version_cmd_fixed_param *cmd; |
| 21492 | wmi_buf_t buf; |
| 21493 | int32_t len = sizeof(wmi_pdev_check_cal_version_cmd_fixed_param); |
| 21494 | |
| 21495 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21496 | if (!buf) { |
| 21497 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 21498 | return QDF_STATUS_E_FAILURE; |
| 21499 | } |
| 21500 | cmd = (wmi_pdev_check_cal_version_cmd_fixed_param *)wmi_buf_data(buf); |
| 21501 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21502 | WMITLV_TAG_STRUC_wmi_pdev_check_cal_version_cmd_fixed_param, |
| 21503 | WMITLV_GET_STRUCT_TLVLEN |
| 21504 | (wmi_pdev_check_cal_version_cmd_fixed_param)); |
| 21505 | cmd->pdev_id = param; /* set to 0x0 as expected from FW */ |
| 21506 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21507 | WMI_PDEV_CHECK_CAL_VERSION_CMDID)) { |
| 21508 | wmi_buf_free(buf); |
| 21509 | return QDF_STATUS_E_FAILURE; |
| 21510 | } |
| 21511 | |
| 21512 | return QDF_STATUS_SUCCESS; |
| 21513 | } |
| 21514 | |
| 21515 | /** |
Pratik Gandhi | 67da1bb | 2018-01-30 19:05:41 +0530 | [diff] [blame] | 21516 | * convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from |
| 21517 | * host to target defines. |
| 21518 | * @param pdev_id: host pdev_id to be converted. |
| 21519 | * Return: target pdev_id after conversion. |
| 21520 | */ |
| 21521 | static uint32_t convert_host_pdev_id_to_target_pdev_id(uint32_t pdev_id) |
| 21522 | { |
| 21523 | switch (pdev_id) { |
| 21524 | case WMI_HOST_PDEV_ID_SOC: |
| 21525 | return WMI_PDEV_ID_SOC; |
| 21526 | case WMI_HOST_PDEV_ID_0: |
| 21527 | return WMI_PDEV_ID_1ST; |
| 21528 | case WMI_HOST_PDEV_ID_1: |
| 21529 | return WMI_PDEV_ID_2ND; |
| 21530 | case WMI_HOST_PDEV_ID_2: |
| 21531 | return WMI_PDEV_ID_3RD; |
| 21532 | } |
| 21533 | |
| 21534 | QDF_ASSERT(0); |
| 21535 | |
| 21536 | return WMI_PDEV_ID_SOC; |
| 21537 | } |
| 21538 | |
| 21539 | /** |
| 21540 | * convert_target_pdev_id_to_host_pdev_id() - Convert pdev_id from |
| 21541 | * target to host defines. |
| 21542 | * @param pdev_id: target pdev_id to be converted. |
| 21543 | * Return: host pdev_id after conversion. |
| 21544 | */ |
| 21545 | static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id) |
| 21546 | { |
| 21547 | switch (pdev_id) { |
| 21548 | case WMI_PDEV_ID_SOC: |
| 21549 | return WMI_HOST_PDEV_ID_SOC; |
| 21550 | case WMI_PDEV_ID_1ST: |
| 21551 | return WMI_HOST_PDEV_ID_0; |
| 21552 | case WMI_PDEV_ID_2ND: |
| 21553 | return WMI_HOST_PDEV_ID_1; |
| 21554 | case WMI_PDEV_ID_3RD: |
| 21555 | return WMI_HOST_PDEV_ID_2; |
| 21556 | } |
| 21557 | |
| 21558 | QDF_ASSERT(0); |
| 21559 | |
| 21560 | return WMI_HOST_PDEV_ID_SOC; |
| 21561 | } |
| 21562 | |
| 21563 | /** |
| 21564 | * wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion |
| 21565 | * |
| 21566 | * Return None. |
| 21567 | */ |
| 21568 | static void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle) |
| 21569 | { |
| 21570 | wmi_handle->ops->convert_pdev_id_host_to_target = |
| 21571 | convert_host_pdev_id_to_target_pdev_id; |
| 21572 | wmi_handle->ops->convert_pdev_id_target_to_host = |
| 21573 | convert_target_pdev_id_to_host_pdev_id; |
| 21574 | } |
| 21575 | |
| 21576 | /** |
Balamurugan Mahalingam | f209829 | 2017-10-26 15:14:57 +0530 | [diff] [blame] | 21577 | * extract_pdev_caldata_version_check_ev_param_tlv() - extract caldata from event |
| 21578 | * @wmi_handle: wmi handle |
| 21579 | * @param evt_buf: pointer to event buffer |
| 21580 | * @param param: Pointer to hold peer caldata version data |
| 21581 | * |
| 21582 | * Return: 0 for success or error code |
| 21583 | */ |
| 21584 | static QDF_STATUS extract_pdev_caldata_version_check_ev_param_tlv( |
| 21585 | wmi_unified_t wmi_handle, |
| 21586 | void *evt_buf, |
| 21587 | wmi_host_pdev_check_cal_version_event *param) |
| 21588 | { |
| 21589 | WMI_PDEV_CHECK_CAL_VERSION_EVENTID_param_tlvs *param_tlvs; |
| 21590 | wmi_pdev_check_cal_version_event_fixed_param *event; |
| 21591 | |
| 21592 | param_tlvs = (WMI_PDEV_CHECK_CAL_VERSION_EVENTID_param_tlvs *) evt_buf; |
| 21593 | if (!param_tlvs) { |
| 21594 | WMI_LOGE("invalid cal version event buf"); |
| 21595 | return QDF_STATUS_E_FAILURE; |
| 21596 | } |
| 21597 | event = param_tlvs->fixed_param; |
| 21598 | if (event->board_mcn_detail[WMI_BOARD_MCN_STRING_MAX_SIZE] != '\0') |
| 21599 | event->board_mcn_detail[WMI_BOARD_MCN_STRING_MAX_SIZE] = '\0'; |
| 21600 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(param->board_mcn_detail, |
| 21601 | event->board_mcn_detail, WMI_BOARD_MCN_STRING_BUF_SIZE); |
| 21602 | |
| 21603 | param->software_cal_version = event->software_cal_version; |
| 21604 | param->board_cal_version = event->board_cal_version; |
| 21605 | param->cal_ok = event->cal_status; |
| 21606 | |
| 21607 | return QDF_STATUS_SUCCESS; |
| 21608 | } |
| 21609 | |
yeshwanth sriram guntuka | 07a15b8 | 2017-09-01 17:56:07 +0530 | [diff] [blame] | 21610 | /* |
| 21611 | * send_btm_config_cmd_tlv() - Send wmi cmd for BTM config |
| 21612 | * @wmi_handle: wmi handle |
| 21613 | * @params: pointer to wmi_btm_config |
| 21614 | * |
| 21615 | * Return: QDF_STATUS |
| 21616 | */ |
| 21617 | static QDF_STATUS send_btm_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 21618 | struct wmi_btm_config *params) |
| 21619 | { |
| 21620 | |
| 21621 | wmi_btm_config_fixed_param *cmd; |
| 21622 | wmi_buf_t buf; |
| 21623 | uint32_t len; |
| 21624 | |
| 21625 | len = sizeof(*cmd); |
| 21626 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21627 | if (!buf) { |
| 21628 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 21629 | return QDF_STATUS_E_NOMEM; |
| 21630 | } |
| 21631 | |
| 21632 | cmd = (wmi_btm_config_fixed_param *)wmi_buf_data(buf); |
| 21633 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21634 | WMITLV_TAG_STRUC_wmi_btm_config_fixed_param, |
| 21635 | WMITLV_GET_STRUCT_TLVLEN(wmi_btm_config_fixed_param)); |
| 21636 | cmd->vdev_id = params->vdev_id; |
| 21637 | cmd->flags = params->btm_offload_config; |
Jiachao Wu | 31bd293 | 2018-01-08 16:45:09 +0800 | [diff] [blame] | 21638 | cmd->max_attempt_cnt = params->btm_max_attempt_cnt; |
| 21639 | cmd->solicited_timeout_ms = params->btm_solicited_timeout; |
| 21640 | cmd->stick_time_seconds = params->btm_sticky_time; |
| 21641 | |
yeshwanth sriram guntuka | 07a15b8 | 2017-09-01 17:56:07 +0530 | [diff] [blame] | 21642 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21643 | WMI_ROAM_BTM_CONFIG_CMDID)) { |
| 21644 | WMI_LOGE("%s: failed to send WMI_ROAM_BTM_CONFIG_CMDID", |
| 21645 | __func__); |
| 21646 | wmi_buf_free(buf); |
| 21647 | return QDF_STATUS_E_FAILURE; |
| 21648 | } |
Arif Hussain | c5bfe07 | 2017-12-27 16:23:45 -0800 | [diff] [blame] | 21649 | |
| 21650 | return QDF_STATUS_SUCCESS; |
| 21651 | } |
| 21652 | |
| 21653 | /** |
| 21654 | * send_obss_detection_cfg_cmd_tlv() - send obss detection |
| 21655 | * configurations to firmware. |
| 21656 | * @wmi_handle: wmi handle |
| 21657 | * @obss_cfg_param: obss detection configurations |
| 21658 | * |
| 21659 | * Send WMI_SAP_OBSS_DETECTION_CFG_CMDID parameters to fw. |
| 21660 | * |
| 21661 | * Return: QDF_STATUS |
| 21662 | */ |
| 21663 | static QDF_STATUS send_obss_detection_cfg_cmd_tlv(wmi_unified_t wmi_handle, |
| 21664 | struct wmi_obss_detection_cfg_param *obss_cfg_param) |
| 21665 | { |
| 21666 | wmi_buf_t buf; |
| 21667 | wmi_sap_obss_detection_cfg_cmd_fixed_param *cmd; |
| 21668 | uint8_t len = sizeof(wmi_sap_obss_detection_cfg_cmd_fixed_param); |
| 21669 | |
| 21670 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21671 | if (!buf) { |
| 21672 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 21673 | return QDF_STATUS_E_NOMEM; |
| 21674 | } |
| 21675 | |
| 21676 | cmd = (wmi_sap_obss_detection_cfg_cmd_fixed_param *)wmi_buf_data(buf); |
| 21677 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21678 | WMITLV_TAG_STRUC_wmi_sap_obss_detection_cfg_cmd_fixed_param, |
| 21679 | WMITLV_GET_STRUCT_TLVLEN |
| 21680 | (wmi_sap_obss_detection_cfg_cmd_fixed_param)); |
| 21681 | |
| 21682 | cmd->vdev_id = obss_cfg_param->vdev_id; |
| 21683 | cmd->detect_period_ms = obss_cfg_param->obss_detect_period_ms; |
| 21684 | cmd->b_ap_detect_mode = obss_cfg_param->obss_11b_ap_detect_mode; |
| 21685 | cmd->b_sta_detect_mode = obss_cfg_param->obss_11b_sta_detect_mode; |
| 21686 | cmd->g_ap_detect_mode = obss_cfg_param->obss_11g_ap_detect_mode; |
| 21687 | cmd->a_detect_mode = obss_cfg_param->obss_11a_detect_mode; |
| 21688 | cmd->ht_legacy_detect_mode = obss_cfg_param->obss_ht_legacy_detect_mode; |
| 21689 | cmd->ht_mixed_detect_mode = obss_cfg_param->obss_ht_mixed_detect_mode; |
| 21690 | 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] | 21691 | |
| 21692 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21693 | WMI_SAP_OBSS_DETECTION_CFG_CMDID)) { |
| 21694 | WMI_LOGE("Failed to send WMI_SAP_OBSS_DETECTION_CFG_CMDID"); |
| 21695 | wmi_buf_free(buf); |
| 21696 | return QDF_STATUS_E_FAILURE; |
| 21697 | } |
| 21698 | |
yeshwanth sriram guntuka | 07a15b8 | 2017-09-01 17:56:07 +0530 | [diff] [blame] | 21699 | return QDF_STATUS_SUCCESS; |
| 21700 | } |
| 21701 | |
Arif Hussain | 33d9850 | 2018-01-12 13:15:04 -0800 | [diff] [blame] | 21702 | /** |
| 21703 | * extract_obss_detection_info_tlv() - Extract obss detection info |
| 21704 | * received from firmware. |
| 21705 | * @evt_buf: pointer to event buffer |
| 21706 | * @obss_detection: Pointer to hold obss detection info |
| 21707 | * |
| 21708 | * Return: QDF_STATUS |
| 21709 | */ |
| 21710 | static QDF_STATUS extract_obss_detection_info_tlv(uint8_t *evt_buf, |
| 21711 | struct wmi_obss_detect_info |
| 21712 | *obss_detection) |
| 21713 | { |
| 21714 | WMI_SAP_OBSS_DETECTION_REPORT_EVENTID_param_tlvs *param_buf; |
| 21715 | wmi_sap_obss_detection_info_evt_fixed_param *fix_param; |
| 21716 | |
| 21717 | if (!obss_detection) { |
| 21718 | WMI_LOGE("%s: Invalid obss_detection event buffer", __func__); |
| 21719 | return QDF_STATUS_E_INVAL; |
| 21720 | } |
| 21721 | |
| 21722 | param_buf = (WMI_SAP_OBSS_DETECTION_REPORT_EVENTID_param_tlvs *)evt_buf; |
| 21723 | if (!param_buf) { |
| 21724 | WMI_LOGE("%s: Invalid evt_buf", __func__); |
| 21725 | return QDF_STATUS_E_INVAL; |
| 21726 | } |
| 21727 | |
| 21728 | fix_param = param_buf->fixed_param; |
| 21729 | obss_detection->vdev_id = fix_param->vdev_id; |
| 21730 | obss_detection->matched_detection_masks = |
| 21731 | fix_param->matched_detection_masks; |
| 21732 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&fix_param->matched_bssid_addr, |
| 21733 | &obss_detection->matched_bssid_addr[0]); |
| 21734 | switch (fix_param->reason) { |
| 21735 | case WMI_SAP_OBSS_DETECTION_EVENT_REASON_NOT_SUPPORT: |
| 21736 | obss_detection->reason = OBSS_OFFLOAD_DETECTION_DISABLED; |
| 21737 | break; |
| 21738 | case WMI_SAP_OBSS_DETECTION_EVENT_REASON_PRESENT_NOTIFY: |
| 21739 | obss_detection->reason = OBSS_OFFLOAD_DETECTION_PRESENT; |
| 21740 | break; |
| 21741 | case WMI_SAP_OBSS_DETECTION_EVENT_REASON_ABSENT_TIMEOUT: |
| 21742 | obss_detection->reason = OBSS_OFFLOAD_DETECTION_ABSENT; |
| 21743 | break; |
| 21744 | default: |
| 21745 | WMI_LOGE("%s: Invalid reason %d", __func__, fix_param->reason); |
| 21746 | return QDF_STATUS_E_INVAL; |
| 21747 | } |
| 21748 | |
| 21749 | return QDF_STATUS_SUCCESS; |
| 21750 | } |
| 21751 | |
Vignesh Viswanathan | 7f05777 | 2018-01-18 19:06:40 +0530 | [diff] [blame] | 21752 | /** |
| 21753 | * send_offload_11k_cmd_tlv() - send wmi cmd with 11k offload params |
| 21754 | * @wmi_handle: wmi handler |
| 21755 | * @params: pointer to 11k offload params |
| 21756 | * |
| 21757 | * Return: 0 for success and non zero for failure |
| 21758 | */ |
| 21759 | static QDF_STATUS send_offload_11k_cmd_tlv(wmi_unified_t wmi_handle, |
| 21760 | struct wmi_11k_offload_params *params) |
| 21761 | { |
| 21762 | wmi_11k_offload_report_fixed_param *cmd; |
| 21763 | wmi_buf_t buf; |
| 21764 | QDF_STATUS status; |
| 21765 | uint8_t *buf_ptr; |
| 21766 | wmi_neighbor_report_11k_offload_tlv_param |
| 21767 | *neighbor_report_offload_params; |
| 21768 | wmi_neighbor_report_offload *neighbor_report_offload; |
| 21769 | |
| 21770 | uint32_t len = sizeof(*cmd); |
| 21771 | |
| 21772 | if (params->offload_11k_bitmask & |
| 21773 | WMI_11K_OFFLOAD_BITMAP_NEIGHBOR_REPORT_REQ) |
| 21774 | len += WMI_TLV_HDR_SIZE + |
| 21775 | sizeof(wmi_neighbor_report_11k_offload_tlv_param); |
| 21776 | |
| 21777 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21778 | if (!buf) { |
| 21779 | WMI_LOGP("%s: failed to allocate memory for 11k offload params", |
| 21780 | __func__); |
| 21781 | return QDF_STATUS_E_NOMEM; |
| 21782 | } |
| 21783 | |
| 21784 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 21785 | cmd = (wmi_11k_offload_report_fixed_param *) buf_ptr; |
| 21786 | |
| 21787 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21788 | WMITLV_TAG_STRUC_wmi_offload_11k_report_fixed_param, |
| 21789 | WMITLV_GET_STRUCT_TLVLEN( |
| 21790 | wmi_11k_offload_report_fixed_param)); |
| 21791 | |
| 21792 | cmd->vdev_id = params->vdev_id; |
| 21793 | cmd->offload_11k = params->offload_11k_bitmask; |
| 21794 | |
| 21795 | if (params->offload_11k_bitmask & |
| 21796 | WMI_11K_OFFLOAD_BITMAP_NEIGHBOR_REPORT_REQ) { |
| 21797 | buf_ptr += sizeof(wmi_11k_offload_report_fixed_param); |
| 21798 | |
| 21799 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 21800 | sizeof(wmi_neighbor_report_11k_offload_tlv_param)); |
| 21801 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 21802 | |
| 21803 | neighbor_report_offload_params = |
| 21804 | (wmi_neighbor_report_11k_offload_tlv_param *)buf_ptr; |
| 21805 | WMITLV_SET_HDR(&neighbor_report_offload_params->tlv_header, |
| 21806 | WMITLV_TAG_STRUC_wmi_neighbor_report_offload_tlv_param, |
| 21807 | WMITLV_GET_STRUCT_TLVLEN( |
| 21808 | wmi_neighbor_report_11k_offload_tlv_param)); |
| 21809 | |
| 21810 | neighbor_report_offload = &neighbor_report_offload_params-> |
| 21811 | neighbor_rep_ofld_params; |
| 21812 | |
| 21813 | neighbor_report_offload->time_offset = |
| 21814 | params->neighbor_report_params.time_offset; |
| 21815 | neighbor_report_offload->low_rssi_offset = |
| 21816 | params->neighbor_report_params.low_rssi_offset; |
| 21817 | neighbor_report_offload->bmiss_count_trigger = |
| 21818 | params->neighbor_report_params.bmiss_count_trigger; |
| 21819 | neighbor_report_offload->per_threshold_offset = |
| 21820 | params->neighbor_report_params.per_threshold_offset; |
| 21821 | neighbor_report_offload->neighbor_report_cache_timeout = |
| 21822 | params->neighbor_report_params. |
| 21823 | neighbor_report_cache_timeout; |
| 21824 | neighbor_report_offload->max_neighbor_report_req_cap = |
| 21825 | params->neighbor_report_params. |
| 21826 | max_neighbor_report_req_cap; |
| 21827 | neighbor_report_offload->ssid.ssid_len = |
| 21828 | params->neighbor_report_params.ssid.length; |
| 21829 | qdf_mem_copy(neighbor_report_offload->ssid.ssid, |
| 21830 | ¶ms->neighbor_report_params.ssid.mac_ssid, |
| 21831 | neighbor_report_offload->ssid.ssid_len); |
| 21832 | } |
| 21833 | |
| 21834 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21835 | WMI_11K_OFFLOAD_REPORT_CMDID); |
| 21836 | if (status != QDF_STATUS_SUCCESS) { |
| 21837 | WMI_LOGE("%s: failed to send 11k offload command %d", |
| 21838 | __func__, status); |
| 21839 | wmi_buf_free(buf); |
| 21840 | } |
| 21841 | |
| 21842 | return status; |
| 21843 | } |
| 21844 | |
| 21845 | /** |
| 21846 | * send_invoke_neighbor_report_cmd_tlv() - send invoke 11k neighbor report |
| 21847 | * command |
| 21848 | * @wmi_handle: wmi handler |
| 21849 | * @params: pointer to neighbor report invoke params |
| 21850 | * |
| 21851 | * Return: 0 for success and non zero for failure |
| 21852 | */ |
| 21853 | static QDF_STATUS send_invoke_neighbor_report_cmd_tlv(wmi_unified_t wmi_handle, |
| 21854 | struct wmi_invoke_neighbor_report_params *params) |
| 21855 | { |
| 21856 | wmi_11k_offload_invoke_neighbor_report_fixed_param *cmd; |
| 21857 | wmi_buf_t buf; |
| 21858 | QDF_STATUS status; |
| 21859 | uint8_t *buf_ptr; |
| 21860 | uint32_t len = sizeof(*cmd); |
| 21861 | |
| 21862 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21863 | if (!buf) { |
| 21864 | WMI_LOGP("%s:failed to allocate memory for neighbor invoke cmd", |
| 21865 | __func__); |
| 21866 | return QDF_STATUS_E_NOMEM; |
| 21867 | } |
| 21868 | |
| 21869 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 21870 | cmd = (wmi_11k_offload_invoke_neighbor_report_fixed_param *) buf_ptr; |
| 21871 | |
| 21872 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21873 | WMITLV_TAG_STRUC_wmi_invoke_neighbor_report_fixed_param, |
| 21874 | WMITLV_GET_STRUCT_TLVLEN( |
| 21875 | wmi_11k_offload_invoke_neighbor_report_fixed_param)); |
| 21876 | |
| 21877 | cmd->vdev_id = params->vdev_id; |
| 21878 | cmd->flags = params->send_resp_to_host; |
| 21879 | |
| 21880 | cmd->ssid.ssid_len = params->ssid.length; |
| 21881 | qdf_mem_copy(cmd->ssid.ssid, |
| 21882 | ¶ms->ssid.mac_ssid, |
| 21883 | cmd->ssid.ssid_len); |
| 21884 | |
| 21885 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21886 | WMI_11K_INVOKE_NEIGHBOR_REPORT_CMDID); |
| 21887 | if (status != QDF_STATUS_SUCCESS) { |
| 21888 | WMI_LOGE("%s: failed to send invoke neighbor report command %d", |
| 21889 | __func__, status); |
| 21890 | wmi_buf_free(buf); |
| 21891 | } |
| 21892 | |
| 21893 | return status; |
| 21894 | } |
| 21895 | |
Himanshu Agarwal | 157e478 | 2018-01-24 22:24:17 +0530 | [diff] [blame] | 21896 | #ifdef WLAN_SUPPORT_GREEN_AP |
| 21897 | static QDF_STATUS extract_green_ap_egap_status_info_tlv( |
| 21898 | uint8_t *evt_buf, |
| 21899 | struct wlan_green_ap_egap_status_info *egap_status_info_params) |
| 21900 | { |
| 21901 | WMI_AP_PS_EGAP_INFO_EVENTID_param_tlvs *param_buf; |
| 21902 | wmi_ap_ps_egap_info_event_fixed_param *egap_info_event; |
| 21903 | wmi_ap_ps_egap_info_chainmask_list *chainmask_event; |
| 21904 | |
| 21905 | param_buf = (WMI_AP_PS_EGAP_INFO_EVENTID_param_tlvs *)evt_buf; |
| 21906 | if (!param_buf) { |
| 21907 | WMI_LOGE("Invalid EGAP Info status event buffer"); |
| 21908 | return QDF_STATUS_E_INVAL; |
| 21909 | } |
| 21910 | |
| 21911 | egap_info_event = (wmi_ap_ps_egap_info_event_fixed_param *) |
| 21912 | param_buf->fixed_param; |
| 21913 | chainmask_event = (wmi_ap_ps_egap_info_chainmask_list *) |
| 21914 | param_buf->chainmask_list; |
| 21915 | |
| 21916 | egap_status_info_params->status = egap_info_event->status; |
| 21917 | egap_status_info_params->mac_id = chainmask_event->mac_id; |
| 21918 | egap_status_info_params->tx_chainmask = chainmask_event->tx_chainmask; |
| 21919 | egap_status_info_params->rx_chainmask = chainmask_event->rx_chainmask; |
| 21920 | |
| 21921 | return QDF_STATUS_SUCCESS; |
| 21922 | } |
| 21923 | #endif |
| 21924 | |
Arif Hussain | ec5cd3c | 2018-01-22 01:19:36 -0800 | [diff] [blame] | 21925 | /* |
| 21926 | * send_bss_color_change_enable_cmd_tlv() - Send command to enable or disable of |
| 21927 | * updating bss color change within firmware when AP announces bss color change. |
| 21928 | * @wmi_handle: wmi handle |
| 21929 | * @vdev_id: vdev ID |
| 21930 | * @enable: enable bss color change within firmware |
| 21931 | * |
| 21932 | * Send WMI_BSS_COLOR_CHANGE_ENABLE_CMDID parameters to fw. |
| 21933 | * |
| 21934 | * Return: QDF_STATUS |
| 21935 | */ |
| 21936 | static QDF_STATUS send_bss_color_change_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 21937 | uint32_t vdev_id, |
| 21938 | bool enable) |
| 21939 | { |
| 21940 | wmi_buf_t buf; |
| 21941 | wmi_bss_color_change_enable_fixed_param *cmd; |
| 21942 | uint8_t len = sizeof(wmi_bss_color_change_enable_fixed_param); |
| 21943 | |
| 21944 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21945 | if (!buf) { |
| 21946 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 21947 | return QDF_STATUS_E_NOMEM; |
| 21948 | } |
| 21949 | |
| 21950 | cmd = (wmi_bss_color_change_enable_fixed_param *)wmi_buf_data(buf); |
| 21951 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21952 | WMITLV_TAG_STRUC_wmi_bss_color_change_enable_fixed_param, |
| 21953 | WMITLV_GET_STRUCT_TLVLEN |
| 21954 | (wmi_bss_color_change_enable_fixed_param)); |
| 21955 | cmd->vdev_id = vdev_id; |
| 21956 | cmd->enable = enable; |
| 21957 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 21958 | WMI_BSS_COLOR_CHANGE_ENABLE_CMDID)) { |
| 21959 | WMI_LOGE("Failed to send WMI_BSS_COLOR_CHANGE_ENABLE_CMDID"); |
| 21960 | wmi_buf_free(buf); |
| 21961 | return QDF_STATUS_E_FAILURE; |
| 21962 | } |
| 21963 | |
| 21964 | return QDF_STATUS_SUCCESS; |
| 21965 | } |
| 21966 | |
| 21967 | /** |
| 21968 | * send_obss_color_collision_cfg_cmd_tlv() - send bss color detection |
| 21969 | * configurations to firmware. |
| 21970 | * @wmi_handle: wmi handle |
| 21971 | * @cfg_param: obss detection configurations |
| 21972 | * |
| 21973 | * Send WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID parameters to fw. |
| 21974 | * |
| 21975 | * Return: QDF_STATUS |
| 21976 | */ |
| 21977 | static QDF_STATUS send_obss_color_collision_cfg_cmd_tlv( |
| 21978 | wmi_unified_t wmi_handle, |
| 21979 | struct wmi_obss_color_collision_cfg_param *cfg_param) |
| 21980 | { |
| 21981 | wmi_buf_t buf; |
| 21982 | wmi_obss_color_collision_det_config_fixed_param *cmd; |
| 21983 | uint8_t len = sizeof(wmi_obss_color_collision_det_config_fixed_param); |
| 21984 | |
| 21985 | buf = wmi_buf_alloc(wmi_handle, len); |
| 21986 | if (!buf) { |
| 21987 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 21988 | return QDF_STATUS_E_NOMEM; |
| 21989 | } |
| 21990 | |
| 21991 | cmd = (wmi_obss_color_collision_det_config_fixed_param *)wmi_buf_data( |
| 21992 | buf); |
| 21993 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 21994 | WMITLV_TAG_STRUC_wmi_obss_color_collision_det_config_fixed_param, |
| 21995 | WMITLV_GET_STRUCT_TLVLEN |
| 21996 | (wmi_obss_color_collision_det_config_fixed_param)); |
| 21997 | cmd->vdev_id = cfg_param->vdev_id; |
| 21998 | cmd->flags = cfg_param->flags; |
| 21999 | cmd->current_bss_color = cfg_param->current_bss_color; |
| 22000 | cmd->detection_period_ms = cfg_param->detection_period_ms; |
| 22001 | cmd->scan_period_ms = cfg_param->scan_period_ms; |
| 22002 | cmd->free_slot_expiry_time_ms = cfg_param->free_slot_expiry_time_ms; |
| 22003 | |
| 22004 | switch (cfg_param->evt_type) { |
| 22005 | case OBSS_COLOR_COLLISION_DETECTION_DISABLE: |
| 22006 | cmd->evt_type = WMI_BSS_COLOR_COLLISION_DISABLE; |
| 22007 | break; |
| 22008 | case OBSS_COLOR_COLLISION_DETECTION: |
| 22009 | cmd->evt_type = WMI_BSS_COLOR_COLLISION_DETECTION; |
| 22010 | break; |
| 22011 | case OBSS_COLOR_FREE_SLOT_TIMER_EXPIRY: |
| 22012 | cmd->evt_type = WMI_BSS_COLOR_FREE_SLOT_TIMER_EXPIRY; |
| 22013 | break; |
| 22014 | case OBSS_COLOR_FREE_SLOT_AVAILABLE: |
| 22015 | cmd->evt_type = WMI_BSS_COLOR_FREE_SLOT_AVAILABLE; |
| 22016 | break; |
| 22017 | default: |
| 22018 | WMI_LOGE("%s: invalid event type: %d", |
| 22019 | __func__, cfg_param->evt_type); |
| 22020 | wmi_buf_free(buf); |
| 22021 | return QDF_STATUS_E_FAILURE; |
| 22022 | } |
| 22023 | |
| 22024 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 22025 | WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID)) { |
| 22026 | WMI_LOGE("%s: Sending OBSS color det cmd failed, vdev_id: %d", |
| 22027 | __func__, cfg_param->vdev_id); |
| 22028 | wmi_buf_free(buf); |
| 22029 | return QDF_STATUS_E_FAILURE; |
| 22030 | } |
| 22031 | |
| 22032 | return QDF_STATUS_SUCCESS; |
| 22033 | } |
| 22034 | |
| 22035 | /** |
| 22036 | * extract_obss_color_collision_info_tlv() - Extract bss color collision info |
| 22037 | * received from firmware. |
| 22038 | * @evt_buf: pointer to event buffer |
| 22039 | * @info: Pointer to hold bss collision info |
| 22040 | * |
| 22041 | * Return: QDF_STATUS |
| 22042 | */ |
| 22043 | static QDF_STATUS extract_obss_color_collision_info_tlv(uint8_t *evt_buf, |
| 22044 | struct wmi_obss_color_collision_info *info) |
| 22045 | { |
| 22046 | WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID_param_tlvs *param_buf; |
| 22047 | wmi_obss_color_collision_evt_fixed_param *fix_param; |
| 22048 | |
| 22049 | if (!info) { |
| 22050 | WMI_LOGE("%s: Invalid obss color buffer", __func__); |
| 22051 | return QDF_STATUS_E_INVAL; |
| 22052 | } |
| 22053 | |
| 22054 | param_buf = (WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID_param_tlvs *) |
| 22055 | evt_buf; |
| 22056 | if (!param_buf) { |
| 22057 | WMI_LOGE("%s: Invalid evt_buf", __func__); |
| 22058 | return QDF_STATUS_E_INVAL; |
| 22059 | } |
| 22060 | |
| 22061 | fix_param = param_buf->fixed_param; |
| 22062 | info->vdev_id = fix_param->vdev_id; |
| 22063 | info->obss_color_bitmap_bit0to31 = fix_param->bss_color_bitmap_bit0to31; |
| 22064 | info->obss_color_bitmap_bit32to63 = |
| 22065 | fix_param->bss_color_bitmap_bit32to63; |
| 22066 | |
| 22067 | switch (fix_param->evt_type) { |
| 22068 | case WMI_BSS_COLOR_COLLISION_DISABLE: |
| 22069 | info->evt_type = OBSS_COLOR_COLLISION_DETECTION_DISABLE; |
| 22070 | break; |
| 22071 | case WMI_BSS_COLOR_COLLISION_DETECTION: |
| 22072 | info->evt_type = OBSS_COLOR_COLLISION_DETECTION; |
| 22073 | break; |
| 22074 | case WMI_BSS_COLOR_FREE_SLOT_TIMER_EXPIRY: |
| 22075 | info->evt_type = OBSS_COLOR_FREE_SLOT_TIMER_EXPIRY; |
| 22076 | break; |
| 22077 | case WMI_BSS_COLOR_FREE_SLOT_AVAILABLE: |
| 22078 | info->evt_type = OBSS_COLOR_FREE_SLOT_AVAILABLE; |
| 22079 | break; |
| 22080 | default: |
| 22081 | WMI_LOGE("%s: invalid event type: %d, vdev_id: %d", |
| 22082 | __func__, fix_param->evt_type, fix_param->vdev_id); |
| 22083 | return QDF_STATUS_E_FAILURE; |
| 22084 | } |
| 22085 | |
| 22086 | return QDF_STATUS_SUCCESS; |
| 22087 | } |
| 22088 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22089 | struct wmi_ops tlv_ops = { |
| 22090 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 22091 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 22092 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 22093 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 22094 | .send_hidden_ssid_vdev_restart_cmd = |
| 22095 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22096 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 22097 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 22098 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 22099 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22100 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 22101 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 22102 | .send_peer_rx_reorder_queue_setup_cmd = |
| 22103 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 22104 | .send_peer_rx_reorder_queue_remove_cmd = |
| 22105 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 22106 | .send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv, |
| 22107 | .send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv, |
| 22108 | .send_peer_update_wds_entry_cmd = send_peer_update_wds_entry_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22109 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 22110 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
Shaakir Mohamed | 75208c3 | 2018-02-15 14:30:21 -0800 | [diff] [blame] | 22111 | .send_pdev_get_tpc_config_cmd = send_pdev_get_tpc_config_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22112 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 22113 | .send_resume_cmd = send_resume_cmd_tlv, |
Will Huang | 422ac9a | 2017-11-17 13:19:16 +0800 | [diff] [blame] | 22114 | #ifdef FEATURE_WLAN_D0WOW |
| 22115 | .send_d0wow_enable_cmd = send_d0wow_enable_cmd_tlv, |
| 22116 | .send_d0wow_disable_cmd = send_d0wow_disable_cmd_tlv, |
| 22117 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22118 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 22119 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 22120 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 22121 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 22122 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 22123 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 22124 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 22125 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
gaurank kathpalia | cdfb445 | 2018-02-21 18:58:29 +0530 | [diff] [blame] | 22126 | .send_time_stamp_sync_cmd = send_time_stamp_sync_cmd_tlv, |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 22127 | .send_packet_log_disable_cmd = send_packet_log_disable_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22128 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 22129 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22130 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 22131 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 22132 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 22133 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 22134 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 22135 | .send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 22136 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 22137 | .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] | 22138 | .send_set_sta_uapsd_auto_trig_cmd = |
| 22139 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 22140 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 22141 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 22142 | .send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 22143 | #ifdef CONVERGED_P2P_ENABLE |
| 22144 | .send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv, |
| 22145 | .send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv, |
| 22146 | #endif |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 22147 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 22148 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 22149 | #ifdef WLAN_FEATURE_DSRC |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 22150 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 22151 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 22152 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 22153 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 22154 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 22155 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 22156 | .send_ocb_stop_timing_advert_cmd = send_ocb_stop_timing_advert_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 22157 | .send_ocb_start_timing_advert_cmd = |
| 22158 | send_ocb_start_timing_advert_cmd_tlv, |
Zhang Qian | 11c0de3 | 2018-01-05 16:50:53 +0800 | [diff] [blame] | 22159 | .extract_ocb_chan_config_resp = extract_ocb_channel_config_resp_tlv, |
| 22160 | .extract_ocb_tsf_timer = extract_ocb_tsf_timer_tlv, |
| 22161 | .extract_dcc_update_ndl_resp = extract_ocb_ndl_resp_tlv, |
| 22162 | .extract_dcc_stats = extract_ocb_dcc_stats_tlv, |
| 22163 | #endif |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 22164 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 22165 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 22166 | .send_set_mcc_channel_time_latency_cmd = |
| 22167 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 22168 | .send_set_mcc_channel_time_quota_cmd = |
| 22169 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 22170 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 22171 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 22172 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 22173 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 22174 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 22175 | .send_vdev_set_gtx_cfg_cmd = send_vdev_set_gtx_cfg_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 22176 | .send_probe_rsp_tmpl_send_cmd = |
| 22177 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 22178 | .send_p2p_go_set_beacon_ie_cmd = |
| 22179 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 22180 | .send_setup_install_key_cmd = |
| 22181 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 22182 | .send_set_gateway_params_cmd = |
| 22183 | send_set_gateway_params_cmd_tlv, |
| 22184 | .send_set_rssi_monitoring_cmd = |
| 22185 | send_set_rssi_monitoring_cmd_tlv, |
| 22186 | .send_scan_probe_setoui_cmd = |
| 22187 | send_scan_probe_setoui_cmd_tlv, |
| 22188 | .send_reset_passpoint_network_list_cmd = |
| 22189 | send_reset_passpoint_network_list_cmd_tlv, |
| 22190 | .send_set_passpoint_network_list_cmd = |
| 22191 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 22192 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 22193 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 22194 | .send_roam_mawc_params_cmd = send_roam_mawc_params_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 22195 | .send_roam_scan_filter_cmd = |
| 22196 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 22197 | .send_set_epno_network_list_cmd = |
| 22198 | send_set_epno_network_list_cmd_tlv, |
| 22199 | .send_ipa_offload_control_cmd = |
| 22200 | send_ipa_offload_control_cmd_tlv, |
| 22201 | .send_extscan_get_capabilities_cmd = |
| 22202 | send_extscan_get_capabilities_cmd_tlv, |
| 22203 | .send_extscan_get_cached_results_cmd = |
| 22204 | send_extscan_get_cached_results_cmd_tlv, |
| 22205 | .send_extscan_stop_change_monitor_cmd = |
| 22206 | send_extscan_stop_change_monitor_cmd_tlv, |
| 22207 | .send_extscan_start_change_monitor_cmd = |
| 22208 | send_extscan_start_change_monitor_cmd_tlv, |
| 22209 | .send_extscan_stop_hotlist_monitor_cmd = |
| 22210 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 22211 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 22212 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 22213 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 22214 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 22215 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
| 22216 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 22217 | .send_nlo_mawc_cmd = send_nlo_mawc_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 22218 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 22219 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 22220 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 22221 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 22222 | .send_congestion_cmd = send_congestion_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22223 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 22224 | .send_snr_cmd = send_snr_cmd_tlv, |
| 22225 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 22226 | #ifdef WLAN_PMO_ENABLE |
| 22227 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 22228 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 22229 | .send_enable_arp_ns_offload_cmd = send_enable_arp_ns_offload_cmd_tlv, |
| 22230 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
Poddar, Siddarth | 79ba820 | 2017-09-28 17:14:01 +0530 | [diff] [blame] | 22231 | .send_multiple_add_clear_mcbc_filter_cmd = |
| 22232 | send_multiple_add_clear_mcbc_filter_cmd_tlv, |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 22233 | .send_conf_hw_filter_cmd = send_conf_hw_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 22234 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 22235 | .send_process_gtk_offload_getinfo_cmd = |
| 22236 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 22237 | .send_enable_enhance_multicast_offload_cmd = |
| 22238 | send_enable_enhance_multicast_offload_tlv, |
| 22239 | .extract_gtk_rsp_event = extract_gtk_rsp_event_tlv, |
| 22240 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 22241 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
| 22242 | #endif |
| 22243 | .send_action_frame_patterns_cmd = send_action_frame_patterns_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22244 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 22245 | .send_lphb_config_tcp_params_cmd = send_lphb_config_tcp_params_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 22246 | .send_lphb_config_tcp_pkt_filter_cmd = |
| 22247 | send_lphb_config_tcp_pkt_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22248 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 22249 | .send_lphb_config_udp_pkt_filter_cmd = |
| 22250 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame] | 22251 | .send_enable_disable_packet_filter_cmd = |
| 22252 | send_enable_disable_packet_filter_cmd_tlv, |
| 22253 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 22254 | #endif /* End of WLAN_PMO_ENABLE */ |
| 22255 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22256 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 22257 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 22258 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 22259 | .send_roam_scan_offload_mode_cmd = |
| 22260 | send_roam_scan_offload_mode_cmd_tlv, |
| 22261 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 22262 | .send_roam_scan_offload_ap_profile_cmd = |
| 22263 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 22264 | #endif |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 22265 | #ifdef WLAN_SUPPORT_GREEN_AP |
| 22266 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
| 22267 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
Himanshu Agarwal | 157e478 | 2018-01-24 22:24:17 +0530 | [diff] [blame] | 22268 | .extract_green_ap_egap_status_info = |
| 22269 | extract_green_ap_egap_status_info_tlv, |
Himanshu Agarwal | 66d4a16 | 2018-01-10 14:21:53 +0530 | [diff] [blame] | 22270 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22271 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 22272 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22273 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
Paul Zhang | 92ab8d3 | 2017-12-08 16:08:00 +0800 | [diff] [blame] | 22274 | .send_wlm_latency_level_cmd = send_wlm_latency_level_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22275 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 22276 | #ifdef WLAN_FEATURE_CIF_CFR |
| 22277 | .send_oem_dma_cfg_cmd = send_oem_dma_cfg_cmd_tlv, |
| 22278 | #endif |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 22279 | .send_dbr_cfg_cmd = send_dbr_cfg_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22280 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 22281 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22282 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 22283 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 22284 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 22285 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 22286 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22287 | .send_process_add_periodic_tx_ptrn_cmd = |
| 22288 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 22289 | .send_process_del_periodic_tx_ptrn_cmd = |
| 22290 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 22291 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 22292 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 22293 | .send_set_app_type2_params_in_fw_cmd = |
| 22294 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 22295 | .send_set_auto_shutdown_timer_cmd = |
| 22296 | send_set_auto_shutdown_timer_cmd_tlv, |
| 22297 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 22298 | .send_process_dhcpserver_offload_cmd = |
| 22299 | send_process_dhcpserver_offload_cmd_tlv, |
| 22300 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 22301 | .send_process_ch_avoid_update_cmd = |
| 22302 | send_process_ch_avoid_update_cmd_tlv, |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 22303 | .send_pdev_set_regdomain_cmd = |
| 22304 | send_pdev_set_regdomain_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22305 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 22306 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 22307 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 22308 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 22309 | .send_process_set_ie_info_cmd = send_process_set_ie_info_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 22310 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22311 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 22312 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 22313 | .send_set_base_macaddr_indicate_cmd = |
| 22314 | send_set_base_macaddr_indicate_cmd_tlv, |
| 22315 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 22316 | .send_enable_specific_fw_logs_cmd = |
| 22317 | send_enable_specific_fw_logs_cmd_tlv, |
| 22318 | .send_flush_logs_to_fw_cmd = send_flush_logs_to_fw_cmd_tlv, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 22319 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 22320 | .send_pdev_set_hw_mode_cmd = send_pdev_set_hw_mode_cmd_tlv, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 22321 | .send_pdev_set_dual_mac_config_cmd = |
| 22322 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 22323 | .send_app_type1_params_in_fw_cmd = |
| 22324 | send_app_type1_params_in_fw_cmd_tlv, |
| 22325 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 22326 | .send_process_roam_synch_complete_cmd = |
| 22327 | send_process_roam_synch_complete_cmd_tlv, |
| 22328 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 22329 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 22330 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 22331 | .send_roam_scan_offload_scan_period_cmd = |
| 22332 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 22333 | .send_roam_scan_offload_chan_list_cmd = |
| 22334 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 22335 | .send_roam_scan_offload_rssi_change_cmd = |
| 22336 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 22337 | .send_get_buf_extscan_hotlist_cmd = |
| 22338 | send_get_buf_extscan_hotlist_cmd_tlv, |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 22339 | .send_set_active_bpf_mode_cmd = send_set_active_bpf_mode_cmd_tlv, |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 22340 | .send_adapt_dwelltime_params_cmd = |
| 22341 | send_adapt_dwelltime_params_cmd_tlv, |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 22342 | .send_dbs_scan_sel_params_cmd = |
| 22343 | send_dbs_scan_sel_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22344 | .init_cmd_send = init_cmd_send_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 22345 | .send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv, |
| 22346 | .send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv, |
| 22347 | .send_set_ctl_table_cmd = send_set_ctl_table_cmd_tlv, |
| 22348 | .send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv, |
| 22349 | .send_packet_power_info_get_cmd = send_packet_power_info_get_cmd_tlv, |
| 22350 | .send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv, |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 22351 | .send_vdev_set_custom_aggr_size_cmd = |
| 22352 | send_vdev_set_custom_aggr_size_cmd_tlv, |
Venkateswara Swamy Bandaru | 9983ac5 | 2017-12-22 17:16:19 +0530 | [diff] [blame] | 22353 | .send_vdev_set_qdepth_thresh_cmd = |
| 22354 | send_vdev_set_qdepth_thresh_cmd_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 22355 | .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, |
| 22356 | .send_vdev_set_neighbour_rx_cmd = send_vdev_set_neighbour_rx_cmd_tlv, |
| 22357 | .send_smart_ant_set_tx_ant_cmd = send_smart_ant_set_tx_ant_cmd_tlv, |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 22358 | .send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv, |
| 22359 | .send_smart_ant_set_training_info_cmd = |
| 22360 | send_smart_ant_set_training_info_cmd_tlv, |
| 22361 | .send_smart_ant_set_node_config_cmd = |
| 22362 | send_smart_ant_set_node_config_cmd_tlv, |
| 22363 | .send_set_atf_cmd = send_set_atf_cmd_tlv, |
| 22364 | .send_vdev_set_fwtest_param_cmd = send_vdev_set_fwtest_param_cmd_tlv, |
| 22365 | .send_set_qboost_param_cmd = send_set_qboost_param_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 22366 | .send_gpio_config_cmd = send_gpio_config_cmd_tlv, |
| 22367 | .send_gpio_output_cmd = send_gpio_output_cmd_tlv, |
| 22368 | .send_phyerr_disable_cmd = send_phyerr_disable_cmd_tlv, |
| 22369 | .send_phyerr_enable_cmd = send_phyerr_enable_cmd_tlv, |
Sathish Kumar | 0ff69e4 | 2017-11-02 10:44:39 +0530 | [diff] [blame] | 22370 | .send_periodic_chan_stats_config_cmd = |
| 22371 | send_periodic_chan_stats_config_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 22372 | .send_nf_dbr_dbm_info_get_cmd = send_nf_dbr_dbm_info_get_cmd_tlv, |
| 22373 | .send_set_ht_ie_cmd = send_set_ht_ie_cmd_tlv, |
| 22374 | .send_set_vht_ie_cmd = send_set_vht_ie_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 22375 | .send_set_quiet_mode_cmd = send_set_quiet_mode_cmd_tlv, |
| 22376 | .send_set_bwf_cmd = send_set_bwf_cmd_tlv, |
| 22377 | .send_mcast_group_update_cmd = send_mcast_group_update_cmd_tlv, |
| 22378 | .send_vdev_spectral_configure_cmd = |
| 22379 | send_vdev_spectral_configure_cmd_tlv, |
| 22380 | .send_vdev_spectral_enable_cmd = |
| 22381 | send_vdev_spectral_enable_cmd_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 22382 | .send_thermal_mitigation_param_cmd = |
| 22383 | send_thermal_mitigation_param_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 22384 | .send_pdev_qvit_cmd = send_pdev_qvit_cmd_tlv, |
| 22385 | .send_wmm_update_cmd = send_wmm_update_cmd_tlv, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 22386 | .send_process_update_edca_param_cmd = |
| 22387 | send_process_update_edca_param_cmd_tlv, |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 22388 | .send_coex_config_cmd = send_coex_config_cmd_tlv, |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 22389 | .send_set_country_cmd = send_set_country_cmd_tlv, |
Kiran Venkatappa | 7fe3afc | 2017-11-08 19:32:23 +0530 | [diff] [blame] | 22390 | .send_bcn_offload_control_cmd = send_bcn_offload_control_cmd_tlv, |
Gyanranjan Hazarika | 3f3b471 | 2018-01-12 13:27:43 -0800 | [diff] [blame] | 22391 | .send_addba_send_cmd = send_addba_send_cmd_tlv, |
| 22392 | .send_delba_send_cmd = send_delba_send_cmd_tlv, |
Gyanranjan Hazarika | cd535f9 | 2018-01-17 19:29:45 -0800 | [diff] [blame] | 22393 | .send_addba_clearresponse_cmd = send_addba_clearresponse_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22394 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 22395 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 22396 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 22397 | .save_service_bitmap = save_service_bitmap_tlv, |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 22398 | .save_ext_service_bitmap = save_ext_service_bitmap_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22399 | .is_service_enabled = is_service_enabled_tlv, |
| 22400 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 22401 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 22402 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 22403 | .ready_extract_mac_addr_list = ready_extract_mac_addr_list_tlv, |
Kiran Venkatappa | 094c24f | 2017-11-10 20:50:12 +0530 | [diff] [blame] | 22404 | .extract_ready_event_params = extract_ready_event_params_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22405 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 22406 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
Om Prakash Tripathi | f3ef42d | 2017-11-24 16:53:07 +0530 | [diff] [blame] | 22407 | .extract_vdev_delete_resp = extract_vdev_delete_resp_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22408 | .extract_tbttoffset_update_params = |
| 22409 | extract_tbttoffset_update_params_tlv, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 22410 | .extract_ext_tbttoffset_update_params = |
| 22411 | extract_ext_tbttoffset_update_params_tlv, |
| 22412 | .extract_tbttoffset_num_vdevs = |
| 22413 | extract_tbttoffset_num_vdevs_tlv, |
| 22414 | .extract_ext_tbttoffset_num_vdevs = |
| 22415 | extract_ext_tbttoffset_num_vdevs_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22416 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 22417 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 22418 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 22419 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 22420 | #ifdef CONVERGED_TDLS_ENABLE |
| 22421 | .extract_vdev_tdls_ev_param = extract_vdev_tdls_ev_param_tlv, |
| 22422 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22423 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 22424 | .extract_swba_num_vdevs = extract_swba_num_vdevs_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22425 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 22426 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 22427 | #ifdef CONVERGED_P2P_ENABLE |
| 22428 | .extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv, |
| 22429 | .extract_p2p_lo_stop_ev_param = |
| 22430 | extract_p2p_lo_stop_ev_param_tlv, |
| 22431 | #endif |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 22432 | .extract_offchan_data_tx_compl_param = |
| 22433 | extract_offchan_data_tx_compl_param_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22434 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 22435 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 22436 | .extract_pdev_stats = extract_pdev_stats_tlv, |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 22437 | .extract_unit_test = extract_unit_test_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22438 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 22439 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 22440 | .extract_peer_stats = extract_peer_stats_tlv, |
Gurumoorthi Gnanasambandhan | b5fb836 | 2017-11-06 22:04:17 +0530 | [diff] [blame] | 22441 | .extract_bcn_stats = extract_bcn_stats_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22442 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 22443 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 22444 | .extract_chan_stats = extract_chan_stats_tlv, |
| 22445 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 22446 | .extract_profile_data = extract_profile_data_tlv, |
| 22447 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 22448 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 22449 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Nachiket Kukade | 03e7ab2 | 2017-12-20 17:28:29 +0530 | [diff] [blame] | 22450 | #ifdef WLAN_FEATURE_DISA |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 22451 | .send_encrypt_decrypt_send_cmd = |
| 22452 | send_encrypt_decrypt_send_cmd_tlv, |
Nachiket Kukade | 03e7ab2 | 2017-12-20 17:28:29 +0530 | [diff] [blame] | 22453 | .extract_encrypt_decrypt_resp_event = |
| 22454 | extract_encrypt_decrypt_resp_event_tlv, |
| 22455 | #endif |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 22456 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Jeff Johnson | 4783f90 | 2017-12-14 15:50:16 -0800 | [diff] [blame] | 22457 | .get_sar_limit_cmd = get_sar_limit_cmd_tlv, |
| 22458 | .extract_sar_limit_event = extract_sar_limit_event_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 22459 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 22460 | .send_multiple_vdev_restart_req_cmd = |
| 22461 | send_multiple_vdev_restart_req_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 22462 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 22463 | .extract_hw_mode_cap_service_ready_ext = |
| 22464 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 22465 | .extract_mac_phy_cap_service_ready_ext = |
| 22466 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 22467 | .extract_reg_cap_service_ready_ext = |
| 22468 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 22469 | .extract_dbr_ring_cap_service_ready_ext = |
| 22470 | extract_dbr_ring_cap_service_ready_ext_tlv, |
| 22471 | .extract_dbr_buf_release_fixed = extract_dbr_buf_release_fixed_tlv, |
| 22472 | .extract_dbr_buf_release_entry = extract_dbr_buf_release_entry_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 22473 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 22474 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 22475 | .extract_dcs_interference_type = extract_dcs_interference_type_tlv, |
| 22476 | .extract_dcs_cw_int = extract_dcs_cw_int_tlv, |
| 22477 | .extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 22478 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 22479 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 22480 | .extract_peer_delete_response_event = |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 22481 | extract_peer_delete_response_event_tlv, |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 22482 | .is_management_record = is_management_record_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 22483 | .extract_pdev_csa_switch_count_status = |
| 22484 | extract_pdev_csa_switch_count_status_tlv, |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 22485 | .extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv, |
Shaakir Mohamed | 75208c3 | 2018-02-15 14:30:21 -0800 | [diff] [blame] | 22486 | .extract_pdev_tpc_config_ev_param = |
| 22487 | extract_pdev_tpc_config_ev_param_tlv, |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 22488 | .extract_wds_addr_event = extract_wds_addr_event_tlv, |
| 22489 | .extract_peer_sta_ps_statechange_ev = |
| 22490 | extract_peer_sta_ps_statechange_ev_tlv, |
| 22491 | .extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv, |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 22492 | .send_per_roam_config_cmd = send_per_roam_config_cmd_tlv, |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 22493 | .send_dfs_phyerr_offload_en_cmd = send_dfs_phyerr_offload_en_cmd_tlv, |
| 22494 | .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] | 22495 | .extract_reg_chan_list_update_event = |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 22496 | extract_reg_chan_list_update_event_tlv, |
| 22497 | .extract_chainmask_tables = |
| 22498 | extract_chainmask_tables_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 22499 | .extract_thermal_stats = extract_thermal_stats_tlv, |
| 22500 | .extract_thermal_level_stats = extract_thermal_level_stats_tlv, |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 22501 | .send_get_rcpi_cmd = send_get_rcpi_cmd_tlv, |
| 22502 | .extract_rcpi_response_event = extract_rcpi_response_event_tlv, |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 22503 | #ifdef DFS_COMPONENT_ENABLE |
| 22504 | .extract_dfs_cac_complete_event = extract_dfs_cac_complete_event_tlv, |
| 22505 | .extract_dfs_radar_detection_event = |
| 22506 | extract_dfs_radar_detection_event_tlv, |
bings | 1ea1253 | 2017-12-18 16:56:53 +0800 | [diff] [blame] | 22507 | .extract_wlan_radar_event_info = extract_wlan_radar_event_info_tlv, |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 22508 | #endif |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 22509 | .convert_pdev_id_host_to_target = |
| 22510 | convert_host_pdev_id_to_target_pdev_id_legacy, |
| 22511 | .convert_pdev_id_target_to_host = |
| 22512 | convert_target_pdev_id_to_host_pdev_id_legacy, |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 22513 | |
| 22514 | .send_start_11d_scan_cmd = send_start_11d_scan_cmd_tlv, |
| 22515 | .send_stop_11d_scan_cmd = send_stop_11d_scan_cmd_tlv, |
| 22516 | .extract_reg_11d_new_country_event = |
| 22517 | extract_reg_11d_new_country_event_tlv, |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 22518 | .send_user_country_code_cmd = send_user_country_code_cmd_tlv, |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 22519 | .send_limit_off_chan_cmd = |
| 22520 | send_limit_off_chan_cmd_tlv, |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 22521 | .extract_reg_ch_avoid_event = |
| 22522 | extract_reg_ch_avoid_event_tlv, |
Balamurugan Mahalingam | f209829 | 2017-10-26 15:14:57 +0530 | [diff] [blame] | 22523 | .send_pdev_caldata_version_check_cmd = |
| 22524 | send_pdev_caldata_version_check_cmd_tlv, |
| 22525 | .extract_pdev_caldata_version_check_ev_param = |
| 22526 | extract_pdev_caldata_version_check_ev_param_tlv, |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 22527 | .send_set_arp_stats_req_cmd = send_set_arp_stats_req_cmd_tlv, |
| 22528 | .send_get_arp_stats_req_cmd = send_get_arp_stats_req_cmd_tlv, |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 22529 | .send_set_del_pmkid_cache_cmd = send_set_del_pmkid_cache_cmd_tlv, |
| 22530 | #if defined(WLAN_FEATURE_FILS_SK) |
| 22531 | .send_roam_scan_hlp_cmd = send_roam_scan_send_hlp_cmd_tlv, |
| 22532 | #endif |
Naveen Rawat | a5817e7 | 2017-10-26 18:50:19 -0700 | [diff] [blame] | 22533 | .send_wow_timer_pattern_cmd = send_wow_timer_pattern_cmd_tlv, |
Naveen Rawat | 4f1e2ac | 2017-12-14 13:24:31 -0800 | [diff] [blame] | 22534 | #ifdef WLAN_FEATURE_NAN_CONVERGENCE |
| 22535 | .send_ndp_initiator_req_cmd = nan_ndp_initiator_req_tlv, |
| 22536 | .send_ndp_responder_req_cmd = nan_ndp_responder_req_tlv, |
| 22537 | .send_ndp_end_req_cmd = nan_ndp_end_req_tlv, |
| 22538 | .extract_ndp_initiator_rsp = extract_ndp_initiator_rsp_tlv, |
| 22539 | .extract_ndp_ind = extract_ndp_ind_tlv, |
| 22540 | .extract_ndp_confirm = extract_ndp_confirm_tlv, |
| 22541 | .extract_ndp_responder_rsp = extract_ndp_responder_rsp_tlv, |
| 22542 | .extract_ndp_end_rsp = extract_ndp_end_rsp_tlv, |
| 22543 | .extract_ndp_end_ind = extract_ndp_end_ind_tlv, |
| 22544 | #endif |
yeshwanth sriram guntuka | 07a15b8 | 2017-09-01 17:56:07 +0530 | [diff] [blame] | 22545 | .send_btm_config = send_btm_config_cmd_tlv, |
Arif Hussain | c5bfe07 | 2017-12-27 16:23:45 -0800 | [diff] [blame] | 22546 | .send_obss_detection_cfg_cmd = send_obss_detection_cfg_cmd_tlv, |
Arif Hussain | 33d9850 | 2018-01-12 13:15:04 -0800 | [diff] [blame] | 22547 | .extract_obss_detection_info = extract_obss_detection_info_tlv, |
Subrat Mishra | d7c7a56 | 2017-09-27 14:41:20 +0530 | [diff] [blame] | 22548 | #ifdef WLAN_SUPPORT_FILS |
| 22549 | .send_vdev_fils_enable_cmd = send_vdev_fils_enable_cmd_tlv, |
| 22550 | .extract_swfda_vdev_id = extract_swfda_vdev_id_tlv, |
| 22551 | .send_fils_discovery_send_cmd = send_fils_discovery_send_cmd_tlv, |
| 22552 | #endif /* WLAN_SUPPORT_FILS */ |
Vignesh Viswanathan | 7f05777 | 2018-01-18 19:06:40 +0530 | [diff] [blame] | 22553 | .send_offload_11k_cmd = send_offload_11k_cmd_tlv, |
| 22554 | .send_invoke_neighbor_report_cmd = send_invoke_neighbor_report_cmd_tlv, |
Pratik Gandhi | 67da1bb | 2018-01-30 19:05:41 +0530 | [diff] [blame] | 22555 | .wmi_pdev_id_conversion_enable = wmi_tlv_pdev_id_conversion_enable, |
| 22556 | .wmi_free_allocated_event = wmitlv_free_allocated_event_tlvs, |
| 22557 | .wmi_check_and_pad_event = wmitlv_check_and_pad_event_tlvs, |
| 22558 | .wmi_check_command_params = wmitlv_check_command_tlv_params, |
Arif Hussain | ec5cd3c | 2018-01-22 01:19:36 -0800 | [diff] [blame] | 22559 | .send_bss_color_change_enable_cmd = |
| 22560 | send_bss_color_change_enable_cmd_tlv, |
| 22561 | .send_obss_color_collision_cfg_cmd = |
| 22562 | send_obss_color_collision_cfg_cmd_tlv, |
| 22563 | .extract_obss_color_collision_info = |
| 22564 | extract_obss_color_collision_info_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 22565 | }; |
| 22566 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22567 | /** |
| 22568 | * populate_tlv_event_id() - populates wmi event ids |
| 22569 | * |
| 22570 | * @param event_ids: Pointer to hold event ids |
| 22571 | * Return: None |
| 22572 | */ |
| 22573 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 22574 | { |
| 22575 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 22576 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 22577 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 22578 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 22579 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 22580 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 22581 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 22582 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 22583 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 22584 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 22585 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 22586 | event_ids[wmi_service_ready_ext_event_id] = |
| 22587 | WMI_SERVICE_READY_EXT_EVENTID; |
| 22588 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 22589 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 22590 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 22591 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 22592 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 22593 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 22594 | |
| 22595 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 22596 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 22597 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 22598 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 22599 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 22600 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 22601 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 22602 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 22603 | event_ids[wmi_peer_delete_response_event_id] = |
| 22604 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22605 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 22606 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 22607 | event_ids[wmi_tbttoffset_update_event_id] = |
| 22608 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 22609 | event_ids[wmi_ext_tbttoffset_update_event_id] = |
| 22610 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22611 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 22612 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 22613 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 22614 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 22615 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 22616 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 22617 | |
| 22618 | event_ids[wmi_tx_delba_complete_event_id] = |
| 22619 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 22620 | event_ids[wmi_tx_addba_complete_event_id] = |
| 22621 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 22622 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 22623 | |
| 22624 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 22625 | |
| 22626 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 22627 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 22628 | |
| 22629 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
Padma, Santhosh Kumar | 9b21b05 | 2017-10-06 15:42:00 +0530 | [diff] [blame] | 22630 | 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] | 22631 | |
| 22632 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 22633 | |
| 22634 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
Wu Gao | 84ed340 | 2017-03-15 19:12:20 +0800 | [diff] [blame] | 22635 | event_ids[wmi_p2p_lo_stop_event_id] = |
| 22636 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22637 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 22638 | 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] | 22639 | event_ids[wmi_d0_wow_disable_ack_event_id] = |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22640 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 22641 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 22642 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 22643 | |
| 22644 | event_ids[wmi_rtt_meas_report_event_id] = |
| 22645 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 22646 | event_ids[wmi_tsf_meas_report_event_id] = |
| 22647 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 22648 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 22649 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 22650 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 22651 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 22652 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22653 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 22654 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 22655 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 22656 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 22657 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 22658 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 22659 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 22660 | |
| 22661 | event_ids[wmi_gtk_offload_status_event_id] = |
| 22662 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 22663 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 22664 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 22665 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 22666 | |
| 22667 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 22668 | |
| 22669 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 22670 | |
| 22671 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 22672 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 22673 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 22674 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 22675 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 22676 | event_ids[wmi_wlan_profile_data_event_id] = |
| 22677 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 22678 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 22679 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 22680 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 22681 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 22682 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 22683 | |
| 22684 | event_ids[wmi_diag_container_event_id] = |
| 22685 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 22686 | |
| 22687 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 22688 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 22689 | |
| 22690 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 22691 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 22692 | |
| 22693 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 22694 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 22695 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 22696 | |
| 22697 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
Adil Saeed Musthafa | d280596 | 2017-08-23 17:32:11 -0700 | [diff] [blame] | 22698 | event_ids[wmi_unit_test_event_id] = WMI_UNIT_TEST_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22699 | |
| 22700 | /** Set OCB Sched Response, deprecated */ |
| 22701 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 22702 | |
| 22703 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 22704 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 22705 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 22706 | |
| 22707 | /* GPIO Event */ |
| 22708 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 22709 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 22710 | |
| 22711 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 22712 | event_ids[wmi_rfkill_state_change_event_id] = |
| 22713 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 22714 | |
| 22715 | /* TDLS Event */ |
| 22716 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 22717 | |
| 22718 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 22719 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 22720 | event_ids[wmi_batch_scan_result_event_id] = |
| 22721 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 22722 | /* OEM Event */ |
| 22723 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 22724 | event_ids[wmi_oem_meas_report_event_id] = |
| 22725 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 22726 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 22727 | |
| 22728 | /* NAN Event */ |
| 22729 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 22730 | |
| 22731 | /* LPI Event */ |
| 22732 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 22733 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 22734 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 22735 | |
| 22736 | /* ExtScan events */ |
| 22737 | event_ids[wmi_extscan_start_stop_event_id] = |
| 22738 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 22739 | event_ids[wmi_extscan_operation_event_id] = |
| 22740 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 22741 | event_ids[wmi_extscan_table_usage_event_id] = |
| 22742 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 22743 | event_ids[wmi_extscan_cached_results_event_id] = |
| 22744 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 22745 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 22746 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 22747 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 22748 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 22749 | event_ids[wmi_extscan_capabilities_event_id] = |
| 22750 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 22751 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 22752 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 22753 | |
| 22754 | /* mDNS offload events */ |
| 22755 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 22756 | |
| 22757 | /* SAP Authentication offload events */ |
| 22758 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 22759 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 22760 | |
| 22761 | /** Out-of-context-of-bss (OCB) events */ |
| 22762 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 22763 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 22764 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 22765 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 22766 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 22767 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 22768 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 22769 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 22770 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 22771 | /* System-On-Chip events */ |
| 22772 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 22773 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 22774 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 22775 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 22776 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 22777 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 22778 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 22779 | event_ids[wmi_pdev_csa_switch_count_status_event_id] = |
| 22780 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID; |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 22781 | 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] | 22782 | event_ids[wmi_inst_rssi_stats_event_id] = WMI_INST_RSSI_STATS_EVENTID; |
| 22783 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 22784 | event_ids[wmi_peer_sta_ps_statechg_event_id] = |
| 22785 | WMI_PEER_STA_PS_STATECHG_EVENTID; |
| 22786 | event_ids[wmi_pdev_channel_hopping_event_id] = |
| 22787 | WMI_PDEV_CHANNEL_HOPPING_EVENTID; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 22788 | event_ids[wmi_offchan_data_tx_completion_event] = |
| 22789 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 22790 | event_ids[wmi_dfs_cac_complete_id] = WMI_VDEV_DFS_CAC_COMPLETE_EVENTID; |
| 22791 | event_ids[wmi_dfs_radar_detection_event_id] = |
| 22792 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID; |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 22793 | event_ids[wmi_tt_stats_event_id] = WMI_THERM_THROT_STATS_EVENTID; |
Amar Singhal | 7db15c8 | 2017-05-19 16:39:34 -0700 | [diff] [blame] | 22794 | 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] | 22795 | event_ids[wmi_pdev_tpc_event_id] = WMI_PDEV_TPC_EVENTID; |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 22796 | 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] | 22797 | event_ids[wmi_service_available_event_id] = |
| 22798 | WMI_SERVICE_AVAILABLE_EVENTID; |
Rajeev Kumar Sirasanagandla | ab4275d | 2016-11-22 21:28:54 +0530 | [diff] [blame] | 22799 | event_ids[wmi_update_rcpi_event_id] = WMI_UPDATE_RCPI_EVENTID; |
Balamurugan Mahalingam | f209829 | 2017-10-26 15:14:57 +0530 | [diff] [blame] | 22800 | 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] | 22801 | /* NDP events */ |
| 22802 | event_ids[wmi_ndp_initiator_rsp_event_id] = |
| 22803 | WMI_NDP_INITIATOR_RSP_EVENTID; |
| 22804 | event_ids[wmi_ndp_indication_event_id] = WMI_NDP_INDICATION_EVENTID; |
| 22805 | event_ids[wmi_ndp_confirm_event_id] = WMI_NDP_CONFIRM_EVENTID; |
| 22806 | event_ids[wmi_ndp_responder_rsp_event_id] = |
| 22807 | WMI_NDP_RESPONDER_RSP_EVENTID; |
| 22808 | event_ids[wmi_ndp_end_indication_event_id] = |
| 22809 | WMI_NDP_END_INDICATION_EVENTID; |
| 22810 | event_ids[wmi_ndp_end_rsp_event_id] = WMI_NDP_END_RSP_EVENTID; |
| 22811 | |
| 22812 | event_ids[wmi_oem_response_event_id] = WMI_OEM_RESPONSE_EVENTID; |
| 22813 | event_ids[wmi_peer_stats_info_event_id] = WMI_PEER_STATS_INFO_EVENTID; |
| 22814 | event_ids[wmi_pdev_chip_power_stats_event_id] = |
| 22815 | WMI_PDEV_CHIP_POWER_STATS_EVENTID; |
| 22816 | event_ids[wmi_ap_ps_egap_info_event_id] = WMI_AP_PS_EGAP_INFO_EVENTID; |
| 22817 | event_ids[wmi_peer_assoc_conf_event_id] = WMI_PEER_ASSOC_CONF_EVENTID; |
| 22818 | event_ids[wmi_vdev_delete_resp_event_id] = WMI_VDEV_DELETE_RESP_EVENTID; |
| 22819 | event_ids[wmi_bpf_capability_info_event_id] = |
| 22820 | WMI_BPF_CAPABILIY_INFO_EVENTID; |
| 22821 | event_ids[wmi_vdev_encrypt_decrypt_data_rsp_event_id] = |
| 22822 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID; |
| 22823 | event_ids[wmi_report_rx_aggr_failure_event_id] = |
| 22824 | WMI_REPORT_RX_AGGR_FAILURE_EVENTID; |
| 22825 | event_ids[wmi_pdev_chip_pwr_save_failure_detect_event_id] = |
| 22826 | WMI_PDEV_CHIP_POWER_SAVE_FAILURE_DETECTED_EVENTID; |
| 22827 | event_ids[wmi_peer_antdiv_info_event_id] = WMI_PEER_ANTDIV_INFO_EVENTID; |
| 22828 | event_ids[wmi_pdev_set_hw_mode_rsp_event_id] = |
| 22829 | WMI_PDEV_SET_HW_MODE_RESP_EVENTID; |
| 22830 | event_ids[wmi_pdev_hw_mode_transition_event_id] = |
| 22831 | WMI_PDEV_HW_MODE_TRANSITION_EVENTID; |
| 22832 | event_ids[wmi_pdev_set_mac_config_resp_event_id] = |
| 22833 | WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID; |
| 22834 | event_ids[wmi_coex_bt_activity_event_id] = |
| 22835 | WMI_WLAN_COEX_BT_ACTIVITY_EVENTID; |
| 22836 | event_ids[wmi_mgmt_tx_bundle_completion_event_id] = |
| 22837 | WMI_MGMT_TX_BUNDLE_COMPLETION_EVENTID; |
| 22838 | event_ids[wmi_radio_tx_power_level_stats_event_id] = |
| 22839 | WMI_RADIO_TX_POWER_LEVEL_STATS_EVENTID; |
| 22840 | event_ids[wmi_report_stats_event_id] = WMI_REPORT_STATS_EVENTID; |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 22841 | event_ids[wmi_dma_buf_release_event_id] = |
| 22842 | WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID; |
Arif Hussain | c5bfe07 | 2017-12-27 16:23:45 -0800 | [diff] [blame] | 22843 | event_ids[wmi_sap_obss_detection_report_event_id] = |
| 22844 | WMI_SAP_OBSS_DETECTION_REPORT_EVENTID; |
Subrat Mishra | d7c7a56 | 2017-09-27 14:41:20 +0530 | [diff] [blame] | 22845 | event_ids[wmi_host_swfda_event_id] = WMI_HOST_SWFDA_EVENTID; |
Jeff Johnson | 4783f90 | 2017-12-14 15:50:16 -0800 | [diff] [blame] | 22846 | 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] | 22847 | event_ids[wmi_obss_color_collision_report_event_id] = |
| 22848 | WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 22849 | } |
| 22850 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 22851 | /** |
| 22852 | * populate_tlv_service() - populates wmi services |
| 22853 | * |
| 22854 | * @param wmi_service: Pointer to hold wmi_service |
| 22855 | * Return: None |
| 22856 | */ |
| 22857 | static void populate_tlv_service(uint32_t *wmi_service) |
| 22858 | { |
| 22859 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
Sathish Kumar | eefe27e | 2017-10-04 09:58:00 +0530 | [diff] [blame] | 22860 | wmi_service[wmi_service_ack_timeout] = WMI_SERVICE_ACK_TIMEOUT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 22861 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 22862 | wmi_service[wmi_service_roam_scan_offload] = |
| 22863 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 22864 | wmi_service[wmi_service_bcn_miss_offload] = |
| 22865 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 22866 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 22867 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 22868 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 22869 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 22870 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 22871 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 22872 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 22873 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 22874 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 22875 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 22876 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 22877 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 22878 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 22879 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 22880 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 22881 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 22882 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 22883 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 22884 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 22885 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 22886 | wmi_service[wmi_service_packet_power_save] = |
| 22887 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 22888 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 22889 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 22890 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 22891 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 22892 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 22893 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 22894 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 22895 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 22896 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 22897 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 22898 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 22899 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 22900 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 22901 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 22902 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 22903 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 22904 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 22905 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 22906 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 22907 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 22908 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 22909 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 22910 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 22911 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 22912 | wmi_service[wmi_service_lte_ant_share_support] = |
| 22913 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 22914 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 22915 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 22916 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 22917 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 22918 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 22919 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 22920 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 22921 | wmi_service[wmi_service_bcn_txrate_override] = |
| 22922 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 22923 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 22924 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 22925 | wmi_service[wmi_service_estimate_linkspeed] = |
| 22926 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 22927 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 22928 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 22929 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 22930 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 22931 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 22932 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 22933 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 22934 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 22935 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 22936 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 22937 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 22938 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 22939 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 22940 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 22941 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 22942 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 22943 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 22944 | wmi_service[wmi_service_sap_auth_offload] = |
| 22945 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 22946 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 22947 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 22948 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 22949 | wmi_service[wmi_service_ap_arpns_offload] = |
| 22950 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 22951 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 22952 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 22953 | wmi_service[wmi_service_packet_filter_offload] = |
| 22954 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 22955 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 22956 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 22957 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 22958 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 22959 | wmi_service[wmi_service_multiple_vdev_restart] = |
| 22960 | WMI_SERVICE_MULTIPLE_VDEV_RESTART; |
| 22961 | |
| 22962 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 22963 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 22964 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 22965 | WMI_SERVICE_UNAVAILABLE; |
| 22966 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 22967 | WMI_SERVICE_UNAVAILABLE; |
| 22968 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
Om Prakash Tripathi | 3bfb50c | 2017-11-07 14:37:22 +0530 | [diff] [blame] | 22969 | wmi_service[wmi_service_tt] = WMI_SERVICE_THERM_THROT; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 22970 | wmi_service[wmi_service_atf] = WMI_SERVICE_ATF; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 22971 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 22972 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 22973 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 22974 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 22975 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 22976 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 22977 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 22978 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 22979 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 22980 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 22981 | wmi_service[wmi_service_periodic_chan_stat_support] = |
Sathish Kumar | 0ff69e4 | 2017-11-02 10:44:39 +0530 | [diff] [blame] | 22982 | WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 22983 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 22984 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 22985 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 22986 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
| 22987 | wmi_service[wmi_service_4_wire_coex_support] = WMI_SERVICE_UNAVAILABLE; |
| 22988 | wmi_service[wmi_service_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
Kiran Venkatappa | 95c82a6 | 2017-05-10 14:34:17 +0530 | [diff] [blame] | 22989 | wmi_service[wmi_service_peer_assoc_conf] = WMI_SERVICE_PEER_ASSOC_CONF; |
| 22990 | wmi_service[wmi_service_egap] = WMI_SERVICE_EGAP; |
| 22991 | wmi_service[wmi_service_sta_pmf_offload] = WMI_SERVICE_STA_PMF_OFFLOAD; |
| 22992 | wmi_service[wmi_service_unified_wow_capability] = |
| 22993 | WMI_SERVICE_UNIFIED_WOW_CAPABILITY; |
| 22994 | wmi_service[wmi_service_enterprise_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
| 22995 | wmi_service[wmi_service_bpf_offload] = WMI_SERVICE_BPF_OFFLOAD; |
| 22996 | wmi_service[wmi_service_sync_delete_cmds] = |
| 22997 | WMI_SERVICE_SYNC_DELETE_CMDS; |
| 22998 | wmi_service[wmi_service_ratectrl_limit_max_min_rates] = |
| 22999 | WMI_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES; |
| 23000 | wmi_service[wmi_service_nan_data] = WMI_SERVICE_NAN_DATA; |
| 23001 | wmi_service[wmi_service_nan_rtt] = WMI_SERVICE_NAN_RTT; |
| 23002 | wmi_service[wmi_service_11ax] = WMI_SERVICE_11AX; |
| 23003 | wmi_service[wmi_service_deprecated_replace] = |
| 23004 | WMI_SERVICE_DEPRECATED_REPLACE; |
| 23005 | wmi_service[wmi_service_tdls_conn_tracker_in_host_mode] = |
| 23006 | WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE; |
| 23007 | wmi_service[wmi_service_enhanced_mcast_filter] = |
| 23008 | WMI_SERVICE_ENHANCED_MCAST_FILTER; |
| 23009 | wmi_service[wmi_service_half_rate_quarter_rate_support] = |
| 23010 | WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT; |
| 23011 | wmi_service[wmi_service_vdev_rx_filter] = WMI_SERVICE_VDEV_RX_FILTER; |
| 23012 | wmi_service[wmi_service_p2p_listen_offload_support] = |
| 23013 | WMI_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT; |
| 23014 | wmi_service[wmi_service_mark_first_wakeup_packet] = |
| 23015 | WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET; |
| 23016 | wmi_service[wmi_service_multiple_mcast_filter_set] = |
| 23017 | WMI_SERVICE_MULTIPLE_MCAST_FILTER_SET; |
| 23018 | wmi_service[wmi_service_host_managed_rx_reorder] = |
| 23019 | WMI_SERVICE_HOST_MANAGED_RX_REORDER; |
| 23020 | wmi_service[wmi_service_flash_rdwr_support] = |
| 23021 | WMI_SERVICE_FLASH_RDWR_SUPPORT; |
| 23022 | wmi_service[wmi_service_wlan_stats_report] = |
| 23023 | WMI_SERVICE_WLAN_STATS_REPORT; |
| 23024 | wmi_service[wmi_service_tx_msdu_id_new_partition_support] = |
| 23025 | WMI_SERVICE_TX_MSDU_ID_NEW_PARTITION_SUPPORT; |
| 23026 | wmi_service[wmi_service_dfs_phyerr_offload] = |
| 23027 | WMI_SERVICE_DFS_PHYERR_OFFLOAD; |
| 23028 | wmi_service[wmi_service_rcpi_support] = WMI_SERVICE_RCPI_SUPPORT; |
| 23029 | wmi_service[wmi_service_fw_mem_dump_support] = |
| 23030 | WMI_SERVICE_FW_MEM_DUMP_SUPPORT; |
| 23031 | wmi_service[wmi_service_peer_stats_info] = WMI_SERVICE_PEER_STATS_INFO; |
| 23032 | wmi_service[wmi_service_regulatory_db] = WMI_SERVICE_REGULATORY_DB; |
| 23033 | wmi_service[wmi_service_11d_offload] = WMI_SERVICE_11D_OFFLOAD; |
| 23034 | wmi_service[wmi_service_hw_data_filtering] = |
| 23035 | WMI_SERVICE_HW_DATA_FILTERING; |
| 23036 | wmi_service[wmi_service_pkt_routing] = WMI_SERVICE_PKT_ROUTING; |
| 23037 | 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] | 23038 | wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_CHAN_LOAD_INFO; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 23039 | wmi_service[wmi_service_extended_nss_support] = |
| 23040 | WMI_SERVICE_EXTENDED_NSS_SUPPORT; |
Om Prakash Tripathi | ae4413b | 2017-11-03 16:11:11 +0530 | [diff] [blame] | 23041 | wmi_service[wmi_service_widebw_scan] = WMI_SERVICE_SCAN_PHYMODE_SUPPORT; |
Kiran Venkatappa | 7fe3afc | 2017-11-08 19:32:23 +0530 | [diff] [blame] | 23042 | wmi_service[wmi_service_bcn_offload_start_stop_support] = |
| 23043 | WMI_SERVICE_BCN_OFFLOAD_START_STOP_SUPPORT; |
Kiran Venkatappa | 9c625d2 | 2017-11-17 17:08:02 +0530 | [diff] [blame] | 23044 | wmi_service[wmi_service_offchan_data_tid_support] = |
| 23045 | WMI_SERVICE_OFFCHAN_DATA_TID_SUPPORT; |
Sathish Kumar | f396c72 | 2017-11-17 17:30:41 +0530 | [diff] [blame] | 23046 | wmi_service[wmi_service_support_dma] = |
| 23047 | WMI_SERVICE_SUPPORT_DIRECT_DMA; |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 23048 | wmi_service[wmi_service_8ss_tx_bfee] = WMI_SERVICE_8SS_TX_BFEE; |
| 23049 | wmi_service[wmi_service_fils_support] = WMI_SERVICE_FILS_SUPPORT; |
| 23050 | wmi_service[wmi_service_mawc_support] = WMI_SERVICE_MAWC_SUPPORT; |
Arunk Khandavalli | 22a7d54 | 2018-02-08 11:52:23 +0530 | [diff] [blame] | 23051 | wmi_service[wmi_service_11k_neighbour_report_support] = |
| 23052 | WMI_SERVICE_11K_NEIGHBOUR_REPORT_SUPPORT; |
Arif Hussain | d9978f8 | 2018-02-09 16:42:05 -0800 | [diff] [blame] | 23053 | wmi_service[wmi_service_ap_obss_detection_offload] = |
| 23054 | WMI_SERVICE_AP_OBSS_DETECTION_OFFLOAD; |
| 23055 | wmi_service[wmi_service_bss_color_offload] = |
| 23056 | WMI_SERVICE_BSS_COLOR_OFFLOAD; |
Padma, Santhosh Kumar | 5e751d4 | 2018-02-02 18:18:34 +0530 | [diff] [blame] | 23057 | wmi_service[wmi_service_gmac_offload_support] = |
| 23058 | WMI_SERVICE_GMAC_OFFLOAD_SUPPORT; |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 23059 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 23060 | } |
| 23061 | |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 23062 | #ifndef CONFIG_MCL |
| 23063 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23064 | /** |
| 23065 | * populate_pdev_param_tlv() - populates pdev params |
| 23066 | * |
| 23067 | * @param pdev_param: Pointer to hold pdev params |
| 23068 | * Return: None |
| 23069 | */ |
| 23070 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 23071 | { |
| 23072 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 23073 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 23074 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 23075 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 23076 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 23077 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 23078 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 23079 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 23080 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 23081 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 23082 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 23083 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 23084 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 23085 | pdev_param[wmi_pdev_param_protection_mode] = |
| 23086 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 23087 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 23088 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 23089 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 23090 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 23091 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 23092 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 23093 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 23094 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 23095 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 23096 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 23097 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 23098 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 23099 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 23100 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 23101 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 23102 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 23103 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 23104 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 23105 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 23106 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 23107 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 23108 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 23109 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 23110 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 23111 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 23112 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 23113 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 23114 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 23115 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 23116 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 23117 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 23118 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 23119 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 23120 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 23121 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 23122 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 23123 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 23124 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 23125 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 23126 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 23127 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 23128 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 23129 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 23130 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 23131 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 23132 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 23133 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 23134 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 23135 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 23136 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 23137 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 23138 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 23139 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 23140 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 23141 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 23142 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 23143 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 23144 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 23145 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 23146 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 23147 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 23148 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 23149 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 23150 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 23151 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 23152 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 23153 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 23154 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 23155 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 23156 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 23157 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 23158 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 23159 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 23160 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 23161 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 23162 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 23163 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 23164 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 23165 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 23166 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 23167 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 23168 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 23169 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 23170 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 23171 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 23172 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 23173 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 23174 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 23175 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 23176 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 23177 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 23178 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 23179 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 23180 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 23181 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 23182 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 23183 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 23184 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 23185 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 23186 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 23187 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 23188 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 23189 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 23190 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 23191 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 23192 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 23193 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 23194 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 23195 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 23196 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 23197 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 23198 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 23199 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 23200 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 23201 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 23202 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 23203 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23204 | pdev_param[wmi_pdev_param_rx_filter] = WMI_PDEV_PARAM_RX_FILTER; |
| 23205 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = |
| 23206 | WMI_PDEV_SET_MCAST_TO_UCAST_TID; |
Sathish Kumar | d99852a | 2017-07-08 12:32:27 +0530 | [diff] [blame] | 23207 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = |
| 23208 | WMI_PDEV_PARAM_MGMT_RETRY_LIMIT; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23209 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_PDEV_PARAM_AGGR_BURST; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23210 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23211 | WMI_PDEV_PEER_STA_PS_STATECHG_ENABLE; |
| 23212 | pdev_param[wmi_pdev_param_proxy_sta_mode] = |
| 23213 | WMI_PDEV_PARAM_PROXY_STA_MODE; |
| 23214 | pdev_param[wmi_pdev_param_mu_group_policy] = |
| 23215 | WMI_PDEV_PARAM_MU_GROUP_POLICY; |
| 23216 | pdev_param[wmi_pdev_param_noise_detection] = |
| 23217 | WMI_PDEV_PARAM_NOISE_DETECTION; |
| 23218 | pdev_param[wmi_pdev_param_noise_threshold] = |
| 23219 | WMI_PDEV_PARAM_NOISE_THRESHOLD; |
| 23220 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_PDEV_PARAM_DPD_ENABLE; |
| 23221 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = |
| 23222 | WMI_PDEV_PARAM_SET_MCAST_BCAST_ECHO; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 23223 | pdev_param[wmi_pdev_param_atf_strict_sch] = |
| 23224 | WMI_PDEV_PARAM_ATF_STRICT_SCH; |
| 23225 | pdev_param[wmi_pdev_param_atf_sched_duration] = |
| 23226 | WMI_PDEV_PARAM_ATF_SCHED_DURATION; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23227 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_PDEV_PARAM_ANT_PLZN; |
| 23228 | pdev_param[wmi_pdev_param_sensitivity_level] = |
| 23229 | WMI_PDEV_PARAM_SENSITIVITY_LEVEL; |
| 23230 | pdev_param[wmi_pdev_param_signed_txpower_2g] = |
| 23231 | WMI_PDEV_PARAM_SIGNED_TXPOWER_2G; |
| 23232 | pdev_param[wmi_pdev_param_signed_txpower_5g] = |
| 23233 | WMI_PDEV_PARAM_SIGNED_TXPOWER_5G; |
Karunakar Dasineni | 39a5ff7 | 2017-08-10 12:12:28 -0700 | [diff] [blame] | 23234 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = |
| 23235 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMSDU; |
| 23236 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = |
| 23237 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMPDU; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23238 | pdev_param[wmi_pdev_param_cca_threshold] = |
| 23239 | WMI_PDEV_PARAM_CCA_THRESHOLD; |
| 23240 | pdev_param[wmi_pdev_param_rts_fixed_rate] = |
| 23241 | WMI_PDEV_PARAM_RTS_FIXED_RATE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23242 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23243 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_PDEV_PARAM_PDEV_RESET; |
| 23244 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = |
| 23245 | WMI_PDEV_PARAM_WAPI_MBSSID_OFFSET; |
| 23246 | pdev_param[wmi_pdev_param_arp_srcaddr] = |
| 23247 | WMI_PDEV_PARAM_ARP_DBG_SRCADDR; |
| 23248 | pdev_param[wmi_pdev_param_arp_dstaddr] = |
| 23249 | WMI_PDEV_PARAM_ARP_DBG_DSTADDR; |
| 23250 | pdev_param[wmi_pdev_param_txpower_decr_db] = |
| 23251 | WMI_PDEV_PARAM_TXPOWER_DECR_DB; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23252 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 23253 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 23254 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = |
| 23255 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCH; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23256 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 23257 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCALING_FACTOR; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23258 | pdev_param[wmi_pdev_param_cust_txpower_scale] = |
| 23259 | WMI_PDEV_PARAM_CUST_TXPOWER_SCALE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 23260 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = |
| 23261 | WMI_PDEV_PARAM_ATF_DYNAMIC_ENABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23262 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 23263 | WMI_UNAVAILABLE_PARAM; |
| 23264 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 23265 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23266 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_PDEV_PARAM_ANTENNA_GAIN; |
| 23267 | pdev_param[wmi_pdev_param_block_interbss] = |
| 23268 | WMI_PDEV_PARAM_BLOCK_INTERBSS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23269 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23270 | WMI_PDEV_PARAM_SET_DISABLE_RESET_CMDID; |
| 23271 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = |
| 23272 | WMI_PDEV_PARAM_SET_MSDU_TTL_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23273 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23274 | WMI_PDEV_PARAM_TXBF_SOUND_PERIOD_CMDID; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 23275 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 23276 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 23277 | 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] | 23278 | pdev_param[wmi_pdev_param_mesh_mcast_enable] = |
| 23279 | WMI_PDEV_PARAM_MESH_MCAST_ENABLE; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 23280 | pdev_param[wmi_pdev_param_set_promisc_mode_cmdid] = |
| 23281 | WMI_PDEV_PARAM_SET_PROMISC_MODE_CMDID; |
| 23282 | pdev_param[wmi_pdev_param_set_ppdu_duration_cmdid] = |
| 23283 | WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID; |
| 23284 | pdev_param[wmi_pdev_param_igmpmld_ac_override] = |
| 23285 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
| 23286 | pdev_param[wmi_pdev_param_remove_mcast2ucast_buffer] = |
| 23287 | WMI_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER; |
| 23288 | pdev_param[wmi_pdev_param_set_mcast2ucast_buffer] = |
| 23289 | WMI_PDEV_PARAM_SET_MCAST2UCAST_BUFFER; |
| 23290 | pdev_param[wmi_pdev_param_set_mcast2ucast_mode] = |
| 23291 | WMI_PDEV_PARAM_SET_MCAST2UCAST_MODE; |
| 23292 | pdev_param[wmi_pdev_param_smart_antenna_default_antenna] = |
| 23293 | WMI_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA; |
| 23294 | pdev_param[wmi_pdev_param_fast_channel_reset] = |
| 23295 | WMI_PDEV_PARAM_FAST_CHANNEL_RESET; |
| 23296 | 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] | 23297 | 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] | 23298 | pdev_param[wmi_pdev_param_cck_tx_enable] = WMI_PDEV_PARAM_CCK_TX_ENABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23299 | } |
| 23300 | |
| 23301 | /** |
| 23302 | * populate_vdev_param_tlv() - populates vdev params |
| 23303 | * |
| 23304 | * @param vdev_param: Pointer to hold vdev params |
| 23305 | * Return: None |
| 23306 | */ |
| 23307 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 23308 | { |
| 23309 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 23310 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 23311 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 23312 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 23313 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 23314 | vdev_param[wmi_vdev_param_listen_interval] = |
| 23315 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 23316 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 23317 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 23318 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 23319 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 23320 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 23321 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 23322 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 23323 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 23324 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 23325 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 23326 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 23327 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 23328 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 23329 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 23330 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 23331 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 23332 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 23333 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 23334 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 23335 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 23336 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 23337 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 23338 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 23339 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 23340 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 23341 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 23342 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 23343 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 23344 | vdev_param[wmi_vdev_param_protection_mode] = |
| 23345 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 23346 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 23347 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 23348 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 23349 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 23350 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 23351 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 23352 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 23353 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 23354 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 23355 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 23356 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 23357 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 23358 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 23359 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 23360 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 23361 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 23362 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 23363 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 23364 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 23365 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 23366 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 23367 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 23368 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 23369 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 23370 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 23371 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 23372 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 23373 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 23374 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 23375 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 23376 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 23377 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 23378 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 23379 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 23380 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 23381 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 23382 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 23383 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 23384 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 23385 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 23386 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 23387 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 23388 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 23389 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 23390 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 23391 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 23392 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 23393 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 23394 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 23395 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 23396 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 23397 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 23398 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 23399 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 23400 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 23401 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 23402 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 23403 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 23404 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 23405 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 23406 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 23407 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 23408 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 23409 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 23410 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 23411 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 23412 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 23413 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 23414 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 23415 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 23416 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 23417 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 23418 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 23419 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 23420 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 23421 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 23422 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 23423 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 23424 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 23425 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 23426 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 23427 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 23428 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 23429 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 23430 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 23431 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 23432 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 23433 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 23434 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 23435 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Kalyan Tallapragada | d9a6abd | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 23436 | 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] | 23437 | vdev_param[wmi_vdev_param_he_dcm_enable] = WMI_VDEV_PARAM_HE_DCM; |
| 23438 | vdev_param[wmi_vdev_param_he_range_ext_enable] = |
| 23439 | WMI_VDEV_PARAM_HE_RANGE_EXT; |
| 23440 | vdev_param[wmi_vdev_param_he_bss_color] = WMI_VDEV_PARAM_BSS_COLOR; |
| 23441 | vdev_param[wmi_vdev_param_set_hemu_mode] = WMI_VDEV_PARAM_SET_HEMU_MODE; |
Gyanranjan Hazarika | dc75d1c | 2017-10-13 12:36:24 -0700 | [diff] [blame] | 23442 | 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] | 23443 | vdev_param[wmi_vdev_param_sensor_ap] = WMI_VDEV_PARAM_SENSOR_AP; |
| 23444 | vdev_param[wmi_vdev_param_dtim_enable_cts] = |
| 23445 | WMI_VDEV_PARAM_DTIM_ENABLE_CTS; |
| 23446 | vdev_param[wmi_vdev_param_atf_ssid_sched_policy] = |
| 23447 | WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY; |
| 23448 | vdev_param[wmi_vdev_param_disable_dyn_bw_rts] = |
| 23449 | WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS; |
Sathish Kumar | 2ac4070 | 2017-03-22 19:18:45 +0530 | [diff] [blame] | 23450 | vdev_param[wmi_vdev_param_mcast2ucast_set] = |
| 23451 | WMI_VDEV_PARAM_MCAST2UCAST_SET; |
| 23452 | vdev_param[wmi_vdev_param_rc_num_retries] = |
| 23453 | WMI_VDEV_PARAM_RC_NUM_RETRIES; |
| 23454 | vdev_param[wmi_vdev_param_cabq_maxdur] = WMI_VDEV_PARAM_CABQ_MAXDUR; |
| 23455 | vdev_param[wmi_vdev_param_mfptest_set] = WMI_VDEV_PARAM_MFPTEST_SET; |
| 23456 | vdev_param[wmi_vdev_param_rts_fixed_rate] = |
| 23457 | WMI_VDEV_PARAM_RTS_FIXED_RATE; |
| 23458 | vdev_param[wmi_vdev_param_vht_sgimask] = WMI_VDEV_PARAM_VHT_SGIMASK; |
| 23459 | vdev_param[wmi_vdev_param_vht80_ratemask] = |
| 23460 | WMI_VDEV_PARAM_VHT80_RATEMASK; |
| 23461 | vdev_param[wmi_vdev_param_proxy_sta] = WMI_VDEV_PARAM_PROXY_STA; |
| 23462 | vdev_param[wmi_vdev_param_bw_nss_ratemask] = |
| 23463 | WMI_VDEV_PARAM_BW_NSS_RATEMASK; |
Gyanranjan Hazarika | 88e1183 | 2017-09-18 15:59:34 -0700 | [diff] [blame] | 23464 | vdev_param[wmi_vdev_param_set_he_ltf] = WMI_VDEV_PARAM_HE_LTF; |
Sathish Kumar | 6011c74 | 2017-11-08 14:49:58 +0530 | [diff] [blame] | 23465 | vdev_param[wmi_vdev_param_rate_dropdown_bmap] = |
| 23466 | WMI_VDEV_PARAM_RATE_DROPDOWN_BMAP; |
Rhythm Patwa | 8cdcf67 | 2018-02-15 13:22:39 -0800 | [diff] [blame] | 23467 | vdev_param[wmi_vdev_param_set_ba_mode] = |
| 23468 | WMI_VDEV_PARAM_BA_MODE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23469 | } |
| 23470 | #endif |
| 23471 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 23472 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 23473 | * populate_target_defines_tlv() - Populate target defines and params |
| 23474 | * @wmi_handle: pointer to wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 23475 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 23476 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 23477 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 23478 | #ifndef CONFIG_MCL |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 23479 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23480 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 23481 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 23482 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 23483 | } |
| 23484 | #else |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 23485 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
| 23486 | { } |
| 23487 | #endif |
| 23488 | |
| 23489 | /** |
Zhang Qian | 537fca6 | 2018-01-03 16:33:24 +0800 | [diff] [blame] | 23490 | * wmi_ocb_ut_attach() - Attach OCB test framework |
| 23491 | * @wmi_handle: wmi handle |
| 23492 | * |
| 23493 | * Return: None |
| 23494 | */ |
| 23495 | #ifdef WLAN_OCB_UT |
| 23496 | void wmi_ocb_ut_attach(struct wmi_unified *wmi_handle); |
| 23497 | #else |
| 23498 | static inline void wmi_ocb_ut_attach(struct wmi_unified *wmi_handle) |
| 23499 | { |
| 23500 | return; |
| 23501 | } |
| 23502 | #endif |
| 23503 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 23504 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 23505 | * wmi_tlv_attach() - Attach TLV APIs |
| 23506 | * |
| 23507 | * Return: None |
| 23508 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 23509 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 23510 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 23511 | wmi_handle->ops = &tlv_ops; |
Zhang Qian | 537fca6 | 2018-01-03 16:33:24 +0800 | [diff] [blame] | 23512 | wmi_ocb_ut_attach(wmi_handle); |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 23513 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Rakesh Pillai | 0511046 | 2017-12-27 14:08:59 +0530 | [diff] [blame] | 23514 | /* Skip saving WMI_CMD_HDR and TLV HDR */ |
| 23515 | wmi_handle->log_info.buf_offset_command = 8; |
| 23516 | /* WMI_CMD_HDR is already stripped, skip saving TLV HDR */ |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 23517 | wmi_handle->log_info.buf_offset_event = 4; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 23518 | #endif |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 23519 | populate_tlv_events_id(wmi_handle->wmi_events); |
Sourav Mohapatra | a7b454d | 2017-12-03 11:44:44 +0530 | [diff] [blame] | 23520 | populate_tlv_service(wmi_handle->services); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 23521 | populate_target_defines_tlv(wmi_handle); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 23522 | } |
Pratik Gandhi | 67da1bb | 2018-01-30 19:05:41 +0530 | [diff] [blame] | 23523 | EXPORT_SYMBOL(wmi_tlv_attach); |
| 23524 | |
| 23525 | /** |
| 23526 | * wmi_tlv_init() - Initialize WMI TLV module by registering TLV attach routine |
| 23527 | * |
| 23528 | * Return: None |
| 23529 | */ |
| 23530 | void wmi_tlv_init(void) |
| 23531 | { |
| 23532 | wmi_unified_register_module(WMI_TLV_TARGET, &wmi_tlv_attach); |
| 23533 | } |