Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1 | /* |
Paul Zhang | d19abd8 | 2017-01-04 16:45:42 +0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2017 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> |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 42 | |
| 43 | /* copy_vdev_create_pdev_id() - copy pdev from host params to target command |
| 44 | * buffer. |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 45 | * @wmi_handle: pointer to wmi_handle |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 46 | * @cmd: pointer target vdev create command buffer |
| 47 | * @param: pointer host params for vdev create |
| 48 | * |
| 49 | * Return: None |
| 50 | */ |
| 51 | #ifdef CONFIG_MCL |
| 52 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 53 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 54 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 55 | struct vdev_create_params *param) |
| 56 | { |
| 57 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 58 | } |
| 59 | #else |
| 60 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 61 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 62 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 63 | struct vdev_create_params *param) |
| 64 | { |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 65 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 66 | param->pdev_id); |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 67 | } |
| 68 | #endif |
| 69 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 70 | /** |
| 71 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 72 | * @wmi_handle: wmi handle |
| 73 | * @param: pointer to hold vdev create parameter |
| 74 | * @macaddr: vdev mac address |
| 75 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 76 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 77 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 78 | 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] | 79 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 80 | struct vdev_create_params *param) |
| 81 | { |
| 82 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 83 | wmi_buf_t buf; |
| 84 | int32_t len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 85 | QDF_STATUS ret; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 86 | int num_bands = 2; |
| 87 | uint8_t *buf_ptr; |
| 88 | wmi_vdev_txrx_streams *txrx_streams; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 89 | |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 90 | len += (num_bands * sizeof(*txrx_streams) + WMI_TLV_HDR_SIZE); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 91 | buf = wmi_buf_alloc(wmi_handle, len); |
| 92 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 93 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 94 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 95 | } |
| 96 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 97 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 98 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 99 | WMITLV_GET_STRUCT_TLVLEN |
| 100 | (wmi_vdev_create_cmd_fixed_param)); |
| 101 | cmd->vdev_id = param->if_id; |
| 102 | cmd->vdev_type = param->type; |
| 103 | cmd->vdev_subtype = param->subtype; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 104 | cmd->num_cfg_txrx_streams = num_bands; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 105 | copy_vdev_create_pdev_id(wmi_handle, cmd, param); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 106 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 107 | WMI_LOGD("%s: ID = %d VAP Addr = %02x:%02x:%02x:%02x:%02x:%02x", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 108 | __func__, param->if_id, |
| 109 | macaddr[0], macaddr[1], macaddr[2], |
| 110 | macaddr[3], macaddr[4], macaddr[5]); |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 111 | buf_ptr = (uint8_t *)cmd + sizeof(*cmd); |
| 112 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 113 | (num_bands * sizeof(wmi_vdev_txrx_streams))); |
| 114 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 115 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 116 | 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] | 117 | param->type, param->subtype, |
| 118 | param->nss_2g, param->nss_5g); |
| 119 | txrx_streams = (wmi_vdev_txrx_streams *)buf_ptr; |
| 120 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_2G; |
| 121 | txrx_streams->supported_tx_streams = param->nss_2g; |
| 122 | txrx_streams->supported_rx_streams = param->nss_2g; |
| 123 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 124 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 125 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
| 126 | |
| 127 | txrx_streams++; |
| 128 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_5G; |
| 129 | txrx_streams->supported_tx_streams = param->nss_5g; |
| 130 | txrx_streams->supported_rx_streams = param->nss_5g; |
| 131 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 132 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 133 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 134 | 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] | 135 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 136 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 137 | wmi_buf_free(buf); |
| 138 | } |
| 139 | |
| 140 | return ret; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 145 | * @wmi_handle: wmi handle |
| 146 | * @if_id: vdev id |
| 147 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 148 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 149 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 150 | 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] | 151 | uint8_t if_id) |
| 152 | { |
| 153 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 154 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 155 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 156 | |
| 157 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 158 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 159 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 160 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 164 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 165 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 166 | WMITLV_GET_STRUCT_TLVLEN |
| 167 | (wmi_vdev_delete_cmd_fixed_param)); |
| 168 | cmd->vdev_id = if_id; |
| 169 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 170 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 171 | WMI_VDEV_DELETE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 172 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 173 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 174 | wmi_buf_free(buf); |
| 175 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 176 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 177 | |
| 178 | return ret; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 183 | * @wmi: wmi handle |
| 184 | * @vdev_id: vdev id |
| 185 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 186 | * Return: QDF_STATUS_SUCCESS for success or erro code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 187 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 188 | static QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 189 | uint8_t vdev_id) |
| 190 | { |
| 191 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 192 | wmi_buf_t buf; |
| 193 | int32_t len = sizeof(*cmd); |
| 194 | |
| 195 | buf = wmi_buf_alloc(wmi, len); |
| 196 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 197 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 198 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 199 | } |
| 200 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 201 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 202 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 203 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 204 | cmd->vdev_id = vdev_id; |
| 205 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 206 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 207 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 208 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 209 | } |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 210 | WMI_LOGD("%s:vdev id = %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 211 | |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 217 | * @wmi: wmi handle |
| 218 | * @vdev_id: vdev id |
| 219 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 220 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 221 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 222 | 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] | 223 | { |
| 224 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 225 | wmi_buf_t buf; |
| 226 | int32_t len = sizeof(*cmd); |
| 227 | |
| 228 | buf = wmi_buf_alloc(wmi, len); |
| 229 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 230 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 231 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 232 | } |
| 233 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 234 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 235 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 236 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 237 | cmd->vdev_id = vdev_id; |
| 238 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 239 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 240 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 241 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 242 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 243 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 244 | |
| 245 | return 0; |
| 246 | } |
| 247 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 248 | #ifdef CONFIG_MCL |
| 249 | static inline void copy_channel_info( |
| 250 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 251 | wmi_channel *chan, |
| 252 | struct vdev_start_params *req) |
| 253 | { |
| 254 | chan->mhz = req->chan_freq; |
| 255 | |
| 256 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 257 | |
| 258 | chan->band_center_freq1 = req->band_center_freq1; |
| 259 | chan->band_center_freq2 = req->band_center_freq2; |
| 260 | |
| 261 | if (req->is_half_rate) |
| 262 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 263 | else if (req->is_quarter_rate) |
| 264 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 265 | |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 266 | if (req->is_dfs && req->flag_dfs) { |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 267 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 268 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 269 | } |
| 270 | |
| 271 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 272 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 273 | |
| 274 | } |
| 275 | #else |
| 276 | static inline void copy_channel_info( |
| 277 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 278 | wmi_channel *chan, |
| 279 | struct vdev_start_params *req) |
| 280 | { |
| 281 | chan->mhz = req->channel.mhz; |
| 282 | |
| 283 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 284 | |
| 285 | chan->band_center_freq1 = req->channel.cfreq1; |
| 286 | chan->band_center_freq2 = req->channel.cfreq2; |
| 287 | |
| 288 | if (req->channel.half_rate) |
| 289 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 290 | else if (req->channel.quarter_rate) |
| 291 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 292 | |
| 293 | if (req->channel.dfs_set) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 294 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 295 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 296 | } |
| 297 | |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 298 | if (req->channel.dfs_set_cfreq2) |
| 299 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS_CFREQ2); |
| 300 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 301 | /* FIXME: Find out min, max and regulatory power levels */ |
| 302 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
| 303 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxpower); |
| 304 | |
| 305 | } |
| 306 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 307 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 308 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 309 | * @wmi_handle: wmi handle |
| 310 | * @req: vdev start params |
| 311 | * |
| 312 | * Return: QDF status |
| 313 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 314 | 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] | 315 | struct vdev_start_params *req) |
| 316 | { |
| 317 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 318 | wmi_buf_t buf; |
| 319 | wmi_channel *chan; |
| 320 | int32_t len, ret; |
| 321 | uint8_t *buf_ptr; |
| 322 | |
| 323 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 324 | buf = wmi_buf_alloc(wmi_handle, len); |
| 325 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 326 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 327 | return QDF_STATUS_E_NOMEM; |
| 328 | } |
| 329 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 330 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 331 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 332 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 333 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 334 | WMITLV_GET_STRUCT_TLVLEN |
| 335 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 336 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 337 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 338 | cmd->vdev_id = req->vdev_id; |
| 339 | |
| 340 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 341 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 342 | |
| 343 | cmd->beacon_interval = req->beacon_intval; |
| 344 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 345 | |
| 346 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 347 | cmd->beacon_interval = req->beacon_intval; |
| 348 | cmd->dtim_period = req->dtim_period; |
| 349 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 350 | /* Copy the SSID */ |
| 351 | if (req->ssid.length) { |
| 352 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 353 | cmd->ssid.ssid_len = req->ssid.length; |
| 354 | else |
| 355 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 356 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 357 | cmd->ssid.ssid_len); |
| 358 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 359 | |
| 360 | if (req->hidden_ssid) |
| 361 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 362 | |
| 363 | if (req->pmf_enabled) |
| 364 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 365 | } |
| 366 | |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 367 | cmd->flags |= WMI_UNIFIED_VDEV_START_LDPC_RX_ENABLED; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 368 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 369 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 370 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 371 | cmd->cac_duration_ms = req->cac_duration_ms; |
| 372 | cmd->regdomain = req->regdomain; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 373 | cmd->he_ops = req->he_ops; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 374 | |
| 375 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 376 | sizeof(wmi_channel)); |
| 377 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 378 | cmd->num_noa_descriptors * |
| 379 | sizeof(wmi_p2p_noa_descriptor)); |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 380 | 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] | 381 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 382 | "reg_info_1: 0x%x reg_info_2: 0x%x, req->max_txpow: 0x%x " |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 383 | "Tx SS %d, Rx SS %d, ldpc_rx: %d, cac %d, regd %d, HE ops: %d", |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 384 | __func__, req->vdev_id, chan->mhz, req->chan_mode, chan->info, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 385 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 386 | chan->band_center_freq1, chan->band_center_freq2, |
| 387 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 388 | req->preferred_tx_streams, req->preferred_rx_streams, |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 389 | req->ldpc_rx_enabled, req->cac_duration_ms, |
| 390 | req->regdomain, req->he_ops); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 391 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 392 | if (req->is_restart) |
| 393 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 394 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 395 | else |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 396 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 397 | WMI_VDEV_START_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 398 | if (ret) { |
| 399 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 400 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 401 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 402 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 403 | |
| 404 | return QDF_STATUS_SUCCESS; |
| 405 | } |
| 406 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 407 | /** |
| 408 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 409 | * @wmi_handle: wmi handle |
| 410 | * @restart_params: vdev restart params |
| 411 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 412 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 413 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 414 | 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] | 415 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 416 | { |
| 417 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 418 | wmi_buf_t buf; |
| 419 | wmi_channel *chan; |
| 420 | int32_t len; |
| 421 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 422 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 423 | |
| 424 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 425 | buf = wmi_buf_alloc(wmi_handle, len); |
| 426 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 427 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 428 | return QDF_STATUS_E_NOMEM; |
| 429 | } |
| 430 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 431 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 432 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 433 | |
| 434 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 435 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 436 | WMITLV_GET_STRUCT_TLVLEN |
| 437 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 438 | |
| 439 | WMITLV_SET_HDR(&chan->tlv_header, |
| 440 | WMITLV_TAG_STRUC_wmi_channel, |
| 441 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 442 | |
| 443 | cmd->vdev_id = restart_params->session_id; |
| 444 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 445 | qdf_mem_copy(cmd->ssid.ssid, |
| 446 | restart_params->ssid, |
| 447 | cmd->ssid.ssid_len); |
| 448 | cmd->flags = restart_params->flags; |
| 449 | cmd->requestor_id = restart_params->requestor_id; |
| 450 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 451 | |
| 452 | chan->mhz = restart_params->mhz; |
| 453 | chan->band_center_freq1 = |
| 454 | restart_params->band_center_freq1; |
| 455 | chan->band_center_freq2 = |
| 456 | restart_params->band_center_freq2; |
| 457 | chan->info = restart_params->info; |
| 458 | chan->reg_info_1 = restart_params->reg_info_1; |
| 459 | chan->reg_info_2 = restart_params->reg_info_2; |
| 460 | |
| 461 | cmd->num_noa_descriptors = 0; |
| 462 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 463 | sizeof(wmi_channel)); |
| 464 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 465 | cmd->num_noa_descriptors * |
| 466 | sizeof(wmi_p2p_noa_descriptor)); |
| 467 | |
| 468 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 469 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 470 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 471 | wmi_buf_free(buf); |
| 472 | return QDF_STATUS_E_FAILURE; |
| 473 | } |
| 474 | return QDF_STATUS_SUCCESS; |
| 475 | } |
| 476 | |
| 477 | |
| 478 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 479 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 480 | * @wmi: wmi handle |
| 481 | * @peer_addr: peer mac address |
| 482 | * @param: pointer to hold peer flush tid parameter |
| 483 | * |
| 484 | * Return: 0 for sucess or error code |
| 485 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 486 | 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] | 487 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 488 | struct peer_flush_params *param) |
| 489 | { |
| 490 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 491 | wmi_buf_t buf; |
| 492 | int32_t len = sizeof(*cmd); |
| 493 | |
| 494 | buf = wmi_buf_alloc(wmi, len); |
| 495 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 496 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 497 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 498 | } |
| 499 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 500 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 501 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 502 | WMITLV_GET_STRUCT_TLVLEN |
| 503 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 504 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 505 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 506 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 507 | 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] | 508 | peer_addr, param->vdev_id, |
| 509 | param->peer_tid_bitmap); |
| 510 | 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] | 511 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 512 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 513 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | return 0; |
| 517 | } |
| 518 | |
| 519 | /** |
| 520 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 521 | * @wmi: wmi handle |
| 522 | * @peer_addr: peer mac addr |
| 523 | * @vdev_id: vdev id |
| 524 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 525 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 526 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 527 | static QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 528 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 529 | uint8_t vdev_id) |
| 530 | { |
| 531 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 532 | wmi_buf_t buf; |
| 533 | int32_t len = sizeof(*cmd); |
| 534 | buf = wmi_buf_alloc(wmi, len); |
| 535 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 536 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 537 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 538 | } |
| 539 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 540 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 541 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 542 | WMITLV_GET_STRUCT_TLVLEN |
| 543 | (wmi_peer_delete_cmd_fixed_param)); |
| 544 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 545 | cmd->vdev_id = vdev_id; |
| 546 | |
Orhan K AKYILDIZ | c8d1c4b | 2017-01-10 14:32:18 -0800 | [diff] [blame] | 547 | 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] | 548 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 549 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 550 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 551 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 552 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 553 | |
| 554 | return 0; |
| 555 | } |
| 556 | |
| 557 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 558 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 559 | * to target id. |
| 560 | * @targ_paramid: Target parameter id to hold the result. |
| 561 | * @peer_param_id: host param id. |
| 562 | * |
| 563 | * Return: QDF_STATUS_SUCCESS for success |
| 564 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
| 565 | */ |
| 566 | #ifdef CONFIG_MCL |
| 567 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 568 | uint32_t *targ_paramid, |
| 569 | uint32_t peer_param_id) |
| 570 | { |
| 571 | *targ_paramid = peer_param_id; |
| 572 | return QDF_STATUS_SUCCESS; |
| 573 | } |
| 574 | #else |
| 575 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 576 | uint32_t *targ_paramid, |
| 577 | uint32_t peer_param_id) |
| 578 | { |
| 579 | switch (peer_param_id) { |
| 580 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 581 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 582 | break; |
| 583 | case WMI_HOST_PEER_AMPDU: |
| 584 | *targ_paramid = WMI_PEER_AMPDU; |
| 585 | break; |
| 586 | case WMI_HOST_PEER_AUTHORIZE: |
| 587 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 588 | break; |
| 589 | case WMI_HOST_PEER_CHWIDTH: |
| 590 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 591 | break; |
| 592 | case WMI_HOST_PEER_NSS: |
| 593 | *targ_paramid = WMI_PEER_NSS; |
| 594 | break; |
| 595 | case WMI_HOST_PEER_USE_4ADDR: |
| 596 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 597 | break; |
| 598 | case WMI_HOST_PEER_MEMBERSHIP: |
| 599 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 600 | break; |
| 601 | case WMI_HOST_PEER_USERPOS: |
| 602 | *targ_paramid = WMI_PEER_USERPOS; |
| 603 | break; |
| 604 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 605 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 606 | break; |
| 607 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 608 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 609 | break; |
| 610 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 611 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 612 | break; |
| 613 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 614 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 615 | break; |
| 616 | case WMI_HOST_PEER_PHYMODE: |
| 617 | *targ_paramid = WMI_PEER_PHYMODE; |
| 618 | break; |
| 619 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 620 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 621 | break; |
| 622 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 623 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 624 | break; |
| 625 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 626 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 627 | break; |
| 628 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 629 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 630 | break; |
| 631 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 632 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 633 | break; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 634 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 635 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 636 | break; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 637 | case WMI_HOST_PEER_NSS_VHT160: |
| 638 | *targ_paramid = WMI_PEER_NSS_VHT160; |
| 639 | break; |
| 640 | case WMI_HOST_PEER_NSS_VHT80_80: |
| 641 | *targ_paramid = WMI_PEER_NSS_VHT80_80; |
| 642 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 643 | default: |
| 644 | return QDF_STATUS_E_NOSUPPORT; |
| 645 | } |
| 646 | |
| 647 | return QDF_STATUS_SUCCESS; |
| 648 | } |
| 649 | #endif |
| 650 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 651 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 652 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 653 | * @peer_addr: peer mac address |
| 654 | * @param : pointer to hold peer set parameter |
| 655 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 656 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 657 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 658 | static QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 659 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 660 | struct peer_set_params *param) |
| 661 | { |
| 662 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 663 | wmi_buf_t buf; |
| 664 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 665 | uint32_t param_id; |
| 666 | |
| 667 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 668 | param->param_id) != QDF_STATUS_SUCCESS) |
| 669 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 670 | |
| 671 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 672 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 673 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 674 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 675 | } |
| 676 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 677 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 678 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 679 | WMITLV_GET_STRUCT_TLVLEN |
| 680 | (wmi_peer_set_param_cmd_fixed_param)); |
| 681 | cmd->vdev_id = param->vdev_id; |
| 682 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 683 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 684 | cmd->param_value = param->param_value; |
| 685 | err = wmi_unified_cmd_send(wmi, buf, |
| 686 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 687 | WMI_PEER_SET_PARAM_CMDID); |
| 688 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 689 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 690 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 691 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 692 | } |
| 693 | |
| 694 | return 0; |
| 695 | } |
| 696 | |
| 697 | /** |
| 698 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 699 | * @wmi: wmi handle |
| 700 | * @bssid: bssid |
| 701 | * @vdev_up_params: pointer to hold vdev up parameter |
| 702 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 703 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 704 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 705 | static QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 706 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 707 | struct vdev_up_params *params) |
| 708 | { |
| 709 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 710 | wmi_buf_t buf; |
| 711 | int32_t len = sizeof(*cmd); |
| 712 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 713 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 714 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 715 | params->vdev_id, params->assoc_id, bssid); |
| 716 | buf = wmi_buf_alloc(wmi, len); |
| 717 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 718 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 719 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 720 | } |
| 721 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 722 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 723 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 724 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 725 | cmd->vdev_id = params->vdev_id; |
| 726 | cmd->vdev_assoc_id = params->assoc_id; |
| 727 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 728 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 729 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 730 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 731 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | return 0; |
| 735 | } |
| 736 | |
| 737 | /** |
| 738 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 739 | * @wmi: wmi handle |
| 740 | * @peer_addr: peer mac address |
| 741 | * @peer_type: peer type |
| 742 | * @vdev_id: vdev id |
| 743 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 744 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 745 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 746 | static QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 747 | struct peer_create_params *param) |
| 748 | { |
| 749 | wmi_peer_create_cmd_fixed_param *cmd; |
| 750 | wmi_buf_t buf; |
| 751 | int32_t len = sizeof(*cmd); |
| 752 | |
| 753 | buf = wmi_buf_alloc(wmi, len); |
| 754 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 755 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 756 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 757 | } |
| 758 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 759 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 760 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 761 | WMITLV_GET_STRUCT_TLVLEN |
| 762 | (wmi_peer_create_cmd_fixed_param)); |
| 763 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 764 | cmd->peer_type = param->peer_type; |
| 765 | cmd->vdev_id = param->vdev_id; |
| 766 | |
| 767 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 768 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 769 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 770 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 771 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 772 | 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] | 773 | param->vdev_id); |
| 774 | |
| 775 | return 0; |
| 776 | } |
| 777 | |
| 778 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 779 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 780 | * command to fw |
| 781 | * @wmi: wmi handle |
| 782 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 783 | * |
| 784 | * Return: 0 for success or error code |
| 785 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 786 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 787 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 788 | struct rx_reorder_queue_setup_params *param) |
| 789 | { |
| 790 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 791 | wmi_buf_t buf; |
| 792 | int32_t len = sizeof(*cmd); |
| 793 | |
| 794 | buf = wmi_buf_alloc(wmi, len); |
| 795 | if (!buf) { |
| 796 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 797 | return QDF_STATUS_E_NOMEM; |
| 798 | } |
| 799 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 800 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 801 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 802 | WMITLV_GET_STRUCT_TLVLEN |
| 803 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 804 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 805 | cmd->vdev_id = param->vdev_id; |
| 806 | cmd->tid = param->tid; |
| 807 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 808 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 809 | cmd->queue_no = param->queue_no; |
| 810 | |
| 811 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 812 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 813 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 814 | __func__); |
| 815 | qdf_nbuf_free(buf); |
| 816 | return QDF_STATUS_E_FAILURE; |
| 817 | } |
| 818 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 819 | param->peer_macaddr, param->vdev_id, param->tid); |
| 820 | |
| 821 | return QDF_STATUS_SUCCESS; |
| 822 | } |
| 823 | |
| 824 | /** |
| 825 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 826 | * command to fw |
| 827 | * @wmi: wmi handle |
| 828 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 829 | * |
| 830 | * Return: 0 for success or error code |
| 831 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 832 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 833 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 834 | struct rx_reorder_queue_remove_params *param) |
| 835 | { |
| 836 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 837 | wmi_buf_t buf; |
| 838 | int32_t len = sizeof(*cmd); |
| 839 | |
| 840 | buf = wmi_buf_alloc(wmi, len); |
| 841 | if (!buf) { |
| 842 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 843 | return QDF_STATUS_E_NOMEM; |
| 844 | } |
| 845 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 846 | wmi_buf_data(buf); |
| 847 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 848 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 849 | WMITLV_GET_STRUCT_TLVLEN |
| 850 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 851 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 852 | cmd->vdev_id = param->vdev_id; |
| 853 | cmd->tid_mask = param->peer_tid_bitmap; |
| 854 | |
| 855 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 856 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 857 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 858 | __func__); |
| 859 | qdf_nbuf_free(buf); |
| 860 | return QDF_STATUS_E_FAILURE; |
| 861 | } |
| 862 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 863 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 864 | |
| 865 | return QDF_STATUS_SUCCESS; |
| 866 | } |
| 867 | |
| 868 | /** |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 869 | * send_peer_add_wds_entry_cmd_tlv() - send peer add command to fw |
| 870 | * @wmi_handle: wmi handle |
| 871 | * @param: pointer holding peer details |
| 872 | * |
| 873 | * Return: 0 for success or error code |
| 874 | */ |
| 875 | static QDF_STATUS send_peer_add_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 876 | struct peer_add_wds_entry_params *param) |
| 877 | { |
| 878 | wmi_peer_add_wds_entry_cmd_fixed_param *cmd; |
| 879 | wmi_buf_t buf; |
| 880 | int len = sizeof(*cmd); |
| 881 | |
| 882 | buf = wmi_buf_alloc(wmi_handle, len); |
| 883 | if (!buf) { |
| 884 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 885 | return QDF_STATUS_E_FAILURE; |
| 886 | } |
| 887 | cmd = (wmi_peer_add_wds_entry_cmd_fixed_param *) wmi_buf_data(buf); |
| 888 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 889 | WMITLV_TAG_STRUC_wmi_peer_add_wds_entry_cmd_fixed_param, |
| 890 | WMITLV_GET_STRUCT_TLVLEN |
| 891 | (wmi_peer_add_wds_entry_cmd_fixed_param)); |
| 892 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 893 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 894 | cmd->flags = param->flags; |
| 895 | |
| 896 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 897 | WMI_PEER_ADD_WDS_ENTRY_CMDID); |
| 898 | } |
| 899 | |
| 900 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 901 | * 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] | 902 | * @wmi_handle: wmi handle |
| 903 | * @param: pointer holding peer details |
| 904 | * |
| 905 | * Return: 0 for success or error code |
| 906 | */ |
| 907 | static QDF_STATUS send_peer_del_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 908 | struct peer_del_wds_entry_params *param) |
| 909 | { |
| 910 | wmi_peer_remove_wds_entry_cmd_fixed_param *cmd; |
| 911 | wmi_buf_t buf; |
| 912 | int len = sizeof(*cmd); |
| 913 | |
| 914 | buf = wmi_buf_alloc(wmi_handle, len); |
| 915 | if (!buf) { |
| 916 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 917 | return QDF_STATUS_E_NOMEM; |
| 918 | } |
| 919 | cmd = (wmi_peer_remove_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 920 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 921 | WMITLV_TAG_STRUC_wmi_peer_remove_wds_entry_cmd_fixed_param, |
| 922 | WMITLV_GET_STRUCT_TLVLEN |
| 923 | (wmi_peer_remove_wds_entry_cmd_fixed_param)); |
| 924 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 925 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 926 | WMI_PEER_REMOVE_WDS_ENTRY_CMDID); |
| 927 | } |
| 928 | |
| 929 | /** |
| 930 | * send_peer_update_wds_entry_cmd_non_tlv() - send peer update command to fw |
| 931 | * @wmi_handle: wmi handle |
| 932 | * @param: pointer holding peer details |
| 933 | * |
| 934 | * Return: 0 for success or error code |
| 935 | */ |
| 936 | static QDF_STATUS send_peer_update_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 937 | struct peer_update_wds_entry_params *param) |
| 938 | { |
| 939 | wmi_peer_update_wds_entry_cmd_fixed_param *cmd; |
| 940 | wmi_buf_t buf; |
| 941 | int len = sizeof(*cmd); |
| 942 | |
| 943 | buf = wmi_buf_alloc(wmi_handle, len); |
| 944 | if (!buf) { |
| 945 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 946 | return QDF_STATUS_E_NOMEM; |
| 947 | } |
| 948 | |
| 949 | /* wmi_buf_alloc returns zeroed command buffer */ |
| 950 | cmd = (wmi_peer_update_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 951 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 952 | WMITLV_TAG_STRUC_wmi_peer_update_wds_entry_cmd_fixed_param, |
| 953 | WMITLV_GET_STRUCT_TLVLEN |
| 954 | (wmi_peer_update_wds_entry_cmd_fixed_param)); |
| 955 | cmd->flags = (param->flags) ? WMI_WDS_FLAG_STATIC : 0; |
| 956 | if (param->wds_macaddr) |
| 957 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->wds_macaddr, |
| 958 | &cmd->wds_macaddr); |
| 959 | if (param->peer_macaddr) |
| 960 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, |
| 961 | &cmd->peer_macaddr); |
| 962 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 963 | WMI_PEER_UPDATE_WDS_ENTRY_CMDID); |
| 964 | } |
| 965 | |
| 966 | |
| 967 | |
| 968 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 969 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 970 | * @wmi_handle: wmi handle |
| 971 | * @value: value |
| 972 | * @mac_id: mac id to have radio context |
| 973 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 974 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 975 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 976 | static QDF_STATUS send_green_ap_ps_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 977 | uint32_t value, uint8_t mac_id) |
| 978 | { |
| 979 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 980 | wmi_buf_t buf; |
| 981 | int32_t len = sizeof(*cmd); |
| 982 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 983 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 984 | |
| 985 | buf = wmi_buf_alloc(wmi_handle, len); |
| 986 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 987 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 988 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 989 | } |
| 990 | |
| 991 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 992 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 993 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 994 | WMITLV_GET_STRUCT_TLVLEN |
| 995 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 996 | 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] | 997 | cmd->enable = value; |
| 998 | |
| 999 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1000 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1001 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1002 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1003 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1004 | } |
| 1005 | |
| 1006 | return 0; |
| 1007 | } |
| 1008 | |
| 1009 | /** |
| 1010 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 1011 | * @wmi_handle: wmi handle |
| 1012 | * @param: pointer to pdev_utf_params |
| 1013 | * @mac_id: mac id to have radio context |
| 1014 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1015 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1016 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1017 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1018 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 1019 | struct pdev_utf_params *param, |
| 1020 | uint8_t mac_id) |
| 1021 | { |
| 1022 | wmi_buf_t buf; |
| 1023 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 1024 | /* if param->len is 0 no data is sent, return error */ |
| 1025 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1026 | static uint8_t msgref = 1; |
| 1027 | uint8_t segNumber = 0, segInfo, numSegments; |
| 1028 | uint16_t chunk_len, total_bytes; |
| 1029 | uint8_t *bufpos; |
| 1030 | struct seg_hdr_info segHdrInfo; |
| 1031 | |
| 1032 | bufpos = param->utf_payload; |
| 1033 | total_bytes = param->len; |
| 1034 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 1035 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 1036 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 1037 | |
| 1038 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 1039 | numSegments++; |
| 1040 | |
| 1041 | while (param->len) { |
| 1042 | if (param->len > MAX_WMI_UTF_LEN) |
| 1043 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 1044 | else |
| 1045 | chunk_len = param->len; |
| 1046 | |
| 1047 | buf = wmi_buf_alloc(wmi_handle, |
| 1048 | (chunk_len + sizeof(segHdrInfo) + |
| 1049 | WMI_TLV_HDR_SIZE)); |
| 1050 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1051 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1052 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1053 | } |
| 1054 | |
| 1055 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 1056 | |
| 1057 | segHdrInfo.len = total_bytes; |
| 1058 | segHdrInfo.msgref = msgref; |
| 1059 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 1060 | segHdrInfo.segmentInfo = segInfo; |
| 1061 | segHdrInfo.pad = 0; |
| 1062 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1063 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1064 | " segHdrInfo.segmentInfo = %d", |
| 1065 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 1066 | segHdrInfo.segmentInfo); |
| 1067 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1068 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1069 | "chunk len %d", __func__, total_bytes, segNumber, |
| 1070 | numSegments, chunk_len); |
| 1071 | |
| 1072 | segNumber++; |
| 1073 | |
| 1074 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 1075 | (chunk_len + sizeof(segHdrInfo))); |
| 1076 | cmd += WMI_TLV_HDR_SIZE; |
| 1077 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 1078 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 1079 | |
| 1080 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 1081 | (chunk_len + sizeof(segHdrInfo) + |
| 1082 | WMI_TLV_HDR_SIZE), |
| 1083 | WMI_PDEV_UTF_CMDID); |
| 1084 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1085 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1086 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1087 | wmi_buf_free(buf); |
| 1088 | break; |
| 1089 | } |
| 1090 | |
| 1091 | param->len -= chunk_len; |
| 1092 | bufpos += chunk_len; |
| 1093 | } |
| 1094 | |
| 1095 | msgref++; |
| 1096 | |
| 1097 | return ret; |
| 1098 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1099 | #ifdef CONFIG_MCL |
| 1100 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1101 | uint32_t host_param) |
| 1102 | { |
| 1103 | return host_param; |
| 1104 | } |
| 1105 | #else |
| 1106 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1107 | uint32_t host_param) |
| 1108 | { |
| 1109 | if (host_param < wmi_pdev_param_max) |
| 1110 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1111 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1112 | return WMI_UNAVAILABLE_PARAM; |
| 1113 | } |
| 1114 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1115 | /** |
| 1116 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 1117 | * @wmi_handle: wmi handle |
| 1118 | * @param: pointer to pdev parameter |
| 1119 | * @mac_id: radio context |
| 1120 | * |
| 1121 | * Return: 0 on success, errno on failure |
| 1122 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1123 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1124 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 1125 | struct pdev_params *param, |
| 1126 | uint8_t mac_id) |
| 1127 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1128 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1129 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 1130 | wmi_buf_t buf; |
| 1131 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1132 | uint32_t pdev_param; |
| 1133 | |
| 1134 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 1135 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1136 | WMI_LOGW("%s: Unavailable param %d\n", |
| 1137 | __func__, param->param_id); |
| 1138 | return QDF_STATUS_E_INVAL; |
| 1139 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1140 | |
| 1141 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1142 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1143 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1144 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1145 | } |
| 1146 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1147 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1148 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 1149 | WMITLV_GET_STRUCT_TLVLEN |
| 1150 | (wmi_pdev_set_param_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1151 | 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] | 1152 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1153 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1154 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1155 | param->param_value); |
| 1156 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1157 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1158 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1159 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1160 | wmi_buf_free(buf); |
| 1161 | } |
| 1162 | return ret; |
| 1163 | } |
| 1164 | |
| 1165 | /** |
| 1166 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1167 | * @param wmi_handle : handle to WMI. |
| 1168 | * @param param : pointer to hold suspend parameter |
| 1169 | * @mac_id: radio context |
| 1170 | * |
| 1171 | * Return 0 on success and -ve on failure. |
| 1172 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1173 | static QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1174 | struct suspend_params *param, |
| 1175 | uint8_t mac_id) |
| 1176 | { |
| 1177 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1178 | wmi_buf_t wmibuf; |
| 1179 | uint32_t len = sizeof(*cmd); |
| 1180 | int32_t ret; |
| 1181 | |
| 1182 | /* |
| 1183 | * send the comand to Target to ignore the |
| 1184 | * PCIE reset so as to ensure that Host and target |
| 1185 | * states are in sync |
| 1186 | */ |
| 1187 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1188 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1189 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1190 | |
| 1191 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1192 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1193 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1194 | WMITLV_GET_STRUCT_TLVLEN |
| 1195 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1196 | if (param->disable_target_intr) |
| 1197 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1198 | else |
| 1199 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
Kiran Venkatappa | 330179c | 2017-06-13 20:44:54 +0530 | [diff] [blame] | 1200 | |
| 1201 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
| 1202 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1203 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1204 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1205 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1206 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1207 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1208 | } |
| 1209 | |
| 1210 | return ret; |
| 1211 | } |
| 1212 | |
| 1213 | /** |
| 1214 | * send_resume_cmd_tlv() - WMI resume function |
| 1215 | * @param wmi_handle : handle to WMI. |
| 1216 | * @mac_id: radio context |
| 1217 | * |
| 1218 | * Return: 0 on success and -ve on failure. |
| 1219 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1220 | static QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1221 | uint8_t mac_id) |
| 1222 | { |
| 1223 | wmi_buf_t wmibuf; |
| 1224 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1225 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1226 | |
| 1227 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1228 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1229 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1230 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1231 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1232 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1233 | WMITLV_GET_STRUCT_TLVLEN |
| 1234 | (wmi_pdev_resume_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1235 | 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] | 1236 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1237 | WMI_PDEV_RESUME_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 WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1240 | wmi_buf_free(wmibuf); |
| 1241 | } |
| 1242 | |
| 1243 | return ret; |
| 1244 | } |
| 1245 | |
| 1246 | /** |
| 1247 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1248 | * @param wmi_handle : handle to WMI. |
| 1249 | * @param param : pointer to hold wow enable parameter |
| 1250 | * @mac_id: radio context |
| 1251 | * |
| 1252 | * Return: 0 on success and -ve on failure. |
| 1253 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1254 | 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] | 1255 | struct wow_cmd_params *param, |
| 1256 | uint8_t mac_id) |
| 1257 | { |
| 1258 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1259 | wmi_buf_t buf; |
| 1260 | int32_t len; |
| 1261 | int32_t ret; |
| 1262 | |
| 1263 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1264 | |
| 1265 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1266 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1267 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1268 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1269 | } |
| 1270 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1271 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1272 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1273 | WMITLV_GET_STRUCT_TLVLEN |
| 1274 | (wmi_wow_enable_cmd_fixed_param)); |
| 1275 | cmd->enable = param->enable; |
| 1276 | if (param->can_suspend_link) |
| 1277 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1278 | else |
| 1279 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1280 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1281 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1282 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1283 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1284 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1285 | |
| 1286 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1287 | WMI_WOW_ENABLE_CMDID); |
| 1288 | if (ret) |
| 1289 | wmi_buf_free(buf); |
| 1290 | |
| 1291 | return ret; |
| 1292 | } |
| 1293 | |
| 1294 | /** |
| 1295 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1296 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1297 | * @peer_addr: peer mac address |
| 1298 | * @param: pointer to ap_ps parameter structure |
| 1299 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1300 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1301 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1302 | 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] | 1303 | uint8_t *peer_addr, |
| 1304 | struct ap_ps_params *param) |
| 1305 | { |
| 1306 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1307 | wmi_buf_t buf; |
| 1308 | int32_t err; |
| 1309 | |
| 1310 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1311 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1312 | 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] | 1313 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1314 | } |
| 1315 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1316 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1317 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1318 | WMITLV_GET_STRUCT_TLVLEN |
| 1319 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1320 | cmd->vdev_id = param->vdev_id; |
| 1321 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1322 | cmd->param = param->param; |
| 1323 | cmd->value = param->value; |
| 1324 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1325 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1326 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1327 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1328 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1329 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1330 | } |
| 1331 | |
| 1332 | return 0; |
| 1333 | } |
| 1334 | |
| 1335 | /** |
| 1336 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1337 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1338 | * @peer_addr: peer mac address |
| 1339 | * @param: pointer to sta_ps parameter structure |
| 1340 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1341 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1342 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1343 | 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] | 1344 | struct sta_ps_params *param) |
| 1345 | { |
| 1346 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1347 | wmi_buf_t buf; |
| 1348 | int32_t len = sizeof(*cmd); |
| 1349 | |
| 1350 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1351 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1352 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1353 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1354 | } |
| 1355 | |
| 1356 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1357 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1358 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1359 | WMITLV_GET_STRUCT_TLVLEN |
| 1360 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1361 | cmd->vdev_id = param->vdev_id; |
| 1362 | cmd->param = param->param; |
| 1363 | cmd->value = param->value; |
| 1364 | |
| 1365 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1366 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1367 | 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] | 1368 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1369 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1370 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1371 | } |
| 1372 | |
| 1373 | return 0; |
| 1374 | } |
| 1375 | |
| 1376 | /** |
| 1377 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1378 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1379 | * @param: ponirt to crash inject paramter structure |
| 1380 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1381 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1382 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1383 | 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] | 1384 | struct crash_inject *param) |
| 1385 | { |
| 1386 | int32_t ret = 0; |
| 1387 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1388 | uint16_t len = sizeof(*cmd); |
| 1389 | wmi_buf_t buf; |
| 1390 | |
| 1391 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1392 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1393 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1394 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1395 | } |
| 1396 | |
| 1397 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1398 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1399 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1400 | WMITLV_GET_STRUCT_TLVLEN |
| 1401 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1402 | cmd->type = param->type; |
| 1403 | cmd->delay_time_ms = param->delay_time_ms; |
| 1404 | |
| 1405 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1406 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1407 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1408 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1409 | __func__, ret); |
| 1410 | wmi_buf_free(buf); |
| 1411 | } |
| 1412 | |
| 1413 | return ret; |
| 1414 | } |
| 1415 | |
| 1416 | /** |
| 1417 | * send_dbglog_cmd_tlv() - set debug log level |
| 1418 | * @param wmi_handle : handle to WMI. |
| 1419 | * @param param : pointer to hold dbglog level parameter |
| 1420 | * |
| 1421 | * Return: 0 on success and -ve on failure. |
| 1422 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1423 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1424 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1425 | struct dbglog_params *dbglog_param) |
| 1426 | { |
| 1427 | wmi_buf_t buf; |
| 1428 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1429 | QDF_STATUS status; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1430 | int32_t i; |
| 1431 | int32_t len; |
| 1432 | int8_t *buf_ptr; |
| 1433 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1434 | |
Alok Kumar | 240afea | 2017-08-30 14:45:34 +0530 | [diff] [blame^] | 1435 | ASSERT(dbglog_param->bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1436 | |
| 1437 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1438 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1439 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1440 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1441 | if (buf == NULL) |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1442 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1443 | |
| 1444 | configmsg = |
| 1445 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1446 | buf_ptr = (int8_t *) configmsg; |
| 1447 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1448 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1449 | WMITLV_GET_STRUCT_TLVLEN |
| 1450 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1451 | configmsg->dbg_log_param = dbglog_param->param; |
| 1452 | configmsg->value = dbglog_param->val; |
| 1453 | /* Filling in the data part of second tlv -- should |
| 1454 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1455 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1456 | sizeof |
| 1457 | (wmi_debug_log_config_cmd_fixed_param) |
| 1458 | + WMI_TLV_HDR_SIZE); |
| 1459 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1460 | WMITLV_TAG_ARRAY_UINT32, |
| 1461 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1462 | if (dbglog_param->module_id_bitmap) { |
| 1463 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1464 | module_id_bitmap_array[i] = |
| 1465 | dbglog_param->module_id_bitmap[i]; |
| 1466 | } |
| 1467 | } |
| 1468 | |
| 1469 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1470 | len, WMI_DBGLOG_CFG_CMDID); |
| 1471 | |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1472 | if (status != QDF_STATUS_SUCCESS) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1473 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1474 | |
| 1475 | return status; |
| 1476 | } |
| 1477 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1478 | #ifdef CONFIG_MCL |
| 1479 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1480 | uint32_t host_param) |
| 1481 | { |
| 1482 | return host_param; |
| 1483 | } |
| 1484 | #else |
| 1485 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1486 | uint32_t host_param) |
| 1487 | { |
| 1488 | if (host_param < wmi_vdev_param_max) |
| 1489 | return wmi_handle->vdev_param[host_param]; |
| 1490 | |
| 1491 | return WMI_UNAVAILABLE_PARAM; |
| 1492 | } |
| 1493 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1494 | /** |
| 1495 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1496 | * @param wmi_handle : handle to WMI. |
| 1497 | * @param macaddr : MAC address |
| 1498 | * @param param : pointer to hold vdev set parameter |
| 1499 | * |
| 1500 | * Return: 0 on success and -ve on failure. |
| 1501 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1502 | 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] | 1503 | struct vdev_set_params *param) |
| 1504 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1505 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1506 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1507 | wmi_buf_t buf; |
| 1508 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1509 | uint32_t vdev_param; |
| 1510 | |
| 1511 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1512 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1513 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1514 | param->param_id); |
| 1515 | return QDF_STATUS_E_INVAL; |
| 1516 | |
| 1517 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1518 | |
| 1519 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1520 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1521 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1522 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1523 | } |
| 1524 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1525 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1526 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1527 | WMITLV_GET_STRUCT_TLVLEN |
| 1528 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1529 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1530 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1531 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1532 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1533 | param->if_id, param->param_id, param->param_value); |
| 1534 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1535 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1536 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1537 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1538 | wmi_buf_free(buf); |
| 1539 | } |
| 1540 | |
| 1541 | return ret; |
| 1542 | } |
| 1543 | |
| 1544 | /** |
| 1545 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1546 | * @param wmi_handle : handle to WMI. |
| 1547 | * @param macaddr : MAC address |
| 1548 | * @param param : pointer to hold stats request parameter |
| 1549 | * |
| 1550 | * Return: 0 on success and -ve on failure. |
| 1551 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1552 | 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] | 1553 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1554 | struct stats_request_params *param) |
| 1555 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1556 | int32_t ret; |
| 1557 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1558 | wmi_buf_t buf; |
| 1559 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1560 | |
| 1561 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1562 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1563 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1564 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1565 | } |
| 1566 | |
| 1567 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1568 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1569 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1570 | WMITLV_GET_STRUCT_TLVLEN |
| 1571 | (wmi_request_stats_cmd_fixed_param)); |
| 1572 | cmd->stats_id = param->stats_id; |
| 1573 | cmd->vdev_id = param->vdev_id; |
| 1574 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1575 | WMI_REQUEST_STATS_CMDID); |
| 1576 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1577 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1578 | wmi_buf_free(buf); |
| 1579 | } |
| 1580 | |
| 1581 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1582 | } |
| 1583 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1584 | #ifdef CONFIG_WIN |
| 1585 | /** |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1586 | * 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] | 1587 | * @param wmi_handle : handle to WMI. |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1588 | * @param PKTLOG_EVENT : packet log event |
| 1589 | * @mac_id: mac id to have radio context |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1590 | * |
| 1591 | * Return: 0 on success and -ve on failure. |
| 1592 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1593 | static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1594 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT, uint8_t mac_id) |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1595 | { |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1596 | int32_t ret; |
| 1597 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 1598 | wmi_buf_t buf; |
| 1599 | uint16_t len = sizeof(wmi_pdev_pktlog_enable_cmd_fixed_param); |
| 1600 | |
| 1601 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1602 | if (!buf) { |
| 1603 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1604 | return -QDF_STATUS_E_NOMEM; |
| 1605 | } |
| 1606 | |
| 1607 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1608 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1609 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 1610 | WMITLV_GET_STRUCT_TLVLEN |
| 1611 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 1612 | cmd->evlist = PKTLOG_EVENT; |
| 1613 | cmd->pdev_id = mac_id; |
| 1614 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1615 | WMI_PDEV_PKTLOG_ENABLE_CMDID); |
| 1616 | if (ret) { |
| 1617 | WMI_LOGE("Failed to send pktlog enable cmd to FW =%d", ret); |
| 1618 | wmi_buf_free(buf); |
| 1619 | } |
| 1620 | |
| 1621 | return ret; |
| 1622 | } |
| 1623 | |
| 1624 | /** |
| 1625 | * send_packet_log_disable_cmd_tlv() - Send WMI command to disable packet-log |
| 1626 | * @param wmi_handle : handle to WMI. |
| 1627 | * @mac_id: mac id to have radio context |
| 1628 | * |
| 1629 | * Return: 0 on success and -ve on failure. |
| 1630 | */ |
| 1631 | 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] | 1632 | uint8_t mac_id) |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1633 | { |
| 1634 | int32_t ret; |
| 1635 | wmi_pdev_pktlog_disable_cmd_fixed_param *cmd; |
| 1636 | wmi_buf_t buf; |
| 1637 | uint16_t len = sizeof(wmi_pdev_pktlog_disable_cmd_fixed_param); |
| 1638 | |
| 1639 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1640 | if (!buf) { |
| 1641 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1642 | return -QDF_STATUS_E_NOMEM; |
| 1643 | } |
| 1644 | |
| 1645 | cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1646 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1647 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 1648 | WMITLV_GET_STRUCT_TLVLEN |
| 1649 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
| 1650 | cmd->pdev_id = mac_id; |
| 1651 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1652 | WMI_PDEV_PKTLOG_DISABLE_CMDID); |
| 1653 | if (ret) { |
| 1654 | WMI_LOGE("Failed to send pktlog disable cmd to FW =%d", ret); |
| 1655 | wmi_buf_free(buf); |
| 1656 | } |
| 1657 | |
| 1658 | return ret; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1659 | } |
| 1660 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1661 | /** |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1662 | * send_packet_log_enable_cmd_tlv() - Send WMI command to enable |
| 1663 | * packet-log |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1664 | * @param wmi_handle : handle to WMI. |
| 1665 | * @param macaddr : MAC address |
| 1666 | * @param param : pointer to hold stats request parameter |
| 1667 | * |
| 1668 | * Return: 0 on success and -ve on failure. |
| 1669 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1670 | 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] | 1671 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1672 | struct packet_enable_params *param) |
| 1673 | { |
| 1674 | return 0; |
| 1675 | } |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1676 | /** |
| 1677 | * send_packet_log_disable_cmd_tlv() - Send WMI command to disable |
| 1678 | * packet-log |
| 1679 | * @param wmi_handle : handle to WMI. |
| 1680 | * @mac_id: mac id to have radio context |
| 1681 | * |
| 1682 | * Return: 0 on success and -ve on failure. |
| 1683 | */ |
| 1684 | static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1685 | uint8_t mac_id) |
| 1686 | { |
| 1687 | return 0; |
| 1688 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1689 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1690 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1691 | 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] | 1692 | struct beacon_params *param) |
| 1693 | { |
Kiran Venkatappa | 9d59bd6 | 2017-04-21 14:42:32 +0530 | [diff] [blame] | 1694 | QDF_STATUS ret; |
| 1695 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 1696 | wmi_buf_t wmi_buf; |
| 1697 | qdf_dma_addr_t dma_addr; |
| 1698 | uint32_t dtim_flag = 0; |
| 1699 | |
| 1700 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1701 | if (!wmi_buf) { |
| 1702 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1703 | return QDF_STATUS_E_NOMEM; |
| 1704 | } |
| 1705 | if (param->is_dtim_count_zero) { |
| 1706 | dtim_flag |= WMI_BCN_SEND_DTIM_ZERO; |
| 1707 | if (param->is_bitctl_reqd) { |
| 1708 | /* deliver CAB traffic in next DTIM beacon */ |
| 1709 | dtim_flag |= WMI_BCN_SEND_DTIM_BITCTL_SET; |
| 1710 | } |
| 1711 | } |
| 1712 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 1713 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1714 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 1715 | WMITLV_GET_STRUCT_TLVLEN |
| 1716 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 1717 | cmd->vdev_id = param->vdev_id; |
| 1718 | cmd->data_len = qdf_nbuf_len(param->wbuf); |
| 1719 | cmd->frame_ctrl = param->frame_ctrl; |
| 1720 | cmd->dtim_flag = dtim_flag; |
| 1721 | dma_addr = qdf_nbuf_get_frag_paddr(param->wbuf, 0); |
| 1722 | cmd->frag_ptr_lo = qdf_get_lower_32_bits(dma_addr); |
| 1723 | #if defined(HTT_PADDR64) |
| 1724 | cmd->frag_ptr_hi = qdf_get_upper_32_bits(dma_addr) & 0x1F; |
| 1725 | #endif |
| 1726 | cmd->bcn_antenna = param->bcn_txant; |
| 1727 | |
| 1728 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1729 | wmi_buf, sizeof(*cmd), WMI_PDEV_SEND_BCN_CMDID); |
| 1730 | if (ret != QDF_STATUS_SUCCESS) { |
| 1731 | WMI_LOGE("%s: Failed to send bcn: %d", __func__, ret); |
| 1732 | wmi_buf_free(wmi_buf); |
| 1733 | } |
| 1734 | |
| 1735 | return ret; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1736 | } |
| 1737 | |
| 1738 | /** |
| 1739 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1740 | * @param wmi_handle : handle to WMI. |
| 1741 | * @param param : pointer to hold beacon send cmd parameter |
| 1742 | * |
| 1743 | * Return: 0 on success and -ve on failure. |
| 1744 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1745 | 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] | 1746 | struct beacon_tmpl_params *param) |
| 1747 | { |
| 1748 | int32_t ret; |
| 1749 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1750 | wmi_bcn_prb_info *bcn_prb_info; |
| 1751 | wmi_buf_t wmi_buf; |
| 1752 | uint8_t *buf_ptr; |
| 1753 | uint32_t wmi_buf_len; |
| 1754 | |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1755 | WMI_LOGI("%s\n", __func__); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1756 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1757 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1758 | param->tmpl_len_aligned; |
| 1759 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1760 | if (!wmi_buf) { |
| 1761 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1762 | return QDF_STATUS_E_NOMEM; |
| 1763 | } |
| 1764 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1765 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1766 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1767 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1768 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1769 | cmd->vdev_id = param->vdev_id; |
| 1770 | cmd->tim_ie_offset = param->tim_ie_offset; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1771 | cmd->csa_switch_count_offset = param->csa_switch_count_offset; |
| 1772 | cmd->ext_csa_switch_count_offset = param->ext_csa_switch_count_offset; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1773 | cmd->buf_len = param->tmpl_len; |
| 1774 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1775 | |
| 1776 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1777 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1778 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1779 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1780 | bcn_prb_info->caps = 0; |
| 1781 | bcn_prb_info->erp = 0; |
| 1782 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1783 | |
| 1784 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1785 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1786 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1787 | |
| 1788 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1789 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1790 | if (ret) { |
| 1791 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1792 | wmi_buf_free(wmi_buf); |
| 1793 | } |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1794 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1795 | return 0; |
| 1796 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1797 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1798 | #ifdef CONFIG_MCL |
| 1799 | static inline void copy_peer_flags_tlv( |
| 1800 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1801 | struct peer_assoc_params *param) |
| 1802 | { |
| 1803 | cmd->peer_flags = param->peer_flags; |
| 1804 | } |
| 1805 | #else |
| 1806 | static inline void copy_peer_flags_tlv( |
| 1807 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1808 | struct peer_assoc_params *param) |
| 1809 | { |
| 1810 | /* |
| 1811 | * The target only needs a subset of the flags maintained in the host. |
| 1812 | * Just populate those flags and send it down |
| 1813 | */ |
| 1814 | cmd->peer_flags = 0; |
| 1815 | |
| 1816 | /* |
| 1817 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1818 | */ |
| 1819 | if (param->is_wme_set) { |
| 1820 | |
| 1821 | if (param->qos_flag) |
| 1822 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1823 | if (param->apsd_flag) |
| 1824 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1825 | if (param->ht_flag) |
| 1826 | cmd->peer_flags |= WMI_PEER_HT; |
| 1827 | if (param->bw_40) |
| 1828 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1829 | if (param->bw_80) |
| 1830 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1831 | if (param->bw_160) |
| 1832 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1833 | |
| 1834 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1835 | * for HT as well |
| 1836 | **/ |
| 1837 | if (param->stbc_flag) |
| 1838 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1839 | |
| 1840 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1841 | * for HT as well |
| 1842 | **/ |
| 1843 | if (param->ldpc_flag) |
| 1844 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1845 | |
| 1846 | if (param->static_mimops_flag) |
| 1847 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1848 | if (param->dynamic_mimops_flag) |
| 1849 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1850 | if (param->spatial_mux_flag) |
| 1851 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1852 | if (param->vht_flag) |
| 1853 | cmd->peer_flags |= WMI_PEER_VHT; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1854 | if (param->he_flag) |
| 1855 | cmd->peer_flags |= WMI_PEER_HE; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1856 | } |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1857 | |
Gurumoorthi Gnanasambandhan | d18a061 | 2017-07-03 16:14:55 +0530 | [diff] [blame] | 1858 | if (param->is_pmf_enabled) |
| 1859 | cmd->peer_flags |= WMI_PEER_PMF; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1860 | /* |
| 1861 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1862 | * (during re-association). |
| 1863 | * Authorization will be done for these modes on key installation. |
| 1864 | */ |
| 1865 | if (param->auth_flag) |
| 1866 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1867 | if (param->need_ptk_4_way) |
| 1868 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1869 | else |
| 1870 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1871 | if (param->need_gtk_2_way) |
| 1872 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1873 | /* safe mode bypass the 4-way handshake */ |
| 1874 | if (param->safe_mode_enabled) |
| 1875 | cmd->peer_flags &= |
| 1876 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1877 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1878 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1879 | * it |
| 1880 | * if (param->amsdu_disable) Add after FW support |
| 1881 | **/ |
| 1882 | |
| 1883 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1884 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1885 | * iwpriv |
| 1886 | **/ |
| 1887 | if (param->peer_ht_rates.num_rates == 0) |
| 1888 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1889 | } |
| 1890 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1891 | |
| 1892 | #ifdef CONFIG_MCL |
| 1893 | static inline void copy_peer_mac_addr_tlv( |
| 1894 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1895 | struct peer_assoc_params *param) |
| 1896 | { |
| 1897 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1898 | sizeof(param->peer_macaddr)); |
| 1899 | } |
| 1900 | #else |
| 1901 | static inline void copy_peer_mac_addr_tlv( |
| 1902 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1903 | struct peer_assoc_params *param) |
| 1904 | { |
| 1905 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 1906 | } |
| 1907 | #endif |
| 1908 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1909 | /** |
| 1910 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1911 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1912 | * @param param : pointer to peer assoc parameter |
| 1913 | * |
| 1914 | * Return: 0 on success and -ve on failure. |
| 1915 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1916 | 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] | 1917 | struct peer_assoc_params *param) |
| 1918 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1919 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1920 | wmi_vht_rate_set *mcs; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1921 | wmi_he_rate_set *he_mcs; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1922 | wmi_buf_t buf; |
| 1923 | int32_t len; |
| 1924 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1925 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1926 | uint32_t peer_legacy_rates_align; |
| 1927 | uint32_t peer_ht_rates_align; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1928 | int32_t i; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1929 | |
| 1930 | |
| 1931 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1932 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1933 | |
| 1934 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1935 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
| 1936 | WMI_TLV_HDR_SIZE + |
| 1937 | (peer_ht_rates_align * sizeof(uint8_t)) + |
| 1938 | sizeof(wmi_vht_rate_set) + |
| 1939 | (sizeof(wmi_he_rate_set) * param->peer_he_mcs_count |
| 1940 | + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1941 | |
| 1942 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1943 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1944 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1945 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1946 | } |
| 1947 | |
| 1948 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1949 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1950 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1951 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1952 | WMITLV_GET_STRUCT_TLVLEN |
| 1953 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1954 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1955 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1956 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1957 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1958 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1959 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1960 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1961 | copy_peer_mac_addr_tlv(cmd, param); |
| 1962 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1963 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1964 | cmd->peer_caps = param->peer_caps; |
| 1965 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1966 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1967 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1968 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1969 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1970 | cmd->peer_phymode = param->peer_phymode; |
| 1971 | |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1972 | /* Update 11ax capabilities */ |
| 1973 | cmd->peer_he_cap_info = param->peer_he_cap_macinfo; |
| 1974 | cmd->peer_he_ops = param->peer_he_ops; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1975 | qdf_mem_copy(&cmd->peer_he_cap_phy, ¶m->peer_he_cap_phyinfo, |
| 1976 | sizeof(param->peer_he_cap_phyinfo)); |
| 1977 | qdf_mem_copy(&cmd->peer_ppet, ¶m->peer_ppet, |
| 1978 | sizeof(param->peer_ppet)); |
| 1979 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1980 | /* Update peer legacy rate information */ |
| 1981 | buf_ptr += sizeof(*cmd); |
| 1982 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1983 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1984 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1985 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1986 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1987 | param->peer_legacy_rates.num_rates); |
| 1988 | |
| 1989 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1990 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1991 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1992 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1993 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1994 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1995 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1996 | param->peer_ht_rates.num_rates); |
| 1997 | |
| 1998 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1999 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2000 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 2001 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 2002 | |
| 2003 | cmd->peer_nss = param->peer_nss; |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2004 | |
| 2005 | /* Update bandwidth-NSS mapping */ |
| 2006 | cmd->peer_bw_rxnss_override = 0; |
| 2007 | cmd->peer_bw_rxnss_override |= param->peer_bw_rxnss_override; |
| 2008 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2009 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 2010 | if (param->vht_capable) { |
| 2011 | mcs->rx_max_rate = param->rx_max_rate; |
| 2012 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 2013 | mcs->tx_max_rate = param->tx_max_rate; |
| 2014 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 2015 | } |
| 2016 | |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2017 | /* HE Rates */ |
| 2018 | cmd->peer_he_mcs = param->peer_he_mcs_count; |
| 2019 | buf_ptr += sizeof(wmi_vht_rate_set); |
| 2020 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2021 | (param->peer_he_mcs_count * sizeof(wmi_he_rate_set))); |
| 2022 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2023 | |
| 2024 | /* Loop through the HE rate set */ |
| 2025 | for (i = 0; i < param->peer_he_mcs_count; i++) { |
| 2026 | he_mcs = (wmi_he_rate_set *) buf_ptr; |
| 2027 | WMITLV_SET_HDR(he_mcs, WMITLV_TAG_STRUC_wmi_he_rate_set, |
| 2028 | WMITLV_GET_STRUCT_TLVLEN(wmi_he_rate_set)); |
| 2029 | |
| 2030 | he_mcs->rx_mcs_set = param->peer_he_rx_mcs_set[i]; |
| 2031 | he_mcs->tx_mcs_set = param->peer_he_tx_mcs_set[i]; |
| 2032 | WMI_LOGD("%s:HE idx %d RxMCSmap %x TxMCSmap %x ", __func__, |
| 2033 | i, he_mcs->rx_mcs_set, he_mcs->tx_mcs_set); |
| 2034 | buf_ptr += sizeof(wmi_he_rate_set); |
| 2035 | } |
| 2036 | |
| 2037 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2038 | 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] | 2039 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 2040 | "nss %d phymode %d peer_mpdu_density %d " |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2041 | "cmd->peer_vht_caps %x " |
| 2042 | "HE cap_info %x ops %x " |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2043 | "HE phy %x %x %x " |
| 2044 | "peer_bw_rxnss_override %x", __func__, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2045 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 2046 | cmd->peer_rate_caps, cmd->peer_caps, |
| 2047 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 2048 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 2049 | cmd->peer_mpdu_density, |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2050 | cmd->peer_vht_caps, cmd->peer_he_cap_info, |
| 2051 | cmd->peer_he_ops, cmd->peer_he_cap_phy[0], |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2052 | cmd->peer_he_cap_phy[1], cmd->peer_he_cap_phy[2], |
| 2053 | cmd->peer_bw_rxnss_override); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2054 | |
| 2055 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2056 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2057 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2058 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2059 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2060 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2061 | } |
| 2062 | |
| 2063 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2064 | } |
| 2065 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2066 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 2067 | */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2068 | static inline void copy_scan_event_cntrl_flags( |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2069 | wmi_start_scan_cmd_fixed_param * cmd, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2070 | struct scan_req_params *param) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2071 | { |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2072 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2073 | /* Scan events subscription */ |
| 2074 | if (param->scan_ev_started) |
| 2075 | cmd->notify_scan_events |= WMI_SCAN_EVENT_STARTED; |
| 2076 | if (param->scan_ev_completed) |
| 2077 | cmd->notify_scan_events |= WMI_SCAN_EVENT_COMPLETED; |
| 2078 | if (param->scan_ev_bss_chan) |
| 2079 | cmd->notify_scan_events |= WMI_SCAN_EVENT_BSS_CHANNEL; |
| 2080 | if (param->scan_ev_foreign_chan) |
| 2081 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL; |
| 2082 | if (param->scan_ev_dequeued) |
| 2083 | cmd->notify_scan_events |= WMI_SCAN_EVENT_DEQUEUED; |
| 2084 | if (param->scan_ev_preempted) |
| 2085 | cmd->notify_scan_events |= WMI_SCAN_EVENT_PREEMPTED; |
| 2086 | if (param->scan_ev_start_failed) |
| 2087 | cmd->notify_scan_events |= WMI_SCAN_EVENT_START_FAILED; |
| 2088 | if (param->scan_ev_restarted) |
| 2089 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESTARTED; |
| 2090 | if (param->scan_ev_foreign_chn_exit) |
| 2091 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 2092 | if (param->scan_ev_suspended) |
| 2093 | cmd->notify_scan_events |= WMI_SCAN_EVENT_SUSPENDED; |
| 2094 | if (param->scan_ev_resumed) |
| 2095 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESUMED; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2096 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2097 | /** Set scan control flags */ |
| 2098 | cmd->scan_ctrl_flags = 0; |
| 2099 | if (param->scan_f_passive) |
| 2100 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; |
| 2101 | if (param->scan_f_strict_passive_pch) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2102 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2103 | if (param->scan_f_promisc_mode) |
| 2104 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROMISCOUS; |
| 2105 | if (param->scan_f_capture_phy_err) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2106 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2107 | if (param->scan_f_half_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2108 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2109 | if (param->scan_f_quarter_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2110 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2111 | if (param->scan_f_cck_rates) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2112 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2113 | if (param->scan_f_ofdm_rates) |
| 2114 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 2115 | if (param->scan_f_chan_stat_evnt) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2116 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2117 | if (param->scan_f_filter_prb_req) |
| 2118 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; |
| 2119 | if (param->scan_f_bcast_probe) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2120 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2121 | if (param->scan_f_offchan_mgmt_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2122 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2123 | if (param->scan_f_offchan_data_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2124 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2125 | if (param->scan_f_force_active_dfs_chn) |
| 2126 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_FORCE_ACTIVE_ON_DFS; |
| 2127 | if (param->scan_f_add_tpc_ie_in_probe) |
| 2128 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_TPC_IE_IN_PROBE_REQ; |
| 2129 | if (param->scan_f_add_ds_ie_in_probe) |
| 2130 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
| 2131 | if (param->scan_f_add_spoofed_mac_in_probe) |
| 2132 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; |
| 2133 | if (param->scan_f_add_rand_seq_in_probe) |
| 2134 | cmd->scan_ctrl_flags |= WMI_SCAN_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 2135 | if (param->scan_f_en_ie_whitelist_in_probe) |
| 2136 | cmd->scan_ctrl_flags |= |
| 2137 | WMI_SCAN_ENABLE_IE_WHTELIST_IN_PROBE_REQ; |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2138 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2139 | /* for adaptive scan mode using 3 bits (21 - 23 bits) */ |
| 2140 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 2141 | param->adaptive_dwell_time_mode); |
| 2142 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2143 | |
| 2144 | /* scan_copy_ie_buffer() - Copy scan ie_data */ |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2145 | static inline void scan_copy_ie_buffer(uint8_t *buf_ptr, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2146 | struct scan_req_params *params) |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2147 | { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2148 | qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len); |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2149 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2150 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2151 | /* |
| 2152 | * get_pdev_wmi_handle() - Helper func to derive pdev wmi handle from vdev_id |
| 2153 | * @param wmi_handle : Handle to WMI |
| 2154 | * @param vdev_id : vdev identifier |
| 2155 | * |
| 2156 | * Return : void * |
| 2157 | */ |
| 2158 | static inline void *get_pdev_wmi_handle(wmi_unified_t wmi_handle, uint8_t vdev_id) |
| 2159 | { |
| 2160 | struct wlan_objmgr_vdev *vdev = NULL; |
| 2161 | struct wlan_objmgr_pdev *pdev = NULL; |
| 2162 | uint8_t pdev_id = 0; |
| 2163 | |
| 2164 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc( |
| 2165 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 2166 | vdev_id, WLAN_SCAN_ID); |
| 2167 | if (vdev) { |
| 2168 | wlan_objmgr_vdev_release_ref(vdev, WLAN_SCAN_ID); |
| 2169 | pdev = wlan_vdev_get_pdev(vdev); |
| 2170 | if (pdev) |
| 2171 | pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); |
| 2172 | else { |
| 2173 | qdf_print("%s : Invalid PDEV, forcing pdev_id to 0\n", __func__); |
| 2174 | } |
| 2175 | } else { |
| 2176 | qdf_print("%s : Invalid VDEV, forcing pdev_id to 0\n", __func__); |
| 2177 | } |
| 2178 | |
| 2179 | return wmi_unified_get_pdev_handle(wmi_handle->soc, pdev_id); |
| 2180 | } |
| 2181 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2182 | /** |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2183 | * wmi_copy_scan_random_mac() - To copy scan randomization attrs to wmi buffer |
| 2184 | * @mac: random mac addr |
| 2185 | * @mask: random mac mask |
| 2186 | * @mac_addr: wmi random mac |
| 2187 | * @mac_mask: wmi random mac mask |
| 2188 | * |
| 2189 | * Return None. |
| 2190 | */ |
| 2191 | static inline |
| 2192 | void wmi_copy_scan_random_mac(uint8_t *mac, uint8_t *mask, |
| 2193 | wmi_mac_addr *mac_addr, wmi_mac_addr *mac_mask) |
| 2194 | { |
| 2195 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mac, mac_addr); |
| 2196 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mask, mac_mask); |
| 2197 | } |
| 2198 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2199 | /* |
| 2200 | * wmi_fill_vendor_oui() - fill vendor OUIs |
| 2201 | * @buf_ptr: pointer to wmi tlv buffer |
| 2202 | * @num_vendor_oui: number of vendor OUIs to be filled |
| 2203 | * @param_voui: pointer to OUI buffer |
| 2204 | * |
| 2205 | * This function populates the wmi tlv buffer when vendor specific OUIs are |
| 2206 | * present. |
| 2207 | * |
| 2208 | * Return: None |
| 2209 | */ |
| 2210 | static inline |
| 2211 | void wmi_fill_vendor_oui(uint8_t *buf_ptr, uint32_t num_vendor_oui, |
| 2212 | uint32_t *pvoui) |
| 2213 | { |
| 2214 | wmi_vendor_oui *voui = NULL; |
| 2215 | uint32_t i; |
| 2216 | |
| 2217 | voui = (wmi_vendor_oui *)buf_ptr; |
| 2218 | |
| 2219 | for (i = 0; i < num_vendor_oui; i++) { |
| 2220 | WMITLV_SET_HDR(&voui[i].tlv_header, |
| 2221 | WMITLV_TAG_STRUC_wmi_vendor_oui, |
| 2222 | WMITLV_GET_STRUCT_TLVLEN(wmi_vendor_oui)); |
| 2223 | voui[i].oui_type_subtype = pvoui[i]; |
| 2224 | } |
| 2225 | } |
| 2226 | |
| 2227 | /* |
| 2228 | * wmi_fill_ie_whitelist_attrs() - fill IE whitelist attrs |
| 2229 | * @ie_bitmap: output pointer to ie bit map in cmd |
| 2230 | * @num_vendor_oui: output pointer to num vendor OUIs |
| 2231 | * @ie_whitelist: input parameter |
| 2232 | * |
| 2233 | * This function populates the IE whitelist attrs of scan, pno and |
| 2234 | * scan oui commands for ie_whitelist parameter. |
| 2235 | * |
| 2236 | * Return: None |
| 2237 | */ |
| 2238 | static inline |
| 2239 | void wmi_fill_ie_whitelist_attrs(uint32_t *ie_bitmap, |
| 2240 | uint32_t *num_vendor_oui, |
| 2241 | struct probe_req_whitelist_attr *ie_whitelist) |
| 2242 | { |
| 2243 | uint32_t i = 0; |
| 2244 | |
| 2245 | for (i = 0; i < PROBE_REQ_BITMAP_LEN; i++) |
| 2246 | ie_bitmap[i] = ie_whitelist->ie_bitmap[i]; |
| 2247 | |
| 2248 | *num_vendor_oui = ie_whitelist->num_vendor_oui; |
| 2249 | } |
| 2250 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2251 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2252 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 2253 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2254 | * @param param : pointer to hold scan start cmd parameter |
| 2255 | * |
| 2256 | * Return: 0 on success and -ve on failure. |
| 2257 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2258 | 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] | 2259 | struct scan_req_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2260 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2261 | int32_t ret = 0; |
| 2262 | int32_t i; |
| 2263 | wmi_buf_t wmi_buf; |
| 2264 | wmi_start_scan_cmd_fixed_param *cmd; |
| 2265 | uint8_t *buf_ptr; |
| 2266 | uint32_t *tmp_ptr; |
| 2267 | wmi_ssid *ssid = NULL; |
| 2268 | wmi_mac_addr *bssid; |
| 2269 | int len = sizeof(*cmd); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2270 | uint8_t extraie_len_with_pad = 0; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2271 | struct probe_req_whitelist_attr *ie_whitelist = ¶ms->ie_whitelist; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2272 | |
| 2273 | /* Length TLV placeholder for array of uint32_t */ |
| 2274 | len += WMI_TLV_HDR_SIZE; |
| 2275 | /* calculate the length of buffer required */ |
| 2276 | if (params->num_chan) |
| 2277 | len += params->num_chan * sizeof(uint32_t); |
| 2278 | |
| 2279 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 2280 | len += WMI_TLV_HDR_SIZE; |
| 2281 | if (params->num_ssids) |
| 2282 | len += params->num_ssids * sizeof(wmi_ssid); |
| 2283 | |
| 2284 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 2285 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2286 | if (params->num_bssid) |
| 2287 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2288 | |
| 2289 | /* Length TLV placeholder for array of bytes */ |
| 2290 | len += WMI_TLV_HDR_SIZE; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2291 | if (params->extraie.len) |
| 2292 | extraie_len_with_pad = |
| 2293 | roundup(params->extraie.len, sizeof(uint32_t)); |
| 2294 | len += extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2295 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2296 | len += WMI_TLV_HDR_SIZE; /* Length of TLV for array of wmi_vendor_oui */ |
| 2297 | if (ie_whitelist->num_vendor_oui) |
| 2298 | len += ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 2299 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2300 | /* Allocate the memory */ |
| 2301 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2302 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2303 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2304 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2305 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2306 | } |
| 2307 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2308 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 2309 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2310 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 2311 | WMITLV_GET_STRUCT_TLVLEN |
| 2312 | (wmi_start_scan_cmd_fixed_param)); |
| 2313 | |
| 2314 | cmd->scan_id = params->scan_id; |
| 2315 | cmd->scan_req_id = params->scan_req_id; |
| 2316 | cmd->vdev_id = params->vdev_id; |
| 2317 | cmd->scan_priority = params->scan_priority; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2318 | |
| 2319 | copy_scan_event_cntrl_flags(cmd, params); |
| 2320 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2321 | cmd->dwell_time_active = params->dwell_time_active; |
| 2322 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 2323 | cmd->min_rest_time = params->min_rest_time; |
| 2324 | cmd->max_rest_time = params->max_rest_time; |
| 2325 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 2326 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 2327 | cmd->idle_time = params->idle_time; |
| 2328 | cmd->max_scan_time = params->max_scan_time; |
| 2329 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2330 | cmd->burst_duration = params->burst_duration; |
| 2331 | cmd->num_chan = params->num_chan; |
| 2332 | cmd->num_bssid = params->num_bssid; |
| 2333 | cmd->num_ssids = params->num_ssids; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2334 | cmd->ie_len = params->extraie.len; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2335 | cmd->n_probes = params->n_probes; |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 2336 | cmd->scan_ctrl_flags_ext = params->scan_ctrl_flags_ext; |
| 2337 | |
| 2338 | WMI_LOGD("scan_ctrl_flags_ext = %x", cmd->scan_ctrl_flags_ext); |
| 2339 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2340 | if (params->scan_random.randomize) |
| 2341 | wmi_copy_scan_random_mac(params->scan_random.mac_addr, |
| 2342 | params->scan_random.mac_mask, |
| 2343 | &cmd->mac_addr, |
| 2344 | &cmd->mac_mask); |
| 2345 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2346 | if (ie_whitelist->white_list) |
| 2347 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 2348 | &cmd->num_vendor_oui, |
| 2349 | ie_whitelist); |
| 2350 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2351 | buf_ptr += sizeof(*cmd); |
| 2352 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2353 | for (i = 0; i < params->num_chan; ++i) |
| 2354 | tmp_ptr[i] = params->chan_list[i]; |
| 2355 | |
| 2356 | WMITLV_SET_HDR(buf_ptr, |
| 2357 | WMITLV_TAG_ARRAY_UINT32, |
| 2358 | (params->num_chan * sizeof(uint32_t))); |
| 2359 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2360 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2361 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2362 | goto error; |
| 2363 | } |
| 2364 | |
| 2365 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2366 | (params->num_ssids * sizeof(wmi_ssid))); |
| 2367 | |
| 2368 | if (params->num_ssids) { |
| 2369 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2370 | for (i = 0; i < params->num_ssids; ++i) { |
| 2371 | ssid->ssid_len = params->ssid[i].length; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2372 | qdf_mem_copy(ssid->ssid, params->ssid[i].ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2373 | params->ssid[i].length); |
| 2374 | ssid++; |
| 2375 | } |
| 2376 | } |
| 2377 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 2378 | |
| 2379 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2380 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 2381 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2382 | |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2383 | if (params->num_bssid) { |
| 2384 | for (i = 0; i < params->num_bssid; ++i) { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2385 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 2386 | ¶ms->bssid_list[i].bytes[0], bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2387 | bssid++; |
| 2388 | } |
| 2389 | } |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2390 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2391 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2392 | (params->num_bssid * sizeof(wmi_mac_addr)); |
| 2393 | |
| 2394 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, extraie_len_with_pad); |
| 2395 | if (params->extraie.len) |
| 2396 | scan_copy_ie_buffer(buf_ptr + WMI_TLV_HDR_SIZE, |
| 2397 | params); |
| 2398 | |
| 2399 | buf_ptr += WMI_TLV_HDR_SIZE + extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2400 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2401 | /* probe req ie whitelisting */ |
| 2402 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2403 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 2404 | |
| 2405 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2406 | |
| 2407 | if (cmd->num_vendor_oui) { |
| 2408 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 2409 | ie_whitelist->voui); |
| 2410 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 2411 | } |
| 2412 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2413 | ret = wmi_unified_cmd_send( |
| 2414 | get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2415 | len, WMI_START_SCAN_CMDID); |
| 2416 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2417 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2418 | wmi_buf_free(wmi_buf); |
| 2419 | } |
| 2420 | return ret; |
| 2421 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2422 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2423 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2424 | } |
| 2425 | |
| 2426 | /** |
| 2427 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 2428 | * @param wmi_handle : handle to WMI. |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2429 | * @param param : pointer to hold scan cancel cmd parameter |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2430 | * |
| 2431 | * Return: 0 on success and -ve on failure. |
| 2432 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2433 | 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] | 2434 | struct scan_cancel_param *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2435 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2436 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2437 | int ret; |
| 2438 | int len = sizeof(*cmd); |
| 2439 | wmi_buf_t wmi_buf; |
| 2440 | |
| 2441 | /* Allocate the memory */ |
| 2442 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2443 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2444 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2445 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2446 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2447 | goto error; |
| 2448 | } |
| 2449 | |
| 2450 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2451 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2452 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2453 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2454 | cmd->vdev_id = param->vdev_id; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2455 | cmd->requestor = param->requester; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2456 | cmd->scan_id = param->scan_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2457 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2458 | param->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2459 | /* stop the scan with the corresponding scan_id */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2460 | if (param->req_type == WLAN_SCAN_CANCEL_PDEV_ALL) { |
| 2461 | /* Cancelling all scans */ |
| 2462 | cmd->req_type = WMI_SCAN_STOP_ALL; |
| 2463 | } else if (param->req_type == WLAN_SCAN_CANCEL_VDEV_ALL) { |
| 2464 | /* Cancelling VAP scans */ |
| 2465 | cmd->req_type = WMI_SCN_STOP_VAP_ALL; |
| 2466 | } else if (param->req_type == WLAN_SCAN_CANCEL_SINGLE) { |
| 2467 | /* Cancelling specific scan */ |
| 2468 | cmd->req_type = WMI_SCAN_STOP_ONE; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2469 | } else { |
| 2470 | WMI_LOGE("%s: Invalid Command : ", __func__); |
| 2471 | wmi_buf_free(wmi_buf); |
| 2472 | return QDF_STATUS_E_INVAL; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2473 | } |
| 2474 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2475 | 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] | 2476 | len, WMI_STOP_SCAN_CMDID); |
| 2477 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2478 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2479 | wmi_buf_free(wmi_buf); |
| 2480 | } |
| 2481 | |
| 2482 | error: |
| 2483 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2484 | } |
| 2485 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2486 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2487 | /** |
| 2488 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2489 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2490 | * @param param : pointer to hold scan channel list parameter |
| 2491 | * |
| 2492 | * Return: 0 on success and -ve on failure. |
| 2493 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2494 | 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] | 2495 | struct scan_chan_list_params *chan_list) |
| 2496 | { |
| 2497 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2498 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2499 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2500 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2501 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2502 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2503 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2504 | |
| 2505 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2506 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2507 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2508 | WMI_LOGE("Failed to allocate memory"); |
| 2509 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2510 | goto end; |
| 2511 | } |
| 2512 | |
| 2513 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2514 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2515 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2516 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2517 | WMITLV_GET_STRUCT_TLVLEN |
| 2518 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2519 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2520 | 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] | 2521 | |
| 2522 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2523 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2524 | WMITLV_TAG_ARRAY_STRUC, |
| 2525 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2526 | chan_info = (wmi_channel_param *) |
| 2527 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2528 | tchan_info = chan_list->chan_info; |
| 2529 | |
| 2530 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2531 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2532 | WMITLV_TAG_STRUC_wmi_channel, |
| 2533 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2534 | chan_info->mhz = tchan_info->mhz; |
| 2535 | chan_info->band_center_freq1 = |
| 2536 | tchan_info->band_center_freq1; |
| 2537 | chan_info->band_center_freq2 = |
| 2538 | tchan_info->band_center_freq2; |
| 2539 | chan_info->info = tchan_info->info; |
| 2540 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2541 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2542 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2543 | |
| 2544 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2545 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2546 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2547 | tchan_info++; |
| 2548 | chan_info++; |
| 2549 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2550 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2551 | chan_list->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2552 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2553 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 2554 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2555 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2556 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2557 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2558 | wmi_buf_free(buf); |
| 2559 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2560 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2561 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2562 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2563 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2564 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2565 | 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] | 2566 | struct scan_chan_list_params *chan_list) |
| 2567 | { |
| 2568 | wmi_buf_t buf; |
| 2569 | QDF_STATUS qdf_status; |
| 2570 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2571 | int i; |
| 2572 | uint8_t *buf_ptr; |
| 2573 | wmi_channel *chan_info; |
| 2574 | struct channel_param *tchan_info; |
| 2575 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2576 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2577 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2578 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2579 | if (!buf) { |
| 2580 | WMI_LOGE("Failed to allocate memory"); |
| 2581 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2582 | goto end; |
| 2583 | } |
| 2584 | |
| 2585 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2586 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2587 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2588 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2589 | WMITLV_GET_STRUCT_TLVLEN |
| 2590 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2591 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2592 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2593 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2594 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2595 | chan_list->pdev_id); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2596 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2597 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2598 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2599 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2600 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2601 | tchan_info = &(chan_list->ch_param[0]); |
| 2602 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2603 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2604 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2605 | WMITLV_TAG_STRUC_wmi_channel, |
| 2606 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2607 | chan_info->mhz = tchan_info->mhz; |
| 2608 | chan_info->band_center_freq1 = |
| 2609 | tchan_info->cfreq1; |
| 2610 | chan_info->band_center_freq2 = |
| 2611 | tchan_info->cfreq2; |
| 2612 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2613 | if (tchan_info->is_chan_passive) |
| 2614 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2615 | WMI_CHAN_FLAG_PASSIVE); |
| 2616 | |
| 2617 | if (tchan_info->allow_vht) |
| 2618 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2619 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2620 | else if (tchan_info->allow_ht) |
| 2621 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2622 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2623 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2624 | tchan_info->phy_mode); |
| 2625 | |
| 2626 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2627 | * after FW support |
| 2628 | */ |
| 2629 | |
| 2630 | /* also fill in power information */ |
| 2631 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2632 | tchan_info->minpower); |
| 2633 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2634 | tchan_info->maxpower); |
| 2635 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2636 | tchan_info->maxregpower); |
| 2637 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2638 | tchan_info->antennamax); |
| 2639 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2640 | tchan_info->reg_class_id); |
| 2641 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2642 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2643 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2644 | tchan_info++; |
| 2645 | chan_info++; |
| 2646 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2647 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2648 | chan_list->pdev_id); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2649 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2650 | qdf_status = wmi_unified_cmd_send( |
| 2651 | wmi_handle, |
| 2652 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2653 | |
| 2654 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2655 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2656 | wmi_buf_free(buf); |
| 2657 | } |
| 2658 | |
| 2659 | end: |
| 2660 | return qdf_status; |
| 2661 | } |
| 2662 | #endif |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2663 | |
| 2664 | /** |
| 2665 | * populate_tx_send_params - Populate TX param TLV for mgmt and offchan tx |
| 2666 | * |
| 2667 | * @bufp: Pointer to buffer |
| 2668 | * @param: Pointer to tx param |
| 2669 | * |
| 2670 | * Return: QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure |
| 2671 | */ |
| 2672 | static inline QDF_STATUS populate_tx_send_params(uint8_t *bufp, |
| 2673 | struct tx_send_params param) |
| 2674 | { |
| 2675 | wmi_tx_send_params *tx_param; |
| 2676 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2677 | |
| 2678 | if (!bufp) { |
| 2679 | status = QDF_STATUS_E_FAILURE; |
| 2680 | return status; |
| 2681 | } |
| 2682 | tx_param = (wmi_tx_send_params *)bufp; |
| 2683 | WMITLV_SET_HDR(&tx_param->tlv_header, |
| 2684 | WMITLV_TAG_STRUC_wmi_tx_send_params, |
| 2685 | WMITLV_GET_STRUCT_TLVLEN(wmi_tx_send_params)); |
| 2686 | WMI_TX_SEND_PARAM_PWR_SET(tx_param->tx_param_dword0, param.pwr); |
| 2687 | WMI_TX_SEND_PARAM_MCS_MASK_SET(tx_param->tx_param_dword0, |
| 2688 | param.mcs_mask); |
| 2689 | WMI_TX_SEND_PARAM_NSS_MASK_SET(tx_param->tx_param_dword0, |
| 2690 | param.nss_mask); |
| 2691 | WMI_TX_SEND_PARAM_RETRY_LIMIT_SET(tx_param->tx_param_dword0, |
| 2692 | param.retry_limit); |
| 2693 | WMI_TX_SEND_PARAM_CHAIN_MASK_SET(tx_param->tx_param_dword1, |
| 2694 | param.chain_mask); |
| 2695 | WMI_TX_SEND_PARAM_BW_MASK_SET(tx_param->tx_param_dword1, |
| 2696 | param.bw_mask); |
| 2697 | WMI_TX_SEND_PARAM_PREAMBLE_SET(tx_param->tx_param_dword1, |
| 2698 | param.preamble_type); |
| 2699 | WMI_TX_SEND_PARAM_FRAME_TYPE_SET(tx_param->tx_param_dword1, |
| 2700 | param.frame_type); |
| 2701 | |
| 2702 | return status; |
| 2703 | } |
| 2704 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2705 | /** |
| 2706 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2707 | * @wmi_handle : handle to WMI. |
| 2708 | * @param : pointer to hold mgmt cmd parameter |
| 2709 | * |
| 2710 | * Return: 0 on success and -ve on failure. |
| 2711 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2712 | static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2713 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2714 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2715 | wmi_buf_t buf; |
| 2716 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2717 | int32_t cmd_len; |
| 2718 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2719 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2720 | uint8_t *bufp; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2721 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2722 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2723 | mgmt_tx_dl_frm_len; |
| 2724 | |
| 2725 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2726 | WMI_TLV_HDR_SIZE + |
| 2727 | roundup(bufp_len, sizeof(uint32_t)); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2728 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2729 | 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] | 2730 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2731 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2732 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2733 | } |
| 2734 | |
| 2735 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2736 | bufp = (uint8_t *) cmd; |
| 2737 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2738 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2739 | WMITLV_GET_STRUCT_TLVLEN |
| 2740 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2741 | |
| 2742 | cmd->vdev_id = param->vdev_id; |
| 2743 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2744 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2745 | cmd->chanfreq = param->chanfreq; |
| 2746 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2747 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2748 | sizeof(uint32_t))); |
| 2749 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2750 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
Himanshu Agarwal | e3d1374 | 2017-04-04 12:36:33 +0530 | [diff] [blame] | 2751 | |
| 2752 | status = qdf_nbuf_map_single(qdf_ctx, param->tx_frame, |
| 2753 | QDF_DMA_TO_DEVICE); |
| 2754 | if (status != QDF_STATUS_SUCCESS) { |
| 2755 | WMI_LOGE("%s: wmi buf map failed", __func__); |
| 2756 | goto err1; |
| 2757 | } |
| 2758 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2759 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2760 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
Orhan K AKYILDIZ | 271641f | 2017-01-29 15:17:12 -0800 | [diff] [blame] | 2761 | #if defined(HTT_PADDR64) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2762 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2763 | #endif |
| 2764 | cmd->frame_len = param->frm_len; |
| 2765 | cmd->buf_len = bufp_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2766 | cmd->tx_params_valid = param->tx_params_valid; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2767 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2768 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2769 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2770 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2771 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 2772 | if (param->tx_params_valid) { |
| 2773 | status = populate_tx_send_params(bufp, param->tx_param); |
| 2774 | if (status != QDF_STATUS_SUCCESS) { |
| 2775 | WMI_LOGE("%s: Populate TX send params failed", |
| 2776 | __func__); |
| 2777 | goto err1; |
| 2778 | } |
| 2779 | cmd_len += sizeof(wmi_tx_send_params); |
| 2780 | } |
| 2781 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2782 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2783 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2784 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2785 | goto err1; |
| 2786 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2787 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2788 | |
| 2789 | err1: |
| 2790 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2791 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2792 | } |
| 2793 | |
| 2794 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2795 | * send_offchan_data_tx_send_cmd_tlv() - Send off-chan tx data |
| 2796 | * @wmi_handle : handle to WMI. |
| 2797 | * @param : pointer to offchan data tx cmd parameter |
| 2798 | * |
| 2799 | * Return: QDF_STATUS_SUCCESS on success and error on failure. |
| 2800 | */ |
| 2801 | static QDF_STATUS send_offchan_data_tx_cmd_tlv(wmi_unified_t wmi_handle, |
| 2802 | struct wmi_offchan_data_tx_params *param) |
| 2803 | { |
| 2804 | wmi_buf_t buf; |
| 2805 | wmi_offchan_data_tx_send_cmd_fixed_param *cmd; |
| 2806 | int32_t cmd_len; |
| 2807 | uint64_t dma_addr; |
| 2808 | void *qdf_ctx = param->qdf_ctx; |
| 2809 | uint8_t *bufp; |
| 2810 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? |
| 2811 | param->frm_len : mgmt_tx_dl_frm_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2812 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2813 | |
| 2814 | cmd_len = sizeof(wmi_offchan_data_tx_send_cmd_fixed_param) + |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2815 | WMI_TLV_HDR_SIZE + |
| 2816 | roundup(bufp_len, sizeof(uint32_t)); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2817 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2818 | 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] | 2819 | if (!buf) { |
| 2820 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2821 | return QDF_STATUS_E_NOMEM; |
| 2822 | } |
| 2823 | |
| 2824 | cmd = (wmi_offchan_data_tx_send_cmd_fixed_param *) wmi_buf_data(buf); |
| 2825 | bufp = (uint8_t *) cmd; |
| 2826 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2827 | WMITLV_TAG_STRUC_wmi_offchan_data_tx_send_cmd_fixed_param, |
| 2828 | WMITLV_GET_STRUCT_TLVLEN |
| 2829 | (wmi_offchan_data_tx_send_cmd_fixed_param)); |
| 2830 | |
| 2831 | cmd->vdev_id = param->vdev_id; |
| 2832 | |
| 2833 | cmd->desc_id = param->desc_id; |
| 2834 | cmd->chanfreq = param->chanfreq; |
| 2835 | bufp += sizeof(wmi_offchan_data_tx_send_cmd_fixed_param); |
| 2836 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2837 | sizeof(uint32_t))); |
| 2838 | bufp += WMI_TLV_HDR_SIZE; |
| 2839 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2840 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2841 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
| 2842 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 2843 | #if defined(HTT_PADDR64) |
| 2844 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2845 | #endif |
| 2846 | cmd->frame_len = param->frm_len; |
| 2847 | cmd->buf_len = bufp_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2848 | cmd->tx_params_valid = param->tx_params_valid; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2849 | |
| 2850 | wmi_mgmt_cmd_record(wmi_handle, WMI_OFFCHAN_DATA_TX_SEND_CMDID, |
| 2851 | bufp, cmd->vdev_id, cmd->chanfreq); |
| 2852 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2853 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 2854 | if (param->tx_params_valid) { |
| 2855 | status = populate_tx_send_params(bufp, param->tx_param); |
| 2856 | if (status != QDF_STATUS_SUCCESS) { |
| 2857 | WMI_LOGE("%s: Populate TX send params failed", |
| 2858 | __func__); |
| 2859 | goto err1; |
| 2860 | } |
| 2861 | cmd_len += sizeof(wmi_tx_send_params); |
| 2862 | } |
| 2863 | |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2864 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2865 | WMI_OFFCHAN_DATA_TX_SEND_CMDID)) { |
| 2866 | WMI_LOGE("%s: Failed to offchan data Tx", __func__); |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2867 | goto err1; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2868 | } |
| 2869 | |
| 2870 | return QDF_STATUS_SUCCESS; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2871 | |
| 2872 | err1: |
| 2873 | wmi_buf_free(buf); |
| 2874 | return QDF_STATUS_E_FAILURE; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2875 | } |
| 2876 | |
| 2877 | /** |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2878 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2879 | * @wmi_handle: wmi handle |
| 2880 | * @param_value: parameter value |
| 2881 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2882 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2883 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2884 | 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] | 2885 | uint32_t param_value) |
| 2886 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2887 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2888 | wmi_modem_power_state_cmd_param *cmd; |
| 2889 | wmi_buf_t buf; |
| 2890 | uint16_t len = sizeof(*cmd); |
| 2891 | |
| 2892 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2893 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2894 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2895 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2896 | } |
| 2897 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2898 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2899 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2900 | WMITLV_GET_STRUCT_TLVLEN |
| 2901 | (wmi_modem_power_state_cmd_param)); |
| 2902 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2903 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2904 | param_value); |
| 2905 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2906 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2907 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2908 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2909 | wmi_buf_free(buf); |
| 2910 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2911 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2912 | return ret; |
| 2913 | } |
| 2914 | |
| 2915 | /** |
| 2916 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2917 | * @wmi_handle: wmi handle |
| 2918 | * @vdev_id: vdev id |
| 2919 | * @val: value |
| 2920 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2921 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2922 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2923 | 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] | 2924 | uint32_t vdev_id, uint8_t val) |
| 2925 | { |
| 2926 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2927 | wmi_buf_t buf; |
| 2928 | int32_t len = sizeof(*cmd); |
| 2929 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2930 | 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] | 2931 | |
| 2932 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2933 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2934 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2935 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2936 | } |
| 2937 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2938 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2939 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2940 | WMITLV_GET_STRUCT_TLVLEN |
| 2941 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2942 | cmd->vdev_id = vdev_id; |
| 2943 | if (val) |
| 2944 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2945 | else |
| 2946 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2947 | |
| 2948 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2949 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2950 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2951 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2952 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2953 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2954 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2955 | return 0; |
| 2956 | } |
| 2957 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2958 | /** |
| 2959 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2960 | * @wmi_handle: wmi handle |
| 2961 | * @vdev_id: vdev id |
| 2962 | * @value: value |
| 2963 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2964 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2965 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2966 | 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] | 2967 | uint8_t vdev_id, int value) |
| 2968 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2969 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2970 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2971 | wmi_buf_t buf; |
| 2972 | uint16_t len = sizeof(*cmd); |
| 2973 | |
| 2974 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2975 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2976 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2977 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2978 | } |
| 2979 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2980 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2981 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2982 | WMITLV_GET_STRUCT_TLVLEN |
| 2983 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2984 | |
| 2985 | cmd->vdev_id = vdev_id; |
| 2986 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2987 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2988 | * to SM power save values defined in the specification. |
| 2989 | * Make sure to send the right mapping. |
| 2990 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2991 | switch (value) { |
| 2992 | case 0: |
| 2993 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 2994 | break; |
| 2995 | case 1: |
| 2996 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 2997 | break; |
| 2998 | case 2: |
| 2999 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 3000 | break; |
| 3001 | case 3: |
| 3002 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 3003 | break; |
| 3004 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3005 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 3006 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3007 | } |
| 3008 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3009 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3010 | |
| 3011 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3012 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3013 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3014 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3015 | wmi_buf_free(buf); |
| 3016 | } |
| 3017 | |
| 3018 | return ret; |
| 3019 | } |
| 3020 | |
| 3021 | /** |
| 3022 | * send_set_smps_params_cmd_tlv() - set smps params |
| 3023 | * @wmi_handle: wmi handle |
| 3024 | * @vdev_id: vdev id |
| 3025 | * @value: value |
| 3026 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3027 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3028 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3029 | 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] | 3030 | int value) |
| 3031 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3032 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3033 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 3034 | wmi_buf_t buf; |
| 3035 | uint16_t len = sizeof(*cmd); |
| 3036 | |
| 3037 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3038 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3039 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3040 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3041 | } |
| 3042 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 3043 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3044 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 3045 | WMITLV_GET_STRUCT_TLVLEN |
| 3046 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 3047 | |
| 3048 | cmd->vdev_id = vdev_id; |
| 3049 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 3050 | cmd->param = |
| 3051 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 3052 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3053 | 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] | 3054 | cmd->param); |
| 3055 | |
| 3056 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3057 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3058 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3059 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3060 | wmi_buf_free(buf); |
| 3061 | } |
| 3062 | |
| 3063 | return ret; |
| 3064 | } |
| 3065 | |
| 3066 | /** |
| 3067 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 3068 | * @wmi_handle: wmi handle |
| 3069 | * @noa: p2p power save parameters |
| 3070 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3071 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3072 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3073 | 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] | 3074 | struct p2p_ps_params *noa) |
| 3075 | { |
| 3076 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 3077 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 3078 | wmi_buf_t buf; |
| 3079 | uint8_t *buf_ptr; |
| 3080 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3081 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3082 | uint32_t duration; |
| 3083 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3084 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3085 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 3086 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3087 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3088 | WMI_LOGE("Failed to allocate memory"); |
| 3089 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3090 | goto end; |
| 3091 | } |
| 3092 | |
| 3093 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3094 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 3095 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3096 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 3097 | WMITLV_GET_STRUCT_TLVLEN |
| 3098 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 3099 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 3100 | cmd->vdev_id = noa->session_id; |
| 3101 | cmd->enable = (duration) ? true : false; |
| 3102 | cmd->num_noa = 1; |
| 3103 | |
| 3104 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 3105 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 3106 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 3107 | sizeof |
| 3108 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 3109 | + WMI_TLV_HDR_SIZE); |
| 3110 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 3111 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 3112 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 3113 | noa_discriptor->type_count = noa->count; |
| 3114 | noa_discriptor->duration = duration; |
| 3115 | noa_discriptor->interval = noa->interval; |
| 3116 | noa_discriptor->start_time = 0; |
| 3117 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3118 | 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] | 3119 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 3120 | noa->interval); |
| 3121 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3122 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3123 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3124 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3125 | wmi_buf_free(buf); |
| 3126 | } |
| 3127 | |
| 3128 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3129 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3130 | return status; |
| 3131 | } |
| 3132 | |
| 3133 | |
| 3134 | /** |
| 3135 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 3136 | * @wmi_handle: wmi handle |
| 3137 | * @noa: p2p opp power save parameters |
| 3138 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3139 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3140 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3141 | static QDF_STATUS send_set_p2pgo_oppps_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3142 | struct p2p_ps_params *oppps) |
| 3143 | { |
| 3144 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 3145 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3146 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3147 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3148 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3149 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3150 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3151 | WMI_LOGE("Failed to allocate memory"); |
| 3152 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3153 | goto end; |
| 3154 | } |
| 3155 | |
| 3156 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 3157 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3158 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 3159 | WMITLV_GET_STRUCT_TLVLEN |
| 3160 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 3161 | cmd->vdev_id = oppps->session_id; |
| 3162 | if (oppps->ctwindow) |
| 3163 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 3164 | |
| 3165 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3166 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3167 | cmd->vdev_id, oppps->ctwindow); |
| 3168 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 3169 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3170 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3171 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3172 | wmi_buf_free(buf); |
| 3173 | } |
| 3174 | |
| 3175 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3176 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3177 | return status; |
| 3178 | } |
| 3179 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 3180 | #ifdef CONVERGED_P2P_ENABLE |
| 3181 | /** |
| 3182 | * send_p2p_lo_start_cmd_tlv() - send p2p lo start request to fw |
| 3183 | * @wmi_handle: wmi handle |
| 3184 | * @param: p2p listen offload start parameters |
| 3185 | * |
| 3186 | * Return: QDF status |
| 3187 | */ |
| 3188 | static QDF_STATUS send_p2p_lo_start_cmd_tlv(wmi_unified_t wmi_handle, |
| 3189 | struct p2p_lo_start *param) |
| 3190 | { |
| 3191 | wmi_buf_t buf; |
| 3192 | wmi_p2p_lo_start_cmd_fixed_param *cmd; |
| 3193 | int32_t len = sizeof(*cmd); |
| 3194 | uint8_t *buf_ptr; |
| 3195 | QDF_STATUS status; |
| 3196 | int device_types_len_aligned; |
| 3197 | int probe_resp_len_aligned; |
| 3198 | |
| 3199 | if (!param) { |
| 3200 | WMI_LOGE("lo start param is null"); |
| 3201 | return QDF_STATUS_E_INVAL; |
| 3202 | } |
| 3203 | |
| 3204 | WMI_LOGD("%s: vdev_id:%d", __func__, param->vdev_id); |
| 3205 | |
| 3206 | device_types_len_aligned = |
| 3207 | qdf_roundup(param->dev_types_len, |
| 3208 | sizeof(A_UINT32)); |
| 3209 | probe_resp_len_aligned = |
| 3210 | qdf_roundup(param->probe_resp_len, |
| 3211 | sizeof(A_UINT32)); |
| 3212 | |
| 3213 | len += 2 * WMI_TLV_HDR_SIZE + device_types_len_aligned + |
| 3214 | probe_resp_len_aligned; |
| 3215 | |
| 3216 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3217 | if (!buf) { |
| 3218 | WMI_LOGE("%s: Failed to allocate memory for p2p lo start", |
| 3219 | __func__); |
| 3220 | return QDF_STATUS_E_NOMEM; |
| 3221 | } |
| 3222 | |
| 3223 | cmd = (wmi_p2p_lo_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 3224 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3225 | |
| 3226 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3227 | WMITLV_TAG_STRUC_wmi_p2p_lo_start_cmd_fixed_param, |
| 3228 | WMITLV_GET_STRUCT_TLVLEN( |
| 3229 | wmi_p2p_lo_start_cmd_fixed_param)); |
| 3230 | |
| 3231 | cmd->vdev_id = param->vdev_id; |
| 3232 | cmd->ctl_flags = param->ctl_flags; |
| 3233 | cmd->channel = param->freq; |
| 3234 | cmd->period = param->period; |
| 3235 | cmd->interval = param->interval; |
| 3236 | cmd->count = param->count; |
| 3237 | cmd->device_types_len = param->dev_types_len; |
| 3238 | cmd->prob_resp_len = param->probe_resp_len; |
| 3239 | |
| 3240 | buf_ptr += sizeof(wmi_p2p_lo_start_cmd_fixed_param); |
| 3241 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3242 | device_types_len_aligned); |
| 3243 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3244 | qdf_mem_copy(buf_ptr, param->device_types, |
| 3245 | param->dev_types_len); |
| 3246 | |
| 3247 | buf_ptr += device_types_len_aligned; |
| 3248 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3249 | probe_resp_len_aligned); |
| 3250 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3251 | qdf_mem_copy(buf_ptr, param->probe_resp_tmplt, |
| 3252 | param->probe_resp_len); |
| 3253 | |
| 3254 | WMI_LOGD("%s: Sending WMI_P2P_LO_START command, channel=%d, period=%d, interval=%d, count=%d", __func__, |
| 3255 | cmd->channel, cmd->period, cmd->interval, cmd->count); |
| 3256 | |
| 3257 | status = wmi_unified_cmd_send(wmi_handle, |
| 3258 | buf, len, |
| 3259 | WMI_P2P_LISTEN_OFFLOAD_START_CMDID); |
| 3260 | if (status != QDF_STATUS_SUCCESS) { |
| 3261 | WMI_LOGE("%s: Failed to send p2p lo start: %d", |
| 3262 | __func__, status); |
| 3263 | wmi_buf_free(buf); |
| 3264 | return status; |
| 3265 | } |
| 3266 | |
| 3267 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_START", __func__); |
| 3268 | |
| 3269 | return QDF_STATUS_SUCCESS; |
| 3270 | } |
| 3271 | |
| 3272 | /** |
| 3273 | * send_p2p_lo_stop_cmd_tlv() - send p2p lo stop request to fw |
| 3274 | * @wmi_handle: wmi handle |
| 3275 | * @param: p2p listen offload stop parameters |
| 3276 | * |
| 3277 | * Return: QDF status |
| 3278 | */ |
| 3279 | static QDF_STATUS send_p2p_lo_stop_cmd_tlv(wmi_unified_t wmi_handle, |
| 3280 | uint8_t vdev_id) |
| 3281 | { |
| 3282 | wmi_buf_t buf; |
| 3283 | wmi_p2p_lo_stop_cmd_fixed_param *cmd; |
| 3284 | int32_t len; |
| 3285 | QDF_STATUS status; |
| 3286 | |
| 3287 | WMI_LOGD("%s: vdev_id:%d", __func__, vdev_id); |
| 3288 | |
| 3289 | len = sizeof(*cmd); |
| 3290 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3291 | if (!buf) { |
| 3292 | qdf_print("%s: Failed to allocate memory for p2p lo stop", |
| 3293 | __func__); |
| 3294 | return QDF_STATUS_E_NOMEM; |
| 3295 | } |
| 3296 | cmd = (wmi_p2p_lo_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 3297 | |
| 3298 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3299 | WMITLV_TAG_STRUC_wmi_p2p_lo_stop_cmd_fixed_param, |
| 3300 | WMITLV_GET_STRUCT_TLVLEN( |
| 3301 | wmi_p2p_lo_stop_cmd_fixed_param)); |
| 3302 | |
| 3303 | cmd->vdev_id = vdev_id; |
| 3304 | |
| 3305 | WMI_LOGD("%s: Sending WMI_P2P_LO_STOP command", __func__); |
| 3306 | |
| 3307 | status = wmi_unified_cmd_send(wmi_handle, |
| 3308 | buf, len, |
| 3309 | WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID); |
| 3310 | if (status != QDF_STATUS_SUCCESS) { |
| 3311 | WMI_LOGE("%s: Failed to send p2p lo stop: %d", |
| 3312 | __func__, status); |
| 3313 | wmi_buf_free(buf); |
| 3314 | return status; |
| 3315 | } |
| 3316 | |
| 3317 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_STOP", __func__); |
| 3318 | |
| 3319 | return QDF_STATUS_SUCCESS; |
| 3320 | } |
| 3321 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 3322 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3323 | /** |
| 3324 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 3325 | * @wmi_handle: wmi handle |
| 3326 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3327 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3328 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3329 | 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] | 3330 | { |
| 3331 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 3332 | wmi_buf_t wmi_buf; |
| 3333 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 3334 | uint8_t *buf_ptr; |
| 3335 | |
| 3336 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3337 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 3338 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3339 | } |
| 3340 | |
| 3341 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 3342 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3343 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3344 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3345 | } |
| 3346 | |
| 3347 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3348 | |
| 3349 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 3350 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3351 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 3352 | WMITLV_GET_STRUCT_TLVLEN |
| 3353 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 3354 | |
| 3355 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 3356 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3357 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3358 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3359 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3360 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3361 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3362 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3363 | } |
| 3364 | |
| 3365 | /** |
| 3366 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 3367 | * @wmi_handle: wmi handle |
| 3368 | * @vdevid: vdev id |
| 3369 | * @peer_addr: peer mac address |
| 3370 | * @auto_triggerparam: auto trigger parameters |
| 3371 | * @num_ac: number of access category |
| 3372 | * |
| 3373 | * This function sets the trigger |
| 3374 | * uapsd params such as service interval, delay interval |
| 3375 | * and suspend interval which will be used by the firmware |
| 3376 | * to send trigger frames periodically when there is no |
| 3377 | * traffic on the transmit side. |
| 3378 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3379 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3380 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3381 | 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] | 3382 | struct sta_uapsd_trig_params *param) |
| 3383 | { |
| 3384 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3385 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3386 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 3387 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 3388 | uint32_t i; |
| 3389 | wmi_buf_t buf; |
| 3390 | uint8_t *buf_ptr; |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3391 | struct sta_uapsd_params *uapsd_param; |
| 3392 | wmi_sta_uapsd_auto_trig_param *trig_param; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3393 | |
| 3394 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 3395 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3396 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3397 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3398 | } |
| 3399 | |
| 3400 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3401 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 3402 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3403 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 3404 | WMITLV_GET_STRUCT_TLVLEN |
| 3405 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 3406 | cmd->vdev_id = param->vdevid; |
| 3407 | cmd->num_ac = param->num_ac; |
| 3408 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 3409 | |
| 3410 | /* TLV indicating array of structures to follow */ |
| 3411 | buf_ptr += sizeof(*cmd); |
| 3412 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 3413 | |
| 3414 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3415 | |
| 3416 | /* |
| 3417 | * Update tag and length for uapsd auto trigger params (this will take |
| 3418 | * care of updating tag and length if it is not pre-filled by caller). |
| 3419 | */ |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3420 | uapsd_param = (struct sta_uapsd_params *)param->auto_triggerparam; |
| 3421 | trig_param = (wmi_sta_uapsd_auto_trig_param *)buf_ptr; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3422 | for (i = 0; i < param->num_ac; i++) { |
| 3423 | WMITLV_SET_HDR((buf_ptr + |
| 3424 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 3425 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 3426 | WMITLV_GET_STRUCT_TLVLEN |
| 3427 | (wmi_sta_uapsd_auto_trig_param)); |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3428 | trig_param->wmm_ac = uapsd_param->wmm_ac; |
| 3429 | trig_param->user_priority = uapsd_param->user_priority; |
| 3430 | trig_param->service_interval = uapsd_param->service_interval; |
| 3431 | trig_param->suspend_interval = uapsd_param->suspend_interval; |
| 3432 | trig_param->delay_interval = uapsd_param->delay_interval; |
| 3433 | trig_param++; |
| 3434 | uapsd_param++; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3435 | } |
| 3436 | |
| 3437 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3438 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3439 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3440 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3441 | wmi_buf_free(buf); |
| 3442 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3443 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3444 | return ret; |
| 3445 | } |
| 3446 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3447 | /** |
| 3448 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 3449 | * @wmi_handle: pointer to the wmi handle |
| 3450 | * @utc: pointer to the UTC time struct |
| 3451 | * |
| 3452 | * Return: 0 on succes |
| 3453 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3454 | 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] | 3455 | struct ocb_utc_param *utc) |
| 3456 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3457 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3458 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 3459 | uint8_t *buf_ptr; |
| 3460 | uint32_t len, i; |
| 3461 | wmi_buf_t buf; |
| 3462 | |
| 3463 | len = sizeof(*cmd); |
| 3464 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3465 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3466 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3467 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3468 | } |
| 3469 | |
| 3470 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3471 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 3472 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3473 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 3474 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 3475 | cmd->vdev_id = utc->vdev_id; |
| 3476 | |
| 3477 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 3478 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 3479 | |
| 3480 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 3481 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 3482 | |
| 3483 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3484 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3485 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3486 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3487 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3488 | } |
| 3489 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3490 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3491 | } |
| 3492 | |
| 3493 | /** |
| 3494 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 3495 | * frames on a channel |
| 3496 | * @wmi_handle: pointer to the wmi handle |
| 3497 | * @timing_advert: pointer to the timing advertisement struct |
| 3498 | * |
| 3499 | * Return: 0 on succes |
| 3500 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3501 | 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] | 3502 | struct ocb_timing_advert_param *timing_advert) |
| 3503 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3504 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3505 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 3506 | uint8_t *buf_ptr; |
| 3507 | uint32_t len, len_template; |
| 3508 | wmi_buf_t buf; |
| 3509 | |
| 3510 | len = sizeof(*cmd) + |
| 3511 | WMI_TLV_HDR_SIZE; |
| 3512 | |
| 3513 | len_template = timing_advert->template_length; |
| 3514 | /* Add padding to the template if needed */ |
| 3515 | if (len_template % 4 != 0) |
| 3516 | len_template += 4 - (len_template % 4); |
| 3517 | len += len_template; |
| 3518 | |
| 3519 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3520 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3521 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3522 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3523 | } |
| 3524 | |
| 3525 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3526 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3527 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3528 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 3529 | WMITLV_GET_STRUCT_TLVLEN( |
| 3530 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 3531 | cmd->vdev_id = timing_advert->vdev_id; |
| 3532 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 3533 | cmd->channel_freq = timing_advert->chan_freq; |
| 3534 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 3535 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 3536 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 3537 | buf_ptr += sizeof(*cmd); |
| 3538 | |
| 3539 | /* Add the timing advert template */ |
| 3540 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3541 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3542 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3543 | (uint8_t *)timing_advert->template_value, |
| 3544 | timing_advert->template_length); |
| 3545 | |
| 3546 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3547 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3548 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3549 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3550 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3551 | } |
| 3552 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3553 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3554 | } |
| 3555 | |
| 3556 | /** |
| 3557 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 3558 | * on a channel |
| 3559 | * @wmi_handle: pointer to the wmi handle |
| 3560 | * @timing_advert: pointer to the timing advertisement struct |
| 3561 | * |
| 3562 | * Return: 0 on succes |
| 3563 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3564 | 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] | 3565 | struct ocb_timing_advert_param *timing_advert) |
| 3566 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3567 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3568 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 3569 | uint8_t *buf_ptr; |
| 3570 | uint32_t len; |
| 3571 | wmi_buf_t buf; |
| 3572 | |
| 3573 | len = sizeof(*cmd); |
| 3574 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3575 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3576 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3577 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3578 | } |
| 3579 | |
| 3580 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3581 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3582 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3583 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 3584 | WMITLV_GET_STRUCT_TLVLEN( |
| 3585 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 3586 | cmd->vdev_id = timing_advert->vdev_id; |
| 3587 | cmd->channel_freq = timing_advert->chan_freq; |
| 3588 | |
| 3589 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3590 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3591 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3592 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3593 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3594 | } |
| 3595 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3596 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3597 | } |
| 3598 | |
| 3599 | /** |
| 3600 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 3601 | * @wmi_handle: pointer to the wmi handle |
| 3602 | * @request: pointer to the request |
| 3603 | * |
| 3604 | * Return: 0 on succes |
| 3605 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3606 | 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] | 3607 | uint8_t vdev_id) |
| 3608 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3609 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3610 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 3611 | uint8_t *buf_ptr; |
| 3612 | wmi_buf_t buf; |
| 3613 | int32_t len; |
| 3614 | |
| 3615 | len = sizeof(*cmd); |
| 3616 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3617 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3618 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3619 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3620 | } |
| 3621 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3622 | |
| 3623 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3624 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3625 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3626 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 3627 | WMITLV_GET_STRUCT_TLVLEN( |
| 3628 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 3629 | cmd->vdev_id = vdev_id; |
| 3630 | |
| 3631 | /* Send the WMI command */ |
| 3632 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3633 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 3634 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3635 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3636 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3637 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3638 | } |
| 3639 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3640 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3641 | } |
| 3642 | |
| 3643 | /** |
| 3644 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 3645 | * @wmi_handle: pointer to the wmi handle |
| 3646 | * @get_stats_param: pointer to the dcc stats |
| 3647 | * |
| 3648 | * Return: 0 on succes |
| 3649 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3650 | static QDF_STATUS send_dcc_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3651 | struct dcc_get_stats_param *get_stats_param) |
| 3652 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3653 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3654 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 3655 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 3656 | wmi_buf_t buf; |
| 3657 | uint8_t *buf_ptr; |
| 3658 | uint32_t len; |
| 3659 | uint32_t i; |
| 3660 | |
| 3661 | /* Validate the input */ |
| 3662 | if (get_stats_param->request_array_len != |
| 3663 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3664 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3665 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3666 | } |
| 3667 | |
| 3668 | /* Allocate memory for the WMI command */ |
| 3669 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 3670 | get_stats_param->request_array_len; |
| 3671 | |
| 3672 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3673 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3674 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3675 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3676 | } |
| 3677 | |
| 3678 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3679 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3680 | |
| 3681 | /* Populate the WMI command */ |
| 3682 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 3683 | buf_ptr += sizeof(*cmd); |
| 3684 | |
| 3685 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3686 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 3687 | WMITLV_GET_STRUCT_TLVLEN( |
| 3688 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 3689 | cmd->vdev_id = get_stats_param->vdev_id; |
| 3690 | cmd->num_channels = get_stats_param->channel_count; |
| 3691 | |
| 3692 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3693 | get_stats_param->request_array_len); |
| 3694 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3695 | |
| 3696 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3697 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3698 | get_stats_param->request_array_len); |
| 3699 | for (i = 0; i < cmd->num_channels; i++) |
| 3700 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 3701 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 3702 | WMITLV_GET_STRUCT_TLVLEN( |
| 3703 | wmi_dcc_channel_stats_request)); |
| 3704 | |
| 3705 | /* Send the WMI command */ |
| 3706 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3707 | WMI_DCC_GET_STATS_CMDID); |
| 3708 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3709 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3710 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3711 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3712 | } |
| 3713 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3714 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3715 | } |
| 3716 | |
| 3717 | /** |
| 3718 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 3719 | * @wmi_handle: pointer to the wmi handle |
| 3720 | * @vdev_id: vdev id |
| 3721 | * @dcc_stats_bitmap: dcc status bitmap |
| 3722 | * |
| 3723 | * Return: 0 on succes |
| 3724 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3725 | 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] | 3726 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 3727 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3728 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3729 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 3730 | wmi_buf_t buf; |
| 3731 | uint8_t *buf_ptr; |
| 3732 | uint32_t len; |
| 3733 | |
| 3734 | /* Allocate memory for the WMI command */ |
| 3735 | len = sizeof(*cmd); |
| 3736 | |
| 3737 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3738 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3739 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3740 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3741 | } |
| 3742 | |
| 3743 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3744 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3745 | |
| 3746 | /* Populate the WMI command */ |
| 3747 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 3748 | |
| 3749 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3750 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 3751 | WMITLV_GET_STRUCT_TLVLEN( |
| 3752 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 3753 | cmd->vdev_id = vdev_id; |
| 3754 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 3755 | |
| 3756 | /* Send the WMI command */ |
| 3757 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3758 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3759 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3760 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3761 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3762 | } |
| 3763 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3764 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3765 | } |
| 3766 | |
| 3767 | /** |
| 3768 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 3769 | * @wmi_handle: pointer to the wmi handle |
| 3770 | * @update_ndl_param: pointer to the request parameters |
| 3771 | * |
| 3772 | * Return: 0 on success |
| 3773 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3774 | static QDF_STATUS send_dcc_update_ndl_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3775 | struct dcc_update_ndl_param *update_ndl_param) |
| 3776 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3777 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3778 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 3779 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 3780 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 3781 | uint32_t active_state_count; |
| 3782 | wmi_buf_t buf; |
| 3783 | uint8_t *buf_ptr; |
| 3784 | uint32_t len; |
| 3785 | uint32_t i; |
| 3786 | |
| 3787 | /* validate the input */ |
| 3788 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 3789 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3790 | WMI_LOGE(FL("Invalid parameter")); |
| 3791 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3792 | } |
| 3793 | active_state_count = 0; |
| 3794 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 3795 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 3796 | active_state_count += |
| 3797 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 3798 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 3799 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3800 | WMI_LOGE(FL("Invalid parameter")); |
| 3801 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3802 | } |
| 3803 | |
| 3804 | /* Allocate memory for the WMI command */ |
| 3805 | len = sizeof(*cmd) + |
| 3806 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 3807 | WMI_TLV_HDR_SIZE + |
| 3808 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 3809 | |
| 3810 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3811 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3812 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3813 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3814 | } |
| 3815 | |
| 3816 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3817 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3818 | |
| 3819 | /* Populate the WMI command */ |
| 3820 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3821 | buf_ptr += sizeof(*cmd); |
| 3822 | |
| 3823 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3824 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3825 | WMITLV_GET_STRUCT_TLVLEN( |
| 3826 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3827 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3828 | cmd->num_channel = update_ndl_param->channel_count; |
| 3829 | |
| 3830 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3831 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3832 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3833 | |
| 3834 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3835 | 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] | 3836 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3837 | for (i = 0; i < cmd->num_channel; i++) |
| 3838 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3839 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3840 | WMITLV_GET_STRUCT_TLVLEN( |
| 3841 | wmi_dcc_ndl_chan)); |
| 3842 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3843 | |
| 3844 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3845 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3846 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3847 | |
| 3848 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3849 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3850 | update_ndl_param->dcc_ndl_active_state_list, |
| 3851 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3852 | for (i = 0; i < active_state_count; i++) { |
| 3853 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3854 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3855 | WMITLV_GET_STRUCT_TLVLEN( |
| 3856 | wmi_dcc_ndl_active_state_config)); |
| 3857 | } |
| 3858 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3859 | |
| 3860 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3861 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3862 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3863 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3864 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3865 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3866 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3867 | } |
| 3868 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3869 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3870 | } |
| 3871 | |
| 3872 | /** |
| 3873 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3874 | * @wmi_handle: pointer to the wmi handle |
| 3875 | * @config: the OCB configuration |
| 3876 | * |
| 3877 | * Return: 0 on success |
| 3878 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3879 | static QDF_STATUS send_ocb_set_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3880 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3881 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3882 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3883 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3884 | wmi_channel *chan; |
| 3885 | wmi_ocb_channel *ocb_chan; |
| 3886 | wmi_qos_parameter *qos_param; |
| 3887 | wmi_dcc_ndl_chan *ndl_chan; |
| 3888 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3889 | wmi_ocb_schedule_element *sched_elem; |
| 3890 | uint8_t *buf_ptr; |
| 3891 | wmi_buf_t buf; |
| 3892 | int32_t len; |
| 3893 | int32_t i, j, active_state_count; |
| 3894 | |
| 3895 | /* |
| 3896 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3897 | * states. Validate dcc_ndl_active_state_list_len. |
| 3898 | */ |
| 3899 | active_state_count = 0; |
| 3900 | if (config->dcc_ndl_chan_list_len) { |
| 3901 | if (!config->dcc_ndl_chan_list || |
| 3902 | config->dcc_ndl_chan_list_len != |
| 3903 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3904 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3905 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3906 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3907 | } |
| 3908 | |
| 3909 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3910 | i < config->channel_count; ++i, ++ndl_chan) |
| 3911 | active_state_count += |
| 3912 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3913 | |
| 3914 | if (active_state_count) { |
| 3915 | if (!config->dcc_ndl_active_state_list || |
| 3916 | config->dcc_ndl_active_state_list_len != |
| 3917 | active_state_count * |
| 3918 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3919 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3920 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3921 | } |
| 3922 | } |
| 3923 | } |
| 3924 | |
| 3925 | len = sizeof(*cmd) + |
| 3926 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3927 | sizeof(wmi_channel) + |
| 3928 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3929 | sizeof(wmi_ocb_channel) + |
| 3930 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3931 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3932 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3933 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3934 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3935 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3936 | sizeof(wmi_ocb_schedule_element); |
| 3937 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3938 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3939 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3940 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3941 | } |
| 3942 | |
| 3943 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3944 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3945 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3946 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3947 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3948 | cmd->vdev_id = config->session_id; |
| 3949 | cmd->channel_count = config->channel_count; |
| 3950 | cmd->schedule_size = config->schedule_size; |
| 3951 | cmd->flags = config->flags; |
| 3952 | buf_ptr += sizeof(*cmd); |
| 3953 | |
| 3954 | /* Add the wmi_channel info */ |
| 3955 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3956 | config->channel_count*sizeof(wmi_channel)); |
| 3957 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3958 | for (i = 0; i < config->channel_count; i++) { |
| 3959 | chan = (wmi_channel *)buf_ptr; |
| 3960 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3961 | WMITLV_TAG_STRUC_wmi_channel, |
| 3962 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3963 | chan->mhz = config->channels[i].chan_freq; |
| 3964 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3965 | chan->band_center_freq2 = 0; |
| 3966 | chan->info = 0; |
| 3967 | |
| 3968 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3969 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3970 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3971 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3972 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3973 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3974 | config->channels[i].antenna_max); |
| 3975 | |
| 3976 | if (config->channels[i].bandwidth < 10) |
| 3977 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3978 | else if (config->channels[i].bandwidth < 20) |
| 3979 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3980 | buf_ptr += sizeof(*chan); |
| 3981 | } |
| 3982 | |
| 3983 | /* Add the wmi_ocb_channel info */ |
| 3984 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3985 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3986 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3987 | for (i = 0; i < config->channel_count; i++) { |
| 3988 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3989 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3990 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 3991 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 3992 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 3993 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 3994 | config->channels[i].mac_address.bytes, |
| 3995 | &ocb_chan->mac_address); |
| 3996 | buf_ptr += sizeof(*ocb_chan); |
| 3997 | } |
| 3998 | |
| 3999 | /* Add the wmi_qos_parameter info */ |
| 4000 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4001 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 4002 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4003 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 4004 | for (i = 0; i < config->channel_count; i++) { |
| 4005 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 4006 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 4007 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 4008 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 4009 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 4010 | qos_param->aifsn = |
| 4011 | config->channels[i].qos_params[j].aifsn; |
| 4012 | qos_param->cwmin = |
| 4013 | config->channels[i].qos_params[j].cwmin; |
| 4014 | qos_param->cwmax = |
| 4015 | config->channels[i].qos_params[j].cwmax; |
| 4016 | buf_ptr += sizeof(*qos_param); |
| 4017 | } |
| 4018 | } |
| 4019 | |
| 4020 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 4021 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4022 | config->dcc_ndl_chan_list_len); |
| 4023 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4024 | if (config->dcc_ndl_chan_list_len) { |
| 4025 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4026 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4027 | config->dcc_ndl_chan_list_len); |
| 4028 | for (i = 0; i < config->channel_count; i++) |
| 4029 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 4030 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 4031 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 4032 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 4033 | } |
| 4034 | |
| 4035 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 4036 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 4037 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 4038 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4039 | if (active_state_count) { |
| 4040 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4041 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4042 | config->dcc_ndl_active_state_list, |
| 4043 | active_state_count * sizeof(*ndl_active_config)); |
| 4044 | for (i = 0; i < active_state_count; ++i) |
| 4045 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 4046 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 4047 | WMITLV_GET_STRUCT_TLVLEN( |
| 4048 | wmi_dcc_ndl_active_state_config)); |
| 4049 | buf_ptr += active_state_count * |
| 4050 | sizeof(*ndl_active_config); |
| 4051 | } |
| 4052 | |
| 4053 | /* Add the wmi_ocb_schedule_element info */ |
| 4054 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4055 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 4056 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4057 | for (i = 0; i < config->schedule_size; i++) { |
| 4058 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 4059 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 4060 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 4061 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 4062 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 4063 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 4064 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 4065 | buf_ptr += sizeof(*sched_elem); |
| 4066 | } |
| 4067 | |
| 4068 | |
| 4069 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4070 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4071 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4072 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4073 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4074 | } |
| 4075 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4076 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4077 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4078 | |
| 4079 | /** |
| 4080 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 4081 | * @wmi_handle: wmi handle |
| 4082 | * @mcc_adaptive_scheduler: enable/disable |
| 4083 | * |
| 4084 | * This function enable/disable mcc adaptive scheduler in fw. |
| 4085 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4086 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4087 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4088 | static QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 4089 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 4090 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4091 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4092 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4093 | wmi_buf_t buf = 0; |
| 4094 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 4095 | uint16_t len = |
| 4096 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 4097 | |
| 4098 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4099 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4100 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 4101 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4102 | } |
| 4103 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 4104 | wmi_buf_data(buf); |
| 4105 | |
| 4106 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4107 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 4108 | WMITLV_GET_STRUCT_TLVLEN |
| 4109 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 4110 | cmd->enable = mcc_adaptive_scheduler; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 4111 | 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] | 4112 | |
| 4113 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4114 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4115 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4116 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4117 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4118 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4119 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4120 | |
| 4121 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4122 | } |
| 4123 | |
| 4124 | /** |
| 4125 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 4126 | * @wmi: wmi handle |
| 4127 | * @mcc_channel: mcc channel |
| 4128 | * @mcc_channel_time_latency: MCC channel time latency. |
| 4129 | * |
| 4130 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 4131 | * channel of it and channel number. The info is provided run time using |
| 4132 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 4133 | * |
| 4134 | * Return: CDF status |
| 4135 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4136 | 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] | 4137 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 4138 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4139 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4140 | wmi_buf_t buf = 0; |
| 4141 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 4142 | uint16_t len = 0; |
| 4143 | uint8_t *buf_ptr = NULL; |
| 4144 | wmi_resmgr_chan_latency chan_latency; |
| 4145 | /* Note: we only support MCC time latency for a single channel */ |
| 4146 | uint32_t num_channels = 1; |
| 4147 | uint32_t chan1_freq = mcc_channel_freq; |
| 4148 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 4149 | |
| 4150 | |
| 4151 | /* If 0ms latency is provided, then FW will set to a default. |
| 4152 | * Otherwise, latency must be at least 30ms. |
| 4153 | */ |
| 4154 | if ((latency_chan1 > 0) && |
| 4155 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4156 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4157 | "Minimum is 30ms (or 0 to use default value by " |
| 4158 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4159 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4160 | } |
| 4161 | |
| 4162 | /* Set WMI CMD for channel time latency here */ |
| 4163 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 4164 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 4165 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 4166 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4167 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4168 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 4169 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4170 | } |
| 4171 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4172 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 4173 | wmi_buf_data(buf); |
| 4174 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 4175 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 4176 | WMITLV_GET_STRUCT_TLVLEN |
| 4177 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 4178 | cmdTL->num_chans = num_channels; |
| 4179 | /* Update channel time latency information for home channel(s) */ |
| 4180 | buf_ptr += sizeof(*cmdTL); |
| 4181 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4182 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 4183 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4184 | chan_latency.chan_mhz = chan1_freq; |
| 4185 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4186 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4187 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4188 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4189 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4190 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4191 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4192 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4193 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4194 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4195 | |
| 4196 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4197 | } |
| 4198 | |
| 4199 | /** |
| 4200 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 4201 | * @wmi: wmi handle |
| 4202 | * @adapter_1_chan_number: adapter 1 channel number |
| 4203 | * @adapter_1_quota: adapter 1 quota |
| 4204 | * @adapter_2_chan_number: adapter 2 channel number |
| 4205 | * |
| 4206 | * Return: CDF status |
| 4207 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4208 | 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] | 4209 | uint32_t adapter_1_chan_freq, |
| 4210 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 4211 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4212 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4213 | wmi_buf_t buf = 0; |
| 4214 | uint16_t len = 0; |
| 4215 | uint8_t *buf_ptr = NULL; |
| 4216 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 4217 | wmi_resmgr_chan_time_quota chan_quota; |
| 4218 | uint32_t quota_chan1 = adapter_1_quota; |
| 4219 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 4220 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 4221 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 4222 | uint32_t num_channels = 2; |
| 4223 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 4224 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 4225 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4226 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4227 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 4228 | chan1_freq, quota_chan1, chan2_freq, |
| 4229 | quota_chan2); |
| 4230 | |
| 4231 | /* |
| 4232 | * Perform sanity check on time quota values provided. |
| 4233 | */ |
| 4234 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 4235 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4236 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4237 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4238 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4239 | } |
| 4240 | /* Set WMI CMD for channel time quota here */ |
| 4241 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 4242 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 4243 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 4244 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4245 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4246 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 4247 | QDF_ASSERT(0); |
| 4248 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4249 | } |
| 4250 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4251 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 4252 | wmi_buf_data(buf); |
| 4253 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 4254 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 4255 | WMITLV_GET_STRUCT_TLVLEN |
| 4256 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 4257 | cmdTQ->num_chans = num_channels; |
| 4258 | |
| 4259 | /* Update channel time quota information for home channel(s) */ |
| 4260 | buf_ptr += sizeof(*cmdTQ); |
| 4261 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4262 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 4263 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4264 | chan_quota.chan_mhz = chan1_freq; |
| 4265 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4266 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4267 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 4268 | buf_ptr += sizeof(chan_quota); |
| 4269 | chan_quota.chan_mhz = chan2_freq; |
| 4270 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4271 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4272 | |
| 4273 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4274 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4275 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4276 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4277 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4278 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4279 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4280 | |
| 4281 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4282 | } |
| 4283 | |
| 4284 | /** |
| 4285 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 4286 | * @wmi_handle: Pointer to wmi handle |
| 4287 | * @thermal_info: Thermal command information |
| 4288 | * |
| 4289 | * This function sends the thermal management command |
| 4290 | * to the firmware |
| 4291 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4292 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4293 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4294 | 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] | 4295 | struct thermal_cmd_params *thermal_info) |
| 4296 | { |
| 4297 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 4298 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4299 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4300 | uint32_t len = 0; |
| 4301 | |
| 4302 | len = sizeof(*cmd); |
| 4303 | |
| 4304 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4305 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4306 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4307 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4308 | } |
| 4309 | |
| 4310 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 4311 | |
| 4312 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4313 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 4314 | WMITLV_GET_STRUCT_TLVLEN |
| 4315 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 4316 | |
| 4317 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 4318 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 4319 | cmd->enable = thermal_info->thermal_enable; |
| 4320 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4321 | 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] | 4322 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 4323 | |
| 4324 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4325 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4326 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4327 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4328 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4329 | } |
| 4330 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4331 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4332 | } |
| 4333 | |
| 4334 | |
| 4335 | /** |
| 4336 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4337 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4338 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 4339 | * |
| 4340 | * This function sends down the LRO configuration parameters to |
| 4341 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 4342 | * seed values for the toeplitz hash generation |
| 4343 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4344 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4345 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4346 | 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] | 4347 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 4348 | { |
| 4349 | wmi_lro_info_cmd_fixed_param *cmd; |
| 4350 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4351 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4352 | |
| 4353 | |
| 4354 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4355 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4356 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4357 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4358 | } |
| 4359 | |
| 4360 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 4361 | |
| 4362 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4363 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 4364 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 4365 | |
| 4366 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 4367 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 4368 | wmi_lro_cmd->tcp_flag); |
| 4369 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 4370 | wmi_lro_cmd->tcp_flag_mask); |
| 4371 | cmd->toeplitz_hash_ipv4_0_3 = |
| 4372 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 4373 | cmd->toeplitz_hash_ipv4_4_7 = |
| 4374 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 4375 | cmd->toeplitz_hash_ipv4_8_11 = |
| 4376 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 4377 | cmd->toeplitz_hash_ipv4_12_15 = |
| 4378 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 4379 | cmd->toeplitz_hash_ipv4_16 = |
| 4380 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 4381 | |
| 4382 | cmd->toeplitz_hash_ipv6_0_3 = |
| 4383 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 4384 | cmd->toeplitz_hash_ipv6_4_7 = |
| 4385 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 4386 | cmd->toeplitz_hash_ipv6_8_11 = |
| 4387 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 4388 | cmd->toeplitz_hash_ipv6_12_15 = |
| 4389 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 4390 | cmd->toeplitz_hash_ipv6_16_19 = |
| 4391 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 4392 | cmd->toeplitz_hash_ipv6_20_23 = |
| 4393 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 4394 | cmd->toeplitz_hash_ipv6_24_27 = |
| 4395 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 4396 | cmd->toeplitz_hash_ipv6_28_31 = |
| 4397 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 4398 | cmd->toeplitz_hash_ipv6_32_35 = |
| 4399 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 4400 | cmd->toeplitz_hash_ipv6_36_39 = |
| 4401 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 4402 | cmd->toeplitz_hash_ipv6_40 = |
| 4403 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 4404 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4405 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4406 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 4407 | |
| 4408 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4409 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4410 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4411 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4412 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4413 | } |
| 4414 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4415 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4416 | } |
| 4417 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4418 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4419 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 4420 | * @wmi_handle: Pointer to wmi handle |
| 4421 | * @rate_report_params: Pointer to peer rate report parameters |
| 4422 | * |
| 4423 | * |
| 4424 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 4425 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4426 | 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] | 4427 | struct wmi_peer_rate_report_params *rate_report_params) |
| 4428 | { |
| 4429 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 4430 | wmi_buf_t buf = NULL; |
| 4431 | QDF_STATUS status = 0; |
| 4432 | uint32_t len = 0; |
| 4433 | uint32_t i, j; |
| 4434 | |
| 4435 | len = sizeof(*cmd); |
| 4436 | |
| 4437 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4438 | if (!buf) { |
| 4439 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 4440 | return QDF_STATUS_E_FAILURE; |
| 4441 | } |
| 4442 | |
| 4443 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 4444 | wmi_buf_data(buf); |
| 4445 | |
| 4446 | WMITLV_SET_HDR( |
| 4447 | &cmd->tlv_header, |
| 4448 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 4449 | WMITLV_GET_STRUCT_TLVLEN( |
| 4450 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 4451 | |
| 4452 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 4453 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 4454 | cmd->report_timer_period = rate_report_params->timer_period; |
| 4455 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 4456 | cmd->cond_per_phy[i].val_cond_flags = |
| 4457 | rate_report_params->report_per_phy[i].cond_flags; |
| 4458 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 4459 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 4460 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 4461 | rate_report_params->report_per_phy[i].delta.percent; |
| 4462 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 4463 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 4464 | rate_report_params->report_per_phy[i]. |
| 4465 | report_rate_threshold[j]; |
| 4466 | } |
| 4467 | } |
| 4468 | |
| 4469 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 4470 | cmd->enable_rate_report, |
| 4471 | cmd->report_backoff_time, cmd->report_timer_period); |
| 4472 | |
| 4473 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4474 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 4475 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4476 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4477 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 4478 | __func__); |
| 4479 | } |
| 4480 | return status; |
| 4481 | } |
| 4482 | |
| 4483 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4484 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 4485 | * @wmi_handle: wmi handle |
| 4486 | * @param: bcn ll cmd parameter |
| 4487 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4488 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4489 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4490 | 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] | 4491 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 4492 | { |
| 4493 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 4494 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4495 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4496 | |
| 4497 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4498 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4499 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4500 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4501 | } |
| 4502 | |
| 4503 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 4504 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4505 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 4506 | WMITLV_GET_STRUCT_TLVLEN |
| 4507 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 4508 | cmd->vdev_id = param->vdev_id; |
| 4509 | cmd->data_len = param->data_len; |
| 4510 | cmd->frame_ctrl = param->frame_ctrl; |
| 4511 | cmd->frag_ptr = param->frag_ptr; |
| 4512 | cmd->dtim_flag = param->dtim_flag; |
| 4513 | |
| 4514 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 4515 | WMI_PDEV_SEND_BCN_CMDID); |
| 4516 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4517 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4518 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4519 | wmi_buf_free(wmi_buf); |
| 4520 | } |
| 4521 | |
| 4522 | return ret; |
| 4523 | } |
| 4524 | |
| 4525 | /** |
| 4526 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 4527 | * @wmi_handle: wmi handle |
| 4528 | * @vdev_id: vdev id |
| 4529 | * @max_retries: max retries |
| 4530 | * @retry_interval: retry interval |
| 4531 | * This function sets sta query related parameters in fw. |
| 4532 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4533 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4534 | */ |
| 4535 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4536 | 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] | 4537 | uint8_t vdev_id, uint32_t max_retries, |
| 4538 | uint32_t retry_interval) |
| 4539 | { |
| 4540 | wmi_buf_t buf; |
| 4541 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 4542 | int len; |
| 4543 | |
| 4544 | len = sizeof(*cmd); |
| 4545 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4546 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4547 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 4548 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4549 | } |
| 4550 | |
| 4551 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 4552 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4553 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 4554 | WMITLV_GET_STRUCT_TLVLEN |
| 4555 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 4556 | |
| 4557 | |
| 4558 | cmd->vdev_id = vdev_id; |
| 4559 | cmd->sa_query_max_retry_count = max_retries; |
| 4560 | cmd->sa_query_retry_interval = retry_interval; |
| 4561 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4562 | 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] | 4563 | vdev_id, retry_interval, max_retries); |
| 4564 | |
| 4565 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4566 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4567 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4568 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4569 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4570 | } |
| 4571 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4572 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4573 | return 0; |
| 4574 | } |
| 4575 | |
| 4576 | /** |
| 4577 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 4578 | * @wmi_handle: wmi handle |
| 4579 | * @params: sta keep alive parameter |
| 4580 | * |
| 4581 | * This function sets keep alive related parameters in fw. |
| 4582 | * |
| 4583 | * Return: CDF status |
| 4584 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4585 | 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] | 4586 | struct sta_params *params) |
| 4587 | { |
| 4588 | wmi_buf_t buf; |
| 4589 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 4590 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 4591 | uint8_t *buf_ptr; |
| 4592 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4593 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4594 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4595 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4596 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4597 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 4598 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4599 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4600 | WMI_LOGE("wmi_buf_alloc failed"); |
| 4601 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4602 | } |
| 4603 | |
| 4604 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 4605 | buf_ptr = (uint8_t *) cmd; |
| 4606 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4607 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 4608 | WMITLV_GET_STRUCT_TLVLEN |
| 4609 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 4610 | cmd->interval = params->timeperiod; |
| 4611 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 4612 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4613 | 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] | 4614 | params->timeperiod, params->method); |
| 4615 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 4616 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 4617 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 4618 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 4619 | |
| 4620 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 4621 | if ((NULL == params->hostv4addr) || |
| 4622 | (NULL == params->destv4addr) || |
| 4623 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4624 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4625 | "destv4addr:%p destmac:%p ", __func__, |
| 4626 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4627 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4628 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4629 | } |
| 4630 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4631 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4632 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4633 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4634 | WMI_IPV4_ADDR_LEN); |
| 4635 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 4636 | } else { |
| 4637 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 4638 | } |
| 4639 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4640 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4641 | WMI_STA_KEEPALIVE_CMDID); |
| 4642 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4643 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4644 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4645 | } |
| 4646 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4647 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4648 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4649 | } |
| 4650 | |
| 4651 | /** |
| 4652 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 4653 | * @wmi_handle: wmi handle |
| 4654 | * @if_id: vdev id |
| 4655 | * @gtx_info: GTX config params |
| 4656 | * |
| 4657 | * This function set GTX related params in firmware. |
| 4658 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4659 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4660 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4661 | 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] | 4662 | struct wmi_gtx_config *gtx_info) |
| 4663 | { |
| 4664 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 4665 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4666 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4667 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4668 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4669 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4670 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4671 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4672 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4673 | } |
| 4674 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 4675 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4676 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 4677 | WMITLV_GET_STRUCT_TLVLEN |
| 4678 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 4679 | cmd->vdev_id = if_id; |
| 4680 | |
| 4681 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 4682 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 4683 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 4684 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 4685 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 4686 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 4687 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 4688 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 4689 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4690 | 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] | 4691 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 4692 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 4693 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 4694 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 4695 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4696 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4697 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4698 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4699 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 4700 | wmi_buf_free(buf); |
| 4701 | } |
| 4702 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4703 | } |
| 4704 | |
| 4705 | /** |
| 4706 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 4707 | * @wmi_handle: wmi handle |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4708 | * @vdev_id: vdev id. |
| 4709 | * @wmm_vparams: edca parameters |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4710 | * |
| 4711 | * This function updates EDCA parameters to the target |
| 4712 | * |
| 4713 | * Return: CDF Status |
| 4714 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4715 | 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] | 4716 | uint8_t vdev_id, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4717 | struct wmi_host_wme_vparams wmm_vparams[WMI_MAX_NUM_AC]) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4718 | { |
| 4719 | uint8_t *buf_ptr; |
| 4720 | wmi_buf_t buf; |
| 4721 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4722 | wmi_wmm_vparams *wmm_param; |
| 4723 | struct wmi_host_wme_vparams *twmm_param; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4724 | int len = sizeof(*cmd); |
| 4725 | int ac; |
| 4726 | |
| 4727 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4728 | |
| 4729 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4730 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4731 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4732 | } |
| 4733 | |
| 4734 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4735 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 4736 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4737 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4738 | WMITLV_GET_STRUCT_TLVLEN |
| 4739 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 4740 | cmd->vdev_id = vdev_id; |
| 4741 | |
| 4742 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 4743 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4744 | twmm_param = (struct wmi_host_wme_vparams *) (&wmm_vparams[ac]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4745 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 4746 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4747 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 4748 | wmm_param->cwmin = twmm_param->cwmin; |
| 4749 | wmm_param->cwmax = twmm_param->cwmax; |
| 4750 | wmm_param->aifs = twmm_param->aifs; |
| 4751 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 4752 | wmm_param->acm = twmm_param->acm; |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4753 | wmm_param->no_ack = twmm_param->noackpolicy; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4754 | } |
| 4755 | |
| 4756 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4757 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 4758 | goto fail; |
| 4759 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4760 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4761 | |
| 4762 | fail: |
| 4763 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4764 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 4765 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4766 | } |
| 4767 | |
| 4768 | /** |
| 4769 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 4770 | * @wmi_handle: wmi handle |
| 4771 | * @vdev_id: vdev id |
| 4772 | * @probe_rsp_info: probe response info |
| 4773 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4774 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4775 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4776 | 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] | 4777 | uint8_t vdev_id, |
| 4778 | struct wmi_probe_resp_params *probe_rsp_info, |
| 4779 | uint8_t *frm) |
| 4780 | { |
| 4781 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 4782 | wmi_bcn_prb_info *bcn_prb_info; |
| 4783 | wmi_buf_t wmi_buf; |
| 4784 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 4785 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4786 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4787 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4788 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4789 | |
| 4790 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 4791 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 4792 | |
| 4793 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 4794 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 4795 | tmpl_len_aligned; |
| 4796 | |
| 4797 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4798 | 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] | 4799 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4800 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4801 | } |
| 4802 | |
| 4803 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4804 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4805 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4806 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4807 | } |
| 4808 | |
| 4809 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4810 | |
| 4811 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 4812 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4813 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 4814 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 4815 | cmd->vdev_id = vdev_id; |
| 4816 | cmd->buf_len = tmpl_len; |
| 4817 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 4818 | |
| 4819 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4820 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4821 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4822 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4823 | bcn_prb_info->caps = 0; |
| 4824 | bcn_prb_info->erp = 0; |
| 4825 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4826 | |
| 4827 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4828 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4829 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4830 | |
| 4831 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4832 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4833 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4834 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4835 | wmi_buf_free(wmi_buf); |
| 4836 | } |
| 4837 | |
| 4838 | return ret; |
| 4839 | } |
| 4840 | |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4841 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4842 | #define WPI_IV_LEN 16 |
| 4843 | |
| 4844 | /** |
| 4845 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4846 | * |
| 4847 | * @dest_tx: destination address of tsc key counter |
| 4848 | * @src_tx: source address of tsc key counter |
| 4849 | * @dest_rx: destination address of rsc key counter |
| 4850 | * @src_rx: source address of rsc key counter |
| 4851 | * |
| 4852 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4853 | * |
| 4854 | * Return: None |
| 4855 | * |
| 4856 | */ |
| 4857 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4858 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4859 | { |
| 4860 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4861 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4862 | } |
| 4863 | #else |
| 4864 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4865 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4866 | { |
| 4867 | return; |
| 4868 | } |
| 4869 | #endif |
| 4870 | |
| 4871 | /** |
| 4872 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4873 | * @wmi_handle: wmi handle |
| 4874 | * @key_params: key parameters |
| 4875 | * |
| 4876 | * This function fills structure from information |
| 4877 | * passed in key_params. |
| 4878 | * |
| 4879 | * Return: QDF_STATUS_SUCCESS - success |
| 4880 | * QDF_STATUS_E_FAILURE - failure |
| 4881 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4882 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4883 | 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] | 4884 | struct set_key_params *key_params) |
| 4885 | { |
| 4886 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4887 | wmi_buf_t buf; |
| 4888 | uint8_t *buf_ptr; |
| 4889 | uint32_t len; |
| 4890 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4891 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4892 | |
| 4893 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4894 | WMI_TLV_HDR_SIZE; |
| 4895 | |
| 4896 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4897 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4898 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4899 | return QDF_STATUS_E_NOMEM; |
| 4900 | } |
| 4901 | |
| 4902 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4903 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4904 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4905 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4906 | WMITLV_GET_STRUCT_TLVLEN |
| 4907 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4908 | cmd->vdev_id = key_params->vdev_id; |
| 4909 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4910 | |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4911 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4912 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4913 | cmd->key_flags |= key_params->key_flags; |
| 4914 | cmd->key_cipher = key_params->key_cipher; |
| 4915 | if ((key_params->key_txmic_len) && |
| 4916 | (key_params->key_rxmic_len)) { |
| 4917 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4918 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4919 | } |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4920 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4921 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4922 | key_params->tx_iv, |
| 4923 | cmd->wpi_key_rsc_counter, |
| 4924 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4925 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4926 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4927 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4928 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4929 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4930 | qdf_mem_copy((void *)key_data, |
| 4931 | (const void *)key_params->key_data, key_params->key_len); |
| 4932 | cmd->key_len = key_params->key_len; |
| 4933 | |
| 4934 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4935 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4936 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4937 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4938 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4939 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4940 | } |
| 4941 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4942 | /** |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 4943 | * send_sar_limit_cmd_tlv() - send sar limit cmd to fw |
| 4944 | * @wmi_handle: wmi handle |
| 4945 | * @params: sar limit params |
| 4946 | * |
| 4947 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4948 | */ |
| 4949 | static QDF_STATUS send_sar_limit_cmd_tlv(wmi_unified_t wmi_handle, |
| 4950 | struct sar_limit_cmd_params *sar_limit_params) |
| 4951 | { |
| 4952 | wmi_buf_t buf; |
| 4953 | QDF_STATUS qdf_status; |
| 4954 | wmi_sar_limits_cmd_fixed_param *cmd; |
| 4955 | int i; |
| 4956 | uint8_t *buf_ptr; |
| 4957 | wmi_sar_limit_cmd_row *wmi_sar_rows_list; |
| 4958 | struct sar_limit_cmd_row *sar_rows_list; |
| 4959 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4960 | |
| 4961 | len += sizeof(wmi_sar_limit_cmd_row) * sar_limit_params->num_limit_rows; |
| 4962 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4963 | if (!buf) { |
| 4964 | WMI_LOGE("Failed to allocate memory"); |
| 4965 | qdf_status = QDF_STATUS_E_NOMEM; |
| 4966 | goto end; |
| 4967 | } |
| 4968 | |
| 4969 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4970 | cmd = (wmi_sar_limits_cmd_fixed_param *) buf_ptr; |
| 4971 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4972 | WMITLV_TAG_STRUC_wmi_sar_limits_cmd_fixed_param, |
| 4973 | WMITLV_GET_STRUCT_TLVLEN |
| 4974 | (wmi_sar_limits_cmd_fixed_param)); |
| 4975 | cmd->sar_enable = sar_limit_params->sar_enable; |
| 4976 | cmd->commit_limits = sar_limit_params->commit_limits; |
| 4977 | cmd->num_limit_rows = sar_limit_params->num_limit_rows; |
| 4978 | |
| 4979 | WMI_LOGD("no of sar rows = %d, len = %d", |
| 4980 | sar_limit_params->num_limit_rows, len); |
| 4981 | buf_ptr += sizeof(*cmd); |
| 4982 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4983 | sizeof(wmi_sar_limit_cmd_row) * |
| 4984 | sar_limit_params->num_limit_rows); |
| 4985 | if (cmd->num_limit_rows == 0) |
| 4986 | goto send_sar_limits; |
| 4987 | |
| 4988 | wmi_sar_rows_list = (wmi_sar_limit_cmd_row *) |
| 4989 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4990 | sar_rows_list = sar_limit_params->sar_limit_row_list; |
| 4991 | |
| 4992 | for (i = 0; i < sar_limit_params->num_limit_rows; i++) { |
| 4993 | WMITLV_SET_HDR(&wmi_sar_rows_list->tlv_header, |
| 4994 | WMITLV_TAG_STRUC_wmi_sar_limit_cmd_row, |
| 4995 | WMITLV_GET_STRUCT_TLVLEN(wmi_sar_limit_cmd_row)); |
| 4996 | wmi_sar_rows_list->band_id = sar_rows_list->band_id; |
| 4997 | wmi_sar_rows_list->chain_id = sar_rows_list->chain_id; |
| 4998 | wmi_sar_rows_list->mod_id = sar_rows_list->mod_id; |
| 4999 | wmi_sar_rows_list->limit_value = sar_rows_list->limit_value; |
| 5000 | wmi_sar_rows_list->validity_bitmap = |
| 5001 | sar_rows_list->validity_bitmap; |
| 5002 | WMI_LOGD("row %d, band_id = %d, chain_id = %d, mod_id = %d, limit_value = %d, validity_bitmap = %d", |
| 5003 | i, wmi_sar_rows_list->band_id, |
| 5004 | wmi_sar_rows_list->chain_id, |
| 5005 | wmi_sar_rows_list->mod_id, |
| 5006 | wmi_sar_rows_list->limit_value, |
| 5007 | wmi_sar_rows_list->validity_bitmap); |
| 5008 | sar_rows_list++; |
| 5009 | wmi_sar_rows_list++; |
| 5010 | } |
| 5011 | send_sar_limits: |
| 5012 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5013 | WMI_SAR_LIMITS_CMDID); |
| 5014 | |
| 5015 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 5016 | WMI_LOGE("Failed to send WMI_SAR_LIMITS_CMDID"); |
| 5017 | wmi_buf_free(buf); |
| 5018 | } |
| 5019 | |
| 5020 | end: |
| 5021 | return qdf_status; |
| 5022 | } |
| 5023 | |
| 5024 | /** |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5025 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 5026 | * @wmi_handle: wmi handle |
| 5027 | * @params: encrypt/decrypt params |
| 5028 | * |
| 5029 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 5030 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5031 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5032 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 5033 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 5034 | { |
| 5035 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 5036 | wmi_buf_t wmi_buf; |
| 5037 | uint8_t *buf_ptr; |
| 5038 | QDF_STATUS ret; |
| 5039 | uint32_t len; |
| 5040 | |
| 5041 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 5042 | |
| 5043 | len = sizeof(*cmd) + |
| 5044 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 5045 | WMI_TLV_HDR_SIZE; |
| 5046 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5047 | if (!wmi_buf) { |
| 5048 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 5049 | __func__); |
| 5050 | return QDF_STATUS_E_NOMEM; |
| 5051 | } |
| 5052 | |
| 5053 | buf_ptr = wmi_buf_data(wmi_buf); |
| 5054 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 5055 | |
| 5056 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5057 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 5058 | WMITLV_GET_STRUCT_TLVLEN( |
| 5059 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 5060 | |
| 5061 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 5062 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 5063 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 5064 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 5065 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 5066 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 5067 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 5068 | |
| 5069 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 5070 | encrypt_decrypt_params->key_len); |
| 5071 | |
| 5072 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 5073 | MAX_MAC_HEADER_LEN); |
| 5074 | |
| 5075 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 5076 | |
| 5077 | if (cmd->data_len) { |
| 5078 | buf_ptr += sizeof(*cmd); |
| 5079 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5080 | roundup(encrypt_decrypt_params->data_len, |
| 5081 | sizeof(A_UINT32))); |
| 5082 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5083 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 5084 | encrypt_decrypt_params->data_len); |
| 5085 | } |
| 5086 | |
| 5087 | /* This conversion is to facilitate data to FW in little endian */ |
| 5088 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 5089 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 5090 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 5091 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 5092 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 5093 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 5094 | |
| 5095 | ret = wmi_unified_cmd_send(wmi_handle, |
| 5096 | wmi_buf, len, |
| 5097 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 5098 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 5099 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 5100 | wmi_buf_free(wmi_buf); |
| 5101 | } |
| 5102 | |
| 5103 | return ret; |
| 5104 | } |
| 5105 | |
| 5106 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5107 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5108 | /** |
| 5109 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 5110 | * @wmi_handle: wmi handle |
| 5111 | * @vdev_id: vdev id |
| 5112 | * @p2p_ie: p2p IE |
| 5113 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5114 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5115 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5116 | 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] | 5117 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 5118 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5119 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5120 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 5121 | wmi_buf_t wmi_buf; |
| 5122 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 5123 | uint8_t *buf_ptr; |
| 5124 | |
| 5125 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 5126 | |
| 5127 | /* More than one P2P IE may be included in a single frame. |
| 5128 | If multiple P2P IEs are present, the complete P2P attribute |
| 5129 | data consists of the concatenation of the P2P Attribute |
| 5130 | fields of the P2P IEs. The P2P Attributes field of each |
| 5131 | P2P IE may be any length up to the maximum (251 octets). |
| 5132 | In this case host sends one P2P IE to firmware so the length |
| 5133 | should not exceed more than 251 bytes |
| 5134 | */ |
| 5135 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5136 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5137 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5138 | } |
| 5139 | |
| 5140 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 5141 | |
| 5142 | wmi_buf_len = |
| 5143 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 5144 | WMI_TLV_HDR_SIZE; |
| 5145 | |
| 5146 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 5147 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5148 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5149 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5150 | } |
| 5151 | |
| 5152 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5153 | |
| 5154 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 5155 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5156 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 5157 | WMITLV_GET_STRUCT_TLVLEN |
| 5158 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 5159 | cmd->vdev_id = vdev_id; |
| 5160 | cmd->ie_buf_len = ie_len; |
| 5161 | |
| 5162 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 5163 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 5164 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5165 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5166 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5167 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5168 | |
| 5169 | ret = wmi_unified_cmd_send(wmi_handle, |
| 5170 | wmi_buf, wmi_buf_len, |
| 5171 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5172 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5173 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5174 | wmi_buf_free(wmi_buf); |
| 5175 | } |
| 5176 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5177 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5178 | return ret; |
| 5179 | } |
| 5180 | |
| 5181 | /** |
| 5182 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 5183 | * @wmi_handle: wmi handle |
| 5184 | * @req: gateway parameter update request structure |
| 5185 | * |
| 5186 | * This function reads the incoming @req and fill in the destination |
| 5187 | * WMI structure and sends down the gateway configs down to the firmware |
| 5188 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5189 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5190 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5191 | 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] | 5192 | struct gateway_update_req_param *req) |
| 5193 | { |
| 5194 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 5195 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5196 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5197 | int len = sizeof(*cmd); |
| 5198 | |
| 5199 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5200 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5201 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5202 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5203 | } |
| 5204 | |
| 5205 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 5206 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5207 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 5208 | WMITLV_GET_STRUCT_TLVLEN( |
| 5209 | wmi_roam_subnet_change_config_fixed_param)); |
| 5210 | |
| 5211 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5212 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 5213 | QDF_IPV4_ADDR_SIZE); |
| 5214 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 5215 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5216 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 5217 | &cmd->inet_gw_mac_addr); |
| 5218 | cmd->max_retries = req->max_retries; |
| 5219 | cmd->timeout = req->timeout; |
| 5220 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 5221 | cmd->flag = 0; |
| 5222 | if (req->ipv4_addr_type) |
| 5223 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 5224 | |
| 5225 | if (req->ipv6_addr_type) |
| 5226 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 5227 | |
| 5228 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5229 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5230 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5231 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5232 | ret); |
| 5233 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5234 | } |
| 5235 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5236 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5237 | } |
| 5238 | |
| 5239 | /** |
| 5240 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 5241 | * @wmi_handle: wmi handle |
| 5242 | * @req: rssi monitoring request structure |
| 5243 | * |
| 5244 | * This function reads the incoming @req and fill in the destination |
| 5245 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 5246 | * |
| 5247 | * Return: 0 on success; error number otherwise |
| 5248 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5249 | 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] | 5250 | struct rssi_monitor_param *req) |
| 5251 | { |
| 5252 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 5253 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5254 | QDF_STATUS ret; |
| 5255 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5256 | |
| 5257 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5258 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5259 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5260 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5261 | } |
| 5262 | |
| 5263 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 5264 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5265 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 5266 | WMITLV_GET_STRUCT_TLVLEN( |
| 5267 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 5268 | |
| 5269 | cmd->vdev_id = req->session_id; |
| 5270 | cmd->request_id = req->request_id; |
| 5271 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 5272 | cmd->hi_rssi_reenable_histeresis = 0; |
| 5273 | cmd->min_report_interval = 0; |
| 5274 | cmd->max_num_report = 1; |
| 5275 | if (req->control) { |
| 5276 | /* enable one threshold for each min/max */ |
| 5277 | cmd->enabled_bitmap = 0x09; |
| 5278 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 5279 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 5280 | } else { |
| 5281 | cmd->enabled_bitmap = 0; |
| 5282 | cmd->low_rssi_breach_threshold[0] = 0; |
| 5283 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 5284 | } |
| 5285 | |
| 5286 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5287 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5288 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5289 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5290 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5291 | } |
| 5292 | |
Rajeev Kumar | ca1de3e | 2017-06-14 10:34:00 -0700 | [diff] [blame] | 5293 | WMI_LOGD("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
| 5294 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5295 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5296 | } |
| 5297 | |
| 5298 | /** |
| 5299 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 5300 | * @wmi_handle: wmi handle |
| 5301 | * @psetoui: OUI parameters |
| 5302 | * |
| 5303 | * set scan probe OUI parameters in firmware |
| 5304 | * |
| 5305 | * Return: CDF status |
| 5306 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5307 | 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] | 5308 | struct scan_mac_oui *psetoui) |
| 5309 | { |
| 5310 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 5311 | wmi_buf_t wmi_buf; |
| 5312 | uint32_t len; |
| 5313 | uint8_t *buf_ptr; |
| 5314 | uint32_t *oui_buf; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5315 | struct probe_req_whitelist_attr *ie_whitelist = &psetoui->ie_whitelist; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5316 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5317 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 5318 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 5319 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5320 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5321 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5322 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5323 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5324 | } |
| 5325 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5326 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 5327 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5328 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 5329 | WMITLV_GET_STRUCT_TLVLEN |
| 5330 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 5331 | |
| 5332 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5333 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5334 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 5335 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5336 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5337 | cmd->prob_req_oui); |
| 5338 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 5339 | cmd->vdev_id = psetoui->vdev_id; |
| 5340 | cmd->flags = WMI_SCAN_PROBE_OUI_SPOOFED_MAC_IN_PROBE_REQ; |
| 5341 | if (psetoui->enb_probe_req_sno_randomization) |
| 5342 | cmd->flags |= WMI_SCAN_PROBE_OUI_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 5343 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5344 | if (ie_whitelist->white_list) { |
| 5345 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 5346 | &cmd->num_vendor_oui, |
| 5347 | ie_whitelist); |
| 5348 | cmd->flags |= |
| 5349 | WMI_SCAN_PROBE_OUI_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 5350 | } |
| 5351 | |
| 5352 | buf_ptr += sizeof(*cmd); |
| 5353 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5354 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 5355 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5356 | |
| 5357 | if (cmd->num_vendor_oui != 0) { |
| 5358 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 5359 | ie_whitelist->voui); |
| 5360 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 5361 | } |
| 5362 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5363 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5364 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5365 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5366 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5367 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5368 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5369 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5370 | } |
| 5371 | |
| 5372 | /** |
| 5373 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 5374 | * @wmi_handle: wmi handle |
| 5375 | * @req: passpoint network request structure |
| 5376 | * |
| 5377 | * This function sends down WMI command with network id set to wildcard id. |
| 5378 | * firmware shall clear all the config entries |
| 5379 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5380 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5381 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5382 | 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] | 5383 | struct wifi_passpoint_req_param *req) |
| 5384 | { |
| 5385 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5386 | wmi_buf_t buf; |
| 5387 | uint32_t len; |
| 5388 | int ret; |
| 5389 | |
| 5390 | len = sizeof(*cmd); |
| 5391 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5392 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5393 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5394 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5395 | } |
| 5396 | |
| 5397 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5398 | |
| 5399 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5400 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5401 | WMITLV_GET_STRUCT_TLVLEN( |
| 5402 | wmi_passpoint_config_cmd_fixed_param)); |
| 5403 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 5404 | |
| 5405 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5406 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5407 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5408 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5409 | __func__); |
| 5410 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5411 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5412 | } |
| 5413 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5414 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5415 | } |
| 5416 | |
| 5417 | /** |
| 5418 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 5419 | * @wmi_handle: wmi handle |
| 5420 | * @req: passpoint network request structure |
| 5421 | * |
| 5422 | * This function reads the incoming @req and fill in the destination |
| 5423 | * WMI structure and send down the passpoint configs down to the firmware |
| 5424 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5425 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5426 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5427 | 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] | 5428 | struct wifi_passpoint_req_param *req) |
| 5429 | { |
| 5430 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5431 | u_int8_t i, j, *bytes; |
| 5432 | wmi_buf_t buf; |
| 5433 | uint32_t len; |
| 5434 | int ret; |
| 5435 | |
| 5436 | len = sizeof(*cmd); |
| 5437 | for (i = 0; i < req->num_networks; i++) { |
| 5438 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5439 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5440 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5441 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5442 | } |
| 5443 | |
| 5444 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 5445 | wmi_buf_data(buf); |
| 5446 | |
| 5447 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5448 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5449 | WMITLV_GET_STRUCT_TLVLEN( |
| 5450 | wmi_passpoint_config_cmd_fixed_param)); |
| 5451 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5452 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 5453 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5454 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5455 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5456 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 5457 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5458 | 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] | 5459 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 5460 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 5461 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5462 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5463 | &req->networks[i].roaming_consortium_ids[j], |
| 5464 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 5465 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5466 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5467 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5468 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5469 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 5470 | |
| 5471 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5472 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5473 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5474 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5475 | __func__); |
| 5476 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5477 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5478 | } |
| 5479 | } |
| 5480 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5481 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5482 | } |
| 5483 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5484 | /** |
| 5485 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 5486 | * @wmi_handle: wmi handle |
| 5487 | * @scan_cmd_fp: start scan command ptr |
| 5488 | * @roam_req: roam request param |
| 5489 | * |
| 5490 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 5491 | * of WMI_ROAM_SCAN_MODE. |
| 5492 | * |
| 5493 | * Return: QDF status |
| 5494 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5495 | 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] | 5496 | wmi_start_scan_cmd_fixed_param * |
| 5497 | scan_cmd_fp, |
| 5498 | struct roam_offload_scan_params *roam_req) |
| 5499 | { |
| 5500 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5501 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5502 | int len; |
| 5503 | uint8_t *buf_ptr; |
| 5504 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5505 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5506 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5507 | int auth_mode = roam_req->auth_mode; |
| 5508 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 5509 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 5510 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 5511 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5512 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5513 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5514 | /* Need to create a buf with roam_scan command at |
| 5515 | * front and piggyback with scan command */ |
| 5516 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 5517 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5518 | (2 * WMI_TLV_HDR_SIZE) + |
| 5519 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5520 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 5521 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5522 | if (roam_req->is_roam_req_valid && |
| 5523 | roam_req->roam_offload_enabled) { |
| 5524 | len += sizeof(wmi_roam_offload_tlv_param); |
| 5525 | len += WMI_TLV_HDR_SIZE; |
| 5526 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5527 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5528 | (auth_mode == WMI_AUTH_OPEN && |
| 5529 | roam_req->mdid.mdie_present) || |
| 5530 | roam_req->is_ese_assoc)) { |
| 5531 | len += WMI_TLV_HDR_SIZE; |
| 5532 | if (roam_req->is_ese_assoc) |
| 5533 | len += |
| 5534 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5535 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 5536 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 5537 | (auth_mode == WMI_AUTH_OPEN && |
| 5538 | roam_req->mdid.mdie_present)) |
| 5539 | len += |
| 5540 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5541 | else |
| 5542 | len += |
| 5543 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5544 | } else { |
| 5545 | len += WMI_TLV_HDR_SIZE; |
| 5546 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5547 | |
| 5548 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 5549 | + roundup(roam_req->assoc_ie_length, |
| 5550 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5551 | } else { |
| 5552 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5553 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5554 | __func__, roam_req->roam_offload_enabled); |
| 5555 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5556 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5557 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5558 | } |
| 5559 | if (roam_req->is_roam_req_valid && |
| 5560 | roam_req->roam_offload_enabled) { |
| 5561 | roam_req->mode = roam_req->mode | |
| 5562 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 5563 | } |
| 5564 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5565 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5566 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 5567 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 5568 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 5569 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5570 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5571 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5572 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5573 | return QDF_STATUS_E_NOMEM; |
| 5574 | } |
| 5575 | |
| 5576 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5577 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5578 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 5579 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 5580 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 5581 | WMITLV_GET_STRUCT_TLVLEN |
| 5582 | (wmi_roam_scan_mode_fixed_param)); |
| 5583 | |
| 5584 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 5585 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 5586 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE | |
| 5587 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) { |
| 5588 | roam_scan_mode_fp->flags |= |
| 5589 | WMI_ROAM_SCAN_MODE_FLAG_REPORT_STATUS; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5590 | goto send_roam_scan_mode_cmd; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 5591 | } |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5592 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5593 | /* Fill in scan parameters suitable for roaming scan */ |
| 5594 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5595 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5596 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 5597 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 5598 | /* Ensure there is no additional IEs */ |
| 5599 | scan_cmd_fp->ie_len = 0; |
| 5600 | WMITLV_SET_HDR(buf_ptr, |
| 5601 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 5602 | WMITLV_GET_STRUCT_TLVLEN |
| 5603 | (wmi_start_scan_cmd_fixed_param)); |
| 5604 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5605 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 5606 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 5607 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5608 | sizeof(wmi_roam_offload_tlv_param)); |
| 5609 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5610 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 5611 | WMITLV_SET_HDR(buf_ptr, |
| 5612 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 5613 | WMITLV_GET_STRUCT_TLVLEN |
| 5614 | (wmi_roam_offload_tlv_param)); |
| 5615 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 5616 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 5617 | roam_offload_params->select_5g_margin = |
| 5618 | roam_req->select_5ghz_margin; |
| 5619 | roam_offload_params->reassoc_failure_timeout = |
| 5620 | roam_req->reassoc_failure_timeout; |
| 5621 | |
| 5622 | /* Fill the capabilities */ |
| 5623 | roam_offload_params->capability = |
| 5624 | roam_req->roam_offload_params.capability; |
| 5625 | roam_offload_params->ht_caps_info = |
| 5626 | roam_req->roam_offload_params.ht_caps_info; |
| 5627 | roam_offload_params->ampdu_param = |
| 5628 | roam_req->roam_offload_params.ampdu_param; |
| 5629 | roam_offload_params->ht_ext_cap = |
| 5630 | roam_req->roam_offload_params.ht_ext_cap; |
| 5631 | roam_offload_params->ht_txbf = |
| 5632 | roam_req->roam_offload_params.ht_txbf; |
| 5633 | roam_offload_params->asel_cap = |
| 5634 | roam_req->roam_offload_params.asel_cap; |
| 5635 | roam_offload_params->qos_caps = |
| 5636 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 5637 | roam_offload_params->qos_enabled = |
| 5638 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5639 | roam_offload_params->wmm_caps = |
| 5640 | roam_req->roam_offload_params.wmm_caps; |
| 5641 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 5642 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 5643 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 5644 | |
| 5645 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 5646 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 5647 | * they are filled in the same order.Depending on the |
| 5648 | * authentication type, the other mode TLV's are nullified |
| 5649 | * and only headers are filled.*/ |
| 5650 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5651 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5652 | (auth_mode == WMI_AUTH_OPEN |
| 5653 | && roam_req->mdid.mdie_present) || |
| 5654 | roam_req->is_ese_assoc)) { |
| 5655 | if (roam_req->is_ese_assoc) { |
| 5656 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5657 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5658 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5659 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5660 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5661 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5662 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5663 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 5664 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5665 | roam_offload_ese = |
| 5666 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 5667 | qdf_mem_copy(roam_offload_ese->krk, |
| 5668 | roam_req->krk, |
| 5669 | sizeof(roam_req->krk)); |
| 5670 | qdf_mem_copy(roam_offload_ese->btk, |
| 5671 | roam_req->btk, |
| 5672 | sizeof(roam_req->btk)); |
| 5673 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 5674 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 5675 | WMITLV_GET_STRUCT_TLVLEN |
| 5676 | (wmi_roam_ese_offload_tlv_param)); |
| 5677 | buf_ptr += |
| 5678 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5679 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 5680 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 5681 | || (auth_mode == WMI_AUTH_OPEN |
| 5682 | && roam_req->mdid.mdie_present)) { |
| 5683 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5684 | 0); |
| 5685 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5686 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5687 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 5688 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5689 | roam_offload_11r = |
| 5690 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 5691 | roam_offload_11r->r0kh_id_len = |
| 5692 | roam_req->rokh_id_length; |
| 5693 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 5694 | roam_req->rokh_id, |
| 5695 | roam_offload_11r->r0kh_id_len); |
| 5696 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 5697 | roam_req->psk_pmk, |
| 5698 | sizeof(roam_req->psk_pmk)); |
| 5699 | roam_offload_11r->psk_msk_len = |
| 5700 | roam_req->pmk_len; |
| 5701 | roam_offload_11r->mdie_present = |
| 5702 | roam_req->mdid.mdie_present; |
| 5703 | roam_offload_11r->mdid = |
| 5704 | roam_req->mdid.mobility_domain; |
| 5705 | if (auth_mode == WMI_AUTH_OPEN) { |
| 5706 | /* If FT-Open ensure pmk length |
| 5707 | and r0khid len are zero */ |
| 5708 | roam_offload_11r->r0kh_id_len = 0; |
| 5709 | roam_offload_11r->psk_msk_len = 0; |
| 5710 | } |
| 5711 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 5712 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 5713 | WMITLV_GET_STRUCT_TLVLEN |
| 5714 | (wmi_roam_11r_offload_tlv_param)); |
| 5715 | buf_ptr += |
| 5716 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5717 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5718 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5719 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5720 | } else { |
| 5721 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5722 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 5723 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5724 | roam_offload_11i = |
| 5725 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5726 | |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 5727 | if (roam_req->roam_key_mgmt_offload_enabled && |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5728 | roam_req->fw_okc) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5729 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 5730 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5731 | WMI_LOGI("LFR3:OKC enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5732 | } else { |
| 5733 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 5734 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5735 | WMI_LOGI("LFR3:OKC disabled"); |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5736 | } |
| 5737 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 5738 | roam_req->fw_pmksa_cache) { |
| 5739 | WMI_SET_ROAM_OFFLOAD_PMK_CACHE_ENABLED |
| 5740 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5741 | WMI_LOGI("LFR3:PMKSA caching enabled"); |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5742 | } else { |
| 5743 | WMI_SET_ROAM_OFFLOAD_PMK_CACHE_DISABLED |
| 5744 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5745 | WMI_LOGI("LFR3:PMKSA caching disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5746 | } |
| 5747 | |
| 5748 | qdf_mem_copy(roam_offload_11i->pmk, |
| 5749 | roam_req->psk_pmk, |
| 5750 | sizeof(roam_req->psk_pmk)); |
| 5751 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 5752 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 5753 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 5754 | WMITLV_GET_STRUCT_TLVLEN |
| 5755 | (wmi_roam_11i_offload_tlv_param)); |
| 5756 | buf_ptr += |
| 5757 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5758 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5759 | 0); |
| 5760 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5761 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5762 | 0); |
| 5763 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5764 | } |
| 5765 | } else { |
| 5766 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5767 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5768 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5769 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5770 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5771 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5772 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5773 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5774 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5775 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5776 | |
| 5777 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5778 | sizeof(*assoc_ies)); |
| 5779 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5780 | |
| 5781 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 5782 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 5783 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 5784 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 5785 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 5786 | |
| 5787 | buf_ptr += sizeof(*assoc_ies); |
| 5788 | |
| 5789 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5790 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 5791 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5792 | |
| 5793 | if (assoc_ies->buf_len != 0) { |
| 5794 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 5795 | assoc_ies->buf_len); |
| 5796 | } |
| 5797 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5798 | } else { |
| 5799 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5800 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5801 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5802 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5803 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5804 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5805 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5806 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5807 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5808 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5809 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5810 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5811 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5812 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5813 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5814 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5815 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5816 | } |
| 5817 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5818 | |
| 5819 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5820 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5821 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5822 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5823 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5824 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 5825 | status); |
| 5826 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5827 | } |
| 5828 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5829 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5830 | } |
| 5831 | |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 5832 | static QDF_STATUS send_roam_mawc_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5833 | struct wmi_mawc_roam_params *params) |
| 5834 | { |
| 5835 | wmi_buf_t buf = NULL; |
| 5836 | QDF_STATUS status; |
| 5837 | int len; |
| 5838 | uint8_t *buf_ptr; |
| 5839 | wmi_roam_configure_mawc_cmd_fixed_param *wmi_roam_mawc_params; |
| 5840 | |
| 5841 | len = sizeof(*wmi_roam_mawc_params); |
| 5842 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5843 | if (!buf) { |
| 5844 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5845 | return QDF_STATUS_E_NOMEM; |
| 5846 | } |
| 5847 | |
| 5848 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5849 | wmi_roam_mawc_params = |
| 5850 | (wmi_roam_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 5851 | WMITLV_SET_HDR(&wmi_roam_mawc_params->tlv_header, |
| 5852 | WMITLV_TAG_STRUC_wmi_roam_configure_mawc_cmd_fixed_param, |
| 5853 | WMITLV_GET_STRUCT_TLVLEN |
| 5854 | (wmi_roam_configure_mawc_cmd_fixed_param)); |
| 5855 | wmi_roam_mawc_params->vdev_id = params->vdev_id; |
| 5856 | if (params->enable) |
| 5857 | wmi_roam_mawc_params->enable = 1; |
| 5858 | else |
| 5859 | wmi_roam_mawc_params->enable = 0; |
| 5860 | wmi_roam_mawc_params->traffic_load_threshold = |
| 5861 | params->traffic_load_threshold; |
| 5862 | wmi_roam_mawc_params->best_ap_rssi_threshold = |
| 5863 | params->best_ap_rssi_threshold; |
| 5864 | wmi_roam_mawc_params->rssi_stationary_high_adjust = |
| 5865 | params->rssi_stationary_high_adjust; |
| 5866 | wmi_roam_mawc_params->rssi_stationary_low_adjust = |
| 5867 | params->rssi_stationary_low_adjust; |
| 5868 | |
| 5869 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5870 | len, WMI_ROAM_CONFIGURE_MAWC_CMDID); |
| 5871 | if (QDF_IS_STATUS_ERROR(status)) { |
| 5872 | WMI_LOGE("WMI_ROAM_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 5873 | status); |
| 5874 | wmi_buf_free(buf); |
| 5875 | return status; |
| 5876 | } |
| 5877 | WMI_LOGD(FL("MAWC roam en=%d, vdev=%d, tr=%d, ap=%d, high=%d, low=%d"), |
| 5878 | wmi_roam_mawc_params->enable, wmi_roam_mawc_params->vdev_id, |
| 5879 | wmi_roam_mawc_params->traffic_load_threshold, |
| 5880 | wmi_roam_mawc_params->best_ap_rssi_threshold, |
| 5881 | wmi_roam_mawc_params->rssi_stationary_high_adjust, |
| 5882 | wmi_roam_mawc_params->rssi_stationary_low_adjust); |
| 5883 | |
| 5884 | return QDF_STATUS_SUCCESS; |
| 5885 | } |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5886 | |
| 5887 | /** |
| 5888 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 5889 | * rssi threashold |
| 5890 | * @wmi_handle: wmi handle |
| 5891 | * @roam_req: Roaming request buffer |
| 5892 | * |
| 5893 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 5894 | * |
| 5895 | * Return: QDF status |
| 5896 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5897 | 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] | 5898 | struct roam_offload_scan_rssi_params *roam_req) |
| 5899 | { |
| 5900 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5901 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5902 | int len; |
| 5903 | uint8_t *buf_ptr; |
| 5904 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 5905 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 5906 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5907 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5908 | |
| 5909 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5910 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5911 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5912 | len += WMI_TLV_HDR_SIZE; |
| 5913 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5914 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 5915 | len += sizeof(wmi_roam_dense_thres_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5916 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5917 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5918 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5919 | return QDF_STATUS_E_NOMEM; |
| 5920 | } |
| 5921 | |
| 5922 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5923 | rssi_threshold_fp = |
| 5924 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 5925 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 5926 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 5927 | WMITLV_GET_STRUCT_TLVLEN |
| 5928 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 5929 | /* fill in threshold values */ |
| 5930 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 5931 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 5932 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 5933 | rssi_threshold_fp->hirssi_scan_max_count = |
| 5934 | roam_req->hi_rssi_scan_max_count; |
| 5935 | rssi_threshold_fp->hirssi_scan_delta = |
| 5936 | roam_req->hi_rssi_scan_rssi_delta; |
| 5937 | 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] | 5938 | rssi_threshold_fp->rssi_thresh_offset_5g = |
| 5939 | roam_req->rssi_thresh_offset_5g; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5940 | |
| 5941 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5942 | WMITLV_SET_HDR(buf_ptr, |
| 5943 | WMITLV_TAG_ARRAY_STRUC, |
| 5944 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 5945 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5946 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 5947 | |
| 5948 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 5949 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 5950 | ext_thresholds->boost_threshold_5g = |
| 5951 | roam_req->boost_threshold_5g; |
| 5952 | |
| 5953 | ext_thresholds->boost_algorithm_5g = |
| 5954 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5955 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 5956 | ext_thresholds->penalty_algorithm_5g = |
| 5957 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5958 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 5959 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 5960 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 5961 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 5962 | |
| 5963 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 5964 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 5965 | WMITLV_GET_STRUCT_TLVLEN |
| 5966 | (wmi_roam_scan_extended_threshold_param)); |
| 5967 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5968 | WMITLV_SET_HDR(buf_ptr, |
| 5969 | WMITLV_TAG_ARRAY_STRUC, |
| 5970 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 5971 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5972 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 5973 | early_stop_thresholds->roam_earlystop_thres_min = |
| 5974 | roam_req->roam_earlystop_thres_min; |
| 5975 | early_stop_thresholds->roam_earlystop_thres_max = |
| 5976 | roam_req->roam_earlystop_thres_max; |
| 5977 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 5978 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 5979 | WMITLV_GET_STRUCT_TLVLEN |
| 5980 | (wmi_roam_earlystop_rssi_thres_param)); |
| 5981 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5982 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 5983 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5984 | sizeof(wmi_roam_dense_thres_param)); |
| 5985 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5986 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 5987 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 5988 | roam_req->dense_rssi_thresh_offset; |
| 5989 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 5990 | dense_thresholds->roam_dense_traffic_thres = |
| 5991 | roam_req->traffic_threshold; |
| 5992 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 5993 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 5994 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 5995 | WMITLV_GET_STRUCT_TLVLEN |
| 5996 | (wmi_roam_dense_thres_param)); |
| 5997 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5998 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5999 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6000 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6001 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6002 | status); |
| 6003 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6004 | } |
| 6005 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6006 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6007 | } |
| 6008 | |
| 6009 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6010 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 6011 | * configuration params |
| 6012 | * @wma_handle: wma handler |
| 6013 | * @dwelltime_params: pointer to dwelltime_params |
| 6014 | * |
| 6015 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 6016 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6017 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6018 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6019 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 6020 | { |
| 6021 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 6022 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 6023 | wmi_buf_t buf; |
| 6024 | uint8_t *buf_ptr; |
| 6025 | int32_t err; |
| 6026 | int len; |
| 6027 | |
| 6028 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 6029 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 6030 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 6031 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6032 | if (!buf) { |
| 6033 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 6034 | __func__); |
| 6035 | return QDF_STATUS_E_NOMEM; |
| 6036 | } |
| 6037 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6038 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 6039 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 6040 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 6041 | WMITLV_GET_STRUCT_TLVLEN |
| 6042 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 6043 | |
| 6044 | dwell_param->enable = dwelltime_params->is_enabled; |
| 6045 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 6046 | WMITLV_SET_HDR(buf_ptr, |
| 6047 | WMITLV_TAG_ARRAY_STRUC, |
| 6048 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 6049 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6050 | |
| 6051 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 6052 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6053 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 6054 | WMITLV_GET_STRUCT_TLVLEN( |
| 6055 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 6056 | |
| 6057 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 6058 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 6059 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 6060 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 6061 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 6062 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 6063 | if (err) { |
| 6064 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 6065 | wmi_buf_free(buf); |
| 6066 | return QDF_STATUS_E_FAILURE; |
| 6067 | } |
| 6068 | |
| 6069 | return QDF_STATUS_SUCCESS; |
| 6070 | } |
| 6071 | |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 6072 | /** |
| 6073 | * send_dbs_scan_sel_params_cmd_tlv() - send wmi cmd of DBS scan selection |
| 6074 | * configuration params |
| 6075 | * @wmi_handle: wmi handler |
| 6076 | * @dbs_scan_params: pointer to wmi_dbs_scan_sel_params |
| 6077 | * |
| 6078 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 6079 | */ |
| 6080 | static QDF_STATUS send_dbs_scan_sel_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6081 | struct wmi_dbs_scan_sel_params *dbs_scan_params) |
| 6082 | { |
| 6083 | wmi_scan_dbs_duty_cycle_fixed_param *dbs_scan_param; |
| 6084 | wmi_scan_dbs_duty_cycle_tlv_param *cmd; |
| 6085 | wmi_buf_t buf; |
| 6086 | uint8_t *buf_ptr; |
| 6087 | QDF_STATUS err; |
| 6088 | uint32_t i; |
| 6089 | int len; |
| 6090 | |
| 6091 | len = sizeof(*dbs_scan_param); |
| 6092 | len += WMI_TLV_HDR_SIZE; |
| 6093 | len += dbs_scan_params->num_clients * sizeof(*cmd); |
| 6094 | |
| 6095 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6096 | if (!buf) { |
| 6097 | WMI_LOGE("%s:Failed to allocate buffer to send cmd", __func__); |
| 6098 | return QDF_STATUS_E_NOMEM; |
| 6099 | } |
| 6100 | |
| 6101 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6102 | dbs_scan_param = (wmi_scan_dbs_duty_cycle_fixed_param *) buf_ptr; |
| 6103 | WMITLV_SET_HDR(&dbs_scan_param->tlv_header, |
| 6104 | WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_fixed_param, |
| 6105 | WMITLV_GET_STRUCT_TLVLEN |
| 6106 | (wmi_scan_dbs_duty_cycle_fixed_param)); |
| 6107 | |
| 6108 | dbs_scan_param->num_clients = dbs_scan_params->num_clients; |
| 6109 | dbs_scan_param->pdev_id = dbs_scan_params->pdev_id; |
| 6110 | buf_ptr += sizeof(*dbs_scan_param); |
| 6111 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6112 | (sizeof(*cmd) * dbs_scan_params->num_clients)); |
| 6113 | buf_ptr = buf_ptr + (uint8_t) WMI_TLV_HDR_SIZE; |
| 6114 | |
| 6115 | for (i = 0; i < dbs_scan_params->num_clients; i++) { |
| 6116 | cmd = (wmi_scan_dbs_duty_cycle_tlv_param *) buf_ptr; |
| 6117 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6118 | WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_param_tlv, |
| 6119 | WMITLV_GET_STRUCT_TLVLEN( |
| 6120 | wmi_scan_dbs_duty_cycle_tlv_param)); |
| 6121 | cmd->module_id = dbs_scan_params->module_id[i]; |
| 6122 | cmd->num_dbs_scans = dbs_scan_params->num_dbs_scans[i]; |
| 6123 | cmd->num_non_dbs_scans = dbs_scan_params->num_non_dbs_scans[i]; |
| 6124 | buf_ptr = buf_ptr + (uint8_t) sizeof(*cmd); |
| 6125 | } |
| 6126 | |
| 6127 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 6128 | len, WMI_SET_SCAN_DBS_DUTY_CYCLE_CMDID); |
| 6129 | if (QDF_IS_STATUS_ERROR(err)) { |
| 6130 | WMI_LOGE("Failed to send dbs scan selection cmd err=%d", err); |
| 6131 | wmi_buf_free(buf); |
| 6132 | return QDF_STATUS_E_FAILURE; |
| 6133 | } |
| 6134 | |
| 6135 | return QDF_STATUS_SUCCESS; |
| 6136 | } |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6137 | |
| 6138 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6139 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 6140 | * @wmi_handle: wmi handle |
| 6141 | * @roam_req: Request which contains the filters |
| 6142 | * |
| 6143 | * There are filters such as whitelist, blacklist and preferred |
| 6144 | * list that need to be applied to the scan results to form the |
| 6145 | * probable candidates for roaming. |
| 6146 | * |
| 6147 | * Return: Return success upon succesfully passing the |
| 6148 | * parameters to the firmware, otherwise failure. |
| 6149 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6150 | 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] | 6151 | struct roam_scan_filter_params *roam_req) |
| 6152 | { |
| 6153 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6154 | QDF_STATUS status; |
| 6155 | uint32_t i; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6156 | uint32_t len, blist_len = 0; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6157 | uint8_t *buf_ptr; |
| 6158 | wmi_roam_filter_fixed_param *roam_filter; |
| 6159 | uint8_t *bssid_src_ptr = NULL; |
| 6160 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 6161 | wmi_ssid *ssid_ptr = NULL; |
| 6162 | uint32_t *bssid_preferred_factor_ptr = NULL; |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6163 | wmi_roam_lca_disallow_config_tlv_param *blist_param; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6164 | wmi_roam_rssi_rejection_oce_config_param *rssi_rej; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6165 | |
| 6166 | len = sizeof(wmi_roam_filter_fixed_param); |
Abhishek Singh | 54aa620 | 2017-07-06 11:25:15 +0530 | [diff] [blame] | 6167 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6168 | len += WMI_TLV_HDR_SIZE; |
Abhishek Singh | 54aa620 | 2017-07-06 11:25:15 +0530 | [diff] [blame] | 6169 | if (roam_req->num_bssid_black_list) |
| 6170 | len += roam_req->num_bssid_black_list * sizeof(wmi_mac_addr); |
| 6171 | len += WMI_TLV_HDR_SIZE; |
| 6172 | if (roam_req->num_ssid_white_list) |
| 6173 | len += roam_req->num_ssid_white_list * sizeof(wmi_ssid); |
| 6174 | len += 2 * WMI_TLV_HDR_SIZE; |
| 6175 | if (roam_req->num_bssid_preferred_list) { |
| 6176 | len += roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr); |
| 6177 | len += roam_req->num_bssid_preferred_list * sizeof(A_UINT32); |
| 6178 | } |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6179 | len += WMI_TLV_HDR_SIZE; |
| 6180 | if (roam_req->lca_disallow_config_present) { |
| 6181 | len += sizeof(*blist_param); |
| 6182 | blist_len = sizeof(*blist_param); |
| 6183 | } |
| 6184 | |
| 6185 | len += WMI_TLV_HDR_SIZE; |
| 6186 | if (roam_req->num_rssi_rejection_ap) |
| 6187 | len += roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6188 | |
| 6189 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6190 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6191 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6192 | return QDF_STATUS_E_NOMEM; |
| 6193 | } |
| 6194 | |
| 6195 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 6196 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 6197 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 6198 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 6199 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 6200 | /* fill in fixed values */ |
| 6201 | roam_filter->vdev_id = roam_req->session_id; |
| 6202 | roam_filter->flags = 0; |
| 6203 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 6204 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 6205 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 6206 | roam_filter->num_bssid_preferred_list = |
| 6207 | roam_req->num_bssid_preferred_list; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6208 | roam_filter->num_rssi_rejection_ap = |
| 6209 | roam_req->num_rssi_rejection_ap; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6210 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 6211 | |
| 6212 | WMITLV_SET_HDR((buf_ptr), |
| 6213 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6214 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 6215 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 6216 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6217 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 6218 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 6219 | bssid_src_ptr += ATH_MAC_LEN; |
| 6220 | bssid_dst_ptr++; |
| 6221 | } |
| 6222 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6223 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 6224 | WMITLV_SET_HDR((buf_ptr), |
| 6225 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6226 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 6227 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6228 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 6229 | qdf_mem_copy(&ssid_ptr->ssid, |
| 6230 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 6231 | roam_req->ssid_allowed_list[i].length); |
| 6232 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 6233 | ssid_ptr++; |
| 6234 | } |
| 6235 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 6236 | sizeof(wmi_ssid)); |
| 6237 | WMITLV_SET_HDR((buf_ptr), |
| 6238 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6239 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 6240 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 6241 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6242 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 6243 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 6244 | (wmi_mac_addr *)bssid_dst_ptr); |
| 6245 | bssid_src_ptr += ATH_MAC_LEN; |
| 6246 | bssid_dst_ptr++; |
| 6247 | } |
| 6248 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6249 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 6250 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6251 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 6252 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6253 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 6254 | *bssid_preferred_factor_ptr = |
| 6255 | roam_req->bssid_favored_factor[i]; |
| 6256 | bssid_preferred_factor_ptr++; |
| 6257 | } |
| 6258 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6259 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 6260 | |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6261 | WMITLV_SET_HDR(buf_ptr, |
| 6262 | WMITLV_TAG_ARRAY_STRUC, blist_len); |
| 6263 | buf_ptr += WMI_TLV_HDR_SIZE; |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6264 | if (roam_req->lca_disallow_config_present) { |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6265 | blist_param = |
| 6266 | (wmi_roam_lca_disallow_config_tlv_param *) buf_ptr; |
| 6267 | WMITLV_SET_HDR(&blist_param->tlv_header, |
| 6268 | WMITLV_TAG_STRUC_wmi_roam_lca_disallow_config_tlv_param, |
| 6269 | WMITLV_GET_STRUCT_TLVLEN( |
| 6270 | wmi_roam_lca_disallow_config_tlv_param)); |
| 6271 | |
| 6272 | blist_param->disallow_duration = roam_req->disallow_duration; |
| 6273 | blist_param->rssi_channel_penalization = |
| 6274 | roam_req->rssi_channel_penalization; |
| 6275 | blist_param->num_disallowed_aps = roam_req->num_disallowed_aps; |
| 6276 | blist_param->disallow_lca_enable_source_bitmap = 0x1; |
| 6277 | buf_ptr += (sizeof(wmi_roam_lca_disallow_config_tlv_param)); |
| 6278 | } |
| 6279 | |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6280 | WMITLV_SET_HDR(buf_ptr, |
| 6281 | WMITLV_TAG_ARRAY_STRUC, |
| 6282 | (roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej))); |
| 6283 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6284 | for (i = 0; i < roam_req->num_rssi_rejection_ap; i++) { |
| 6285 | rssi_rej = |
| 6286 | (wmi_roam_rssi_rejection_oce_config_param *) buf_ptr; |
| 6287 | WMITLV_SET_HDR(&rssi_rej->tlv_header, |
| 6288 | WMITLV_TAG_STRUC_wmi_roam_rssi_rejection_oce_config_param, |
| 6289 | WMITLV_GET_STRUCT_TLVLEN( |
| 6290 | wmi_roam_rssi_rejection_oce_config_param)); |
| 6291 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 6292 | roam_req->rssi_rejection_ap[i].bssid.bytes, |
| 6293 | &rssi_rej->bssid); |
| 6294 | rssi_rej->remaining_disallow_duration = |
| 6295 | roam_req->rssi_rejection_ap[i].remaining_duration; |
| 6296 | rssi_rej->requested_rssi = |
| 6297 | (A_INT32)roam_req->rssi_rejection_ap[i].expected_rssi; |
| 6298 | buf_ptr += |
| 6299 | (sizeof(wmi_roam_rssi_rejection_oce_config_param)); |
| 6300 | } |
| 6301 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6302 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6303 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6304 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6305 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6306 | status); |
| 6307 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6308 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6309 | |
| 6310 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6311 | } |
| 6312 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6313 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 6314 | * @wmi_handle: wmi handle |
| 6315 | * @req: epno config params request structure |
| 6316 | * |
| 6317 | * This function reads the incoming epno config request structure |
| 6318 | * and constructs the WMI message to the firmware. |
| 6319 | * |
| 6320 | * Returns: 0 on success, error number otherwise |
| 6321 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6322 | 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] | 6323 | struct wifi_enhanched_pno_params *req) |
| 6324 | { |
| 6325 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6326 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6327 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6328 | u_int8_t i, *buf_ptr; |
| 6329 | wmi_buf_t buf; |
| 6330 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6331 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6332 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6333 | /* Fixed Params */ |
| 6334 | len = sizeof(*cmd); |
| 6335 | if (req->num_networks) { |
| 6336 | /* TLV place holder for array of structures |
| 6337 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 6338 | */ |
| 6339 | len += WMI_TLV_HDR_SIZE; |
| 6340 | len += (sizeof(nlo_configured_parameters) |
| 6341 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 6342 | /* TLV for array of uint32 channel_list */ |
| 6343 | len += WMI_TLV_HDR_SIZE; |
| 6344 | /* TLV for nlo_channel_prediction_cfg */ |
| 6345 | len += WMI_TLV_HDR_SIZE; |
| 6346 | /* TLV for candidate score params */ |
| 6347 | len += sizeof(enlo_candidate_score_params); |
| 6348 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6349 | |
| 6350 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6351 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6352 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6353 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6354 | } |
| 6355 | |
| 6356 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6357 | |
| 6358 | buf_ptr = (u_int8_t *) cmd; |
| 6359 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6360 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6361 | WMITLV_GET_STRUCT_TLVLEN( |
| 6362 | wmi_nlo_config_cmd_fixed_param)); |
| 6363 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6364 | |
| 6365 | /* set flag to reset if num of networks are 0 */ |
| 6366 | cmd->flags = (req->num_networks == 0 ? |
| 6367 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6368 | |
| 6369 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6370 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6371 | 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] | 6372 | WMI_LOGD("SSID count: %d flags: %d", |
| 6373 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6374 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6375 | /* Fill nlo_config only when num_networks are non zero */ |
| 6376 | if (cmd->no_of_ssids) { |
| 6377 | /* Fill networks */ |
| 6378 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6379 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6380 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6381 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6382 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6383 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6384 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6385 | WMITLV_TAG_ARRAY_BYTE, |
| 6386 | WMITLV_GET_STRUCT_TLVLEN( |
| 6387 | nlo_configured_parameters)); |
| 6388 | /* Copy ssid and it's length */ |
| 6389 | nlo_list[i].ssid.valid = true; |
| 6390 | nlo_list[i].ssid.ssid.ssid_len = |
| 6391 | req->networks[i].ssid.length; |
| 6392 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 6393 | req->networks[i].ssid.mac_ssid, |
| 6394 | nlo_list[i].ssid.ssid.ssid_len); |
| 6395 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 6396 | nlo_list[i].ssid.ssid.ssid_len, |
| 6397 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 6398 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6399 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6400 | /* Copy pno flags */ |
| 6401 | nlo_list[i].bcast_nw_type.valid = true; |
| 6402 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6403 | req->networks[i].flags; |
| 6404 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6405 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6406 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6407 | /* Copy auth bit field */ |
| 6408 | nlo_list[i].auth_type.valid = true; |
| 6409 | nlo_list[i].auth_type.auth_type = |
| 6410 | req->networks[i].auth_bit_field; |
| 6411 | WMI_LOGD("Auth bit field (%u)", |
| 6412 | nlo_list[i].auth_type.auth_type); |
| 6413 | } |
| 6414 | |
| 6415 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6416 | /* Fill the channel list */ |
| 6417 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6418 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6419 | |
| 6420 | /* Fill prediction_param */ |
| 6421 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6422 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6423 | |
| 6424 | /* Fill epno candidate score params */ |
| 6425 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 6426 | WMITLV_SET_HDR(buf_ptr, |
| 6427 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 6428 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 6429 | cand_score_params->min5GHz_rssi = |
| 6430 | req->min_5ghz_rssi; |
| 6431 | cand_score_params->min24GHz_rssi = |
| 6432 | req->min_24ghz_rssi; |
| 6433 | cand_score_params->initial_score_max = |
| 6434 | req->initial_score_max; |
| 6435 | cand_score_params->current_connection_bonus = |
| 6436 | req->current_connection_bonus; |
| 6437 | cand_score_params->same_network_bonus = |
| 6438 | req->same_network_bonus; |
| 6439 | cand_score_params->secure_bonus = |
| 6440 | req->secure_bonus; |
| 6441 | cand_score_params->band5GHz_bonus = |
| 6442 | req->band_5ghz_bonus; |
| 6443 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6444 | } |
| 6445 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6446 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6447 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6448 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6449 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6450 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6451 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6452 | } |
| 6453 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6454 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6455 | req->session_id); |
| 6456 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6457 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6458 | } |
| 6459 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6460 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6461 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 6462 | * @wmi_handle: wmi handle |
| 6463 | * @ipa_offload: ipa offload control parameter |
| 6464 | * |
| 6465 | * Returns: 0 on success, error number otherwise |
| 6466 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6467 | 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] | 6468 | struct ipa_offload_control_params *ipa_offload) |
| 6469 | { |
| 6470 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 6471 | wmi_buf_t wmi_buf; |
| 6472 | uint32_t len; |
| 6473 | u_int8_t *buf_ptr; |
| 6474 | |
| 6475 | len = sizeof(*cmd); |
| 6476 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6477 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6478 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 6479 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6480 | } |
| 6481 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 6482 | WMI_LOGD("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6483 | ipa_offload->offload_type, ipa_offload->enable); |
| 6484 | |
| 6485 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 6486 | |
| 6487 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 6488 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6489 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 6490 | WMITLV_GET_STRUCT_TLVLEN( |
| 6491 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 6492 | |
| 6493 | cmd->offload_type = ipa_offload->offload_type; |
| 6494 | cmd->vdev_id = ipa_offload->vdev_id; |
| 6495 | cmd->enable = ipa_offload->enable; |
| 6496 | |
| 6497 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6498 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6499 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6500 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6501 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6502 | } |
| 6503 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6504 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6505 | } |
| 6506 | |
| 6507 | /** |
| 6508 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 6509 | * @wmi_handle: wmi handle |
| 6510 | * @pgetcapab: get capabilities params |
| 6511 | * |
| 6512 | * This function send request to fw to get extscan capabilities. |
| 6513 | * |
| 6514 | * Return: CDF status |
| 6515 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6516 | 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] | 6517 | struct extscan_capabilities_params *pgetcapab) |
| 6518 | { |
| 6519 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 6520 | wmi_buf_t wmi_buf; |
| 6521 | uint32_t len; |
| 6522 | uint8_t *buf_ptr; |
| 6523 | |
| 6524 | len = sizeof(*cmd); |
| 6525 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6526 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6527 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6528 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6529 | } |
| 6530 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6531 | |
| 6532 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 6533 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6534 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 6535 | WMITLV_GET_STRUCT_TLVLEN |
| 6536 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 6537 | |
| 6538 | cmd->request_id = pgetcapab->request_id; |
| 6539 | |
| 6540 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6541 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6542 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6543 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6544 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6545 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6546 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6547 | } |
| 6548 | |
| 6549 | /** |
| 6550 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 6551 | * @wmi_handle: wmi handle |
| 6552 | * @pcached_results: cached results parameters |
| 6553 | * |
| 6554 | * This function send request to fw to get cached results. |
| 6555 | * |
| 6556 | * Return: CDF status |
| 6557 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6558 | 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] | 6559 | struct extscan_cached_result_params *pcached_results) |
| 6560 | { |
| 6561 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 6562 | wmi_buf_t wmi_buf; |
| 6563 | uint32_t len; |
| 6564 | uint8_t *buf_ptr; |
| 6565 | |
| 6566 | len = sizeof(*cmd); |
| 6567 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6568 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6569 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6570 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6571 | } |
| 6572 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6573 | |
| 6574 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 6575 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6576 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 6577 | WMITLV_GET_STRUCT_TLVLEN |
| 6578 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 6579 | |
| 6580 | cmd->request_id = pcached_results->request_id; |
| 6581 | cmd->vdev_id = pcached_results->session_id; |
| 6582 | cmd->control_flags = pcached_results->flush; |
| 6583 | |
| 6584 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6585 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6586 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6587 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6588 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6589 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6590 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6591 | } |
| 6592 | |
| 6593 | /** |
| 6594 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 6595 | * @wmi_handle: wmi handle |
| 6596 | * @reset_req: Reset change request params |
| 6597 | * |
| 6598 | * This function sends stop change monitor request to fw. |
| 6599 | * |
| 6600 | * Return: CDF status |
| 6601 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6602 | 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] | 6603 | struct extscan_capabilities_reset_params *reset_req) |
| 6604 | { |
| 6605 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6606 | wmi_buf_t wmi_buf; |
| 6607 | uint32_t len; |
| 6608 | uint8_t *buf_ptr; |
| 6609 | int change_list = 0; |
| 6610 | |
| 6611 | len = sizeof(*cmd); |
| 6612 | |
| 6613 | /* reset significant change tlv is set to 0 */ |
| 6614 | len += WMI_TLV_HDR_SIZE; |
| 6615 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6616 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6617 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6618 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6619 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6620 | } |
| 6621 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6622 | |
| 6623 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6624 | buf_ptr; |
| 6625 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6626 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6627 | WMITLV_GET_STRUCT_TLVLEN |
| 6628 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6629 | |
| 6630 | cmd->request_id = reset_req->request_id; |
| 6631 | cmd->vdev_id = reset_req->session_id; |
| 6632 | cmd->mode = 0; |
| 6633 | |
| 6634 | buf_ptr += sizeof(*cmd); |
| 6635 | WMITLV_SET_HDR(buf_ptr, |
| 6636 | WMITLV_TAG_ARRAY_STRUC, |
| 6637 | change_list * |
| 6638 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6639 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 6640 | sizeof |
| 6641 | (wmi_extscan_wlan_change_bssid_param)); |
| 6642 | |
| 6643 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6644 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6645 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6646 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6647 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6648 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6649 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6650 | } |
| 6651 | |
| 6652 | /** |
| 6653 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 6654 | * @wmi_handle: wmi handle |
| 6655 | * @psigchange: change monitor request params |
| 6656 | * @buf: wmi buffer |
| 6657 | * @buf_len: buffer length |
| 6658 | * |
| 6659 | * This function fills elements of change monitor request buffer. |
| 6660 | * |
| 6661 | * Return: CDF status |
| 6662 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6663 | 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] | 6664 | struct extscan_set_sig_changereq_params |
| 6665 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 6666 | { |
| 6667 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6668 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 6669 | uint8_t *buf_ptr; |
| 6670 | int j; |
| 6671 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6672 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6673 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 6674 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6675 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6676 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 6677 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6678 | } |
| 6679 | len += WMI_TLV_HDR_SIZE; |
| 6680 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6681 | |
| 6682 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6683 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6684 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6685 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6686 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6687 | } |
| 6688 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6689 | cmd = |
| 6690 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6691 | buf_ptr; |
| 6692 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6693 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6694 | WMITLV_GET_STRUCT_TLVLEN |
| 6695 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6696 | |
| 6697 | cmd->request_id = psigchange->request_id; |
| 6698 | cmd->vdev_id = psigchange->session_id; |
| 6699 | cmd->total_entries = numap; |
| 6700 | cmd->mode = 1; |
| 6701 | cmd->num_entries_in_page = numap; |
| 6702 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 6703 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 6704 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 6705 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 6706 | |
| 6707 | buf_ptr += sizeof(*cmd); |
| 6708 | WMITLV_SET_HDR(buf_ptr, |
| 6709 | WMITLV_TAG_ARRAY_STRUC, |
| 6710 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6711 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 6712 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6713 | |
| 6714 | for (j = 0; j < numap; j++) { |
| 6715 | WMITLV_SET_HDR(dest_chglist, |
| 6716 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6717 | WMITLV_GET_STRUCT_TLVLEN |
| 6718 | (wmi_extscan_wlan_change_bssid_param)); |
| 6719 | |
| 6720 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 6721 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 6722 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 6723 | &dest_chglist->bssid); |
| 6724 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6725 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6726 | dest_chglist->lower_rssi_limit); |
| 6727 | dest_chglist++; |
| 6728 | src_ap++; |
| 6729 | } |
| 6730 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6731 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6732 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6733 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6734 | } |
| 6735 | |
| 6736 | /** |
| 6737 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 6738 | * @wmi_handle: wmi handle |
| 6739 | * @psigchange: change monitor request params |
| 6740 | * |
| 6741 | * This function sends start change monitor request to fw. |
| 6742 | * |
| 6743 | * Return: CDF status |
| 6744 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6745 | 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] | 6746 | struct extscan_set_sig_changereq_params * |
| 6747 | psigchange) |
| 6748 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6749 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6750 | wmi_buf_t buf; |
| 6751 | int len; |
| 6752 | |
| 6753 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6754 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6755 | psigchange, &buf, |
| 6756 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6757 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6758 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6759 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6760 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6761 | } |
| 6762 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6763 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 6764 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6765 | } |
| 6766 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6767 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6768 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6769 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6770 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6771 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6772 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6773 | } |
| 6774 | |
| 6775 | /** |
| 6776 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 6777 | * @wmi_handle: wmi handle |
| 6778 | * @photlist_reset: hotlist reset params |
| 6779 | * |
| 6780 | * This function configures hotlist monitor to stop in fw. |
| 6781 | * |
| 6782 | * Return: CDF status |
| 6783 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6784 | 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] | 6785 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 6786 | { |
| 6787 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 6788 | wmi_buf_t wmi_buf; |
| 6789 | uint32_t len; |
| 6790 | uint8_t *buf_ptr; |
| 6791 | int hotlist_entries = 0; |
| 6792 | |
| 6793 | len = sizeof(*cmd); |
| 6794 | |
| 6795 | /* reset bssid hotlist with tlv set to 0 */ |
| 6796 | len += WMI_TLV_HDR_SIZE; |
| 6797 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 6798 | |
| 6799 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6800 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6801 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6802 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6803 | } |
| 6804 | |
| 6805 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6806 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 6807 | buf_ptr; |
| 6808 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6809 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 6810 | WMITLV_GET_STRUCT_TLVLEN |
| 6811 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 6812 | |
| 6813 | cmd->request_id = photlist_reset->request_id; |
| 6814 | cmd->vdev_id = photlist_reset->session_id; |
| 6815 | cmd->mode = 0; |
| 6816 | |
| 6817 | buf_ptr += sizeof(*cmd); |
| 6818 | WMITLV_SET_HDR(buf_ptr, |
| 6819 | WMITLV_TAG_ARRAY_STRUC, |
| 6820 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6821 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6822 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6823 | |
| 6824 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6825 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6826 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6827 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6828 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6829 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6830 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6831 | } |
| 6832 | |
| 6833 | /** |
| 6834 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 6835 | * @wmi_handle: wmi handle |
| 6836 | * @pstopcmd: stop scan command request params |
| 6837 | * |
| 6838 | * This function sends stop extscan request to fw. |
| 6839 | * |
| 6840 | * Return: CDF Status. |
| 6841 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6842 | 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] | 6843 | struct extscan_stop_req_params *pstopcmd) |
| 6844 | { |
| 6845 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 6846 | wmi_buf_t wmi_buf; |
| 6847 | uint32_t len; |
| 6848 | uint8_t *buf_ptr; |
| 6849 | |
| 6850 | len = sizeof(*cmd); |
| 6851 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6852 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6853 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6854 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6855 | } |
| 6856 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6857 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 6858 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6859 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 6860 | WMITLV_GET_STRUCT_TLVLEN |
| 6861 | (wmi_extscan_stop_cmd_fixed_param)); |
| 6862 | |
| 6863 | cmd->request_id = pstopcmd->request_id; |
| 6864 | cmd->vdev_id = pstopcmd->session_id; |
| 6865 | |
| 6866 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6867 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6868 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6869 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6870 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6871 | } |
| 6872 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6873 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6874 | } |
| 6875 | |
| 6876 | /** |
| 6877 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 6878 | * @wmi_handle: wmi handle |
| 6879 | * @pstart: scan command request params |
| 6880 | * @buf: event buffer |
| 6881 | * @buf_len: length of buffer |
| 6882 | * |
| 6883 | * This function fills individual elements of extscan request and |
| 6884 | * TLV for buckets, channel list. |
| 6885 | * |
| 6886 | * Return: CDF Status. |
| 6887 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6888 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6889 | 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] | 6890 | struct wifi_scan_cmd_req_params *pstart, |
| 6891 | wmi_buf_t *buf, int *buf_len) |
| 6892 | { |
| 6893 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 6894 | wmi_extscan_bucket *dest_blist; |
| 6895 | wmi_extscan_bucket_channel *dest_clist; |
| 6896 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 6897 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 6898 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 6899 | |
| 6900 | uint8_t *buf_ptr; |
| 6901 | int i, k, count = 0; |
| 6902 | int len = sizeof(*cmd); |
| 6903 | int nbuckets = pstart->numBuckets; |
| 6904 | int nchannels = 0; |
| 6905 | |
| 6906 | /* These TLV's are are NULL by default */ |
| 6907 | uint32_t ie_len_with_pad = 0; |
| 6908 | int num_ssid = 0; |
| 6909 | int num_bssid = 0; |
| 6910 | int ie_len = 0; |
| 6911 | |
| 6912 | uint32_t base_period = pstart->basePeriod; |
| 6913 | |
| 6914 | /* TLV placeholder for ssid_list (NULL) */ |
| 6915 | len += WMI_TLV_HDR_SIZE; |
| 6916 | len += num_ssid * sizeof(wmi_ssid); |
| 6917 | |
| 6918 | /* TLV placeholder for bssid_list (NULL) */ |
| 6919 | len += WMI_TLV_HDR_SIZE; |
| 6920 | len += num_bssid * sizeof(wmi_mac_addr); |
| 6921 | |
| 6922 | /* TLV placeholder for ie_data (NULL) */ |
| 6923 | len += WMI_TLV_HDR_SIZE; |
| 6924 | len += ie_len * sizeof(uint32_t); |
| 6925 | |
| 6926 | /* TLV placeholder for bucket */ |
| 6927 | len += WMI_TLV_HDR_SIZE; |
| 6928 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 6929 | |
| 6930 | /* TLV channel placeholder */ |
| 6931 | len += WMI_TLV_HDR_SIZE; |
| 6932 | for (i = 0; i < nbuckets; i++) { |
| 6933 | nchannels += src_bucket->numChannels; |
| 6934 | src_bucket++; |
| 6935 | } |
| 6936 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6937 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6938 | __func__, nbuckets, nchannels); |
| 6939 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 6940 | /* Allocate the memory */ |
| 6941 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6942 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6943 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6944 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6945 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6946 | } |
| 6947 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6948 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 6949 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6950 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 6951 | WMITLV_GET_STRUCT_TLVLEN |
| 6952 | (wmi_extscan_start_cmd_fixed_param)); |
| 6953 | |
| 6954 | cmd->request_id = pstart->requestId; |
| 6955 | cmd->vdev_id = pstart->sessionId; |
| 6956 | cmd->base_period = pstart->basePeriod; |
| 6957 | cmd->num_buckets = nbuckets; |
| 6958 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 6959 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6960 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6961 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6962 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6963 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6964 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 6965 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6966 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 6967 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 6968 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6969 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 6970 | |
| 6971 | /* The max dwell time is retrieved from the first channel |
| 6972 | * of the first bucket and kept common for all channels. |
| 6973 | */ |
| 6974 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 6975 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 6976 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 6977 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 6978 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 6979 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 6980 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 6981 | |
| 6982 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6983 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6984 | cmd->probe_delay = 0; |
| 6985 | cmd->probe_spacing_time = 0; |
| 6986 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6987 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 6988 | WMI_SCAN_ADD_CCK_RATES | |
| 6989 | WMI_SCAN_ADD_OFDM_RATES | |
| 6990 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 6991 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6992 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 6993 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 6994 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6995 | cmd->num_ssids = 0; |
| 6996 | cmd->num_bssid = 0; |
| 6997 | cmd->ie_len = 0; |
| 6998 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 6999 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 7000 | |
| 7001 | buf_ptr += sizeof(*cmd); |
| 7002 | WMITLV_SET_HDR(buf_ptr, |
| 7003 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 7004 | num_ssid * sizeof(wmi_ssid)); |
| 7005 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 7006 | |
| 7007 | WMITLV_SET_HDR(buf_ptr, |
| 7008 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 7009 | num_bssid * sizeof(wmi_mac_addr)); |
| 7010 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 7011 | |
| 7012 | ie_len_with_pad = 0; |
| 7013 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 7014 | ie_len_with_pad); |
| 7015 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 7016 | |
| 7017 | WMITLV_SET_HDR(buf_ptr, |
| 7018 | WMITLV_TAG_ARRAY_STRUC, |
| 7019 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 7020 | dest_blist = (wmi_extscan_bucket *) |
| 7021 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7022 | src_bucket = pstart->buckets; |
| 7023 | |
| 7024 | /* Retrieve scanning information from each bucket and |
| 7025 | * channels and send it to the target |
| 7026 | */ |
| 7027 | for (i = 0; i < nbuckets; i++) { |
| 7028 | WMITLV_SET_HDR(dest_blist, |
| 7029 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 7030 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 7031 | |
| 7032 | dest_blist->bucket_id = src_bucket->bucket; |
| 7033 | dest_blist->base_period_multiplier = |
| 7034 | src_bucket->period / base_period; |
| 7035 | dest_blist->min_period = src_bucket->period; |
| 7036 | dest_blist->max_period = src_bucket->max_period; |
| 7037 | dest_blist->exp_backoff = src_bucket->exponent; |
| 7038 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 7039 | dest_blist->channel_band = src_bucket->band; |
| 7040 | dest_blist->num_channels = src_bucket->numChannels; |
| 7041 | dest_blist->notify_extscan_events = 0; |
| 7042 | |
| 7043 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 7044 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 7045 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 7046 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7047 | |
| 7048 | if (src_bucket->reportEvents & |
| 7049 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 7050 | dest_blist->forwarding_flags = |
| 7051 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 7052 | dest_blist->notify_extscan_events |= |
| 7053 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 7054 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 7055 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 7056 | } else { |
| 7057 | dest_blist->forwarding_flags = |
| 7058 | WMI_EXTSCAN_NO_FORWARDING; |
| 7059 | } |
| 7060 | |
| 7061 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 7062 | dest_blist->configuration_flags = 0; |
| 7063 | else |
| 7064 | dest_blist->configuration_flags = |
| 7065 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 7066 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7067 | 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] | 7068 | __func__, dest_blist->notify_extscan_events, |
| 7069 | dest_blist->configuration_flags, |
| 7070 | dest_blist->forwarding_flags); |
| 7071 | |
| 7072 | dest_blist->min_dwell_time_active = |
| 7073 | src_bucket->min_dwell_time_active; |
| 7074 | dest_blist->max_dwell_time_active = |
| 7075 | src_bucket->max_dwell_time_active; |
| 7076 | dest_blist->min_dwell_time_passive = |
| 7077 | src_bucket->min_dwell_time_passive; |
| 7078 | dest_blist->max_dwell_time_passive = |
| 7079 | src_bucket->max_dwell_time_passive; |
| 7080 | src_channel = src_bucket->channels; |
| 7081 | |
| 7082 | /* save the channel info to later populate |
| 7083 | * the channel TLV |
| 7084 | */ |
| 7085 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 7086 | save_channel[count++].channel = src_channel->channel; |
| 7087 | src_channel++; |
| 7088 | } |
| 7089 | dest_blist++; |
| 7090 | src_bucket++; |
| 7091 | } |
| 7092 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 7093 | WMITLV_SET_HDR(buf_ptr, |
| 7094 | WMITLV_TAG_ARRAY_STRUC, |
| 7095 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 7096 | dest_clist = (wmi_extscan_bucket_channel *) |
| 7097 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7098 | |
| 7099 | /* Active or passive scan is based on the bucket dwell time |
| 7100 | * and channel specific active,passive scans are not |
| 7101 | * supported yet |
| 7102 | */ |
| 7103 | for (i = 0; i < nchannels; i++) { |
| 7104 | WMITLV_SET_HDR(dest_clist, |
| 7105 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 7106 | WMITLV_GET_STRUCT_TLVLEN |
| 7107 | (wmi_extscan_bucket_channel)); |
| 7108 | dest_clist->channel = save_channel[i].channel; |
| 7109 | dest_clist++; |
| 7110 | } |
| 7111 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 7112 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 7113 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7114 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7115 | } |
| 7116 | |
| 7117 | /** |
| 7118 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 7119 | * @wmi_handle: wmi handle |
| 7120 | * @pstart: scan command request params |
| 7121 | * |
| 7122 | * This function sends start extscan request to fw. |
| 7123 | * |
| 7124 | * Return: CDF Status. |
| 7125 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7126 | 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] | 7127 | struct wifi_scan_cmd_req_params *pstart) |
| 7128 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7129 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7130 | wmi_buf_t buf; |
| 7131 | int len; |
| 7132 | |
| 7133 | /* Fill individual elements of extscan request and |
| 7134 | * TLV for buckets, channel list. |
| 7135 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7136 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7137 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7138 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 7139 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 7140 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7141 | } |
| 7142 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7143 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7144 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7145 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7146 | } |
| 7147 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 7148 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7149 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7150 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7151 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7152 | } |
| 7153 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7154 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7155 | } |
| 7156 | |
| 7157 | /** |
| 7158 | * send_plm_stop_cmd_tlv() - plm stop request |
| 7159 | * @wmi_handle: wmi handle |
| 7160 | * @plm: plm request parameters |
| 7161 | * |
| 7162 | * This function request FW to stop PLM. |
| 7163 | * |
| 7164 | * Return: CDF status |
| 7165 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7166 | 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] | 7167 | const struct plm_req_params *plm) |
| 7168 | { |
| 7169 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 7170 | int32_t len; |
| 7171 | wmi_buf_t buf; |
| 7172 | uint8_t *buf_ptr; |
| 7173 | int ret; |
| 7174 | |
| 7175 | len = sizeof(*cmd); |
| 7176 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7177 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7178 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7179 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7180 | } |
| 7181 | |
| 7182 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 7183 | |
| 7184 | buf_ptr = (uint8_t *) cmd; |
| 7185 | |
| 7186 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7187 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 7188 | WMITLV_GET_STRUCT_TLVLEN |
| 7189 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 7190 | |
| 7191 | cmd->vdev_id = plm->session_id; |
| 7192 | |
| 7193 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7194 | 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] | 7195 | |
| 7196 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7197 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 7198 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7199 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7200 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7201 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7202 | } |
| 7203 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7204 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7205 | } |
| 7206 | |
| 7207 | /** |
| 7208 | * send_plm_start_cmd_tlv() - plm start request |
| 7209 | * @wmi_handle: wmi handle |
| 7210 | * @plm: plm request parameters |
| 7211 | * |
| 7212 | * This function request FW to start PLM. |
| 7213 | * |
| 7214 | * Return: CDF status |
| 7215 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7216 | 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] | 7217 | const struct plm_req_params *plm, |
| 7218 | uint32_t *gchannel_list) |
| 7219 | { |
| 7220 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 7221 | uint32_t *channel_list; |
| 7222 | int32_t len; |
| 7223 | wmi_buf_t buf; |
| 7224 | uint8_t *buf_ptr; |
| 7225 | uint8_t count; |
| 7226 | int ret; |
| 7227 | |
| 7228 | /* TLV place holder for channel_list */ |
| 7229 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 7230 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 7231 | |
| 7232 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7233 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7234 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7235 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7236 | } |
| 7237 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 7238 | |
| 7239 | buf_ptr = (uint8_t *) cmd; |
| 7240 | |
| 7241 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7242 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 7243 | WMITLV_GET_STRUCT_TLVLEN |
| 7244 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 7245 | |
| 7246 | cmd->vdev_id = plm->session_id; |
| 7247 | |
| 7248 | cmd->meas_token = plm->meas_token; |
| 7249 | cmd->dialog_token = plm->diag_token; |
| 7250 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7251 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7252 | cmd->off_duration = plm->meas_duration; |
| 7253 | cmd->burst_cycle = plm->burst_len; |
| 7254 | cmd->tx_power = plm->desired_tx_pwr; |
| 7255 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 7256 | cmd->num_chans = plm->plm_num_ch; |
| 7257 | |
| 7258 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 7259 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7260 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 7261 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 7262 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 7263 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 7264 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 7265 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 7266 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 7267 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7268 | |
| 7269 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7270 | (cmd->num_chans * sizeof(uint32_t))); |
| 7271 | |
| 7272 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7273 | if (cmd->num_chans) { |
| 7274 | channel_list = (uint32_t *) buf_ptr; |
| 7275 | for (count = 0; count < cmd->num_chans; count++) { |
| 7276 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7277 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7278 | channel_list[count] = |
| 7279 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7280 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7281 | } |
| 7282 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 7283 | } |
| 7284 | |
| 7285 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7286 | WMI_VDEV_PLMREQ_START_CMDID); |
| 7287 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7288 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7289 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7290 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7291 | } |
| 7292 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7293 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7294 | } |
| 7295 | |
| 7296 | /** |
| 7297 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 7298 | * @wmi_handle: wmi handle |
| 7299 | * @vdev_id: vdev id |
| 7300 | * |
| 7301 | * This function request FW to stop ongoing PNO operation. |
| 7302 | * |
| 7303 | * Return: CDF status |
| 7304 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7305 | 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] | 7306 | { |
| 7307 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 7308 | int32_t len = sizeof(*cmd); |
| 7309 | wmi_buf_t buf; |
| 7310 | uint8_t *buf_ptr; |
| 7311 | int ret; |
| 7312 | |
| 7313 | /* |
| 7314 | * TLV place holder for array of structures nlo_configured_parameters |
| 7315 | * TLV place holder for array of uint32_t channel_list |
| 7316 | * TLV place holder for chnl prediction cfg |
| 7317 | */ |
| 7318 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 7319 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7320 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7321 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7322 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7323 | } |
| 7324 | |
| 7325 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 7326 | buf_ptr = (uint8_t *) cmd; |
| 7327 | |
| 7328 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7329 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 7330 | WMITLV_GET_STRUCT_TLVLEN |
| 7331 | (wmi_nlo_config_cmd_fixed_param)); |
| 7332 | |
| 7333 | cmd->vdev_id = vdev_id; |
| 7334 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 7335 | buf_ptr += sizeof(*cmd); |
| 7336 | |
| 7337 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7338 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7339 | |
| 7340 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7341 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7342 | |
| 7343 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7344 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7345 | |
| 7346 | |
| 7347 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7348 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 7349 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7350 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7351 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7352 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7353 | } |
| 7354 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7355 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7356 | } |
| 7357 | |
| 7358 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7359 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 7360 | * @buf_ptr: Buffer passed by upper layers |
| 7361 | * @pno: Buffer to be sent to the firmware |
| 7362 | * |
| 7363 | * Copy the PNO Channel prediction configuration parameters |
| 7364 | * passed by the upper layers to a WMI format TLV and send it |
| 7365 | * down to the firmware. |
| 7366 | * |
| 7367 | * Return: None |
| 7368 | */ |
| 7369 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 7370 | struct pno_scan_req_params *pno) |
| 7371 | { |
| 7372 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 7373 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 7374 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 7375 | WMITLV_TAG_ARRAY_BYTE, |
| 7376 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7377 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7378 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 7379 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 7380 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 7381 | channel_prediction_cfg->full_scan_period_ms = |
| 7382 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7383 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7384 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 7385 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 7386 | channel_prediction_cfg->enable, |
| 7387 | channel_prediction_cfg->top_k_num, |
| 7388 | channel_prediction_cfg->stationary_threshold, |
| 7389 | channel_prediction_cfg->full_scan_period_ms); |
| 7390 | } |
| 7391 | |
| 7392 | /** |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 7393 | * send_nlo_mawc_cmd_tlv() - Send MAWC NLO configuration |
| 7394 | * @wmi_handle: wmi handle |
| 7395 | * @params: configuration parameters |
| 7396 | * |
| 7397 | * Return: QDF_STATUS |
| 7398 | */ |
| 7399 | static QDF_STATUS send_nlo_mawc_cmd_tlv(wmi_unified_t wmi_handle, |
| 7400 | struct nlo_mawc_params *params) |
| 7401 | { |
| 7402 | wmi_buf_t buf = NULL; |
| 7403 | QDF_STATUS status; |
| 7404 | int len; |
| 7405 | uint8_t *buf_ptr; |
| 7406 | wmi_nlo_configure_mawc_cmd_fixed_param *wmi_nlo_mawc_params; |
| 7407 | |
| 7408 | len = sizeof(*wmi_nlo_mawc_params); |
| 7409 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7410 | if (!buf) { |
| 7411 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7412 | return QDF_STATUS_E_NOMEM; |
| 7413 | } |
| 7414 | |
| 7415 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7416 | wmi_nlo_mawc_params = |
| 7417 | (wmi_nlo_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 7418 | WMITLV_SET_HDR(&wmi_nlo_mawc_params->tlv_header, |
| 7419 | WMITLV_TAG_STRUC_wmi_nlo_configure_mawc_cmd_fixed_param, |
| 7420 | WMITLV_GET_STRUCT_TLVLEN |
| 7421 | (wmi_nlo_configure_mawc_cmd_fixed_param)); |
| 7422 | wmi_nlo_mawc_params->vdev_id = params->vdev_id; |
| 7423 | if (params->enable) |
| 7424 | wmi_nlo_mawc_params->enable = 1; |
| 7425 | else |
| 7426 | wmi_nlo_mawc_params->enable = 0; |
| 7427 | wmi_nlo_mawc_params->exp_backoff_ratio = params->exp_backoff_ratio; |
| 7428 | wmi_nlo_mawc_params->init_scan_interval = params->init_scan_interval; |
| 7429 | wmi_nlo_mawc_params->max_scan_interval = params->max_scan_interval; |
| 7430 | |
| 7431 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7432 | len, WMI_NLO_CONFIGURE_MAWC_CMDID); |
| 7433 | if (QDF_IS_STATUS_ERROR(status)) { |
| 7434 | WMI_LOGE("WMI_NLO_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 7435 | status); |
| 7436 | wmi_buf_free(buf); |
| 7437 | return QDF_STATUS_E_FAILURE; |
| 7438 | } |
| 7439 | WMI_LOGD(FL("MAWC NLO en=%d, vdev=%d, ratio=%d, SCAN init=%d, max=%d"), |
| 7440 | wmi_nlo_mawc_params->enable, wmi_nlo_mawc_params->vdev_id, |
| 7441 | wmi_nlo_mawc_params->exp_backoff_ratio, |
| 7442 | wmi_nlo_mawc_params->init_scan_interval, |
| 7443 | wmi_nlo_mawc_params->max_scan_interval); |
| 7444 | |
| 7445 | return QDF_STATUS_SUCCESS; |
| 7446 | } |
| 7447 | |
| 7448 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7449 | * send_pno_start_cmd_tlv() - PNO start request |
| 7450 | * @wmi_handle: wmi handle |
| 7451 | * @pno: PNO request |
| 7452 | * |
| 7453 | * This function request FW to start PNO request. |
| 7454 | * Request: CDF status |
| 7455 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7456 | 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] | 7457 | struct pno_scan_req_params *pno) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7458 | { |
| 7459 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 7460 | nlo_configured_parameters *nlo_list; |
| 7461 | uint32_t *channel_list; |
| 7462 | int32_t len; |
| 7463 | wmi_buf_t buf; |
| 7464 | uint8_t *buf_ptr; |
| 7465 | uint8_t i; |
| 7466 | int ret; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7467 | struct probe_req_whitelist_attr *ie_whitelist = &pno->ie_whitelist; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7468 | connected_nlo_rssi_params *nlo_relative_rssi; |
| 7469 | connected_nlo_bss_band_rssi_pref *nlo_band_rssi; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7470 | |
| 7471 | /* |
| 7472 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 7473 | * TLV place holder for array of uint32_t channel_list |
| 7474 | * TLV place holder for chnnl prediction cfg |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7475 | * TLV place holder for array of wmi_vendor_oui |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7476 | * TLV place holder for array of connected_nlo_bss_band_rssi_pref |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7477 | */ |
| 7478 | len = sizeof(*cmd) + |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7479 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7480 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7481 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7482 | len += sizeof(uint32_t) * QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7483 | WMI_NLO_MAX_CHAN); |
| 7484 | len += sizeof(nlo_configured_parameters) * |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7485 | QDF_MIN(pno->networks_cnt, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7486 | len += sizeof(nlo_channel_prediction_cfg); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7487 | len += sizeof(enlo_candidate_score_params); |
| 7488 | len += sizeof(wmi_vendor_oui) * ie_whitelist->num_vendor_oui; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7489 | len += sizeof(connected_nlo_rssi_params); |
| 7490 | len += sizeof(connected_nlo_bss_band_rssi_pref); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7491 | |
| 7492 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7493 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7494 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7495 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7496 | } |
| 7497 | |
| 7498 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 7499 | |
| 7500 | buf_ptr = (uint8_t *) cmd; |
| 7501 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7502 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 7503 | WMITLV_GET_STRUCT_TLVLEN |
| 7504 | (wmi_nlo_config_cmd_fixed_param)); |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7505 | cmd->vdev_id = pno->vdev_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7506 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 7507 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7508 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 7509 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7510 | pno->adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7511 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7512 | /* Current FW does not support min-max range for dwell time */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7513 | cmd->active_dwell_time = pno->active_dwell_time; |
| 7514 | cmd->passive_dwell_time = pno->passive_dwell_time; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7515 | |
| 7516 | /* Copy scan interval */ |
| 7517 | cmd->fast_scan_period = pno->fast_scan_period; |
| 7518 | cmd->slow_scan_period = pno->slow_scan_period; |
Arif Hussain | 17ff203 | 2017-03-02 11:56:04 -0800 | [diff] [blame] | 7519 | cmd->delay_start_time = WMI_SEC_TO_MSEC(pno->delay_start_time); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7520 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Dustin Brown | 9d86564 | 2017-04-24 10:47:42 -0700 | [diff] [blame] | 7521 | cmd->scan_backoff_multiplier = pno->scan_backoff_multiplier; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7522 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7523 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7524 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7525 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 7526 | /* mac randomization attributes */ |
| 7527 | if (pno->scan_random.randomize) { |
| 7528 | cmd->flags |= WMI_NLO_CONFIG_SPOOFED_MAC_IN_PROBE_REQ | |
| 7529 | WMI_NLO_CONFIG_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 7530 | wmi_copy_scan_random_mac(pno->scan_random.mac_addr, |
| 7531 | pno->scan_random.mac_mask, |
| 7532 | &cmd->mac_addr, |
| 7533 | &cmd->mac_mask); |
| 7534 | } |
| 7535 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7536 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 7537 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7538 | 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] | 7539 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7540 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7541 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 7542 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7543 | |
| 7544 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 7545 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 7546 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 7547 | WMITLV_TAG_ARRAY_BYTE, |
| 7548 | WMITLV_GET_STRUCT_TLVLEN |
| 7549 | (nlo_configured_parameters)); |
| 7550 | /* Copy ssid and it's length */ |
| 7551 | nlo_list[i].ssid.valid = true; |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7552 | nlo_list[i].ssid.ssid.ssid_len = |
| 7553 | pno->networks_list[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7554 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7555 | pno->networks_list[i].ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7556 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7557 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7558 | nlo_list[i].ssid.ssid.ssid_len, |
| 7559 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 7560 | nlo_list[i].ssid.ssid.ssid_len); |
| 7561 | |
| 7562 | /* Copy rssi threshold */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7563 | if (pno->networks_list[i].rssi_thresh && |
| 7564 | pno->networks_list[i].rssi_thresh > |
| 7565 | WMI_RSSI_THOLD_DEFAULT) { |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7566 | nlo_list[i].rssi_cond.valid = true; |
| 7567 | nlo_list[i].rssi_cond.rssi = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7568 | pno->networks_list[i].rssi_thresh; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7569 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7570 | nlo_list[i].rssi_cond.rssi); |
| 7571 | } |
| 7572 | nlo_list[i].bcast_nw_type.valid = true; |
| 7573 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7574 | pno->networks_list[i].bc_new_type; |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 7575 | WMI_LOGD("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7576 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 7577 | } |
| 7578 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 7579 | |
| 7580 | /* Copy channel info */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7581 | cmd->num_of_channels = QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7582 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7583 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7584 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7585 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 7586 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7587 | |
| 7588 | channel_list = (uint32_t *) buf_ptr; |
| 7589 | for (i = 0; i < cmd->num_of_channels; i++) { |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7590 | channel_list[i] = pno->networks_list[0].channels[i]; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7591 | |
| 7592 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7593 | channel_list[i] = |
| 7594 | wlan_chan_to_freq(pno-> |
| 7595 | networks_list[0].channels[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7596 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7597 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7598 | } |
| 7599 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 7600 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7601 | sizeof(nlo_channel_prediction_cfg)); |
| 7602 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7603 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7604 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7605 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 7606 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 7607 | */ |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7608 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 7609 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 7610 | buf_ptr += sizeof(enlo_candidate_score_params); |
| 7611 | |
| 7612 | if (ie_whitelist->white_list) { |
| 7613 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 7614 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 7615 | &cmd->num_vendor_oui, |
| 7616 | ie_whitelist); |
| 7617 | } |
| 7618 | |
| 7619 | /* ie white list */ |
| 7620 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7621 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 7622 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7623 | if (cmd->num_vendor_oui != 0) { |
| 7624 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 7625 | ie_whitelist->voui); |
| 7626 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 7627 | } |
| 7628 | |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7629 | if (pno->relative_rssi_set) |
| 7630 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_CNLO_RSSI_CONFIG; |
| 7631 | |
| 7632 | /* |
| 7633 | * Firmware calculation using connected PNO params: |
| 7634 | * New AP's RSSI >= (Connected AP's RSSI + relative_rssi +/- rssi_pref) |
| 7635 | * deduction of rssi_pref for chosen band_pref and |
| 7636 | * addition of rssi_pref for remaining bands (other than chosen band). |
| 7637 | */ |
| 7638 | nlo_relative_rssi = (connected_nlo_rssi_params *) buf_ptr; |
| 7639 | WMITLV_SET_HDR(&nlo_relative_rssi->tlv_header, |
| 7640 | WMITLV_TAG_STRUC_wmi_connected_nlo_rssi_params, |
| 7641 | WMITLV_GET_STRUCT_TLVLEN(connected_nlo_rssi_params)); |
| 7642 | nlo_relative_rssi->relative_rssi = pno->relative_rssi; |
| 7643 | WMI_LOGD("relative_rssi %d", nlo_relative_rssi->relative_rssi); |
| 7644 | buf_ptr += sizeof(*nlo_relative_rssi); |
| 7645 | |
| 7646 | /* |
| 7647 | * As of now Kernel and Host supports one band and rssi preference. |
| 7648 | * Firmware supports array of band and rssi preferences |
| 7649 | */ |
| 7650 | cmd->num_cnlo_band_pref = 1; |
| 7651 | WMITLV_SET_HDR(buf_ptr, |
| 7652 | WMITLV_TAG_ARRAY_STRUC, |
| 7653 | cmd->num_cnlo_band_pref * |
| 7654 | sizeof(connected_nlo_bss_band_rssi_pref)); |
| 7655 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7656 | |
| 7657 | nlo_band_rssi = (connected_nlo_bss_band_rssi_pref *) buf_ptr; |
| 7658 | for (i = 0; i < cmd->num_cnlo_band_pref; i++) { |
| 7659 | WMITLV_SET_HDR(&nlo_band_rssi[i].tlv_header, |
| 7660 | WMITLV_TAG_STRUC_wmi_connected_nlo_bss_band_rssi_pref, |
| 7661 | WMITLV_GET_STRUCT_TLVLEN( |
| 7662 | connected_nlo_bss_band_rssi_pref)); |
| 7663 | nlo_band_rssi[i].band = pno->band_rssi_pref.band; |
| 7664 | nlo_band_rssi[i].rssi_pref = pno->band_rssi_pref.rssi; |
| 7665 | WMI_LOGI("band_pref %d, rssi_pref %d", |
| 7666 | nlo_band_rssi[i].band, |
| 7667 | nlo_band_rssi[i].rssi_pref); |
| 7668 | } |
| 7669 | buf_ptr += cmd->num_cnlo_band_pref * sizeof(*nlo_band_rssi); |
| 7670 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7671 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7672 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 7673 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7674 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7675 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7676 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7677 | } |
| 7678 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7679 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7680 | } |
| 7681 | |
| 7682 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 7683 | * @wmi_handle: wmi handle |
| 7684 | * @msg: message |
| 7685 | * @is_add_ts: is addts required |
| 7686 | * |
| 7687 | * This function sets ric request element for 11r roaming. |
| 7688 | * |
| 7689 | * Return: CDF status |
| 7690 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7691 | 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] | 7692 | void *msg, uint8_t is_add_ts) |
| 7693 | { |
| 7694 | wmi_ric_request_fixed_param *cmd; |
| 7695 | wmi_ric_tspec *tspec_param; |
| 7696 | wmi_buf_t buf; |
| 7697 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7698 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7699 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 7700 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 7701 | |
| 7702 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7703 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7704 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 7705 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7706 | } |
| 7707 | |
| 7708 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7709 | |
| 7710 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 7711 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7712 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 7713 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 7714 | if (is_add_ts) |
Deepak Dhamdhere | 990df85 | 2017-04-24 16:17:48 -0700 | [diff] [blame] | 7715 | cmd->vdev_id = ((struct add_ts_param *) msg)->sme_session_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7716 | else |
| 7717 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 7718 | cmd->num_ric_request = 1; |
| 7719 | cmd->is_add_ric = is_add_ts; |
| 7720 | |
| 7721 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 7722 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 7723 | |
| 7724 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7725 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 7726 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 7727 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 7728 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 7729 | |
| 7730 | if (is_add_ts) |
| 7731 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7732 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7733 | else |
| 7734 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7735 | #endif |
| 7736 | if (ptspecIE) { |
| 7737 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7738 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7739 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 7740 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7741 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7742 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 7743 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7744 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 7745 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7746 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 7747 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 7748 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 7749 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 7750 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 7751 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 7752 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 7753 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 7754 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 7755 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 7756 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 7757 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 7758 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 7759 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 7760 | tspec_param->medium_time = 0; |
| 7761 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7762 | 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] | 7763 | |
| 7764 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7765 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7766 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7767 | __func__); |
| 7768 | if (is_add_ts) |
| 7769 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7770 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7771 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7772 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7773 | } |
| 7774 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7775 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7776 | } |
| 7777 | |
| 7778 | /** |
| 7779 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 7780 | * @wmi_handle: wmi handle |
| 7781 | * @clear_req: ll stats clear request command params |
| 7782 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7783 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7784 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7785 | 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] | 7786 | const struct ll_stats_clear_params *clear_req, |
| 7787 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7788 | { |
| 7789 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 7790 | int32_t len; |
| 7791 | wmi_buf_t buf; |
| 7792 | uint8_t *buf_ptr; |
| 7793 | int ret; |
| 7794 | |
| 7795 | len = sizeof(*cmd); |
| 7796 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7797 | |
| 7798 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7799 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7800 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7801 | } |
| 7802 | |
| 7803 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7804 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7805 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 7806 | |
| 7807 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7808 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 7809 | WMITLV_GET_STRUCT_TLVLEN |
| 7810 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 7811 | |
| 7812 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 7813 | cmd->vdev_id = clear_req->sta_id; |
| 7814 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 7815 | |
| 7816 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7817 | &cmd->peer_macaddr); |
| 7818 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7819 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 7820 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 7821 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 7822 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 7823 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7824 | cmd->peer_macaddr); */ |
| 7825 | |
| 7826 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7827 | WMI_CLEAR_LINK_STATS_CMDID); |
| 7828 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7829 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7830 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7831 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7832 | } |
| 7833 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7834 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 7835 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7836 | } |
| 7837 | |
| 7838 | /** |
| 7839 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 7840 | * @wmi_handle: wmi handle |
| 7841 | * @setReq: ll stats set request command params |
| 7842 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7843 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7844 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7845 | 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] | 7846 | const struct ll_stats_set_params *set_req) |
| 7847 | { |
| 7848 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 7849 | int32_t len; |
| 7850 | wmi_buf_t buf; |
| 7851 | uint8_t *buf_ptr; |
| 7852 | int ret; |
| 7853 | |
| 7854 | len = sizeof(*cmd); |
| 7855 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7856 | |
| 7857 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7858 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7859 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7860 | } |
| 7861 | |
| 7862 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7863 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7864 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 7865 | |
| 7866 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7867 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 7868 | WMITLV_GET_STRUCT_TLVLEN |
| 7869 | (wmi_start_link_stats_cmd_fixed_param)); |
| 7870 | |
| 7871 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 7872 | cmd->aggressive_statistics_gathering = |
| 7873 | set_req->aggressive_statistics_gathering; |
| 7874 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7875 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 7876 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 7877 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7878 | |
| 7879 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7880 | WMI_START_LINK_STATS_CMDID); |
| 7881 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7882 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7883 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7884 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7885 | } |
| 7886 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7887 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7888 | } |
| 7889 | |
| 7890 | /** |
| 7891 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 7892 | * @wmi_handle:wmi handle |
| 7893 | * @get_req:ll stats get request command params |
| 7894 | * @addr: mac address |
| 7895 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7896 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7897 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7898 | 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] | 7899 | const struct ll_stats_get_params *get_req, |
| 7900 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7901 | { |
| 7902 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 7903 | int32_t len; |
| 7904 | wmi_buf_t buf; |
| 7905 | uint8_t *buf_ptr; |
| 7906 | int ret; |
| 7907 | |
| 7908 | len = sizeof(*cmd); |
| 7909 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7910 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 7911 | if (!buf) { |
| 7912 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 7913 | return QDF_STATUS_E_NOMEM; |
| 7914 | } |
| 7915 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7916 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7917 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7918 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 7919 | |
| 7920 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7921 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 7922 | WMITLV_GET_STRUCT_TLVLEN |
| 7923 | (wmi_request_link_stats_cmd_fixed_param)); |
| 7924 | |
| 7925 | cmd->request_id = get_req->req_id; |
| 7926 | cmd->stats_type = get_req->param_id_mask; |
| 7927 | cmd->vdev_id = get_req->sta_id; |
| 7928 | |
| 7929 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7930 | &cmd->peer_macaddr); |
| 7931 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7932 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
Krishna Kumaar Natarajan | f6a996c | 2017-03-10 17:24:55 -0800 | [diff] [blame] | 7933 | WMI_LOGD("Request ID : %u", cmd->request_id); |
| 7934 | WMI_LOGD("Stats Type : %0x", cmd->stats_type); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7935 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 7936 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7937 | |
| 7938 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7939 | WMI_REQUEST_LINK_STATS_CMDID); |
| 7940 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7941 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7942 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7943 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7944 | } |
| 7945 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7946 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7947 | } |
| 7948 | |
| 7949 | /** |
| 7950 | * send_get_stats_cmd_tlv() - get stats request |
| 7951 | * @wmi_handle: wmi handle |
| 7952 | * @get_stats_param: stats params |
| 7953 | * @addr: mac address |
| 7954 | * |
| 7955 | * Return: CDF status |
| 7956 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7957 | static QDF_STATUS send_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7958 | struct pe_stats_req *get_stats_param, |
| 7959 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7960 | { |
| 7961 | wmi_buf_t buf; |
| 7962 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7963 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7964 | |
| 7965 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7966 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7967 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 7968 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7969 | } |
| 7970 | |
| 7971 | |
| 7972 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7973 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7974 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7975 | WMITLV_GET_STRUCT_TLVLEN |
| 7976 | (wmi_request_stats_cmd_fixed_param)); |
Gurumoorthi Gnanasambandhan | 4aec367 | 2017-07-10 11:55:23 +0530 | [diff] [blame] | 7977 | cmd->stats_id = get_stats_param->stats_mask; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7978 | cmd->vdev_id = get_stats_param->session_id; |
| 7979 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7980 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7981 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7982 | WMI_REQUEST_STATS_CMDID)) { |
| 7983 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7984 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7985 | __func__); |
| 7986 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7987 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7988 | } |
| 7989 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7990 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7991 | |
| 7992 | } |
| 7993 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7994 | /** |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 7995 | * send_congestion_cmd_tlv() - send request to fw to get CCA |
| 7996 | * @wmi_handle: wmi handle |
| 7997 | * @vdev_id: vdev id |
| 7998 | * |
| 7999 | * Return: CDF status |
| 8000 | */ |
| 8001 | static QDF_STATUS send_congestion_cmd_tlv(wmi_unified_t wmi_handle, |
| 8002 | A_UINT8 vdev_id) |
| 8003 | { |
| 8004 | wmi_buf_t buf; |
| 8005 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8006 | uint8_t len; |
| 8007 | uint8_t *buf_ptr; |
| 8008 | |
| 8009 | len = sizeof(*cmd); |
| 8010 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8011 | if (!buf) { |
| 8012 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 8013 | return QDF_STATUS_E_FAILURE; |
| 8014 | } |
| 8015 | |
| 8016 | buf_ptr = wmi_buf_data(buf); |
| 8017 | cmd = (wmi_request_stats_cmd_fixed_param *)buf_ptr; |
| 8018 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8019 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8020 | WMITLV_GET_STRUCT_TLVLEN |
| 8021 | (wmi_request_stats_cmd_fixed_param)); |
| 8022 | |
| 8023 | cmd->stats_id = WMI_REQUEST_CONGESTION_STAT; |
| 8024 | cmd->vdev_id = vdev_id; |
| 8025 | WMI_LOGD("STATS REQ VDEV_ID:%d stats_id %d -->", |
| 8026 | cmd->vdev_id, cmd->stats_id); |
| 8027 | |
| 8028 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8029 | WMI_REQUEST_STATS_CMDID)) { |
| 8030 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
| 8031 | __func__); |
| 8032 | wmi_buf_free(buf); |
| 8033 | return QDF_STATUS_E_FAILURE; |
| 8034 | } |
| 8035 | |
| 8036 | return QDF_STATUS_SUCCESS; |
| 8037 | } |
| 8038 | |
| 8039 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8040 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 8041 | * @wmi_handle: wmi handle |
| 8042 | * @rssi_req: get RSSI request |
| 8043 | * |
| 8044 | * Return: CDF status |
| 8045 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8046 | 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] | 8047 | { |
| 8048 | wmi_buf_t buf; |
| 8049 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8050 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8051 | |
| 8052 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8053 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8054 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8055 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8056 | } |
| 8057 | |
| 8058 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8059 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8060 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8061 | WMITLV_GET_STRUCT_TLVLEN |
| 8062 | (wmi_request_stats_cmd_fixed_param)); |
| 8063 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 8064 | if (wmi_unified_cmd_send |
| 8065 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8066 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8067 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8068 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8069 | } |
| 8070 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8071 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8072 | } |
| 8073 | |
| 8074 | /** |
| 8075 | * send_snr_cmd_tlv() - get RSSI from fw |
| 8076 | * @wmi_handle: wmi handle |
| 8077 | * @vdev_id: vdev id |
| 8078 | * |
| 8079 | * Return: CDF status |
| 8080 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8081 | 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] | 8082 | { |
| 8083 | wmi_buf_t buf; |
| 8084 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8085 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8086 | |
| 8087 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8088 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8089 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8090 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8091 | } |
| 8092 | |
| 8093 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8094 | cmd->vdev_id = vdev_id; |
| 8095 | |
| 8096 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8097 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8098 | WMITLV_GET_STRUCT_TLVLEN |
| 8099 | (wmi_request_stats_cmd_fixed_param)); |
| 8100 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 8101 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8102 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8103 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8104 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8105 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8106 | } |
| 8107 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8108 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8109 | } |
| 8110 | |
| 8111 | /** |
| 8112 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 8113 | * @wmi_handle: wmi handle |
| 8114 | * @link_status: get link params |
| 8115 | * |
| 8116 | * Return: CDF status |
| 8117 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8118 | 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] | 8119 | struct link_status_params *link_status) |
| 8120 | { |
| 8121 | wmi_buf_t buf; |
| 8122 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8123 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8124 | |
| 8125 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8126 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8127 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8128 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8129 | } |
| 8130 | |
| 8131 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8132 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8133 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8134 | WMITLV_GET_STRUCT_TLVLEN |
| 8135 | (wmi_request_stats_cmd_fixed_param)); |
| 8136 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 8137 | cmd->vdev_id = link_status->session_id; |
| 8138 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8139 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8140 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8141 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8142 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8143 | } |
| 8144 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8145 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8146 | } |
| 8147 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8148 | /** |
| 8149 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 8150 | * @wmi_handle: wmi handle |
| 8151 | * @ta_dhcp_ind: DHCP indication parameter |
| 8152 | * |
| 8153 | * Return: CDF Status |
| 8154 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8155 | 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] | 8156 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 8157 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8158 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8159 | wmi_buf_t buf = NULL; |
| 8160 | uint8_t *buf_ptr; |
| 8161 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 8162 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 8163 | |
| 8164 | |
| 8165 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8166 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8167 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8168 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8169 | } |
| 8170 | |
| 8171 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8172 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 8173 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 8174 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 8175 | WMITLV_GET_STRUCT_TLVLEN |
| 8176 | (wmi_peer_set_param_cmd_fixed_param)); |
| 8177 | |
| 8178 | /* fill in values */ |
| 8179 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 8180 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 8181 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8182 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8183 | &ta_dhcp_ind->peer_macaddr, |
| 8184 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 8185 | |
| 8186 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8187 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 8188 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8189 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8190 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 8191 | wmi_buf_free(buf); |
| 8192 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8193 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8194 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8195 | } |
| 8196 | |
| 8197 | /** |
| 8198 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 8199 | * @wmi_handle: wmi handle |
| 8200 | * @pLinkSpeed: link speed info |
| 8201 | * |
| 8202 | * Return: CDF status |
| 8203 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8204 | 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] | 8205 | wmi_mac_addr peer_macaddr) |
| 8206 | { |
| 8207 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 8208 | wmi_buf_t wmi_buf; |
| 8209 | uint32_t len; |
| 8210 | uint8_t *buf_ptr; |
| 8211 | |
| 8212 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 8213 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8214 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8215 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8216 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8217 | } |
| 8218 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8219 | |
| 8220 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 8221 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8222 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 8223 | WMITLV_GET_STRUCT_TLVLEN |
| 8224 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 8225 | |
| 8226 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8227 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8228 | &peer_macaddr, |
| 8229 | sizeof(peer_macaddr)); |
| 8230 | |
| 8231 | |
| 8232 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8233 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8234 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8235 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8236 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8237 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8238 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8239 | } |
| 8240 | |
| 8241 | /** |
| 8242 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 8243 | * @wmi_handle: wmi handler |
| 8244 | * @egap_params: pointer to egap_params |
| 8245 | * |
| 8246 | * Return: 0 for success, otherwise appropriate error code |
| 8247 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8248 | static QDF_STATUS send_egap_conf_params_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8249 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 8250 | { |
| 8251 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 8252 | wmi_buf_t buf; |
| 8253 | int32_t err; |
| 8254 | |
| 8255 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8256 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8257 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 8258 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8259 | } |
| 8260 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 8261 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8262 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 8263 | WMITLV_GET_STRUCT_TLVLEN( |
| 8264 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 8265 | |
| 8266 | cmd->enable = egap_params->enable; |
| 8267 | cmd->inactivity_time = egap_params->inactivity_time; |
| 8268 | cmd->wait_time = egap_params->wait_time; |
| 8269 | cmd->flags = egap_params->flags; |
| 8270 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 8271 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 8272 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8273 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8274 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8275 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8276 | } |
| 8277 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8278 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8279 | } |
| 8280 | |
| 8281 | /** |
| 8282 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 8283 | * @wmi_handl: wmi handle |
| 8284 | * @cmd: Profiling command index |
| 8285 | * @value1: parameter1 value |
| 8286 | * @value2: parameter2 value |
| 8287 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8288 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8289 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8290 | 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] | 8291 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 8292 | { |
| 8293 | wmi_buf_t buf; |
| 8294 | int32_t len = 0; |
| 8295 | int ret; |
| 8296 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 8297 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 8298 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 8299 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 8300 | |
| 8301 | switch (cmd) { |
| 8302 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 8303 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 8304 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8305 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8306 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8307 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8308 | } |
| 8309 | prof_trig_cmd = |
| 8310 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 8311 | wmi_buf_data(buf); |
| 8312 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 8313 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 8314 | WMITLV_GET_STRUCT_TLVLEN |
| 8315 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 8316 | prof_trig_cmd->enable = value1; |
| 8317 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8318 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 8319 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8320 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8321 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8322 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8323 | return ret; |
| 8324 | } |
| 8325 | break; |
| 8326 | |
| 8327 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 8328 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 8329 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8330 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8331 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8332 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8333 | } |
| 8334 | profile_getdata_cmd = |
| 8335 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 8336 | wmi_buf_data(buf); |
| 8337 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 8338 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 8339 | WMITLV_GET_STRUCT_TLVLEN |
| 8340 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 8341 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8342 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 8343 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8344 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8345 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8346 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8347 | return ret; |
| 8348 | } |
| 8349 | break; |
| 8350 | |
| 8351 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 8352 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 8353 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8354 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8355 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8356 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8357 | } |
| 8358 | hist_intvl_cmd = |
| 8359 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 8360 | wmi_buf_data(buf); |
| 8361 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 8362 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 8363 | WMITLV_GET_STRUCT_TLVLEN |
| 8364 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 8365 | hist_intvl_cmd->profile_id = value1; |
| 8366 | hist_intvl_cmd->value = value2; |
| 8367 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8368 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 8369 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8370 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8371 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8372 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8373 | return ret; |
| 8374 | } |
| 8375 | break; |
| 8376 | |
| 8377 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 8378 | len = |
| 8379 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 8380 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8381 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8382 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8383 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8384 | } |
| 8385 | profile_enable_cmd = |
| 8386 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 8387 | wmi_buf_data(buf); |
| 8388 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 8389 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 8390 | WMITLV_GET_STRUCT_TLVLEN |
| 8391 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 8392 | profile_enable_cmd->profile_id = value1; |
| 8393 | profile_enable_cmd->enable = value2; |
| 8394 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8395 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 8396 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8397 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8398 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8399 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8400 | return ret; |
| 8401 | } |
| 8402 | break; |
| 8403 | |
| 8404 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8405 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8406 | break; |
| 8407 | } |
| 8408 | |
| 8409 | return 0; |
| 8410 | } |
| 8411 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8412 | /** |
| 8413 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 8414 | * @wmi_handle: wmi handle |
| 8415 | * @vdev_id: vdev id |
| 8416 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8417 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8418 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8419 | 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] | 8420 | { |
| 8421 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 8422 | wmi_buf_t buf; |
| 8423 | int32_t len = sizeof(*cmd); |
| 8424 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8425 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8426 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8427 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8428 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8429 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8430 | } |
| 8431 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 8432 | wmi_buf_data(buf); |
| 8433 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8434 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 8435 | WMITLV_GET_STRUCT_TLVLEN |
| 8436 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 8437 | cmd->vdev_id = vdev_id; |
| 8438 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 8439 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8440 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8441 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8442 | __func__); |
| 8443 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8444 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8445 | } |
| 8446 | |
| 8447 | return 0; |
| 8448 | } |
| 8449 | |
| 8450 | /** |
| 8451 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 8452 | * @wmi_handle: wmi handle |
| 8453 | * @vdev_id: vdev id |
| 8454 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8455 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8456 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8457 | 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] | 8458 | uint8_t vdev_id) |
| 8459 | { |
| 8460 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 8461 | wmi_buf_t buf; |
| 8462 | int32_t len = sizeof(*cmd); |
| 8463 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8464 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8465 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8466 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8467 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8468 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8469 | } |
| 8470 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8471 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8472 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 8473 | WMITLV_GET_STRUCT_TLVLEN |
| 8474 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 8475 | cmd->vdev_id = vdev_id; |
| 8476 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 8477 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8478 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8479 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8480 | __func__); |
| 8481 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8482 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8483 | } |
| 8484 | |
| 8485 | return 0; |
| 8486 | } |
| 8487 | |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 8488 | #ifdef WLAN_FEATURE_CIF_CFR |
| 8489 | /** |
| 8490 | * send_oem_dma_cfg_cmd_tlv() - configure OEM DMA rings |
| 8491 | * @wmi_handle: wmi handle |
| 8492 | * @data_len: len of dma cfg req |
| 8493 | * @data: dma cfg req |
| 8494 | * |
| 8495 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure |
| 8496 | */ |
| 8497 | static QDF_STATUS send_oem_dma_cfg_cmd_tlv(wmi_unified_t wmi_handle, |
| 8498 | wmi_oem_dma_ring_cfg_req_fixed_param *cfg) |
| 8499 | { |
| 8500 | wmi_buf_t buf; |
| 8501 | uint8_t *cmd; |
| 8502 | QDF_STATUS ret; |
| 8503 | |
| 8504 | WMITLV_SET_HDR(cfg, |
| 8505 | WMITLV_TAG_STRUC_wmi_oem_dma_ring_cfg_req_fixed_param, |
| 8506 | (sizeof(*cfg) - WMI_TLV_HDR_SIZE)); |
| 8507 | |
| 8508 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cfg)); |
| 8509 | if (!buf) { |
| 8510 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 8511 | return QDF_STATUS_E_FAILURE; |
| 8512 | } |
| 8513 | |
| 8514 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 8515 | qdf_mem_copy(cmd, cfg, sizeof(*cfg)); |
| 8516 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %lu"), |
| 8517 | sizeof(*cfg)); |
| 8518 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cfg), |
| 8519 | WMI_OEM_DMA_RING_CFG_REQ_CMDID); |
| 8520 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 8521 | WMI_LOGE(FL(":wmi cmd send failed")); |
| 8522 | wmi_buf_free(buf); |
| 8523 | } |
| 8524 | |
| 8525 | return ret; |
| 8526 | } |
| 8527 | #endif |
| 8528 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8529 | /** |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 8530 | * send_start_11d_scan_cmd_tlv() - start 11d scan request |
| 8531 | * @wmi_handle: wmi handle |
| 8532 | * @start_11d_scan: 11d scan start request parameters |
| 8533 | * |
| 8534 | * This function request FW to start 11d scan. |
| 8535 | * |
| 8536 | * Return: QDF status |
| 8537 | */ |
| 8538 | static QDF_STATUS send_start_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 8539 | struct reg_start_11d_scan_req *start_11d_scan) |
| 8540 | { |
| 8541 | wmi_11d_scan_start_cmd_fixed_param *cmd; |
| 8542 | int32_t len; |
| 8543 | wmi_buf_t buf; |
| 8544 | int ret; |
| 8545 | |
| 8546 | len = sizeof(*cmd); |
| 8547 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8548 | if (!buf) { |
| 8549 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8550 | return QDF_STATUS_E_NOMEM; |
| 8551 | } |
| 8552 | |
| 8553 | cmd = (wmi_11d_scan_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 8554 | |
| 8555 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8556 | WMITLV_TAG_STRUC_wmi_11d_scan_start_cmd_fixed_param, |
| 8557 | WMITLV_GET_STRUCT_TLVLEN |
| 8558 | (wmi_11d_scan_start_cmd_fixed_param)); |
| 8559 | |
| 8560 | cmd->vdev_id = start_11d_scan->vdev_id; |
| 8561 | cmd->scan_period_msec = start_11d_scan->scan_period_msec; |
| 8562 | cmd->start_interval_msec = start_11d_scan->start_interval_msec; |
| 8563 | |
| 8564 | WMI_LOGD("vdev %d sending 11D scan start req", cmd->vdev_id); |
| 8565 | |
| 8566 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8567 | WMI_11D_SCAN_START_CMDID); |
| 8568 | if (ret) { |
| 8569 | WMI_LOGE("%s: Failed to send start 11d scan wmi cmd", __func__); |
| 8570 | wmi_buf_free(buf); |
| 8571 | return QDF_STATUS_E_FAILURE; |
| 8572 | } |
| 8573 | |
| 8574 | return QDF_STATUS_SUCCESS; |
| 8575 | } |
| 8576 | |
| 8577 | /** |
| 8578 | * send_stop_11d_scan_cmd_tlv() - stop 11d scan request |
| 8579 | * @wmi_handle: wmi handle |
| 8580 | * @start_11d_scan: 11d scan stop request parameters |
| 8581 | * |
| 8582 | * This function request FW to stop 11d scan. |
| 8583 | * |
| 8584 | * Return: QDF status |
| 8585 | */ |
| 8586 | static QDF_STATUS send_stop_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 8587 | struct reg_stop_11d_scan_req *stop_11d_scan) |
| 8588 | { |
| 8589 | wmi_11d_scan_stop_cmd_fixed_param *cmd; |
| 8590 | int32_t len; |
| 8591 | wmi_buf_t buf; |
| 8592 | int ret; |
| 8593 | |
| 8594 | len = sizeof(*cmd); |
| 8595 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8596 | if (!buf) { |
| 8597 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8598 | return QDF_STATUS_E_NOMEM; |
| 8599 | } |
| 8600 | |
| 8601 | cmd = (wmi_11d_scan_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 8602 | |
| 8603 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8604 | WMITLV_TAG_STRUC_wmi_11d_scan_stop_cmd_fixed_param, |
| 8605 | WMITLV_GET_STRUCT_TLVLEN |
| 8606 | (wmi_11d_scan_stop_cmd_fixed_param)); |
| 8607 | |
| 8608 | cmd->vdev_id = stop_11d_scan->vdev_id; |
| 8609 | |
| 8610 | WMI_LOGD("vdev %d sending 11D scan stop req", cmd->vdev_id); |
| 8611 | |
| 8612 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8613 | WMI_11D_SCAN_STOP_CMDID); |
| 8614 | if (ret) { |
| 8615 | WMI_LOGE("%s: Failed to send stop 11d scan wmi cmd", __func__); |
| 8616 | wmi_buf_free(buf); |
| 8617 | return QDF_STATUS_E_FAILURE; |
| 8618 | } |
| 8619 | |
| 8620 | return QDF_STATUS_SUCCESS; |
| 8621 | } |
| 8622 | |
| 8623 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8624 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 8625 | * @wmi_handle: wmi handle |
| 8626 | * @startOemDataReq: start request params |
| 8627 | * |
| 8628 | * Return: CDF status |
| 8629 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8630 | 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] | 8631 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8632 | uint8_t *data) |
| 8633 | { |
| 8634 | wmi_buf_t buf; |
| 8635 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8636 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8637 | |
| 8638 | buf = wmi_buf_alloc(wmi_handle, |
| 8639 | (data_len + WMI_TLV_HDR_SIZE)); |
| 8640 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8641 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 8642 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8643 | } |
| 8644 | |
| 8645 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 8646 | |
| 8647 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 8648 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8649 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8650 | data_len); |
| 8651 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 8652 | WMI_LOGD(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8653 | data_len); |
| 8654 | |
| 8655 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 8656 | (data_len + |
| 8657 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 8658 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8659 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8660 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8661 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8662 | } |
| 8663 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8664 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8665 | } |
| 8666 | |
| 8667 | /** |
| 8668 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 8669 | * @wmi_handle: wmi handle |
| 8670 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 8671 | * |
| 8672 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 8673 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 8674 | * to firmware based on phyerr filtering |
| 8675 | * offload status. |
| 8676 | * |
| 8677 | * Return: 1 success, 0 failure |
| 8678 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8679 | static QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8680 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 8681 | bool dfs_phyerr_filter_offload) |
| 8682 | { |
| 8683 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 8684 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 8685 | wmi_buf_t buf; |
| 8686 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8687 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8688 | |
| 8689 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 8690 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8691 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8692 | __func__); |
| 8693 | len = sizeof(*disable_phyerr_offload_cmd); |
| 8694 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8695 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8696 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8697 | return 0; |
| 8698 | } |
| 8699 | disable_phyerr_offload_cmd = |
| 8700 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 8701 | wmi_buf_data(buf); |
| 8702 | |
| 8703 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 8704 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 8705 | WMITLV_GET_STRUCT_TLVLEN |
| 8706 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 8707 | |
| 8708 | /* |
| 8709 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 8710 | * to the firmware to disable the phyerror |
| 8711 | * filtering offload. |
| 8712 | */ |
| 8713 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8714 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8715 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8716 | 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] | 8717 | __func__, ret); |
| 8718 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8719 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8720 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8721 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8722 | __func__); |
| 8723 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8724 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8725 | __func__); |
| 8726 | |
| 8727 | len = sizeof(*enable_phyerr_offload_cmd); |
| 8728 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8729 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8730 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8731 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8732 | } |
| 8733 | |
| 8734 | enable_phyerr_offload_cmd = |
| 8735 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 8736 | wmi_buf_data(buf); |
| 8737 | |
| 8738 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 8739 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 8740 | WMITLV_GET_STRUCT_TLVLEN |
| 8741 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 8742 | |
| 8743 | /* |
| 8744 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 8745 | * to the firmware to enable the phyerror |
| 8746 | * filtering offload. |
| 8747 | */ |
| 8748 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8749 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 8750 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8751 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8752 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8753 | __func__, ret); |
| 8754 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8755 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8756 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8757 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8758 | __func__); |
| 8759 | } |
| 8760 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8761 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8762 | } |
| 8763 | |
| 8764 | #if !defined(REMOVE_PKT_LOG) |
| 8765 | /** |
| 8766 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 8767 | * @wmi_handle: wmi handle |
| 8768 | * @pktlog_event: pktlog event |
| 8769 | * @cmd_id: pktlog cmd id |
| 8770 | * |
| 8771 | * Return: CDF status |
| 8772 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8773 | 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] | 8774 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 8775 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8776 | { |
| 8777 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 8778 | WMI_CMD_ID CMD_ID; |
| 8779 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 8780 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 8781 | int len = 0; |
| 8782 | wmi_buf_t buf; |
| 8783 | |
| 8784 | PKTLOG_EVENT = pktlog_event; |
| 8785 | CMD_ID = cmd_id; |
| 8786 | |
| 8787 | switch (CMD_ID) { |
| 8788 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 8789 | len = sizeof(*cmd); |
| 8790 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8791 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8792 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8793 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8794 | } |
| 8795 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 8796 | wmi_buf_data(buf); |
| 8797 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8798 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 8799 | WMITLV_GET_STRUCT_TLVLEN |
| 8800 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 8801 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 8802 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 8803 | : WMI_PKTLOG_ENABLE_AUTO; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8804 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 8805 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8806 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8807 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8808 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8809 | goto wmi_send_failed; |
| 8810 | } |
| 8811 | break; |
| 8812 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 8813 | len = sizeof(*disable_cmd); |
| 8814 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8815 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8816 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8817 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8818 | } |
| 8819 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 8820 | wmi_buf_data(buf); |
| 8821 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 8822 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 8823 | WMITLV_GET_STRUCT_TLVLEN |
| 8824 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8825 | disable_cmd->pdev_id = |
| 8826 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 8827 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8828 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8829 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8830 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8831 | goto wmi_send_failed; |
| 8832 | } |
| 8833 | break; |
| 8834 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8835 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8836 | break; |
| 8837 | } |
| 8838 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8839 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8840 | |
| 8841 | wmi_send_failed: |
| 8842 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8843 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8844 | } |
| 8845 | #endif /* REMOVE_PKT_LOG */ |
| 8846 | |
| 8847 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8848 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 8849 | * @wmi_handle: wmi handle |
| 8850 | * @ptrn_id: pattern id |
| 8851 | * @vdev_id: vdev id |
| 8852 | * |
| 8853 | * Return: CDF status |
| 8854 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 8855 | static QDF_STATUS send_wow_delete_pattern_cmd_tlv(wmi_unified_t wmi_handle, |
| 8856 | uint8_t ptrn_id, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8857 | { |
| 8858 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 8859 | wmi_buf_t buf; |
| 8860 | int32_t len; |
| 8861 | int ret; |
| 8862 | |
| 8863 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 8864 | |
| 8865 | |
| 8866 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8867 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8868 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8869 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8870 | } |
| 8871 | |
| 8872 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 8873 | |
| 8874 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8875 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 8876 | WMITLV_GET_STRUCT_TLVLEN( |
| 8877 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 8878 | cmd->vdev_id = vdev_id; |
| 8879 | cmd->pattern_id = ptrn_id; |
| 8880 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 8881 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8882 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8883 | cmd->pattern_id, vdev_id); |
| 8884 | |
| 8885 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8886 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 8887 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8888 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8889 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8890 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8891 | } |
| 8892 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8893 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8894 | } |
| 8895 | |
| 8896 | /** |
| 8897 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 8898 | * @wmi_handle: wmi handle |
| 8899 | * |
| 8900 | * Sends host wakeup indication to FW. On receiving this indication, |
| 8901 | * FW will come out of WOW. |
| 8902 | * |
| 8903 | * Return: CDF status |
| 8904 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8905 | 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] | 8906 | { |
| 8907 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 8908 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8909 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8910 | int32_t len; |
| 8911 | int ret; |
| 8912 | |
| 8913 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 8914 | |
| 8915 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8916 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8917 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8918 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8919 | } |
| 8920 | |
| 8921 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 8922 | wmi_buf_data(buf); |
| 8923 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8924 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 8925 | WMITLV_GET_STRUCT_TLVLEN |
| 8926 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 8927 | |
| 8928 | |
| 8929 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8930 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 8931 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8932 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8933 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8934 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8935 | } |
| 8936 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8937 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8938 | } |
| 8939 | |
| 8940 | /** |
| 8941 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8942 | * @wmi_handle: wmi handle |
| 8943 | * @msg: delts params |
| 8944 | * |
| 8945 | * Return: CDF status |
| 8946 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8947 | 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] | 8948 | uint8_t ac) |
| 8949 | { |
| 8950 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8951 | wmi_buf_t buf; |
| 8952 | int32_t len = sizeof(*cmd); |
| 8953 | |
| 8954 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8955 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8956 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8957 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8958 | } |
| 8959 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8960 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8961 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8962 | WMITLV_GET_STRUCT_TLVLEN |
| 8963 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8964 | cmd->vdev_id = vdev_id; |
| 8965 | cmd->ac = ac; |
| 8966 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8967 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8968 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8969 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8970 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8971 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8972 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8973 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8974 | } |
| 8975 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8976 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8977 | } |
| 8978 | |
| 8979 | /** |
| 8980 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8981 | * @wmi_handle: handle to wmi |
| 8982 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8983 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8984 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8985 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8986 | * active flow. |
| 8987 | * |
| 8988 | * Return: CDF status |
| 8989 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8990 | 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] | 8991 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8992 | { |
| 8993 | int i = 0; |
| 8994 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8995 | wmi_buf_t buf; |
| 8996 | int32_t len = sizeof(*cmd); |
| 8997 | |
| 8998 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 8999 | /* if flow in this AC is active */ |
| 9000 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 9001 | /* |
| 9002 | * as per implementation of wma_add_ts_req() we |
| 9003 | * are not waiting any response from firmware so |
| 9004 | * apart from sending ADDTS to firmware just send |
| 9005 | * success to upper layers |
| 9006 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9007 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9008 | |
| 9009 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9010 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9011 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9012 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9013 | } |
| 9014 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 9015 | wmi_buf_data(buf); |
| 9016 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9017 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 9018 | WMITLV_GET_STRUCT_TLVLEN |
| 9019 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 9020 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 9021 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9022 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9023 | traffic.userPrio); |
| 9024 | cmd->medium_time_us = |
| 9025 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 9026 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9027 | 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] | 9028 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 9029 | cmd->medium_time_us, cmd->downgrade_type); |
| 9030 | if (wmi_unified_cmd_send |
| 9031 | (wmi_handle, buf, len, |
| 9032 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9033 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9034 | __func__); |
| 9035 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9036 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9037 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9038 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9039 | } |
| 9040 | } |
| 9041 | } |
| 9042 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9043 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9044 | } |
| 9045 | |
| 9046 | /** |
| 9047 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 9048 | * @wmi_handle: wmi handle |
| 9049 | * @msg: ADDTS params |
| 9050 | * |
| 9051 | * Return: CDF status |
| 9052 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9053 | 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] | 9054 | struct add_ts_param *msg) |
| 9055 | { |
| 9056 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 9057 | wmi_buf_t buf; |
| 9058 | int32_t len = sizeof(*cmd); |
| 9059 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9060 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9061 | |
| 9062 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9063 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9064 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9065 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9066 | } |
| 9067 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 9068 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9069 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 9070 | WMITLV_GET_STRUCT_TLVLEN |
| 9071 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 9072 | cmd->vdev_id = msg->sme_session_id; |
| 9073 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 9074 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 9075 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9076 | 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] | 9077 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 9078 | cmd->downgrade_type, __func__, __LINE__); |
| 9079 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9080 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9081 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 9082 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9083 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9084 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9085 | } |
| 9086 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9087 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9088 | } |
| 9089 | |
| 9090 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9091 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 9092 | * @wmi_handle: wmi handle |
| 9093 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 9094 | * |
| 9095 | * Retrun: CDF status |
| 9096 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9097 | 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] | 9098 | struct periodic_tx_pattern * |
| 9099 | pAddPeriodicTxPtrnParams, |
| 9100 | uint8_t vdev_id) |
| 9101 | { |
| 9102 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 9103 | wmi_buf_t wmi_buf; |
| 9104 | uint32_t len; |
| 9105 | uint8_t *buf_ptr; |
| 9106 | uint32_t ptrn_len, ptrn_len_aligned; |
| 9107 | int j; |
| 9108 | |
| 9109 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 9110 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 9111 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 9112 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 9113 | |
| 9114 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9115 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9116 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9117 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9118 | } |
| 9119 | |
| 9120 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9121 | |
| 9122 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 9123 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9124 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 9125 | WMITLV_GET_STRUCT_TLVLEN |
| 9126 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 9127 | |
| 9128 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 9129 | cmd->vdev_id = vdev_id; |
| 9130 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 9131 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 9132 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 9133 | |
| 9134 | /* Pattern info */ |
| 9135 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 9136 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 9137 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9138 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9139 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9140 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9141 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9142 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9143 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 9144 | |
| 9145 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9146 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9147 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9148 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9149 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9150 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9151 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9152 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9153 | } |
| 9154 | |
| 9155 | /** |
| 9156 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 9157 | * @wmi_handle: wmi handle |
| 9158 | * @vdev_id: vdev id |
| 9159 | * @pattern_id: pattern id |
| 9160 | * |
| 9161 | * Retrun: CDF status |
| 9162 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9163 | 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] | 9164 | uint8_t vdev_id, |
| 9165 | uint8_t pattern_id) |
| 9166 | { |
| 9167 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 9168 | wmi_buf_t wmi_buf; |
| 9169 | uint32_t len = |
| 9170 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 9171 | |
| 9172 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9173 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9174 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9175 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9176 | } |
| 9177 | |
| 9178 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 9179 | wmi_buf_data(wmi_buf); |
| 9180 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9181 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 9182 | WMITLV_GET_STRUCT_TLVLEN |
| 9183 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 9184 | |
| 9185 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 9186 | cmd->vdev_id = vdev_id; |
| 9187 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9188 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9189 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 9190 | |
| 9191 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9192 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9193 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9194 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9195 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9196 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9197 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9198 | } |
| 9199 | |
| 9200 | /** |
| 9201 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 9202 | * @wmi_handle: wmi handle |
| 9203 | * @preq: stats ext params |
| 9204 | * |
| 9205 | * Return: CDF status |
| 9206 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9207 | 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] | 9208 | struct stats_ext_params *preq) |
| 9209 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9210 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9211 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 9212 | wmi_buf_t buf; |
| 9213 | uint16_t len; |
| 9214 | uint8_t *buf_ptr; |
| 9215 | |
| 9216 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 9217 | |
| 9218 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9219 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9220 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9221 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9222 | } |
| 9223 | |
| 9224 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9225 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 9226 | |
| 9227 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9228 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 9229 | WMITLV_GET_STRUCT_TLVLEN |
| 9230 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 9231 | cmd->vdev_id = preq->vdev_id; |
| 9232 | cmd->data_len = preq->request_data_len; |
| 9233 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9234 | 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] | 9235 | __func__, preq->request_data_len, preq->vdev_id); |
| 9236 | |
| 9237 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 9238 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 9239 | |
| 9240 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9241 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9242 | |
| 9243 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9244 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9245 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9246 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9247 | ret); |
| 9248 | wmi_buf_free(buf); |
| 9249 | } |
| 9250 | |
| 9251 | return ret; |
| 9252 | } |
| 9253 | |
| 9254 | /** |
| 9255 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 9256 | * @wmi_handle: wmi handle |
| 9257 | * @params: ext wow params |
| 9258 | * |
| 9259 | * Return:0 for success or error code |
| 9260 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9261 | 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] | 9262 | struct ext_wow_params *params) |
| 9263 | { |
| 9264 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 9265 | wmi_buf_t buf; |
| 9266 | int32_t len; |
| 9267 | int ret; |
| 9268 | |
| 9269 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 9270 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9271 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9272 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9273 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9274 | } |
| 9275 | |
| 9276 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 9277 | |
| 9278 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9279 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 9280 | WMITLV_GET_STRUCT_TLVLEN |
| 9281 | (wmi_extwow_enable_cmd_fixed_param)); |
| 9282 | |
| 9283 | cmd->vdev_id = params->vdev_id; |
| 9284 | cmd->type = params->type; |
| 9285 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 9286 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9287 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9288 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 9289 | |
| 9290 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9291 | WMI_EXTWOW_ENABLE_CMDID); |
| 9292 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9293 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9294 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9295 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9296 | } |
| 9297 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9298 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9299 | |
| 9300 | } |
| 9301 | |
| 9302 | /** |
| 9303 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 9304 | * @wmi_handle: wmi handle |
| 9305 | * @app_type1_params: app type1 params |
| 9306 | * |
| 9307 | * Return: CDF status |
| 9308 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9309 | 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] | 9310 | struct app_type1_params *app_type1_params) |
| 9311 | { |
| 9312 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 9313 | wmi_buf_t buf; |
| 9314 | int32_t len; |
| 9315 | int ret; |
| 9316 | |
| 9317 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 9318 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9319 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9320 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9321 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9322 | } |
| 9323 | |
| 9324 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 9325 | wmi_buf_data(buf); |
| 9326 | |
| 9327 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9328 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 9329 | WMITLV_GET_STRUCT_TLVLEN |
| 9330 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 9331 | |
| 9332 | cmd->vdev_id = app_type1_params->vdev_id; |
| 9333 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 9334 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9335 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9336 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9337 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9338 | cmd->passwd_len = app_type1_params->pass_length; |
| 9339 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9340 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9341 | "identification_id %.8s id_length %u " |
| 9342 | "password %.16s pass_length %u", |
| 9343 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 9344 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 9345 | |
| 9346 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9347 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 9348 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9349 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9350 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9351 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9352 | } |
| 9353 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9354 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9355 | } |
| 9356 | |
| 9357 | /** |
| 9358 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 9359 | * @wmi_handle: wmi handle |
| 9360 | * @appType2Params: app type2 params |
| 9361 | * |
| 9362 | * Return: CDF status |
| 9363 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9364 | 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] | 9365 | struct app_type2_params *appType2Params) |
| 9366 | { |
| 9367 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 9368 | wmi_buf_t buf; |
| 9369 | int32_t len; |
| 9370 | int ret; |
| 9371 | |
| 9372 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 9373 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9374 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9375 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9376 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9377 | } |
| 9378 | |
| 9379 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 9380 | wmi_buf_data(buf); |
| 9381 | |
| 9382 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9383 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 9384 | WMITLV_GET_STRUCT_TLVLEN |
| 9385 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 9386 | |
| 9387 | cmd->vdev_id = appType2Params->vdev_id; |
| 9388 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9389 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9390 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 9391 | |
| 9392 | cmd->ip_id = appType2Params->ip_id; |
| 9393 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 9394 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 9395 | |
| 9396 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 9397 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 9398 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 9399 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 9400 | |
| 9401 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 9402 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 9403 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 9404 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 9405 | |
| 9406 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 9407 | &cmd->gateway_mac); |
| 9408 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 9409 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 9410 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9411 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9412 | "rc4_key %.16s rc4_key_len %u " |
| 9413 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 9414 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 9415 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 9416 | "keepalive_max %u keepalive_inc %u " |
| 9417 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 9418 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 9419 | cmd->rc4_key, cmd->rc4_key_len, |
| 9420 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 9421 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 9422 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 9423 | cmd->keepalive_max, cmd->keepalive_inc, |
| 9424 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 9425 | |
| 9426 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9427 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 9428 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9429 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9430 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9431 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9432 | } |
| 9433 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9434 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9435 | |
| 9436 | } |
| 9437 | |
| 9438 | /** |
| 9439 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 9440 | * @wmi_handle: wmi handle |
| 9441 | * @timer_val: auto shutdown timer value |
| 9442 | * |
| 9443 | * Return: CDF status |
| 9444 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9445 | 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] | 9446 | uint32_t timer_val) |
| 9447 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9448 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9449 | wmi_buf_t buf = NULL; |
| 9450 | uint8_t *buf_ptr; |
| 9451 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 9452 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 9453 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9454 | 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] | 9455 | __func__, timer_val); |
| 9456 | |
| 9457 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9458 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9459 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9460 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9461 | } |
| 9462 | |
| 9463 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9464 | wmi_auto_sh_cmd = |
| 9465 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 9466 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 9467 | |
| 9468 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 9469 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 9470 | WMITLV_GET_STRUCT_TLVLEN |
| 9471 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 9472 | |
| 9473 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9474 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9475 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9476 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9477 | __func__, status); |
| 9478 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9479 | } |
| 9480 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9481 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9482 | } |
| 9483 | |
| 9484 | /** |
| 9485 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 9486 | * @wmi_handle: wmi handle |
| 9487 | * @nan_req: request data which will be non-null |
| 9488 | * |
| 9489 | * Return: CDF status |
| 9490 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9491 | 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] | 9492 | struct nan_req_params *nan_req) |
| 9493 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9494 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9495 | wmi_nan_cmd_param *cmd; |
| 9496 | wmi_buf_t buf; |
| 9497 | uint16_t len = sizeof(*cmd); |
| 9498 | uint16_t nan_data_len, nan_data_len_aligned; |
| 9499 | uint8_t *buf_ptr; |
| 9500 | |
| 9501 | /* |
| 9502 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 9503 | * +------------+----------+-----------------------+--------------+ |
| 9504 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 9505 | * +------------+----------+-----------------------+--------------+ |
| 9506 | */ |
| 9507 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9508 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 9509 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9510 | } |
| 9511 | nan_data_len = nan_req->request_data_len; |
| 9512 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 9513 | sizeof(uint32_t)); |
| 9514 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 9515 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9516 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9517 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 9518 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9519 | } |
| 9520 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9521 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 9522 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9523 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 9524 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 9525 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9526 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9527 | __func__, nan_req->request_data_len); |
| 9528 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 9529 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 9530 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9531 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9532 | |
| 9533 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9534 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9535 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9536 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9537 | __func__, ret); |
| 9538 | wmi_buf_free(buf); |
| 9539 | } |
| 9540 | |
| 9541 | return ret; |
| 9542 | } |
| 9543 | |
| 9544 | /** |
| 9545 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 9546 | * @wmi_handle: wmi handle |
| 9547 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 9548 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9549 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9550 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9551 | static QDF_STATUS send_process_dhcpserver_offload_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9552 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 9553 | { |
| 9554 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 9555 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9556 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9557 | |
| 9558 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 9559 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9560 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9561 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9562 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9563 | } |
| 9564 | |
| 9565 | cmd = (wmi_set_dhcp_server_offload_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9566 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9567 | |
| 9568 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9569 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 9570 | WMITLV_GET_STRUCT_TLVLEN |
| 9571 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 9572 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 9573 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 9574 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 9575 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 9576 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9577 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9578 | sizeof(*cmd), |
| 9579 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9580 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9581 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9582 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9583 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9584 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9585 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9586 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9587 | |
| 9588 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9589 | } |
| 9590 | |
| 9591 | /** |
| 9592 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 9593 | * @wmi_handle: wmi handle |
| 9594 | * @flashing: flashing request |
| 9595 | * |
| 9596 | * Return: CDF status |
| 9597 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9598 | 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] | 9599 | struct flashing_req_params *flashing) |
| 9600 | { |
| 9601 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9602 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9603 | wmi_buf_t buf; |
| 9604 | uint8_t *buf_ptr; |
| 9605 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 9606 | |
| 9607 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9608 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9609 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9610 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9611 | } |
| 9612 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9613 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 9614 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9615 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 9616 | WMITLV_GET_STRUCT_TLVLEN |
| 9617 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 9618 | cmd->pattern_id = flashing->pattern_id; |
| 9619 | cmd->led_x0 = flashing->led_x0; |
| 9620 | cmd->led_x1 = flashing->led_x1; |
| 9621 | |
| 9622 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9623 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9624 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9625 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9626 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9627 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9628 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9629 | |
| 9630 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9631 | } |
| 9632 | |
| 9633 | /** |
| 9634 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 9635 | * @wmi_handle: wmi handle |
| 9636 | * @ch_avoid_update_req: channel avoid update params |
| 9637 | * |
| 9638 | * Return: CDF status |
| 9639 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9640 | 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] | 9641 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9642 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9643 | wmi_buf_t buf = NULL; |
| 9644 | uint8_t *buf_ptr; |
| 9645 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 9646 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 9647 | |
| 9648 | |
| 9649 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9650 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9651 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9652 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9653 | } |
| 9654 | |
| 9655 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9656 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 9657 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 9658 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 9659 | WMITLV_GET_STRUCT_TLVLEN |
| 9660 | (wmi_chan_avoid_update_cmd_param)); |
| 9661 | |
| 9662 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9663 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9664 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9665 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9666 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 9667 | " returned Error %d", status); |
| 9668 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9669 | } |
| 9670 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9671 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9672 | } |
| 9673 | |
| 9674 | /** |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 9675 | * send_pdev_set_regdomain_cmd_tlv() - send set regdomain command to fw |
| 9676 | * @wmi_handle: wmi handle |
| 9677 | * @param: pointer to pdev regdomain params |
| 9678 | * |
| 9679 | * Return: 0 for success or error code |
| 9680 | */ |
| 9681 | static QDF_STATUS |
| 9682 | send_pdev_set_regdomain_cmd_tlv(wmi_unified_t wmi_handle, |
| 9683 | struct pdev_set_regdomain_params *param) |
| 9684 | { |
| 9685 | wmi_buf_t buf; |
| 9686 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9687 | int32_t len = sizeof(*cmd); |
| 9688 | |
| 9689 | |
| 9690 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9691 | if (!buf) { |
| 9692 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9693 | return QDF_STATUS_E_NOMEM; |
| 9694 | } |
| 9695 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9696 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9697 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9698 | WMITLV_GET_STRUCT_TLVLEN |
| 9699 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9700 | |
| 9701 | cmd->reg_domain = param->currentRDinuse; |
| 9702 | cmd->reg_domain_2G = param->currentRD2G; |
| 9703 | cmd->reg_domain_5G = param->currentRD5G; |
| 9704 | cmd->conformance_test_limit_2G = param->ctl_2G; |
| 9705 | cmd->conformance_test_limit_5G = param->ctl_5G; |
| 9706 | cmd->dfs_domain = param->dfsDomain; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9707 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9708 | param->pdev_id); |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 9709 | |
| 9710 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9711 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
| 9712 | WMI_LOGE("%s: Failed to send pdev set regdomain command", |
| 9713 | __func__); |
| 9714 | wmi_buf_free(buf); |
| 9715 | return QDF_STATUS_E_FAILURE; |
| 9716 | } |
| 9717 | |
| 9718 | return QDF_STATUS_SUCCESS; |
| 9719 | } |
| 9720 | |
| 9721 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9722 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 9723 | * @wmi_handle: wmi handle |
| 9724 | * @reg_dmn: reg domain |
| 9725 | * @regdmn2G: 2G reg domain |
| 9726 | * @regdmn5G: 5G reg domain |
| 9727 | * @ctl2G: 2G test limit |
| 9728 | * @ctl5G: 5G test limit |
| 9729 | * |
| 9730 | * Return: none |
| 9731 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9732 | 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] | 9733 | uint32_t reg_dmn, uint16_t regdmn2G, |
Rajeev Kumar Sirasanagandla | 4c1fecd | 2017-06-06 13:27:56 +0530 | [diff] [blame] | 9734 | uint16_t regdmn5G, uint8_t ctl2G, |
| 9735 | uint8_t ctl5G) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9736 | { |
| 9737 | wmi_buf_t buf; |
| 9738 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9739 | int32_t len = sizeof(*cmd); |
| 9740 | |
| 9741 | |
| 9742 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9743 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9744 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9745 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9746 | } |
| 9747 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9748 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9749 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9750 | WMITLV_GET_STRUCT_TLVLEN |
| 9751 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9752 | cmd->reg_domain = reg_dmn; |
| 9753 | cmd->reg_domain_2G = regdmn2G; |
| 9754 | cmd->reg_domain_5G = regdmn5G; |
| 9755 | cmd->conformance_test_limit_2G = ctl2G; |
| 9756 | cmd->conformance_test_limit_5G = ctl5G; |
| 9757 | |
| 9758 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9759 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9760 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9761 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9762 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9763 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9764 | } |
| 9765 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9766 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9767 | } |
| 9768 | |
| 9769 | |
| 9770 | /** |
| 9771 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 9772 | * @wmi_handle: wmi handle |
| 9773 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 9774 | * |
| 9775 | * This function sets tdls off channel mode |
| 9776 | * |
| 9777 | * Return: 0 on success; Negative errno otherwise |
| 9778 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9779 | 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] | 9780 | struct tdls_channel_switch_params *chan_switch_params) |
| 9781 | { |
| 9782 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9783 | wmi_buf_t wmi_buf; |
| 9784 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9785 | |
| 9786 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9787 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9788 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9789 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9790 | } |
| 9791 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9792 | wmi_buf_data(wmi_buf); |
| 9793 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9794 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9795 | WMITLV_GET_STRUCT_TLVLEN( |
| 9796 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9797 | |
| 9798 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9799 | &cmd->peer_macaddr); |
| 9800 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9801 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9802 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9803 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9804 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9805 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9806 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9807 | 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] | 9808 | cmd->peer_macaddr.mac_addr31to0, |
| 9809 | cmd->peer_macaddr.mac_addr47to32); |
| 9810 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9811 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9812 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9813 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9814 | ), |
| 9815 | cmd->vdev_id, |
| 9816 | cmd->offchan_mode, |
| 9817 | cmd->offchan_num, |
| 9818 | cmd->offchan_bw_bitmap, |
| 9819 | cmd->is_peer_responder, |
| 9820 | cmd->offchan_oper_class); |
| 9821 | |
| 9822 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9823 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9824 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9825 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9826 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9827 | } |
| 9828 | |
| 9829 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9830 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9831 | } |
| 9832 | |
| 9833 | /** |
| 9834 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9835 | * @wmi_handle: wmi handle |
| 9836 | * @pwmaTdlsparams: TDLS params |
| 9837 | * |
| 9838 | * Return: 0 for sucess or error code |
| 9839 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9840 | 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] | 9841 | void *tdls_param, uint8_t tdls_state) |
| 9842 | { |
| 9843 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9844 | wmi_buf_t wmi_buf; |
| 9845 | |
| 9846 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9847 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9848 | |
| 9849 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9850 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9851 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9852 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9853 | } |
| 9854 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9855 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9856 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9857 | WMITLV_GET_STRUCT_TLVLEN |
| 9858 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9859 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9860 | cmd->state = tdls_state; |
| 9861 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9862 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9863 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9864 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9865 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9866 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9867 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9868 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9869 | wmi_tdls->peer_traffic_response_timeout; |
| 9870 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9871 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9872 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9873 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9874 | cmd->teardown_notification_ms = |
| 9875 | wmi_tdls->teardown_notification_ms; |
| 9876 | cmd->tdls_peer_kickout_threshold = |
| 9877 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9878 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9879 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9880 | "notification_interval_ms: %d, " |
| 9881 | "tx_discovery_threshold: %d, " |
| 9882 | "tx_teardown_threshold: %d, " |
| 9883 | "rssi_teardown_threshold: %d, " |
| 9884 | "rssi_delta: %d, " |
| 9885 | "tdls_options: 0x%x, " |
| 9886 | "tdls_peer_traffic_ind_window: %d, " |
| 9887 | "tdls_peer_traffic_response_timeout: %d, " |
| 9888 | "tdls_puapsd_mask: 0x%x, " |
| 9889 | "tdls_puapsd_inactivity_time: %d, " |
| 9890 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9891 | "teardown_notification_ms: %d, " |
| 9892 | "tdls_peer_kickout_threshold: %d", |
| 9893 | __func__, tdls_state, cmd->state, |
| 9894 | cmd->notification_interval_ms, |
| 9895 | cmd->tx_discovery_threshold, |
| 9896 | cmd->tx_teardown_threshold, |
| 9897 | cmd->rssi_teardown_threshold, |
| 9898 | cmd->rssi_delta, |
| 9899 | cmd->tdls_options, |
| 9900 | cmd->tdls_peer_traffic_ind_window, |
| 9901 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9902 | cmd->tdls_puapsd_mask, |
| 9903 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9904 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9905 | cmd->teardown_notification_ms, |
| 9906 | cmd->tdls_peer_kickout_threshold); |
| 9907 | |
| 9908 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9909 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9910 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9911 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9912 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9913 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9914 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9915 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9916 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9917 | } |
| 9918 | |
| 9919 | /** |
| 9920 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9921 | * @wmi_handle: wmi handle |
| 9922 | * @peerStateParams: TDLS peer state params |
| 9923 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9924 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9925 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9926 | 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] | 9927 | struct tdls_peer_state_params *peerStateParams, |
| 9928 | uint32_t *ch_mhz) |
| 9929 | { |
| 9930 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9931 | wmi_tdls_peer_capabilities *peer_cap; |
| 9932 | wmi_channel *chan_info; |
| 9933 | wmi_buf_t wmi_buf; |
| 9934 | uint8_t *buf_ptr; |
| 9935 | uint32_t i; |
| 9936 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9937 | sizeof(wmi_tdls_peer_capabilities); |
| 9938 | |
| 9939 | |
| 9940 | len += WMI_TLV_HDR_SIZE + |
| 9941 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9942 | |
| 9943 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9944 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9945 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9946 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9947 | } |
| 9948 | |
| 9949 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9950 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9951 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9952 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9953 | WMITLV_GET_STRUCT_TLVLEN |
| 9954 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9955 | |
| 9956 | cmd->vdev_id = peerStateParams->vdevId; |
| 9957 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9958 | &cmd->peer_macaddr); |
| 9959 | |
| 9960 | |
| 9961 | cmd->peer_state = peerStateParams->peerState; |
| 9962 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9963 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9964 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9965 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9966 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9967 | cmd->peer_macaddr.mac_addr31to0, |
| 9968 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9969 | |
| 9970 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9971 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9972 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9973 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9974 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9975 | |
| 9976 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9977 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9978 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9979 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9980 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9981 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9982 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9983 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9984 | |
| 9985 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9986 | * but fill SP |
| 9987 | */ |
| 9988 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9989 | peerStateParams->peerCap.peerMaxSp); |
| 9990 | |
| 9991 | peer_cap->buff_sta_support = |
| 9992 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9993 | peer_cap->off_chan_support = |
| 9994 | peerStateParams->peerCap.peerOffChanSupport; |
| 9995 | peer_cap->peer_curr_operclass = |
| 9996 | peerStateParams->peerCap.peerCurrOperClass; |
| 9997 | /* self curr operclass is not being used and so pass op class for |
| 9998 | * preferred off chan in it. |
| 9999 | */ |
| 10000 | peer_cap->self_curr_operclass = |
| 10001 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 10002 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 10003 | peer_cap->peer_operclass_len = |
| 10004 | peerStateParams->peerCap.peerOperClassLen; |
| 10005 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10006 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10007 | __func__, peer_cap->peer_operclass_len); |
| 10008 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 10009 | peer_cap->peer_operclass[i] = |
| 10010 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10011 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10012 | __func__, i, peer_cap->peer_operclass[i]); |
| 10013 | } |
| 10014 | |
| 10015 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 10016 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 10017 | peer_cap->pref_offchan_bw = |
| 10018 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 10019 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10020 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10021 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 10022 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 10023 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 10024 | " %d, pref_offchan_bw: %d", |
| 10025 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 10026 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 10027 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 10028 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 10029 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 10030 | |
| 10031 | /* next fill variable size array of peer chan info */ |
| 10032 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 10033 | WMITLV_SET_HDR(buf_ptr, |
| 10034 | WMITLV_TAG_ARRAY_STRUC, |
| 10035 | sizeof(wmi_channel) * |
| 10036 | peerStateParams->peerCap.peerChanLen); |
| 10037 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10038 | |
| 10039 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 10040 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 10041 | WMITLV_TAG_STRUC_wmi_channel, |
| 10042 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 10043 | chan_info->mhz = ch_mhz[i]; |
| 10044 | chan_info->band_center_freq1 = chan_info->mhz; |
| 10045 | chan_info->band_center_freq2 = 0; |
| 10046 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10047 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10048 | |
| 10049 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 10050 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10051 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10052 | peerStateParams->peerCap.peerChan[i].chanId, |
| 10053 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 10054 | } |
| 10055 | |
| 10056 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 10057 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 10058 | else |
| 10059 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 10060 | |
| 10061 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 10062 | peerStateParams->peerCap. |
| 10063 | peerChan[i].pwr); |
| 10064 | |
| 10065 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 10066 | peerStateParams->peerCap.peerChan[i]. |
| 10067 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10068 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10069 | peerStateParams->peerCap.peerChan[i].pwr); |
| 10070 | |
| 10071 | chan_info++; |
| 10072 | } |
| 10073 | |
| 10074 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10075 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10076 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10077 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10078 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10079 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10080 | } |
| 10081 | |
| 10082 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10083 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10084 | } |
| 10085 | |
| 10086 | /* |
| 10087 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 10088 | * firmware |
| 10089 | * @wmi_handle: Pointer to wmi handle |
| 10090 | * @mem_dump_req: Pointer for mem_dump_req |
| 10091 | * |
| 10092 | * This function sends memory dump request to firmware |
| 10093 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10094 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10095 | * |
| 10096 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10097 | static QDF_STATUS send_process_fw_mem_dump_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10098 | struct fw_dump_req_param *mem_dump_req) |
| 10099 | { |
| 10100 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 10101 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10102 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10103 | int32_t len; |
| 10104 | wmi_buf_t buf; |
| 10105 | u_int8_t *buf_ptr; |
| 10106 | int ret, loop; |
| 10107 | |
| 10108 | /* |
| 10109 | * len = sizeof(fixed param) that includes tlv header + |
| 10110 | * tlv header for array of struc + |
| 10111 | * sizeof (each struct) |
| 10112 | */ |
| 10113 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10114 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 10115 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10116 | |
| 10117 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10118 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 10119 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10120 | } |
| 10121 | |
| 10122 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10123 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10124 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 10125 | |
| 10126 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10127 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 10128 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 10129 | |
| 10130 | cmd->request_id = mem_dump_req->request_id; |
| 10131 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 10132 | |
| 10133 | /* TLV indicating array of structures to follow */ |
| 10134 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 10135 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10136 | sizeof(wmi_fw_mem_dump) * |
| 10137 | cmd->num_fw_mem_dump_segs); |
| 10138 | |
| 10139 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10140 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 10141 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10142 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10143 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 10144 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10145 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10146 | ((uint8_t *)(mem_dump_req->segment) + |
| 10147 | loop * sizeof(*seg_req)); |
| 10148 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 10149 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 10150 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 10151 | dump_params->seg_id = seg_req->seg_id; |
| 10152 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 10153 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 10154 | dump_params->seg_length = seg_req->seg_length; |
| 10155 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 10156 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10157 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 10158 | WMI_LOGI(FL("seg_id:%d start_addr_lo:0x%x start_addr_hi:0x%x"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10159 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 10160 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10161 | WMI_LOGI(FL("seg_length:%d dst_addr_lo:0x%x dst_addr_hi:0x%x"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10162 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 10163 | dump_params->dest_addr_hi); |
| 10164 | dump_params++; |
| 10165 | } |
| 10166 | |
| 10167 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10168 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 10169 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10170 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10171 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10172 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10173 | } |
| 10174 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10175 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 10176 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10177 | } |
| 10178 | |
| 10179 | /* |
| 10180 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 10181 | * @wmi_handle: Pointer to WMi handle |
| 10182 | * @ie_data: Pointer for ie data |
| 10183 | * |
| 10184 | * This function sends IE information to firmware |
| 10185 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10186 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10187 | * |
| 10188 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10189 | 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] | 10190 | struct vdev_ie_info_param *ie_info) |
| 10191 | { |
| 10192 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 10193 | wmi_buf_t buf; |
| 10194 | uint8_t *buf_ptr; |
| 10195 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10196 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10197 | |
| 10198 | |
| 10199 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 10200 | /* Allocate memory for the WMI command */ |
| 10201 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 10202 | |
| 10203 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10204 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10205 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 10206 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10207 | } |
| 10208 | |
| 10209 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10210 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10211 | |
| 10212 | /* Populate the WMI command */ |
| 10213 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 10214 | |
| 10215 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10216 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 10217 | WMITLV_GET_STRUCT_TLVLEN( |
| 10218 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 10219 | cmd->vdev_id = ie_info->vdev_id; |
| 10220 | cmd->ie_id = ie_info->ie_id; |
| 10221 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 10222 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10223 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10224 | 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] | 10225 | ie_info->length, ie_info->vdev_id); |
| 10226 | |
| 10227 | buf_ptr += sizeof(*cmd); |
| 10228 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 10229 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10230 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10231 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10232 | |
| 10233 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10234 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10235 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10236 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10237 | wmi_buf_free(buf); |
| 10238 | } |
| 10239 | |
| 10240 | return ret; |
| 10241 | } |
| 10242 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10243 | /** |
| 10244 | * send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function |
| 10245 | * |
| 10246 | * @param wmi_handle : handle to WMI. |
| 10247 | * @param param : pointer to antenna param |
| 10248 | * |
| 10249 | * This function sends smart antenna enable command to FW |
| 10250 | * |
| 10251 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10252 | */ |
| 10253 | static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 10254 | struct smart_ant_enable_params *param) |
| 10255 | { |
| 10256 | /* Send WMI COMMAND to Enable */ |
| 10257 | wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd; |
| 10258 | wmi_pdev_smart_ant_gpio_handle *gpio_param; |
| 10259 | wmi_buf_t buf; |
| 10260 | uint8_t *buf_ptr; |
| 10261 | int len = 0; |
| 10262 | QDF_STATUS ret; |
| 10263 | int loop = 0; |
| 10264 | |
| 10265 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10266 | len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle); |
| 10267 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10268 | |
| 10269 | if (!buf) { |
| 10270 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10271 | return QDF_STATUS_E_NOMEM; |
| 10272 | } |
| 10273 | |
| 10274 | buf_ptr = wmi_buf_data(buf); |
| 10275 | qdf_mem_zero(buf_ptr, len); |
| 10276 | cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr; |
| 10277 | |
| 10278 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10279 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param, |
| 10280 | WMITLV_GET_STRUCT_TLVLEN( |
| 10281 | wmi_pdev_smart_ant_enable_cmd_fixed_param)); |
| 10282 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10283 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10284 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10285 | cmd->enable = param->enable; |
| 10286 | cmd->mode = param->mode; |
| 10287 | cmd->rx_antenna = param->rx_antenna; |
| 10288 | cmd->tx_default_antenna = param->rx_antenna; |
| 10289 | |
| 10290 | /* TLV indicating array of structures to follow */ |
| 10291 | buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param); |
| 10292 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10293 | WMI_HAL_MAX_SANTENNA * |
| 10294 | sizeof(wmi_pdev_smart_ant_gpio_handle)); |
| 10295 | |
| 10296 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10297 | gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr; |
| 10298 | |
| 10299 | for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) { |
| 10300 | WMITLV_SET_HDR(&gpio_param->tlv_header, |
| 10301 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle, |
| 10302 | WMITLV_GET_STRUCT_TLVLEN( |
| 10303 | wmi_pdev_smart_ant_gpio_handle)); |
| 10304 | if (param->mode == SMART_ANT_MODE_SERIAL) { |
| 10305 | if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) { |
| 10306 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 10307 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 10308 | } else { |
| 10309 | gpio_param->gpio_pin = 0; |
| 10310 | gpio_param->gpio_func = 0; |
| 10311 | } |
| 10312 | } else if (param->mode == SMART_ANT_MODE_PARALLEL) { |
| 10313 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 10314 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 10315 | } |
| 10316 | /* Setting it to 0 for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10317 | gpio_param->pdev_id = |
| 10318 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10319 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10320 | gpio_param++; |
| 10321 | } |
| 10322 | |
| 10323 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10324 | buf, |
| 10325 | len, |
| 10326 | WMI_PDEV_SMART_ANT_ENABLE_CMDID); |
| 10327 | |
| 10328 | if (ret != 0) { |
| 10329 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10330 | WMI_LOGE("enable:%d mode:%d rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n", |
| 10331 | cmd->enable, |
| 10332 | cmd->mode, |
| 10333 | cmd->rx_antenna, |
| 10334 | param->gpio_pin[0], param->gpio_pin[1], |
| 10335 | param->gpio_pin[2], param->gpio_pin[3], |
| 10336 | param->gpio_func[0], param->gpio_func[1], |
| 10337 | param->gpio_func[2], param->gpio_func[3], |
| 10338 | ret); |
| 10339 | wmi_buf_free(buf); |
| 10340 | } |
| 10341 | |
| 10342 | return ret; |
| 10343 | } |
| 10344 | |
| 10345 | /** |
| 10346 | * send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function |
| 10347 | * |
| 10348 | * @param wmi_handle : handle to WMI. |
| 10349 | * @param param : pointer to rx antenna param |
| 10350 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10351 | */ |
| 10352 | static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 10353 | struct smart_ant_rx_ant_params *param) |
| 10354 | { |
| 10355 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd; |
| 10356 | wmi_buf_t buf; |
| 10357 | uint8_t *buf_ptr; |
| 10358 | uint32_t len; |
| 10359 | QDF_STATUS ret; |
| 10360 | |
| 10361 | len = sizeof(*cmd); |
| 10362 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10363 | WMI_LOGD("%s:\n", __func__); |
| 10364 | if (!buf) { |
| 10365 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10366 | return QDF_STATUS_E_NOMEM; |
| 10367 | } |
| 10368 | |
| 10369 | buf_ptr = wmi_buf_data(buf); |
| 10370 | cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr; |
| 10371 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10372 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param, |
| 10373 | WMITLV_GET_STRUCT_TLVLEN( |
| 10374 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param)); |
| 10375 | cmd->rx_antenna = param->antenna; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10376 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10377 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10378 | |
| 10379 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10380 | buf, |
| 10381 | len, |
| 10382 | WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID); |
| 10383 | |
| 10384 | if (ret != 0) { |
| 10385 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10386 | WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n", |
| 10387 | __func__, |
| 10388 | cmd->rx_antenna, |
| 10389 | ret); |
| 10390 | wmi_buf_free(buf); |
| 10391 | } |
| 10392 | |
| 10393 | return ret; |
| 10394 | } |
| 10395 | |
| 10396 | /** |
| 10397 | * send_set_ctl_table_cmd_tlv() - send ctl table cmd to fw |
| 10398 | * @wmi_handle: wmi handle |
| 10399 | * @param: pointer to hold ctl table param |
| 10400 | * |
| 10401 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10402 | */ |
| 10403 | static QDF_STATUS |
| 10404 | send_set_ctl_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 10405 | struct ctl_table_params *param) |
| 10406 | { |
| 10407 | uint16_t len, ctl_tlv_len; |
| 10408 | uint8_t *buf_ptr; |
| 10409 | wmi_buf_t buf; |
| 10410 | wmi_pdev_set_ctl_table_cmd_fixed_param *cmd; |
| 10411 | uint32_t *ctl_array; |
| 10412 | |
| 10413 | if (!param->ctl_array) |
| 10414 | return QDF_STATUS_E_FAILURE; |
| 10415 | |
| 10416 | if (param->ctl_cmd_len != |
| 10417 | WMI_HOST_NUM_CTLS_2G * WMI_HOST_NUM_BAND_EDGES_2G * 2 + |
| 10418 | WMI_HOST_NUM_CTLS_5G * WMI_HOST_NUM_BAND_EDGES_5G * 2) { |
| 10419 | qdf_print("CTL array len not correct\n"); |
| 10420 | return QDF_STATUS_E_FAILURE; |
| 10421 | } |
| 10422 | |
| 10423 | ctl_tlv_len = WMI_TLV_HDR_SIZE + |
| 10424 | roundup(param->ctl_cmd_len, sizeof(A_UINT32)); |
| 10425 | len = sizeof(*cmd) + ctl_tlv_len; |
| 10426 | |
| 10427 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10428 | if (!buf) { |
| 10429 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10430 | return QDF_STATUS_E_FAILURE; |
| 10431 | } |
| 10432 | |
| 10433 | buf_ptr = wmi_buf_data(buf); |
| 10434 | qdf_mem_zero(buf_ptr, len); |
| 10435 | |
| 10436 | cmd = (wmi_pdev_set_ctl_table_cmd_fixed_param *)buf_ptr; |
| 10437 | |
| 10438 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10439 | WMITLV_TAG_STRUC_wmi_pdev_set_ctl_table_cmd_fixed_param, |
| 10440 | WMITLV_GET_STRUCT_TLVLEN( |
| 10441 | wmi_pdev_set_ctl_table_cmd_fixed_param)); |
| 10442 | cmd->ctl_len = param->ctl_cmd_len; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10443 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10444 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10445 | |
| 10446 | buf_ptr += sizeof(*cmd); |
| 10447 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10448 | (cmd->ctl_len)); |
| 10449 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10450 | ctl_array = (uint32_t *)buf_ptr; |
| 10451 | |
| 10452 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[0], ¶m->ctl_band, |
| 10453 | sizeof(param->ctl_band)); |
| 10454 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[1], param->ctl_array, |
| 10455 | param->ctl_cmd_len - |
| 10456 | sizeof(param->ctl_band)); |
| 10457 | |
| 10458 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10459 | WMI_PDEV_SET_CTL_TABLE_CMDID)) { |
| 10460 | WMI_LOGE("%s:Failed to send command\n", __func__); |
| 10461 | wmi_buf_free(buf); |
| 10462 | return QDF_STATUS_E_FAILURE; |
| 10463 | } |
| 10464 | |
| 10465 | return QDF_STATUS_SUCCESS; |
| 10466 | } |
| 10467 | |
| 10468 | /** |
| 10469 | * send_set_mimogain_table_cmd_tlv() - send mimogain table cmd to fw |
| 10470 | * @wmi_handle: wmi handle |
| 10471 | * @param: pointer to hold mimogain table param |
| 10472 | * |
| 10473 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10474 | */ |
| 10475 | static QDF_STATUS |
| 10476 | send_set_mimogain_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 10477 | struct mimogain_table_params *param) |
| 10478 | { |
| 10479 | uint16_t len, table_tlv_len; |
| 10480 | wmi_buf_t buf; |
| 10481 | uint8_t *buf_ptr; |
| 10482 | wmi_pdev_set_mimogain_table_cmd_fixed_param *cmd; |
| 10483 | uint32_t *gain_table; |
| 10484 | |
| 10485 | if (!param->array_gain) |
| 10486 | return QDF_STATUS_E_FAILURE; |
| 10487 | |
| 10488 | /* len must be multiple of a single array gain table */ |
| 10489 | if (param->tbl_len % |
| 10490 | ((WMI_HOST_TX_NUM_CHAIN-1) * WMI_HOST_TPC_REGINDEX_MAX * |
| 10491 | WMI_HOST_ARRAY_GAIN_NUM_STREAMS) != 0) { |
| 10492 | WMI_LOGE("Array gain table len not correct\n"); |
| 10493 | return QDF_STATUS_E_FAILURE; |
| 10494 | } |
| 10495 | |
| 10496 | table_tlv_len = WMI_TLV_HDR_SIZE + |
| 10497 | roundup(param->tbl_len, sizeof(uint32_t)); |
| 10498 | len = sizeof(*cmd) + table_tlv_len; |
| 10499 | |
| 10500 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10501 | if (!buf) { |
| 10502 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10503 | return QDF_STATUS_E_FAILURE; |
| 10504 | } |
| 10505 | |
| 10506 | buf_ptr = wmi_buf_data(buf); |
| 10507 | qdf_mem_zero(buf_ptr, len); |
| 10508 | |
| 10509 | cmd = (wmi_pdev_set_mimogain_table_cmd_fixed_param *)buf_ptr; |
| 10510 | |
| 10511 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10512 | WMITLV_TAG_STRUC_wmi_pdev_set_mimogain_table_cmd_fixed_param, |
| 10513 | WMITLV_GET_STRUCT_TLVLEN( |
| 10514 | wmi_pdev_set_mimogain_table_cmd_fixed_param)); |
| 10515 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10516 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10517 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10518 | WMI_MIMOGAIN_ARRAY_GAIN_LEN_SET(cmd->mimogain_info, param->tbl_len); |
| 10519 | WMI_MIMOGAIN_MULTI_CHAIN_BYPASS_SET(cmd->mimogain_info, |
| 10520 | param->multichain_gain_bypass); |
| 10521 | |
| 10522 | buf_ptr += sizeof(*cmd); |
| 10523 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10524 | (param->tbl_len)); |
| 10525 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10526 | gain_table = (uint32_t *)buf_ptr; |
| 10527 | |
| 10528 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(gain_table, |
| 10529 | param->array_gain, |
| 10530 | param->tbl_len); |
| 10531 | |
| 10532 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10533 | WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID)) { |
| 10534 | return QDF_STATUS_E_FAILURE; |
| 10535 | } |
| 10536 | |
| 10537 | return QDF_STATUS_SUCCESS; |
| 10538 | } |
| 10539 | |
| 10540 | /** |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10541 | * enum packet_power_tlv_flags: target defined |
| 10542 | * packet power rate flags for TLV |
| 10543 | * @WMI_TLV_FLAG_ONE_CHAIN: one chain |
| 10544 | * @WMI_TLV_FLAG_TWO_CHAIN: two chain |
| 10545 | * @WMI_TLV_FLAG_THREE_CHAIN: three chain |
| 10546 | * @WMI_TLV_FLAG_FOUR_CHAIN: four chain |
| 10547 | * @WMI_TLV_FLAG_FIVE_CHAIN: five chain |
| 10548 | * @WMI_TLV_FLAG_SIX_CHAIN: six chain |
| 10549 | * @WMI_TLV_FLAG_SEVEN_CHAIN: seven chain |
| 10550 | * @WMI_TLV_FLAG_EIGHT_CHAIN:eight chain |
| 10551 | * @WMI_TLV_FLAG_STBC: STBC is set |
| 10552 | * @WMI_TLV_FLAG_40MHZ: 40MHz chan width |
| 10553 | * @WMI_TLV_FLAG_80MHZ: 80MHz chan width |
| 10554 | * @WMI_TLV_FLAG_160MHZ: 160MHz chan width |
| 10555 | * @WMI_TLV_FLAG_TXBF: Tx Bf enabled |
| 10556 | * @WMI_TLV_FLAG_RTSENA: RTS enabled |
| 10557 | * @WMI_TLV_FLAG_CTSENA: CTS enabled |
| 10558 | * @WMI_TLV_FLAG_LDPC: LDPC is set |
| 10559 | * @WMI_TLV_FLAG_SGI: Short gaurd interval |
| 10560 | * @WMI_TLV_FLAG_SU: SU Data |
| 10561 | * @WMI_TLV_FLAG_DL_MU_MIMO_AC: DL AC MU data |
| 10562 | * @WMI_TLV_FLAG_DL_MU_MIMO_AX: DL AX MU data |
| 10563 | * @WMI_TLV_FLAG_DL_OFDMA: DL OFDMA data |
| 10564 | * @WMI_TLV_FLAG_UL_OFDMA: UL OFDMA data |
| 10565 | * @WMI_TLV_FLAG_UL_MU_MIMO: UL MU data |
| 10566 | * |
| 10567 | * @WMI_TLV_FLAG_BW_MASK: bandwidth mask |
| 10568 | * @WMI_TLV_FLAG_BW_SHIFT: bandwidth shift |
| 10569 | * @WMI_TLV_FLAG_SU_MU_OFDMA_MASK: su/mu/ofdma mask |
| 10570 | * @WMI_TLV_FLAG_SU_MU_OFDMA_shift: su/mu/ofdma shift |
| 10571 | */ |
| 10572 | enum packet_power_tlv_flags { |
| 10573 | WMI_TLV_FLAG_ONE_CHAIN = 0x00000001, |
| 10574 | WMI_TLV_FLAG_TWO_CHAIN = 0x00000003, |
| 10575 | WMI_TLV_FLAG_THREE_CHAIN = 0x00000007, |
| 10576 | WMI_TLV_FLAG_FOUR_CHAIN = 0x0000000F, |
| 10577 | WMI_TLV_FLAG_FIVE_CHAIN = 0x0000001F, |
| 10578 | WMI_TLV_FLAG_SIX_CHAIN = 0x0000003F, |
| 10579 | WMI_TLV_FLAG_SEVEN_CHAIN = 0x0000007F, |
| 10580 | WMI_TLV_FLAG_EIGHT_CHAIN = 0x0000008F, |
| 10581 | WMI_TLV_FLAG_STBC = 0x00000100, |
| 10582 | WMI_TLV_FLAG_40MHZ = 0x00000200, |
| 10583 | WMI_TLV_FLAG_80MHZ = 0x00000300, |
| 10584 | WMI_TLV_FLAG_160MHZ = 0x00000400, |
| 10585 | WMI_TLV_FLAG_TXBF = 0x00000800, |
| 10586 | WMI_TLV_FLAG_RTSENA = 0x00001000, |
| 10587 | WMI_TLV_FLAG_CTSENA = 0x00002000, |
| 10588 | WMI_TLV_FLAG_LDPC = 0x00004000, |
| 10589 | WMI_TLV_FLAG_SGI = 0x00008000, |
| 10590 | WMI_TLV_FLAG_SU = 0x00100000, |
| 10591 | WMI_TLV_FLAG_DL_MU_MIMO_AC = 0x00200000, |
| 10592 | WMI_TLV_FLAG_DL_MU_MIMO_AX = 0x00300000, |
| 10593 | WMI_TLV_FLAG_DL_OFDMA = 0x00400000, |
| 10594 | WMI_TLV_FLAG_UL_OFDMA = 0x00500000, |
| 10595 | WMI_TLV_FLAG_UL_MU_MIMO = 0x00600000, |
| 10596 | |
| 10597 | WMI_TLV_FLAG_CHAIN_MASK = 0xff, |
| 10598 | WMI_TLV_FLAG_BW_MASK = 0x3, |
| 10599 | WMI_TLV_FLAG_BW_SHIFT = 9, |
| 10600 | WMI_TLV_FLAG_SU_MU_OFDMA_MASK = 0x7, |
| 10601 | WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT = 20, |
| 10602 | }; |
| 10603 | |
| 10604 | /** |
| 10605 | * convert_to_power_info_rate_flags() - convert packet_power_info_params |
| 10606 | * to FW understandable format |
| 10607 | * @param: pointer to hold packet power info param |
| 10608 | * |
| 10609 | * @return FW understandable 32 bit rate flags |
| 10610 | */ |
| 10611 | static uint32_t |
| 10612 | convert_to_power_info_rate_flags(struct packet_power_info_params *param) |
| 10613 | { |
| 10614 | uint32_t rateflags = 0; |
| 10615 | |
| 10616 | if (param->chainmask) |
| 10617 | rateflags |= |
| 10618 | (param->chainmask & WMI_TLV_FLAG_CHAIN_MASK); |
| 10619 | if (param->chan_width) |
| 10620 | rateflags |= |
| 10621 | ((param->chan_width & WMI_TLV_FLAG_BW_MASK) |
| 10622 | << WMI_TLV_FLAG_BW_SHIFT); |
| 10623 | if (param->su_mu_ofdma) |
| 10624 | rateflags |= |
| 10625 | ((param->su_mu_ofdma & WMI_TLV_FLAG_SU_MU_OFDMA_MASK) |
| 10626 | << WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT); |
| 10627 | if (param->rate_flags & WMI_HOST_FLAG_STBC) |
| 10628 | rateflags |= WMI_TLV_FLAG_STBC; |
| 10629 | if (param->rate_flags & WMI_HOST_FLAG_LDPC) |
| 10630 | rateflags |= WMI_TLV_FLAG_LDPC; |
| 10631 | if (param->rate_flags & WMI_HOST_FLAG_TXBF) |
| 10632 | rateflags |= WMI_TLV_FLAG_TXBF; |
| 10633 | if (param->rate_flags & WMI_HOST_FLAG_RTSENA) |
| 10634 | rateflags |= WMI_TLV_FLAG_RTSENA; |
| 10635 | if (param->rate_flags & WMI_HOST_FLAG_CTSENA) |
| 10636 | rateflags |= WMI_TLV_FLAG_CTSENA; |
| 10637 | if (param->rate_flags & WMI_HOST_FLAG_SGI) |
| 10638 | rateflags |= WMI_TLV_FLAG_SGI; |
| 10639 | |
| 10640 | return rateflags; |
| 10641 | } |
| 10642 | |
| 10643 | /** |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10644 | * send_packet_power_info_get_cmd_tlv() - send request to get packet power |
| 10645 | * info to fw |
| 10646 | * @wmi_handle: wmi handle |
| 10647 | * @param: pointer to hold packet power info param |
| 10648 | * |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10649 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10650 | */ |
| 10651 | static QDF_STATUS |
| 10652 | send_packet_power_info_get_cmd_tlv(wmi_unified_t wmi_handle, |
| 10653 | struct packet_power_info_params *param) |
| 10654 | { |
| 10655 | wmi_pdev_get_tpc_cmd_fixed_param *cmd; |
| 10656 | wmi_buf_t wmibuf; |
| 10657 | uint8_t *buf_ptr; |
| 10658 | u_int32_t len = sizeof(wmi_pdev_get_tpc_cmd_fixed_param); |
| 10659 | |
| 10660 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 10661 | if (wmibuf == NULL) |
| 10662 | return QDF_STATUS_E_NOMEM; |
| 10663 | |
| 10664 | buf_ptr = (uint8_t *)wmi_buf_data(wmibuf); |
| 10665 | |
| 10666 | cmd = (wmi_pdev_get_tpc_cmd_fixed_param *)buf_ptr; |
| 10667 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10668 | WMITLV_TAG_STRUC_wmi_pdev_get_tpc_cmd_fixed_param, |
| 10669 | WMITLV_GET_STRUCT_TLVLEN( |
| 10670 | wmi_pdev_get_tpc_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10671 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10672 | param->pdev_id); |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10673 | cmd->rate_flags = convert_to_power_info_rate_flags(param); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10674 | cmd->nss = param->nss; |
| 10675 | cmd->preamble = param->preamble; |
| 10676 | cmd->hw_rate = param->hw_rate; |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10677 | |
| 10678 | WMI_LOGI("%s[%d] commandID %d, wmi_pdev_get_tpc_cmd=0x%x," |
| 10679 | "rate_flags: 0x%x, nss: %d, preamble: %d, hw_rate: %d\n", |
| 10680 | __func__, __LINE__, WMI_PDEV_GET_TPC_CMDID, *((u_int32_t *)cmd), |
| 10681 | cmd->rate_flags, cmd->nss, cmd->preamble, cmd->hw_rate); |
| 10682 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10683 | if (wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 10684 | WMI_PDEV_GET_TPC_CMDID)) { |
| 10685 | WMI_LOGE(FL("Failed to get tpc command\n")); |
| 10686 | wmi_buf_free(wmibuf); |
| 10687 | return QDF_STATUS_E_FAILURE; |
| 10688 | } |
| 10689 | |
| 10690 | return QDF_STATUS_SUCCESS; |
| 10691 | } |
| 10692 | |
| 10693 | /** |
| 10694 | * send_vdev_config_ratemask_cmd_tlv() - config ratemask param in fw |
| 10695 | * @wmi_handle: wmi handle |
| 10696 | * @param: pointer to hold config ratemask params |
| 10697 | * |
| 10698 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10699 | */ |
| 10700 | static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle, |
| 10701 | struct config_ratemask_params *param) |
| 10702 | { |
| 10703 | wmi_vdev_config_ratemask_cmd_fixed_param *cmd; |
| 10704 | wmi_buf_t buf; |
| 10705 | int32_t len = sizeof(*cmd); |
| 10706 | |
| 10707 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10708 | if (!buf) { |
| 10709 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10710 | return QDF_STATUS_E_FAILURE; |
| 10711 | } |
| 10712 | cmd = (wmi_vdev_config_ratemask_cmd_fixed_param *)wmi_buf_data(buf); |
| 10713 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10714 | WMITLV_TAG_STRUC_wmi_vdev_config_ratemask_fixed_param, |
| 10715 | WMITLV_GET_STRUCT_TLVLEN( |
| 10716 | wmi_vdev_config_ratemask_cmd_fixed_param)); |
| 10717 | cmd->vdev_id = param->vdev_id; |
| 10718 | cmd->type = param->type; |
| 10719 | cmd->mask_lower32 = param->lower32; |
| 10720 | cmd->mask_higher32 = param->higher32; |
| 10721 | WMI_LOGI("Setting vdev ratemask vdev id = 0x%X, type = 0x%X, mask_l32 = 0x%X mask_h32 = 0x%X\n", |
| 10722 | param->vdev_id, param->type, param->lower32, param->higher32); |
| 10723 | |
| 10724 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10725 | WMI_VDEV_RATEMASK_CMDID)) { |
| 10726 | WMI_LOGE("Seting vdev ratemask failed\n"); |
| 10727 | wmi_buf_free(buf); |
| 10728 | return QDF_STATUS_E_FAILURE; |
| 10729 | } |
| 10730 | |
| 10731 | return QDF_STATUS_SUCCESS; |
| 10732 | } |
| 10733 | |
| 10734 | /** |
| 10735 | * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw |
| 10736 | * @wmi_handle: wmi handle |
| 10737 | * @param: pointer to hold vap dscp tid map param |
| 10738 | * |
| 10739 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10740 | */ |
| 10741 | static QDF_STATUS |
| 10742 | send_set_vap_dscp_tid_map_cmd_tlv(wmi_unified_t wmi_handle, |
| 10743 | struct vap_dscp_tid_map_params *param) |
| 10744 | { |
| 10745 | wmi_buf_t buf; |
| 10746 | wmi_vdev_set_dscp_tid_map_cmd_fixed_param *cmd; |
| 10747 | int32_t len = sizeof(*cmd); |
| 10748 | |
| 10749 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10750 | if (!buf) { |
| 10751 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10752 | return QDF_STATUS_E_FAILURE; |
| 10753 | } |
| 10754 | |
| 10755 | cmd = (wmi_vdev_set_dscp_tid_map_cmd_fixed_param *)wmi_buf_data(buf); |
| 10756 | qdf_mem_copy(cmd->dscp_to_tid_map, param->dscp_to_tid_map, |
| 10757 | sizeof(A_UINT32) * WMI_DSCP_MAP_MAX); |
| 10758 | |
| 10759 | cmd->vdev_id = param->vdev_id; |
| 10760 | cmd->enable_override = 0; |
| 10761 | |
| 10762 | WMI_LOGI("Setting dscp for vap id: %d\n", cmd->vdev_id); |
| 10763 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10764 | WMI_VDEV_SET_DSCP_TID_MAP_CMDID)) { |
| 10765 | WMI_LOGE("Failed to set dscp cmd\n"); |
| 10766 | wmi_buf_free(buf); |
| 10767 | return QDF_STATUS_E_FAILURE; |
| 10768 | } |
| 10769 | |
| 10770 | return QDF_STATUS_SUCCESS; |
| 10771 | } |
| 10772 | |
| 10773 | /** |
| 10774 | * send_vdev_set_neighbour_rx_cmd_tlv() - set neighbour rx param in fw |
| 10775 | * @wmi_handle: wmi handle |
| 10776 | * @macaddr: vdev mac address |
| 10777 | * @param: pointer to hold neigbour rx param |
| 10778 | * |
| 10779 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10780 | */ |
| 10781 | static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(wmi_unified_t wmi_handle, |
| 10782 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10783 | struct set_neighbour_rx_params *param) |
| 10784 | { |
| 10785 | wmi_vdev_filter_nrp_config_cmd_fixed_param *cmd; |
| 10786 | wmi_buf_t buf; |
| 10787 | int32_t len = sizeof(*cmd); |
| 10788 | |
| 10789 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10790 | if (!buf) { |
| 10791 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10792 | return QDF_STATUS_E_FAILURE; |
| 10793 | } |
| 10794 | cmd = (wmi_vdev_filter_nrp_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 10795 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10796 | WMITLV_TAG_STRUC_wmi_vdev_filter_nrp_config_cmd_fixed_param, |
| 10797 | WMITLV_GET_STRUCT_TLVLEN( |
| 10798 | wmi_vdev_filter_nrp_config_cmd_fixed_param)); |
| 10799 | cmd->vdev_id = param->vdev_id; |
| 10800 | cmd->bssid_idx = param->idx; |
| 10801 | cmd->action = param->action; |
| 10802 | cmd->type = param->type; |
| 10803 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr); |
| 10804 | cmd->flag = 0; |
| 10805 | |
| 10806 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10807 | WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID)) { |
| 10808 | WMI_LOGE("Failed to set neighbour rx param\n"); |
| 10809 | wmi_buf_free(buf); |
| 10810 | return QDF_STATUS_E_FAILURE; |
| 10811 | } |
| 10812 | |
| 10813 | return QDF_STATUS_SUCCESS; |
| 10814 | } |
| 10815 | |
| 10816 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 10817 | * 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] | 10818 | * @param wmi_handle : handle to WMI. |
| 10819 | * @param macaddr : vdev mac address |
| 10820 | * @param param : pointer to tx antenna param |
| 10821 | * |
| 10822 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10823 | */ |
| 10824 | static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 10825 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10826 | struct smart_ant_tx_ant_params *param) |
| 10827 | { |
| 10828 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd; |
| 10829 | wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series; |
| 10830 | wmi_buf_t buf; |
| 10831 | int32_t len = 0; |
| 10832 | int i; |
| 10833 | uint8_t *buf_ptr; |
| 10834 | QDF_STATUS ret; |
| 10835 | |
| 10836 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10837 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10838 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series); |
| 10839 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10840 | |
| 10841 | if (!buf) { |
| 10842 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10843 | return QDF_STATUS_E_NOMEM; |
| 10844 | } |
| 10845 | |
| 10846 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10847 | qdf_mem_zero(buf_ptr, len); |
| 10848 | cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr; |
| 10849 | |
| 10850 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10851 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param, |
| 10852 | WMITLV_GET_STRUCT_TLVLEN( |
| 10853 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param)); |
| 10854 | |
| 10855 | cmd->vdev_id = param->vdev_id; |
| 10856 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10857 | |
| 10858 | buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param); |
| 10859 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10860 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series)); |
| 10861 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10862 | ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr; |
| 10863 | |
| 10864 | for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) { |
| 10865 | WMITLV_SET_HDR(&ant_tx_series->tlv_header, |
| 10866 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series, |
| 10867 | WMITLV_GET_STRUCT_TLVLEN( |
| 10868 | wmi_peer_smart_ant_set_tx_antenna_series)); |
| 10869 | ant_tx_series->antenna_series = param->antenna_array[i]; |
| 10870 | ant_tx_series++; |
| 10871 | } |
| 10872 | |
| 10873 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10874 | buf, |
| 10875 | len, |
| 10876 | WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID); |
| 10877 | |
| 10878 | if (ret != 0) { |
| 10879 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10880 | wmi_buf_free(buf); |
| 10881 | } |
| 10882 | |
| 10883 | return ret; |
| 10884 | } |
| 10885 | |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10886 | /** |
| 10887 | * send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw |
| 10888 | * @wmi_handle: wmi handle |
| 10889 | * @param: pointer to hold ant switch tbl param |
| 10890 | * |
| 10891 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10892 | */ |
| 10893 | static QDF_STATUS |
| 10894 | send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10895 | struct ant_switch_tbl_params *param) |
| 10896 | { |
| 10897 | uint8_t len; |
| 10898 | wmi_buf_t buf; |
| 10899 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd; |
| 10900 | wmi_pdev_set_ant_ctrl_chain *ctrl_chain; |
| 10901 | uint8_t *buf_ptr; |
| 10902 | |
| 10903 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10904 | len += sizeof(wmi_pdev_set_ant_ctrl_chain); |
| 10905 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10906 | |
| 10907 | if (!buf) { |
| 10908 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10909 | return QDF_STATUS_E_NOMEM; |
| 10910 | } |
| 10911 | |
| 10912 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10913 | qdf_mem_zero(buf_ptr, len); |
| 10914 | cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr; |
| 10915 | |
| 10916 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10917 | WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param, |
| 10918 | WMITLV_GET_STRUCT_TLVLEN( |
| 10919 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param)); |
| 10920 | |
| 10921 | cmd->antCtrlCommon1 = param->ant_ctrl_common1; |
| 10922 | cmd->antCtrlCommon2 = param->ant_ctrl_common2; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10923 | cmd->mac_id = |
| 10924 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10925 | |
| 10926 | /* TLV indicating array of structures to follow */ |
| 10927 | buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param); |
| 10928 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10929 | sizeof(wmi_pdev_set_ant_ctrl_chain)); |
| 10930 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10931 | ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr; |
| 10932 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10933 | ctrl_chain->pdev_id = |
| 10934 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10935 | ctrl_chain->antCtrlChain = param->antCtrlChain; |
| 10936 | |
| 10937 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10938 | WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) { |
| 10939 | wmi_buf_free(buf); |
| 10940 | return QDF_STATUS_E_FAILURE; |
| 10941 | } |
| 10942 | |
| 10943 | return QDF_STATUS_SUCCESS; |
| 10944 | } |
| 10945 | |
| 10946 | /** |
| 10947 | * send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna |
| 10948 | * training information function |
| 10949 | * @param wmi_handle : handle to WMI. |
| 10950 | * @macaddr : vdev mac address |
| 10951 | * @param param : pointer to tx antenna param |
| 10952 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10953 | */ |
| 10954 | static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv( |
| 10955 | wmi_unified_t wmi_handle, |
| 10956 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10957 | struct smart_ant_training_info_params *param) |
| 10958 | { |
| 10959 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd; |
| 10960 | wmi_peer_smart_ant_set_train_antenna_param *train_param; |
| 10961 | wmi_buf_t buf; |
| 10962 | uint8_t *buf_ptr; |
| 10963 | int32_t len = 0; |
| 10964 | QDF_STATUS ret; |
| 10965 | int loop; |
| 10966 | |
| 10967 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10968 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10969 | sizeof(wmi_peer_smart_ant_set_train_antenna_param); |
| 10970 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10971 | |
| 10972 | if (!buf) { |
| 10973 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10974 | return QDF_STATUS_E_NOMEM; |
| 10975 | } |
| 10976 | |
| 10977 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10978 | qdf_mem_zero(buf_ptr, len); |
| 10979 | cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr; |
| 10980 | |
| 10981 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10982 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param, |
| 10983 | WMITLV_GET_STRUCT_TLVLEN( |
| 10984 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param)); |
| 10985 | |
| 10986 | cmd->vdev_id = param->vdev_id; |
| 10987 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10988 | cmd->num_pkts = param->numpkts; |
| 10989 | |
| 10990 | buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param); |
| 10991 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10992 | sizeof(wmi_peer_smart_ant_set_train_antenna_param) * |
| 10993 | WMI_SMART_ANT_MAX_RATE_SERIES); |
| 10994 | |
| 10995 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10996 | train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr; |
| 10997 | |
| 10998 | for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) { |
| 10999 | WMITLV_SET_HDR(&train_param->tlv_header, |
| 11000 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param, |
| 11001 | WMITLV_GET_STRUCT_TLVLEN( |
| 11002 | wmi_peer_smart_ant_set_train_antenna_param)); |
| 11003 | train_param->train_rate_series = param->rate_array[loop]; |
| 11004 | train_param->train_antenna_series = param->antenna_array[loop]; |
| 11005 | train_param->rc_flags = 0; |
| 11006 | WMI_LOGI(FL("Series number:%d\n"), loop); |
| 11007 | WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"), |
| 11008 | train_param->train_rate_series, |
| 11009 | train_param->train_antenna_series); |
| 11010 | train_param++; |
| 11011 | } |
| 11012 | |
| 11013 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11014 | buf, |
| 11015 | len, |
| 11016 | WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID); |
| 11017 | |
| 11018 | if (ret != 0) { |
| 11019 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11020 | wmi_buf_free(buf); |
| 11021 | return QDF_STATUS_E_FAILURE; |
| 11022 | } |
| 11023 | |
| 11024 | return ret; |
| 11025 | } |
| 11026 | |
| 11027 | /** |
| 11028 | * send_smart_ant_set_node_config_cmd_tlv() - WMI set node |
| 11029 | * configuration function |
| 11030 | * @param wmi_handle : handle to WMI. |
| 11031 | * @macaddr : vdev mad address |
| 11032 | * @param param : pointer to tx antenna param |
| 11033 | * |
| 11034 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11035 | */ |
| 11036 | static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv( |
| 11037 | wmi_unified_t wmi_handle, |
| 11038 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11039 | struct smart_ant_node_config_params *param) |
| 11040 | { |
| 11041 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd; |
| 11042 | wmi_buf_t buf; |
| 11043 | uint8_t *buf_ptr; |
| 11044 | int32_t len = 0, args_tlv_len; |
| 11045 | int ret; |
| 11046 | int i = 0; |
| 11047 | A_UINT32 *node_config_args; |
| 11048 | |
| 11049 | args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(A_UINT32); |
| 11050 | len = sizeof(*cmd) + args_tlv_len; |
| 11051 | |
| 11052 | if ((param->args_count == 0)) { |
| 11053 | WMI_LOGE("%s: Can't send a command with %d arguments\n", |
| 11054 | __func__, param->args_count); |
| 11055 | return QDF_STATUS_E_FAILURE; |
| 11056 | } |
| 11057 | |
| 11058 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11059 | if (!buf) { |
| 11060 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11061 | return QDF_STATUS_E_NOMEM; |
| 11062 | } |
| 11063 | |
| 11064 | cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *) |
| 11065 | wmi_buf_data(buf); |
| 11066 | buf_ptr = (uint8_t *)cmd; |
| 11067 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11068 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param, |
| 11069 | WMITLV_GET_STRUCT_TLVLEN( |
| 11070 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param)); |
| 11071 | cmd->vdev_id = param->vdev_id; |
| 11072 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11073 | cmd->cmd_id = param->cmd_id; |
| 11074 | cmd->args_count = param->args_count; |
| 11075 | buf_ptr += sizeof( |
| 11076 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param); |
| 11077 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11078 | (cmd->args_count * sizeof(A_UINT32))); |
| 11079 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11080 | node_config_args = (A_UINT32 *)buf_ptr; |
| 11081 | |
| 11082 | for (i = 0; i < param->args_count; i++) { |
| 11083 | node_config_args[i] = param->args_arr[i]; |
| 11084 | WMI_LOGI("%d", param->args_arr[i]); |
| 11085 | } |
| 11086 | |
| 11087 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11088 | buf, |
| 11089 | len, |
| 11090 | WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID); |
| 11091 | |
| 11092 | if (ret != 0) { |
| 11093 | WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n", |
| 11094 | __func__, param->cmd_id, macaddr[0], |
| 11095 | macaddr[1], macaddr[2], macaddr[3], |
| 11096 | macaddr[4], macaddr[5], ret); |
| 11097 | wmi_buf_free(buf); |
| 11098 | } |
| 11099 | |
| 11100 | return ret; |
| 11101 | } |
| 11102 | |
| 11103 | /** |
| 11104 | * send_set_atf_cmd_tlv() - send set atf command to fw |
| 11105 | * @wmi_handle: wmi handle |
| 11106 | * @param: pointer to set atf param |
| 11107 | * |
| 11108 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11109 | */ |
| 11110 | static QDF_STATUS |
| 11111 | send_set_atf_cmd_tlv(wmi_unified_t wmi_handle, |
| 11112 | struct set_atf_params *param) |
| 11113 | { |
| 11114 | wmi_atf_peer_info *peer_info; |
| 11115 | wmi_peer_atf_request_fixed_param *cmd; |
| 11116 | wmi_buf_t buf; |
| 11117 | uint8_t *buf_ptr; |
| 11118 | int i; |
| 11119 | int32_t len = 0; |
| 11120 | QDF_STATUS retval; |
| 11121 | |
| 11122 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11123 | len += param->num_peers * sizeof(wmi_atf_peer_info); |
| 11124 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11125 | if (!buf) { |
| 11126 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11127 | return QDF_STATUS_E_FAILURE; |
| 11128 | } |
| 11129 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11130 | cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr; |
| 11131 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11132 | WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param, |
| 11133 | WMITLV_GET_STRUCT_TLVLEN( |
| 11134 | wmi_peer_atf_request_fixed_param)); |
| 11135 | cmd->num_peers = param->num_peers; |
| 11136 | |
| 11137 | buf_ptr += sizeof(*cmd); |
| 11138 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11139 | sizeof(wmi_atf_peer_info) * |
| 11140 | cmd->num_peers); |
| 11141 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11142 | peer_info = (wmi_atf_peer_info *)buf_ptr; |
| 11143 | |
| 11144 | for (i = 0; i < cmd->num_peers; i++) { |
| 11145 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 11146 | WMITLV_TAG_STRUC_wmi_atf_peer_info, |
| 11147 | WMITLV_GET_STRUCT_TLVLEN( |
| 11148 | wmi_atf_peer_info)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11149 | qdf_mem_copy(&(peer_info->peer_macaddr), |
| 11150 | &(param->peer_info[i].peer_macaddr), |
| 11151 | sizeof(wmi_mac_addr)); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11152 | peer_info->atf_units = param->peer_info[i].percentage_peer; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11153 | peer_info->vdev_id = param->peer_info[i].vdev_id; |
| 11154 | peer_info->pdev_id = |
| 11155 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11156 | param->peer_info[i].pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11157 | /* |
| 11158 | * TLV definition for peer atf request fixed param combines |
| 11159 | * extension stats. Legacy FW for WIN (Non-TLV) has peer atf |
| 11160 | * stats and atf extension stats as two different |
| 11161 | * implementations. |
| 11162 | * Need to discuss with FW on this. |
| 11163 | * |
| 11164 | * peer_info->atf_groupid = param->peer_ext_info[i].group_index; |
| 11165 | * peer_info->atf_units_reserved = |
| 11166 | * param->peer_ext_info[i].atf_index_reserved; |
| 11167 | */ |
| 11168 | peer_info++; |
| 11169 | } |
| 11170 | |
| 11171 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11172 | WMI_PEER_ATF_REQUEST_CMDID); |
| 11173 | |
| 11174 | if (retval != QDF_STATUS_SUCCESS) { |
| 11175 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11176 | wmi_buf_free(buf); |
| 11177 | } |
| 11178 | |
| 11179 | return retval; |
| 11180 | } |
| 11181 | |
| 11182 | /** |
| 11183 | * send_vdev_set_fwtest_param_cmd_tlv() - send fwtest param in fw |
| 11184 | * @wmi_handle: wmi handle |
| 11185 | * @param: pointer to hold fwtest param |
| 11186 | * |
| 11187 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11188 | */ |
| 11189 | static QDF_STATUS send_vdev_set_fwtest_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 11190 | struct set_fwtest_params *param) |
| 11191 | { |
| 11192 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 11193 | wmi_buf_t buf; |
| 11194 | int32_t len = sizeof(*cmd); |
| 11195 | |
| 11196 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11197 | |
| 11198 | if (!buf) { |
| 11199 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11200 | return QDF_STATUS_E_FAILURE; |
| 11201 | } |
| 11202 | |
| 11203 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 11204 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11205 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 11206 | WMITLV_GET_STRUCT_TLVLEN( |
| 11207 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 11208 | cmd->param_id = param->arg; |
| 11209 | cmd->param_value = param->value; |
| 11210 | |
| 11211 | if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FWTEST_CMDID)) { |
| 11212 | WMI_LOGE("Setting FW test param failed\n"); |
| 11213 | wmi_buf_free(buf); |
| 11214 | return QDF_STATUS_E_FAILURE; |
| 11215 | } |
| 11216 | |
| 11217 | return QDF_STATUS_SUCCESS; |
| 11218 | } |
| 11219 | |
| 11220 | /** |
| 11221 | * send_set_qboost_param_cmd_tlv() - send set qboost command to fw |
| 11222 | * @wmi_handle: wmi handle |
| 11223 | * @param: pointer to qboost params |
| 11224 | * @macaddr: vdev mac address |
| 11225 | * |
| 11226 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11227 | */ |
| 11228 | static QDF_STATUS |
| 11229 | send_set_qboost_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 11230 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11231 | struct set_qboost_params *param) |
| 11232 | { |
| 11233 | WMI_QBOOST_CFG_CMD_fixed_param *cmd; |
| 11234 | wmi_buf_t buf; |
| 11235 | int32_t len; |
| 11236 | QDF_STATUS ret; |
| 11237 | |
| 11238 | len = sizeof(*cmd); |
| 11239 | |
| 11240 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11241 | if (!buf) { |
| 11242 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11243 | return QDF_STATUS_E_FAILURE; |
| 11244 | } |
| 11245 | |
| 11246 | cmd = (WMI_QBOOST_CFG_CMD_fixed_param *)wmi_buf_data(buf); |
| 11247 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11248 | WMITLV_TAG_STRUC_WMI_QBOOST_CFG_CMD_fixed_param, |
| 11249 | WMITLV_GET_STRUCT_TLVLEN( |
| 11250 | WMI_QBOOST_CFG_CMD_fixed_param)); |
| 11251 | cmd->vdev_id = param->vdev_id; |
| 11252 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11253 | cmd->qb_enable = param->value; |
| 11254 | |
| 11255 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11256 | WMI_QBOOST_CFG_CMDID); |
| 11257 | |
| 11258 | if (ret != 0) { |
| 11259 | WMI_LOGE("Setting qboost cmd failed\n"); |
| 11260 | wmi_buf_free(buf); |
| 11261 | } |
| 11262 | |
| 11263 | return ret; |
| 11264 | } |
| 11265 | |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 11266 | /** |
| 11267 | * send_gpio_config_cmd_tlv() - send gpio config to fw |
| 11268 | * @wmi_handle: wmi handle |
| 11269 | * @param: pointer to hold gpio config param |
| 11270 | * |
| 11271 | * Return: 0 for success or error code |
| 11272 | */ |
| 11273 | static QDF_STATUS |
| 11274 | send_gpio_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 11275 | struct gpio_config_params *param) |
| 11276 | { |
| 11277 | wmi_gpio_config_cmd_fixed_param *cmd; |
| 11278 | wmi_buf_t buf; |
| 11279 | int32_t len; |
| 11280 | QDF_STATUS ret; |
| 11281 | |
| 11282 | len = sizeof(*cmd); |
| 11283 | |
| 11284 | /* Sanity Checks */ |
| 11285 | if (param->pull_type > WMI_GPIO_PULL_DOWN || |
| 11286 | param->intr_mode > WMI_GPIO_INTTYPE_LEVEL_HIGH) { |
| 11287 | return QDF_STATUS_E_FAILURE; |
| 11288 | } |
| 11289 | |
| 11290 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11291 | if (!buf) { |
| 11292 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11293 | return QDF_STATUS_E_FAILURE; |
| 11294 | } |
| 11295 | |
| 11296 | cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 11297 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11298 | WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param, |
| 11299 | WMITLV_GET_STRUCT_TLVLEN( |
| 11300 | wmi_gpio_config_cmd_fixed_param)); |
| 11301 | cmd->gpio_num = param->gpio_num; |
| 11302 | cmd->input = param->input; |
| 11303 | cmd->pull_type = param->pull_type; |
| 11304 | cmd->intr_mode = param->intr_mode; |
| 11305 | |
| 11306 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11307 | WMI_GPIO_CONFIG_CMDID); |
| 11308 | |
| 11309 | if (ret != 0) { |
| 11310 | WMI_LOGE("Sending GPIO config cmd failed\n"); |
| 11311 | wmi_buf_free(buf); |
| 11312 | } |
| 11313 | |
| 11314 | return ret; |
| 11315 | } |
| 11316 | |
| 11317 | /** |
| 11318 | * send_gpio_output_cmd_tlv() - send gpio output to fw |
| 11319 | * @wmi_handle: wmi handle |
| 11320 | * @param: pointer to hold gpio output param |
| 11321 | * |
| 11322 | * Return: 0 for success or error code |
| 11323 | */ |
| 11324 | static QDF_STATUS |
| 11325 | send_gpio_output_cmd_tlv(wmi_unified_t wmi_handle, |
| 11326 | struct gpio_output_params *param) |
| 11327 | { |
| 11328 | wmi_gpio_output_cmd_fixed_param *cmd; |
| 11329 | wmi_buf_t buf; |
| 11330 | int32_t len; |
| 11331 | QDF_STATUS ret; |
| 11332 | |
| 11333 | len = sizeof(*cmd); |
| 11334 | |
| 11335 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11336 | if (!buf) { |
| 11337 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11338 | return QDF_STATUS_E_FAILURE; |
| 11339 | } |
| 11340 | |
| 11341 | cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf); |
| 11342 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11343 | WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param, |
| 11344 | WMITLV_GET_STRUCT_TLVLEN( |
| 11345 | wmi_gpio_output_cmd_fixed_param)); |
| 11346 | cmd->gpio_num = param->gpio_num; |
| 11347 | cmd->set = param->set; |
| 11348 | |
| 11349 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11350 | WMI_GPIO_OUTPUT_CMDID); |
| 11351 | |
| 11352 | if (ret != 0) { |
| 11353 | WMI_LOGE("Sending GPIO output cmd failed\n"); |
| 11354 | wmi_buf_free(buf); |
| 11355 | } |
| 11356 | |
| 11357 | return ret; |
| 11358 | |
| 11359 | } |
| 11360 | |
| 11361 | /** |
| 11362 | * send_phyerr_disable_cmd_tlv() - WMI phyerr disable function |
| 11363 | * |
| 11364 | * @param wmi_handle : handle to WMI. |
| 11365 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11366 | */ |
| 11367 | static QDF_STATUS send_phyerr_disable_cmd_tlv(wmi_unified_t wmi_handle) |
| 11368 | { |
| 11369 | wmi_pdev_dfs_disable_cmd_fixed_param *cmd; |
| 11370 | wmi_buf_t buf; |
| 11371 | QDF_STATUS ret; |
| 11372 | int32_t len; |
| 11373 | |
| 11374 | len = sizeof(*cmd); |
| 11375 | |
| 11376 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11377 | if (!buf) { |
| 11378 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11379 | return QDF_STATUS_E_FAILURE; |
| 11380 | } |
| 11381 | |
| 11382 | cmd = (wmi_pdev_dfs_disable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11383 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11384 | WMITLV_TAG_STRUC_wmi_pdev_dfs_disable_cmd_fixed_param, |
| 11385 | WMITLV_GET_STRUCT_TLVLEN( |
| 11386 | wmi_pdev_dfs_disable_cmd_fixed_param)); |
| 11387 | /* Filling it with WMI_PDEV_ID_SOC for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11388 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11389 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 11390 | |
| 11391 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11392 | WMI_PDEV_DFS_DISABLE_CMDID); |
| 11393 | |
| 11394 | if (ret != 0) { |
| 11395 | WMI_LOGE("Sending PDEV DFS disable cmd failed\n"); |
| 11396 | wmi_buf_free(buf); |
| 11397 | } |
| 11398 | |
| 11399 | return ret; |
| 11400 | } |
| 11401 | |
| 11402 | /** |
| 11403 | * send_phyerr_enable_cmd_tlv() - WMI phyerr disable function |
| 11404 | * |
| 11405 | * @param wmi_handle : handle to WMI. |
| 11406 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11407 | */ |
| 11408 | static QDF_STATUS send_phyerr_enable_cmd_tlv(wmi_unified_t wmi_handle) |
| 11409 | { |
| 11410 | wmi_pdev_dfs_enable_cmd_fixed_param *cmd; |
| 11411 | wmi_buf_t buf; |
| 11412 | QDF_STATUS ret; |
| 11413 | int32_t len; |
| 11414 | |
| 11415 | len = sizeof(*cmd); |
| 11416 | |
| 11417 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11418 | if (!buf) { |
| 11419 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11420 | return QDF_STATUS_E_FAILURE; |
| 11421 | } |
| 11422 | |
| 11423 | cmd = (wmi_pdev_dfs_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11424 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11425 | WMITLV_TAG_STRUC_wmi_pdev_dfs_enable_cmd_fixed_param, |
| 11426 | WMITLV_GET_STRUCT_TLVLEN( |
| 11427 | wmi_pdev_dfs_enable_cmd_fixed_param)); |
| 11428 | /* Reserved for future use */ |
| 11429 | cmd->reserved0 = 0; |
| 11430 | |
| 11431 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11432 | WMI_PDEV_DFS_ENABLE_CMDID); |
| 11433 | |
| 11434 | if (ret != 0) { |
| 11435 | WMI_LOGE("Sending PDEV DFS enable cmd failed\n"); |
| 11436 | wmi_buf_free(buf); |
| 11437 | } |
| 11438 | |
| 11439 | return ret; |
| 11440 | } |
| 11441 | |
| 11442 | /** |
| 11443 | * send_nf_dbr_dbm_info_get_cmd_tlv() - send request to get nf to fw |
| 11444 | * @wmi_handle: wmi handle |
| 11445 | * |
| 11446 | * Return: 0 for success or error code |
| 11447 | */ |
| 11448 | static QDF_STATUS |
| 11449 | send_nf_dbr_dbm_info_get_cmd_tlv(wmi_unified_t wmi_handle) |
| 11450 | { |
| 11451 | wmi_buf_t buf; |
| 11452 | QDF_STATUS ret; |
| 11453 | |
| 11454 | buf = wmi_buf_alloc(wmi_handle, 0); |
| 11455 | if (buf == NULL) |
| 11456 | return QDF_STATUS_E_NOMEM; |
| 11457 | |
| 11458 | ret = wmi_unified_cmd_send(wmi_handle, buf, 0, |
| 11459 | WMI_PDEV_GET_NFCAL_POWER_CMDID); |
| 11460 | if (ret != 0) { |
| 11461 | WMI_LOGE("Sending get nfcal power cmd failed\n"); |
| 11462 | wmi_buf_free(buf); |
| 11463 | } |
| 11464 | |
| 11465 | return ret; |
| 11466 | } |
| 11467 | |
| 11468 | /** |
| 11469 | * send_set_ht_ie_cmd_tlv() - send ht ie command to fw |
| 11470 | * @wmi_handle: wmi handle |
| 11471 | * @param: pointer to ht ie param |
| 11472 | * |
| 11473 | * Return: 0 for success or error code |
| 11474 | */ |
| 11475 | static QDF_STATUS |
| 11476 | send_set_ht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 11477 | struct ht_ie_params *param) |
| 11478 | { |
| 11479 | wmi_pdev_set_ht_ie_cmd_fixed_param *cmd; |
| 11480 | wmi_buf_t buf; |
| 11481 | QDF_STATUS ret; |
| 11482 | int32_t len; |
| 11483 | uint8_t *buf_ptr; |
| 11484 | |
| 11485 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11486 | roundup(param->ie_len, sizeof(uint32_t)); |
| 11487 | |
| 11488 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11489 | if (!buf) { |
| 11490 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11491 | return QDF_STATUS_E_FAILURE; |
| 11492 | } |
| 11493 | |
| 11494 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11495 | cmd = (wmi_pdev_set_ht_ie_cmd_fixed_param *)buf_ptr; |
| 11496 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11497 | WMITLV_TAG_STRUC_wmi_pdev_set_ht_ie_cmd_fixed_param, |
| 11498 | WMITLV_GET_STRUCT_TLVLEN( |
| 11499 | wmi_pdev_set_ht_ie_cmd_fixed_param)); |
| 11500 | cmd->reserved0 = 0; |
| 11501 | cmd->ie_len = param->ie_len; |
| 11502 | cmd->tx_streams = param->tx_streams; |
| 11503 | cmd->rx_streams = param->rx_streams; |
| 11504 | |
| 11505 | buf_ptr += sizeof(*cmd); |
| 11506 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 11507 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11508 | if (param->ie_len) |
| 11509 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 11510 | cmd->ie_len); |
| 11511 | |
| 11512 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11513 | WMI_PDEV_SET_HT_CAP_IE_CMDID); |
| 11514 | |
| 11515 | if (ret != 0) { |
| 11516 | WMI_LOGE("Sending set ht ie cmd failed\n"); |
| 11517 | wmi_buf_free(buf); |
| 11518 | } |
| 11519 | |
| 11520 | return ret; |
| 11521 | } |
| 11522 | |
| 11523 | /** |
| 11524 | * send_set_vht_ie_cmd_tlv() - send vht ie command to fw |
| 11525 | * @wmi_handle: wmi handle |
| 11526 | * @param: pointer to vht ie param |
| 11527 | * |
| 11528 | * Return: 0 for success or error code |
| 11529 | */ |
| 11530 | static QDF_STATUS |
| 11531 | send_set_vht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 11532 | struct vht_ie_params *param) |
| 11533 | { |
| 11534 | wmi_pdev_set_vht_ie_cmd_fixed_param *cmd; |
| 11535 | wmi_buf_t buf; |
| 11536 | QDF_STATUS ret; |
| 11537 | int32_t len; |
| 11538 | uint8_t *buf_ptr; |
| 11539 | |
| 11540 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11541 | roundup(param->ie_len, sizeof(uint32_t)); |
| 11542 | |
| 11543 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11544 | if (!buf) { |
| 11545 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11546 | return QDF_STATUS_E_FAILURE; |
| 11547 | } |
| 11548 | |
| 11549 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11550 | cmd = (wmi_pdev_set_vht_ie_cmd_fixed_param *)buf_ptr; |
| 11551 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11552 | WMITLV_TAG_STRUC_wmi_pdev_set_vht_ie_cmd_fixed_param, |
| 11553 | WMITLV_GET_STRUCT_TLVLEN( |
| 11554 | wmi_pdev_set_vht_ie_cmd_fixed_param)); |
| 11555 | cmd->reserved0 = 0; |
| 11556 | cmd->ie_len = param->ie_len; |
| 11557 | cmd->tx_streams = param->tx_streams; |
| 11558 | cmd->rx_streams = param->rx_streams; |
| 11559 | |
| 11560 | buf_ptr += sizeof(*cmd); |
| 11561 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 11562 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11563 | if (param->ie_len) |
| 11564 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 11565 | cmd->ie_len); |
| 11566 | |
| 11567 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11568 | WMI_PDEV_SET_VHT_CAP_IE_CMDID); |
| 11569 | |
| 11570 | if (ret != 0) { |
| 11571 | WMI_LOGE("Sending set vht ie cmd failed\n"); |
| 11572 | wmi_buf_free(buf); |
| 11573 | } |
| 11574 | |
| 11575 | return ret; |
| 11576 | } |
| 11577 | |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11578 | /** |
| 11579 | * send_set_quiet_mode_cmd_tlv() - send set quiet mode command to fw |
| 11580 | * @wmi_handle: wmi handle |
| 11581 | * @param: pointer to quiet mode params |
| 11582 | * |
| 11583 | * Return: 0 for success or error code |
| 11584 | */ |
| 11585 | static QDF_STATUS |
| 11586 | send_set_quiet_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 11587 | struct set_quiet_mode_params *param) |
| 11588 | { |
| 11589 | wmi_pdev_set_quiet_cmd_fixed_param *quiet_cmd; |
| 11590 | wmi_buf_t buf; |
| 11591 | QDF_STATUS ret; |
| 11592 | int32_t len; |
| 11593 | |
| 11594 | len = sizeof(*quiet_cmd); |
| 11595 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11596 | if (!buf) { |
| 11597 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11598 | return QDF_STATUS_E_FAILURE; |
| 11599 | } |
| 11600 | |
| 11601 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 11602 | WMITLV_SET_HDR(&quiet_cmd->tlv_header, |
| 11603 | WMITLV_TAG_STRUC_wmi_pdev_set_quiet_cmd_fixed_param, |
| 11604 | WMITLV_GET_STRUCT_TLVLEN( |
| 11605 | wmi_pdev_set_quiet_cmd_fixed_param)); |
| 11606 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 11607 | quiet_cmd->enabled = param->enabled; |
| 11608 | quiet_cmd->period = (param->period)*(param->intval); |
| 11609 | quiet_cmd->duration = param->duration; |
| 11610 | quiet_cmd->next_start = param->offset; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11611 | quiet_cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11612 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11613 | |
| 11614 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11615 | WMI_PDEV_SET_QUIET_MODE_CMDID); |
| 11616 | |
| 11617 | if (ret != 0) { |
| 11618 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 11619 | wmi_buf_free(buf); |
| 11620 | } |
| 11621 | |
| 11622 | return ret; |
| 11623 | } |
| 11624 | |
| 11625 | /** |
| 11626 | * send_set_bwf_cmd_tlv() - send set bwf command to fw |
| 11627 | * @wmi_handle: wmi handle |
| 11628 | * @param: pointer to set bwf param |
| 11629 | * |
| 11630 | * Return: 0 for success or error code |
| 11631 | */ |
| 11632 | static QDF_STATUS |
| 11633 | send_set_bwf_cmd_tlv(wmi_unified_t wmi_handle, |
| 11634 | struct set_bwf_params *param) |
| 11635 | { |
| 11636 | wmi_bwf_peer_info *peer_info; |
| 11637 | wmi_peer_bwf_request_fixed_param *cmd; |
| 11638 | wmi_buf_t buf; |
| 11639 | QDF_STATUS retval; |
| 11640 | int32_t len; |
| 11641 | uint8_t *buf_ptr; |
| 11642 | int i; |
| 11643 | |
| 11644 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11645 | len += param->num_peers * sizeof(wmi_bwf_peer_info); |
| 11646 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11647 | if (!buf) { |
| 11648 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11649 | return QDF_STATUS_E_FAILURE; |
| 11650 | } |
| 11651 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11652 | cmd = (wmi_peer_bwf_request_fixed_param *)buf_ptr; |
| 11653 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11654 | WMITLV_TAG_STRUC_wmi_peer_bwf_request_fixed_param, |
| 11655 | WMITLV_GET_STRUCT_TLVLEN( |
| 11656 | wmi_peer_bwf_request_fixed_param)); |
| 11657 | cmd->num_peers = param->num_peers; |
| 11658 | |
| 11659 | buf_ptr += sizeof(*cmd); |
| 11660 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11661 | sizeof(wmi_bwf_peer_info) * |
| 11662 | cmd->num_peers); |
| 11663 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11664 | peer_info = (wmi_bwf_peer_info *)buf_ptr; |
| 11665 | |
| 11666 | for (i = 0; i < cmd->num_peers; i++) { |
| 11667 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 11668 | WMITLV_TAG_STRUC_wmi_bwf_peer_info, |
| 11669 | WMITLV_GET_STRUCT_TLVLEN(wmi_bwf_peer_info)); |
| 11670 | peer_info->bwf_guaranteed_bandwidth = |
| 11671 | param->peer_info[i].throughput; |
| 11672 | peer_info->bwf_max_airtime = |
| 11673 | param->peer_info[i].max_airtime; |
| 11674 | peer_info->bwf_peer_priority = |
| 11675 | param->peer_info[i].priority; |
| 11676 | qdf_mem_copy(&peer_info->peer_macaddr, |
| 11677 | ¶m->peer_info[i].peer_macaddr, |
| 11678 | sizeof(param->peer_info[i].peer_macaddr)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11679 | peer_info->vdev_id = |
| 11680 | param->peer_info[i].vdev_id; |
| 11681 | peer_info->pdev_id = |
| 11682 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11683 | param->peer_info[i].pdev_id); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11684 | peer_info++; |
| 11685 | } |
| 11686 | |
| 11687 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11688 | WMI_PEER_BWF_REQUEST_CMDID); |
| 11689 | |
| 11690 | if (retval != QDF_STATUS_SUCCESS) { |
| 11691 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11692 | wmi_buf_free(buf); |
| 11693 | } |
| 11694 | |
| 11695 | return retval; |
| 11696 | } |
| 11697 | |
| 11698 | /** |
| 11699 | * send_mcast_group_update_cmd_tlv() - send mcast group update cmd to fw |
| 11700 | * @wmi_handle: wmi handle |
| 11701 | * @param: pointer to hold mcast update param |
| 11702 | * |
| 11703 | * Return: 0 for success or error code |
| 11704 | */ |
| 11705 | static QDF_STATUS |
| 11706 | send_mcast_group_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 11707 | struct mcast_group_update_params *param) |
| 11708 | { |
| 11709 | wmi_peer_mcast_group_cmd_fixed_param *cmd; |
| 11710 | wmi_buf_t buf; |
| 11711 | QDF_STATUS ret; |
| 11712 | int32_t len; |
| 11713 | int offset = 0; |
| 11714 | static char dummymask[4] = { 0xFF, 0xFF, 0xFF, 0xFF}; |
| 11715 | |
| 11716 | len = sizeof(*cmd); |
| 11717 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11718 | if (!buf) { |
| 11719 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11720 | return QDF_STATUS_E_FAILURE; |
| 11721 | } |
| 11722 | cmd = (wmi_peer_mcast_group_cmd_fixed_param *)wmi_buf_data(buf); |
| 11723 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11724 | WMITLV_TAG_STRUC_wmi_peer_mcast_group_cmd_fixed_param, |
| 11725 | WMITLV_GET_STRUCT_TLVLEN( |
| 11726 | wmi_peer_mcast_group_cmd_fixed_param)); |
| 11727 | /* confirm the buffer is 4-byte aligned */ |
| 11728 | QDF_ASSERT((((size_t) cmd) & 0x3) == 0); |
| 11729 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 11730 | |
| 11731 | cmd->vdev_id = param->vap_id; |
| 11732 | /* construct the message assuming our endianness matches the target */ |
| 11733 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_ACTION_M & |
| 11734 | (param->action << WMI_PEER_MCAST_GROUP_FLAG_ACTION_S); |
| 11735 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_M & |
| 11736 | (param->wildcard << WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_S); |
| 11737 | if (param->is_action_delete) |
| 11738 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_DELETEALL_M; |
| 11739 | |
| 11740 | if (param->is_mcast_addr_len) |
| 11741 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_IPV6_M; |
| 11742 | |
| 11743 | if (param->is_filter_mode_snoop) |
| 11744 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_SRC_FILTER_EXCLUDE_M; |
| 11745 | |
| 11746 | /* unicast address spec only applies for non-wildcard cases */ |
| 11747 | if (!param->wildcard && param->ucast_mac_addr) { |
| 11748 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->ucast_mac_addr, |
| 11749 | &cmd->ucast_mac_addr); |
| 11750 | } |
| 11751 | if (param->mcast_ip_addr) { |
| 11752 | QDF_ASSERT(param->mcast_ip_addr_bytes <= |
| 11753 | sizeof(cmd->mcast_ip_addr)); |
| 11754 | offset = sizeof(cmd->mcast_ip_addr) - |
| 11755 | param->mcast_ip_addr_bytes; |
| 11756 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_addr) + offset, |
| 11757 | param->mcast_ip_addr, |
| 11758 | param->mcast_ip_addr_bytes); |
| 11759 | } |
| 11760 | if (!param->mask) |
| 11761 | param->mask = &dummymask[0]; |
| 11762 | |
| 11763 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_mask) + offset, |
| 11764 | param->mask, |
| 11765 | param->mcast_ip_addr_bytes); |
| 11766 | |
| 11767 | if (param->srcs && param->nsrcs) { |
| 11768 | cmd->num_filter_addr = param->nsrcs; |
| 11769 | QDF_ASSERT((param->nsrcs * param->mcast_ip_addr_bytes) <= |
| 11770 | sizeof(cmd->filter_addr)); |
| 11771 | |
| 11772 | qdf_mem_copy(((uint8_t *) &cmd->filter_addr), param->srcs, |
| 11773 | param->nsrcs * param->mcast_ip_addr_bytes); |
| 11774 | } |
| 11775 | |
| 11776 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11777 | WMI_PEER_MCAST_GROUP_CMDID); |
| 11778 | |
| 11779 | if (ret != QDF_STATUS_SUCCESS) { |
| 11780 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11781 | wmi_buf_free(buf); |
| 11782 | } |
| 11783 | |
| 11784 | return ret; |
| 11785 | } |
| 11786 | |
| 11787 | /** |
| 11788 | * send_vdev_spectral_configure_cmd_tlv() - send VDEV spectral configure |
| 11789 | * command to fw |
| 11790 | * @wmi_handle: wmi handle |
| 11791 | * @param: pointer to hold spectral config parameter |
| 11792 | * |
| 11793 | * Return: 0 for success or error code |
| 11794 | */ |
| 11795 | static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle, |
| 11796 | struct vdev_spectral_configure_params *param) |
| 11797 | { |
| 11798 | wmi_vdev_spectral_configure_cmd_fixed_param *cmd; |
| 11799 | wmi_buf_t buf; |
| 11800 | QDF_STATUS ret; |
| 11801 | int32_t len; |
| 11802 | |
| 11803 | len = sizeof(*cmd); |
| 11804 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11805 | if (!buf) { |
| 11806 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11807 | return QDF_STATUS_E_FAILURE; |
| 11808 | } |
| 11809 | |
| 11810 | cmd = (wmi_vdev_spectral_configure_cmd_fixed_param *)wmi_buf_data(buf); |
| 11811 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11812 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param, |
| 11813 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 11814 | wmi_vdev_spectral_configure_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11815 | |
| 11816 | cmd->vdev_id = param->vdev_id; |
| 11817 | cmd->spectral_scan_count = param->count; |
| 11818 | cmd->spectral_scan_period = param->period; |
| 11819 | cmd->spectral_scan_priority = param->spectral_pri; |
| 11820 | cmd->spectral_scan_fft_size = param->fft_size; |
| 11821 | cmd->spectral_scan_gc_ena = param->gc_enable; |
| 11822 | cmd->spectral_scan_restart_ena = param->restart_enable; |
| 11823 | cmd->spectral_scan_noise_floor_ref = param->noise_floor_ref; |
| 11824 | cmd->spectral_scan_init_delay = param->init_delay; |
| 11825 | cmd->spectral_scan_nb_tone_thr = param->nb_tone_thr; |
| 11826 | cmd->spectral_scan_str_bin_thr = param->str_bin_thr; |
| 11827 | cmd->spectral_scan_wb_rpt_mode = param->wb_rpt_mode; |
| 11828 | cmd->spectral_scan_rssi_rpt_mode = param->rssi_rpt_mode; |
| 11829 | cmd->spectral_scan_rssi_thr = param->rssi_thr; |
| 11830 | cmd->spectral_scan_pwr_format = param->pwr_format; |
| 11831 | cmd->spectral_scan_rpt_mode = param->rpt_mode; |
| 11832 | cmd->spectral_scan_bin_scale = param->bin_scale; |
| 11833 | cmd->spectral_scan_dBm_adj = param->dBm_adj; |
| 11834 | cmd->spectral_scan_chn_mask = param->chn_mask; |
| 11835 | |
| 11836 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11837 | WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID); |
| 11838 | |
| 11839 | if (ret != 0) { |
| 11840 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 11841 | wmi_buf_free(buf); |
| 11842 | } |
| 11843 | |
| 11844 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID\n", |
| 11845 | __func__); |
| 11846 | |
| 11847 | WMI_LOGI("vdev_id = %u\n" |
| 11848 | "spectral_scan_count = %u\n" |
| 11849 | "spectral_scan_period = %u\n" |
| 11850 | "spectral_scan_priority = %u\n" |
| 11851 | "spectral_scan_fft_size = %u\n" |
| 11852 | "spectral_scan_gc_ena = %u\n" |
| 11853 | "spectral_scan_restart_ena = %u\n" |
| 11854 | "spectral_scan_noise_floor_ref = %u\n" |
| 11855 | "spectral_scan_init_delay = %u\n" |
| 11856 | "spectral_scan_nb_tone_thr = %u\n" |
| 11857 | "spectral_scan_str_bin_thr = %u\n" |
| 11858 | "spectral_scan_wb_rpt_mode = %u\n" |
| 11859 | "spectral_scan_rssi_rpt_mode = %u\n" |
| 11860 | "spectral_scan_rssi_thr = %u\n" |
| 11861 | "spectral_scan_pwr_format = %u\n" |
| 11862 | "spectral_scan_rpt_mode = %u\n" |
| 11863 | "spectral_scan_bin_scale = %u\n" |
| 11864 | "spectral_scan_dBm_adj = %u\n" |
| 11865 | "spectral_scan_chn_mask = %u\n", |
| 11866 | param->vdev_id, |
| 11867 | param->count, |
| 11868 | param->period, |
| 11869 | param->spectral_pri, |
| 11870 | param->fft_size, |
| 11871 | param->gc_enable, |
| 11872 | param->restart_enable, |
| 11873 | param->noise_floor_ref, |
| 11874 | param->init_delay, |
| 11875 | param->nb_tone_thr, |
| 11876 | param->str_bin_thr, |
| 11877 | param->wb_rpt_mode, |
| 11878 | param->rssi_rpt_mode, |
| 11879 | param->rssi_thr, |
| 11880 | param->pwr_format, |
| 11881 | param->rpt_mode, |
| 11882 | param->bin_scale, |
| 11883 | param->dBm_adj, |
| 11884 | param->chn_mask); |
| 11885 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 11886 | |
| 11887 | return ret; |
| 11888 | } |
| 11889 | |
| 11890 | /** |
| 11891 | * send_vdev_spectral_enable_cmd_tlv() - send VDEV spectral configure |
| 11892 | * command to fw |
| 11893 | * @wmi_handle: wmi handle |
| 11894 | * @param: pointer to hold spectral enable parameter |
| 11895 | * |
| 11896 | * Return: 0 for success or error code |
| 11897 | */ |
| 11898 | static QDF_STATUS send_vdev_spectral_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 11899 | struct vdev_spectral_enable_params *param) |
| 11900 | { |
| 11901 | wmi_vdev_spectral_enable_cmd_fixed_param *cmd; |
| 11902 | wmi_buf_t buf; |
| 11903 | QDF_STATUS ret; |
| 11904 | int32_t len; |
| 11905 | |
| 11906 | len = sizeof(*cmd); |
| 11907 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11908 | if (!buf) { |
| 11909 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11910 | return QDF_STATUS_E_FAILURE; |
| 11911 | } |
| 11912 | |
| 11913 | cmd = (wmi_vdev_spectral_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11914 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11915 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param, |
| 11916 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 11917 | wmi_vdev_spectral_enable_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11918 | |
| 11919 | cmd->vdev_id = param->vdev_id; |
| 11920 | |
| 11921 | if (param->active_valid) { |
| 11922 | cmd->trigger_cmd = param->active ? 1 : 2; |
| 11923 | /* 1: Trigger, 2: Clear Trigger */ |
| 11924 | } else { |
| 11925 | cmd->trigger_cmd = 0; /* 0: Ignore */ |
| 11926 | } |
| 11927 | |
| 11928 | if (param->enabled_valid) { |
| 11929 | cmd->enable_cmd = param->enabled ? 1 : 2; |
| 11930 | /* 1: Enable 2: Disable */ |
| 11931 | } else { |
| 11932 | cmd->enable_cmd = 0; /* 0: Ignore */ |
| 11933 | } |
| 11934 | |
| 11935 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11936 | WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID); |
| 11937 | |
| 11938 | if (ret != 0) { |
| 11939 | WMI_LOGE("Sending scan enable CMD failed\n"); |
| 11940 | wmi_buf_free(buf); |
| 11941 | } |
| 11942 | |
| 11943 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID\n", __func__); |
| 11944 | |
| 11945 | WMI_LOGI("vdev_id = %u\n" |
| 11946 | "trigger_cmd = %u\n" |
| 11947 | "enable_cmd = %u\n", |
| 11948 | cmd->vdev_id, |
| 11949 | cmd->trigger_cmd, |
| 11950 | cmd->enable_cmd); |
| 11951 | |
| 11952 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 11953 | |
| 11954 | return ret; |
| 11955 | } |
| 11956 | |
| 11957 | /** |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11958 | * send_thermal_mitigation_param_cmd_tlv() - configure thermal mitigation params |
| 11959 | * @param wmi_handle : handle to WMI. |
| 11960 | * @param param : pointer to hold thermal mitigation param |
| 11961 | * |
| 11962 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11963 | */ |
| 11964 | static QDF_STATUS send_thermal_mitigation_param_cmd_tlv( |
| 11965 | wmi_unified_t wmi_handle, |
| 11966 | struct thermal_mitigation_params *param) |
| 11967 | { |
| 11968 | wmi_therm_throt_config_request_fixed_param *tt_conf = NULL; |
| 11969 | wmi_therm_throt_level_config_info *lvl_conf = NULL; |
| 11970 | wmi_buf_t buf = NULL; |
| 11971 | uint8_t *buf_ptr = NULL; |
| 11972 | int error; |
| 11973 | int32_t len; |
| 11974 | int i; |
| 11975 | |
| 11976 | len = sizeof(*tt_conf) + WMI_TLV_HDR_SIZE + |
| 11977 | THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info); |
| 11978 | |
| 11979 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11980 | if (!buf) { |
| 11981 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 11982 | return QDF_STATUS_E_NOMEM; |
| 11983 | } |
| 11984 | tt_conf = (wmi_therm_throt_config_request_fixed_param *) wmi_buf_data(buf); |
| 11985 | |
| 11986 | /* init fixed params */ |
| 11987 | WMITLV_SET_HDR(tt_conf, |
| 11988 | WMITLV_TAG_STRUC_wmi_therm_throt_config_request_fixed_param, |
| 11989 | (WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_config_request_fixed_param))); |
| 11990 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11991 | tt_conf->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11992 | param->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11993 | tt_conf->enable = param->enable; |
| 11994 | tt_conf->dc = param->dc; |
| 11995 | tt_conf->dc_per_event = param->dc_per_event; |
| 11996 | tt_conf->therm_throt_levels = THERMAL_LEVELS; |
| 11997 | |
| 11998 | buf_ptr = (uint8_t *) ++tt_conf; |
| 11999 | /* init TLV params */ |
| 12000 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12001 | (THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info))); |
| 12002 | |
| 12003 | lvl_conf = (wmi_therm_throt_level_config_info *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12004 | for (i = 0; i < THERMAL_LEVELS; i++) { |
| 12005 | WMITLV_SET_HDR(&lvl_conf->tlv_header, |
| 12006 | WMITLV_TAG_STRUC_wmi_therm_throt_level_config_info, |
| 12007 | WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_level_config_info)); |
| 12008 | lvl_conf->temp_lwm = param->levelconf[i].tmplwm; |
| 12009 | lvl_conf->temp_hwm = param->levelconf[i].tmphwm; |
| 12010 | lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; |
| 12011 | lvl_conf->prio = param->levelconf[i].priority; |
| 12012 | lvl_conf++; |
| 12013 | } |
| 12014 | |
| 12015 | error = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12016 | WMI_THERM_THROT_SET_CONF_CMDID); |
| 12017 | if (QDF_IS_STATUS_ERROR(error)) { |
| 12018 | wmi_buf_free(buf); |
| 12019 | WMI_LOGE("Failed to send WMI_THERM_THROT_SET_CONF_CMDID command"); |
| 12020 | } |
| 12021 | |
| 12022 | return error; |
| 12023 | } |
| 12024 | |
| 12025 | /** |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12026 | * send_pdev_qvit_cmd_tlv() - send qvit command to fw |
| 12027 | * @wmi_handle: wmi handle |
| 12028 | * @param: pointer to pdev_qvit_params |
| 12029 | * |
| 12030 | * Return: 0 for success or error code |
| 12031 | */ |
| 12032 | static QDF_STATUS |
| 12033 | send_pdev_qvit_cmd_tlv(wmi_unified_t wmi_handle, |
| 12034 | struct pdev_qvit_params *param) |
| 12035 | { |
| 12036 | wmi_buf_t buf; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12037 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12038 | uint8_t *cmd; |
| 12039 | static uint8_t msgref = 1; |
| 12040 | uint8_t segnumber = 0, seginfo, numsegments; |
| 12041 | uint16_t chunk_len, total_bytes; |
| 12042 | uint8_t *bufpos; |
| 12043 | QVIT_SEG_HDR_INFO_STRUCT seghdrinfo; |
| 12044 | |
| 12045 | bufpos = param->utf_payload; |
| 12046 | total_bytes = param->len; |
| 12047 | ASSERT(total_bytes / MAX_WMI_QVIT_LEN == |
| 12048 | (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN)); |
| 12049 | numsegments = (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN); |
| 12050 | |
| 12051 | if (param->len - (numsegments * MAX_WMI_QVIT_LEN)) |
| 12052 | numsegments++; |
| 12053 | |
| 12054 | while (param->len) { |
| 12055 | if (param->len > MAX_WMI_QVIT_LEN) |
| 12056 | chunk_len = MAX_WMI_QVIT_LEN; /* MAX messsage */ |
| 12057 | else |
| 12058 | chunk_len = param->len; |
| 12059 | |
| 12060 | buf = wmi_buf_alloc(wmi_handle, |
| 12061 | (chunk_len + sizeof(seghdrinfo) + |
| 12062 | WMI_TLV_HDR_SIZE)); |
| 12063 | if (!buf) { |
| 12064 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 12065 | return QDF_STATUS_E_NOMEM; |
| 12066 | } |
| 12067 | |
| 12068 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 12069 | |
| 12070 | seghdrinfo.len = total_bytes; |
| 12071 | seghdrinfo.msgref = msgref; |
| 12072 | seginfo = ((numsegments << 4) & 0xF0) | (segnumber & 0xF); |
| 12073 | seghdrinfo.segmentInfo = seginfo; |
| 12074 | |
| 12075 | segnumber++; |
| 12076 | |
| 12077 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 12078 | (chunk_len + sizeof(seghdrinfo))); |
| 12079 | cmd += WMI_TLV_HDR_SIZE; |
| 12080 | qdf_mem_copy(cmd, &seghdrinfo, sizeof(seghdrinfo)); |
| 12081 | qdf_mem_copy(&cmd[sizeof(seghdrinfo)], bufpos, chunk_len); |
| 12082 | |
| 12083 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 12084 | (chunk_len + sizeof(seghdrinfo) + |
| 12085 | WMI_TLV_HDR_SIZE), |
| 12086 | WMI_PDEV_QVIT_CMDID); |
| 12087 | |
| 12088 | if (ret != 0) { |
| 12089 | WMI_LOGE("Failed to send WMI_PDEV_QVIT_CMDID command"); |
| 12090 | wmi_buf_free(buf); |
| 12091 | break; |
| 12092 | } |
| 12093 | |
| 12094 | param->len -= chunk_len; |
| 12095 | bufpos += chunk_len; |
| 12096 | } |
| 12097 | msgref++; |
| 12098 | |
| 12099 | return ret; |
| 12100 | } |
| 12101 | |
| 12102 | /** |
| 12103 | * send_wmm_update_cmd_tlv() - send wmm update command to fw |
| 12104 | * @wmi_handle: wmi handle |
| 12105 | * @param: pointer to wmm update param |
| 12106 | * |
| 12107 | * Return: 0 for success or error code |
| 12108 | */ |
| 12109 | static QDF_STATUS |
| 12110 | send_wmm_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 12111 | struct wmm_update_params *param) |
| 12112 | { |
| 12113 | wmi_pdev_set_wmm_params_cmd_fixed_param *cmd; |
| 12114 | wmi_wmm_params *wmm_param; |
| 12115 | wmi_buf_t buf; |
| 12116 | QDF_STATUS ret; |
| 12117 | int32_t len; |
| 12118 | int ac = 0; |
| 12119 | struct wmi_host_wmeParams *wmep; |
| 12120 | uint8_t *buf_ptr; |
| 12121 | |
| 12122 | len = sizeof(*cmd) + (WME_NUM_AC * sizeof(*wmm_param)); |
| 12123 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12124 | if (!buf) { |
| 12125 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12126 | return QDF_STATUS_E_FAILURE; |
| 12127 | } |
| 12128 | |
| 12129 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12130 | cmd = (wmi_pdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 12131 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12132 | WMITLV_TAG_STRUC_wmi_pdev_set_wmm_params_cmd_fixed_param, |
| 12133 | WMITLV_GET_STRUCT_TLVLEN |
| 12134 | (wmi_pdev_set_wmm_params_cmd_fixed_param)); |
| 12135 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12136 | cmd->reserved0 = WMI_HOST_PDEV_ID_SOC; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12137 | |
| 12138 | buf_ptr += sizeof(wmi_pdev_set_wmm_params_cmd_fixed_param); |
| 12139 | |
| 12140 | for (ac = 0; ac < WME_NUM_AC; ac++) { |
| 12141 | wmep = ¶m->wmep_array[ac]; |
| 12142 | wmm_param = (wmi_wmm_params *)buf_ptr; |
| 12143 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 12144 | WMITLV_TAG_STRUC_wmi_wmm_params, |
| 12145 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_params)); |
| 12146 | wmm_param->aifs = wmep->wmep_aifsn; |
| 12147 | wmm_param->cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin); |
| 12148 | wmm_param->cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax); |
| 12149 | wmm_param->txoplimit = ATH_TXOP_TO_US(wmep->wmep_txopLimit); |
| 12150 | wmm_param->acm = wmep->wmep_acm; |
| 12151 | wmm_param->no_ack = wmep->wmep_noackPolicy; |
| 12152 | buf_ptr += sizeof(wmi_wmm_params); |
| 12153 | } |
| 12154 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12155 | WMI_PDEV_SET_WMM_PARAMS_CMDID); |
| 12156 | |
| 12157 | if (ret != 0) { |
| 12158 | WMI_LOGE("Sending WMM update CMD failed\n"); |
| 12159 | wmi_buf_free(buf); |
| 12160 | } |
| 12161 | |
| 12162 | return ret; |
| 12163 | } |
| 12164 | |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 12165 | /** |
| 12166 | * send_coex_config_cmd_tlv() - send coex config command to fw |
| 12167 | * @wmi_handle: wmi handle |
| 12168 | * @param: pointer to coex config param |
| 12169 | * |
| 12170 | * Return: 0 for success or error code |
| 12171 | */ |
| 12172 | static QDF_STATUS |
| 12173 | send_coex_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 12174 | struct coex_config_params *param) |
| 12175 | { |
| 12176 | WMI_COEX_CONFIG_CMD_fixed_param *cmd; |
| 12177 | wmi_buf_t buf; |
| 12178 | QDF_STATUS ret; |
| 12179 | int32_t len; |
| 12180 | |
| 12181 | len = sizeof(*cmd); |
| 12182 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12183 | if (!buf) { |
| 12184 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12185 | return QDF_STATUS_E_FAILURE; |
| 12186 | } |
| 12187 | |
| 12188 | cmd = (WMI_COEX_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 12189 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12190 | WMITLV_TAG_STRUC_WMI_COEX_CONFIG_CMD_fixed_param, |
| 12191 | WMITLV_GET_STRUCT_TLVLEN( |
Sathish Kumar | 8458a05 | 2017-05-12 15:52:00 +0530 | [diff] [blame] | 12192 | WMI_COEX_CONFIG_CMD_fixed_param)); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 12193 | |
| 12194 | cmd->vdev_id = param->vdev_id; |
| 12195 | cmd->config_type = param->config_type; |
| 12196 | cmd->config_arg1 = param->config_arg1; |
| 12197 | cmd->config_arg2 = param->config_arg2; |
| 12198 | cmd->config_arg3 = param->config_arg3; |
| 12199 | cmd->config_arg4 = param->config_arg4; |
| 12200 | cmd->config_arg5 = param->config_arg5; |
| 12201 | cmd->config_arg6 = param->config_arg6; |
| 12202 | |
| 12203 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12204 | WMI_COEX_CONFIG_CMDID); |
| 12205 | |
| 12206 | if (ret != 0) { |
| 12207 | WMI_LOGE("Sending COEX CONFIG CMD failed\n"); |
| 12208 | wmi_buf_free(buf); |
| 12209 | } |
| 12210 | |
| 12211 | return ret; |
| 12212 | } |
| 12213 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 12214 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12215 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12216 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12217 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12218 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12219 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 12220 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 12221 | resource_cfg->num_offload_reorder_buffs = |
| 12222 | tgt_res_cfg->num_offload_reorder_buffs; |
| 12223 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 12224 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 12225 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 12226 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 12227 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 12228 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 12229 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 12230 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 12231 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 12232 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 12233 | resource_cfg->scan_max_pending_req = |
| 12234 | tgt_res_cfg->scan_max_pending_req; |
| 12235 | resource_cfg->bmiss_offload_max_vdev = |
| 12236 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 12237 | resource_cfg->roam_offload_max_vdev = |
| 12238 | tgt_res_cfg->roam_offload_max_vdev; |
| 12239 | resource_cfg->roam_offload_max_ap_profiles = |
| 12240 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 12241 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 12242 | resource_cfg->num_mcast_table_elems = |
| 12243 | tgt_res_cfg->num_mcast_table_elems; |
| 12244 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 12245 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 12246 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 12247 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 12248 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 12249 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 12250 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 12251 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 12252 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 12253 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 12254 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 12255 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 12256 | resource_cfg->num_tdls_conn_table_entries = |
| 12257 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 12258 | resource_cfg->beacon_tx_offload_max_vdev = |
| 12259 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 12260 | resource_cfg->num_multicast_filter_entries = |
| 12261 | tgt_res_cfg->num_multicast_filter_entries; |
| 12262 | resource_cfg->num_wow_filters = |
| 12263 | tgt_res_cfg->num_wow_filters; |
| 12264 | resource_cfg->num_keep_alive_pattern = |
| 12265 | tgt_res_cfg->num_keep_alive_pattern; |
| 12266 | resource_cfg->keep_alive_pattern_size = |
| 12267 | tgt_res_cfg->keep_alive_pattern_size; |
| 12268 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 12269 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 12270 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 12271 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 12272 | resource_cfg->wmi_send_separate = |
| 12273 | tgt_res_cfg->wmi_send_separate; |
| 12274 | resource_cfg->num_ocb_vdevs = |
| 12275 | tgt_res_cfg->num_ocb_vdevs; |
| 12276 | resource_cfg->num_ocb_channels = |
| 12277 | tgt_res_cfg->num_ocb_channels; |
| 12278 | resource_cfg->num_ocb_schedules = |
| 12279 | tgt_res_cfg->num_ocb_schedules; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 12280 | resource_cfg->bpf_instruction_size = tgt_res_cfg->bpf_instruction_size; |
| 12281 | resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters; |
| 12282 | resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 12283 | |
| 12284 | WMI_RSRC_CFG_FLAG_ATF_CONFIG_ENABLE_SET(resource_cfg->flag1, |
| 12285 | tgt_res_cfg->atf_config); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12286 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 12287 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12288 | /** |
| 12289 | * send_init_cmd_tlv() - wmi init command |
| 12290 | * @wmi_handle: pointer to wmi handle |
| 12291 | * @res_cfg: resource config |
| 12292 | * @num_mem_chunks: no of mem chunck |
| 12293 | * @mem_chunk: pointer to mem chunck structure |
| 12294 | * |
| 12295 | * This function sends IE information to firmware |
| 12296 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12297 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12298 | * |
| 12299 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12300 | static QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12301 | wmi_resource_config *tgt_res_cfg, |
| 12302 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 12303 | bool action) |
| 12304 | { |
| 12305 | wmi_buf_t buf; |
| 12306 | wmi_init_cmd_fixed_param *cmd; |
| 12307 | wmi_abi_version my_vers; |
| 12308 | int num_whitelist; |
| 12309 | uint8_t *buf_ptr; |
| 12310 | wmi_resource_config *resource_cfg; |
| 12311 | wlan_host_memory_chunk *host_mem_chunks; |
| 12312 | uint32_t mem_chunk_len = 0; |
| 12313 | uint16_t idx; |
| 12314 | int len; |
| 12315 | int ret; |
| 12316 | |
| 12317 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 12318 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 12319 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 12320 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12321 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 12322 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12323 | } |
| 12324 | |
| 12325 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12326 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 12327 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 12328 | |
| 12329 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 12330 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 12331 | + WMI_TLV_HDR_SIZE); |
| 12332 | |
| 12333 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12334 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 12335 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 12336 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12337 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12338 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 12339 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 12340 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 12341 | |
| 12342 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 12343 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 12344 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 12345 | WMITLV_GET_STRUCT_TLVLEN |
| 12346 | (wlan_host_memory_chunk)); |
| 12347 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 12348 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 12349 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12350 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12351 | idx, host_mem_chunks[idx].size, |
| 12352 | host_mem_chunks[idx].ptr); |
| 12353 | } |
| 12354 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 12355 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 12356 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 12357 | WMITLV_TAG_ARRAY_STRUC, |
| 12358 | (sizeof(wlan_host_memory_chunk) * |
| 12359 | num_mem_chunks)); |
| 12360 | |
| 12361 | num_whitelist = sizeof(version_whitelist) / |
| 12362 | sizeof(wmi_whitelist_version_info); |
| 12363 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 12364 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 12365 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 12366 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 12367 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 12368 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12369 | #ifdef CONFIG_MCL |
| 12370 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 12371 | * on wmi_unified.h from priv.h for using wmi_abi_version type */ |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12372 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 12373 | &my_vers, |
| 12374 | &wmi_handle->fw_abi_version, |
| 12375 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12376 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12377 | WMI_LOGD("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12378 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 12379 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 12380 | cmd->host_abi_vers.abi_version_ns_0, |
| 12381 | cmd->host_abi_vers.abi_version_ns_1, |
| 12382 | cmd->host_abi_vers.abi_version_ns_2, |
| 12383 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12384 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12385 | /* Save version sent from host - |
| 12386 | * Will be used to check ready event |
| 12387 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12388 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12389 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12390 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12391 | if (action) { |
| 12392 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12393 | WMI_INIT_CMDID); |
| 12394 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12395 | WMI_LOGE(FL("Failed to send set WMI INIT command ret = %d"), ret); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12396 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12397 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12398 | } |
| 12399 | } else { |
| 12400 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 12401 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 12402 | } |
| 12403 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12404 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12405 | |
| 12406 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 12407 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12408 | /** |
| 12409 | * send_saved_init_cmd_tlv() - wmi init command |
| 12410 | * @wmi_handle: pointer to wmi handle |
| 12411 | * |
| 12412 | * This function sends IE information to firmware |
| 12413 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12414 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12415 | * |
| 12416 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12417 | static QDF_STATUS send_saved_init_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12418 | { |
| 12419 | int status; |
| 12420 | |
| 12421 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 12422 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12423 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 12424 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12425 | } |
| 12426 | status = wmi_unified_cmd_send(wmi_handle, |
| 12427 | wmi_handle->saved_wmi_init_cmd.buf, |
| 12428 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 12429 | WMI_INIT_CMDID); |
| 12430 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12431 | WMI_LOGE(FL("Failed to send set WMI INIT command ret = %d"), status); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12432 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12433 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12434 | } |
| 12435 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 12436 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 12437 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12438 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12439 | } |
| 12440 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12441 | 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] | 12442 | { |
| 12443 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 12444 | wmi_service_ready_event_fixed_param *ev; |
| 12445 | |
| 12446 | |
| 12447 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 12448 | |
| 12449 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 12450 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12451 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12452 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12453 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12454 | /*Save fw version from service ready message */ |
| 12455 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12456 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12457 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12458 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12459 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12460 | } |
| 12461 | |
| 12462 | /** |
| 12463 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 12464 | * @wmi_handle: pointer to wmi handle |
| 12465 | * @res_cfg: resource config |
| 12466 | * @num_mem_chunks: no of mem chunck |
| 12467 | * @mem_chunk: pointer to mem chunck structure |
| 12468 | * |
| 12469 | * This function sends IE information to firmware |
| 12470 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12471 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12472 | * |
| 12473 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12474 | 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] | 12475 | void *evt_buf) |
| 12476 | { |
| 12477 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 12478 | wmi_ready_event_fixed_param *ev = NULL; |
| 12479 | |
| 12480 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 12481 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12482 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12483 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 12484 | &ev->fw_abi_vers)) { |
| 12485 | /* |
| 12486 | * Error: Our host version and the given firmware version |
| 12487 | * are incompatible. |
| 12488 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12489 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12490 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 12491 | __func__, |
| 12492 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 12493 | abi_version_0), |
| 12494 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 12495 | abi_version_0), |
| 12496 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 12497 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 12498 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 12499 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 12500 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 12501 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 12502 | ev->fw_abi_vers.abi_version_ns_0, |
| 12503 | ev->fw_abi_vers.abi_version_ns_1, |
| 12504 | ev->fw_abi_vers.abi_version_ns_2, |
| 12505 | ev->fw_abi_vers.abi_version_ns_3); |
| 12506 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12507 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12508 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12509 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12510 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12511 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12512 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12513 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12514 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12515 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12516 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12517 | |
| 12518 | /** |
| 12519 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 12520 | * @wmi_handle: wmi handle |
| 12521 | * @custom_addr: base mac address |
| 12522 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12523 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12524 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12525 | 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] | 12526 | uint8_t *custom_addr) |
| 12527 | { |
| 12528 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 12529 | wmi_buf_t buf; |
| 12530 | int err; |
| 12531 | |
| 12532 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12533 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12534 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12535 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12536 | } |
| 12537 | |
| 12538 | 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] | 12539 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12540 | |
| 12541 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12542 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 12543 | WMITLV_GET_STRUCT_TLVLEN |
| 12544 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 12545 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12546 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12547 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12548 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 12549 | sizeof(*cmd), |
| 12550 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 12551 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12552 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12553 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12554 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12555 | } |
| 12556 | |
| 12557 | return 0; |
| 12558 | } |
| 12559 | |
| 12560 | /** |
| 12561 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 12562 | * @handle: wmi handle |
| 12563 | * @event: Event received from FW |
| 12564 | * @len: Length of the event |
| 12565 | * |
| 12566 | * Enables the low frequency events and disables the high frequency |
| 12567 | * events. Bit 17 indicates if the event if low/high frequency. |
| 12568 | * 1 - high frequency, 0 - low frequency |
| 12569 | * |
| 12570 | * Return: 0 on successfully enabling/disabling the events |
| 12571 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12572 | 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] | 12573 | uint8_t *event, |
| 12574 | uint32_t len) |
| 12575 | { |
| 12576 | uint32_t num_of_diag_events_logs; |
| 12577 | wmi_diag_event_log_config_fixed_param *cmd; |
| 12578 | wmi_buf_t buf; |
| 12579 | uint8_t *buf_ptr; |
| 12580 | uint32_t *cmd_args, *evt_args; |
| 12581 | uint32_t buf_len, i; |
| 12582 | |
| 12583 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 12584 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 12585 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12586 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12587 | |
| 12588 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 12589 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12590 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12591 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12592 | } |
| 12593 | wmi_event = param_buf->fixed_param; |
| 12594 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 12595 | evt_args = param_buf->diag_events_logs_list; |
| 12596 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12597 | 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] | 12598 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12599 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12600 | } |
| 12601 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12602 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12603 | __func__, num_of_diag_events_logs); |
| 12604 | |
| 12605 | /* Free any previous allocation */ |
| 12606 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12607 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12608 | |
Varun Reddy Yeturu | c799752 | 2017-08-20 13:41:02 -0700 | [diff] [blame] | 12609 | if (num_of_diag_events_logs > |
| 12610 | (WMI_SVC_MSG_MAX_SIZE / sizeof(uint32_t))) { |
| 12611 | WMI_LOGE("%s: excess num of logs:%d", __func__, |
| 12612 | num_of_diag_events_logs); |
| 12613 | QDF_ASSERT(0); |
| 12614 | return QDF_STATUS_E_INVAL; |
| 12615 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12616 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12617 | 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] | 12618 | sizeof(uint32_t)); |
| 12619 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12620 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12621 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12622 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12623 | } |
| 12624 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 12625 | |
| 12626 | /* Prepare the send buffer */ |
| 12627 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 12628 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 12629 | |
| 12630 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 12631 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12632 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12633 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12634 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12635 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12636 | } |
| 12637 | |
| 12638 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 12639 | buf_ptr = (uint8_t *) cmd; |
| 12640 | |
| 12641 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12642 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 12643 | WMITLV_GET_STRUCT_TLVLEN( |
| 12644 | wmi_diag_event_log_config_fixed_param)); |
| 12645 | |
| 12646 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 12647 | |
| 12648 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 12649 | |
| 12650 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 12651 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 12652 | |
| 12653 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12654 | |
| 12655 | /* Populate the events */ |
| 12656 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 12657 | /* Low freq (0) - Enable (1) the event |
| 12658 | * High freq (1) - Disable (0) the event |
| 12659 | */ |
| 12660 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 12661 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 12662 | /* Set the event ID */ |
| 12663 | WMI_DIAG_ID_SET(cmd_args[i], |
| 12664 | WMI_DIAG_ID_GET(evt_args[i])); |
| 12665 | /* Set the type */ |
| 12666 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 12667 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12668 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12669 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 12670 | } |
| 12671 | |
| 12672 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 12673 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12674 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12675 | __func__); |
| 12676 | wmi_buf_free(buf); |
| 12677 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 12678 | * Host can still have this list |
| 12679 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12680 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12681 | } |
| 12682 | |
| 12683 | return 0; |
| 12684 | } |
| 12685 | |
| 12686 | /** |
| 12687 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 12688 | * @wmi_handle: wmi handle |
| 12689 | * @start_log: Start logging related parameters |
| 12690 | * |
| 12691 | * Send the command to the FW based on which specific logging of diag |
| 12692 | * event/log id can be started/stopped |
| 12693 | * |
| 12694 | * Return: None |
| 12695 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12696 | 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] | 12697 | struct wmi_wifi_start_log *start_log) |
| 12698 | { |
| 12699 | wmi_diag_event_log_config_fixed_param *cmd; |
| 12700 | wmi_buf_t buf; |
| 12701 | uint8_t *buf_ptr; |
| 12702 | uint32_t len, count, log_level, i; |
| 12703 | uint32_t *cmd_args; |
| 12704 | uint32_t total_len; |
| 12705 | count = 0; |
| 12706 | |
| 12707 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12708 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12709 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12710 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12711 | } |
| 12712 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 12713 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 12714 | */ |
| 12715 | total_len = 0; |
| 12716 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 12717 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 12718 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 12719 | total_len++; |
| 12720 | } |
| 12721 | |
| 12722 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 12723 | (total_len * sizeof(uint32_t)); |
| 12724 | |
| 12725 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12726 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12727 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12728 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12729 | } |
| 12730 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 12731 | buf_ptr = (uint8_t *) cmd; |
| 12732 | |
| 12733 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12734 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 12735 | WMITLV_GET_STRUCT_TLVLEN( |
| 12736 | wmi_diag_event_log_config_fixed_param)); |
| 12737 | |
| 12738 | cmd->num_of_diag_events_logs = total_len; |
| 12739 | |
| 12740 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 12741 | |
| 12742 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 12743 | (total_len * sizeof(uint32_t))); |
| 12744 | |
| 12745 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12746 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 12747 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12748 | log_level = 1; |
| 12749 | else |
| 12750 | log_level = 0; |
| 12751 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12752 | 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] | 12753 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 12754 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 12755 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 12756 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 12757 | |
| 12758 | WMI_DIAG_ID_SET(cmd_args[count], |
| 12759 | WMI_DIAG_ID_GET(val)); |
| 12760 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 12761 | WMI_DIAG_TYPE_GET(val)); |
| 12762 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 12763 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12764 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12765 | count++; |
| 12766 | } |
| 12767 | } |
| 12768 | |
| 12769 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12770 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12771 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12772 | __func__); |
| 12773 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12774 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12775 | } |
| 12776 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12777 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12778 | } |
| 12779 | |
| 12780 | /** |
| 12781 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 12782 | * @wmi_handle: WMI handle |
| 12783 | * |
| 12784 | * This function is used to send the flush command to the FW, |
| 12785 | * that will flush the fw logs that are residue in the FW |
| 12786 | * |
| 12787 | * Return: None |
| 12788 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12789 | 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] | 12790 | { |
| 12791 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 12792 | wmi_buf_t buf; |
| 12793 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12794 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12795 | |
| 12796 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12797 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12798 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12799 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12800 | } |
| 12801 | |
| 12802 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 12803 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12804 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 12805 | WMITLV_GET_STRUCT_TLVLEN( |
| 12806 | wmi_debug_mesg_flush_fixed_param)); |
| 12807 | cmd->reserved0 = 0; |
| 12808 | |
| 12809 | ret = wmi_unified_cmd_send(wmi_handle, |
| 12810 | buf, |
| 12811 | len, |
| 12812 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12813 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12814 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12815 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12816 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12817 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12818 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12819 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12820 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12821 | } |
| 12822 | |
| 12823 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12824 | * 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] | 12825 | * @wmi_handle: wmi handle |
| 12826 | * @msg: PCL structure containing the PCL and the number of channels |
| 12827 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12828 | * 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] | 12829 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 12830 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 12831 | * to migrate to a new channel without host driver involvement. An example of |
| 12832 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 12833 | * manage the channel selection without firmware involvement. |
| 12834 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12835 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 12836 | * channel list. The weights corresponds to the channels sent in |
| 12837 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 12838 | * weightage compared to the non PCL channels. |
| 12839 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12840 | * Return: Success if the cmd is sent successfully to the firmware |
| 12841 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12842 | 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] | 12843 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12844 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12845 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12846 | wmi_buf_t buf; |
| 12847 | uint8_t *buf_ptr; |
| 12848 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12849 | uint32_t chan_len; |
| 12850 | |
| 12851 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12852 | |
| 12853 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12854 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12855 | |
| 12856 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12857 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12858 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12859 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12860 | } |
| 12861 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12862 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12863 | buf_ptr = (uint8_t *) cmd; |
| 12864 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12865 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 12866 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12867 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12868 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12869 | WMI_HOST_PDEV_ID_SOC); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12870 | cmd->num_chan = chan_len; |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 12871 | WMI_LOGD("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12872 | |
| 12873 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12874 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12875 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12876 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12877 | for (i = 0; i < chan_len ; i++) { |
| 12878 | cmd_args[i] = msg->weighed_valid_list[i]; |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 12879 | WMI_LOGD("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12880 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12881 | } |
| 12882 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12883 | WMI_PDEV_SET_PCL_CMDID)) { |
| 12884 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12885 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12886 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12887 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12888 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12889 | } |
| 12890 | |
| 12891 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12892 | * 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] | 12893 | * @wmi_handle: wmi handle |
| 12894 | * @msg: Structure containing the following parameters |
| 12895 | * |
| 12896 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 12897 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 12898 | * |
| 12899 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 12900 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 12901 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 12902 | * |
| 12903 | * Return: Success if the cmd is sent successfully to the firmware |
| 12904 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12905 | 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] | 12906 | uint32_t hw_mode_index) |
| 12907 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12908 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12909 | wmi_buf_t buf; |
| 12910 | uint32_t len; |
| 12911 | |
| 12912 | len = sizeof(*cmd); |
| 12913 | |
| 12914 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12915 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12916 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12917 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12918 | } |
| 12919 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12920 | 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] | 12921 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12922 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 12923 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 12924 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12925 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12926 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12927 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12928 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12929 | |
| 12930 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12931 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 12932 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12933 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12934 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12935 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12936 | } |
| 12937 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12938 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12939 | } |
| 12940 | |
| 12941 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12942 | * 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] | 12943 | * @wmi_handle: wmi handle |
| 12944 | * @msg: Dual MAC config parameters |
| 12945 | * |
| 12946 | * Configures WLAN firmware with the dual MAC features |
| 12947 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12948 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12949 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 12950 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12951 | 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] | 12952 | struct wmi_dual_mac_config *msg) |
| 12953 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12954 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12955 | wmi_buf_t buf; |
| 12956 | uint32_t len; |
| 12957 | |
| 12958 | len = sizeof(*cmd); |
| 12959 | |
| 12960 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12961 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12962 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12963 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12964 | } |
| 12965 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12966 | 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] | 12967 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12968 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12969 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12970 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 12971 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12972 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12973 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12974 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 12975 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12976 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12977 | __func__, msg->scan_config, msg->fw_mode_config); |
| 12978 | |
| 12979 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12980 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 12981 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12982 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12983 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12984 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12985 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12986 | } |
| 12987 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 12988 | #ifdef BIG_ENDIAN_HOST |
| 12989 | /** |
| 12990 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 12991 | * @param data_len - data length |
| 12992 | * @param data - pointer to data |
| 12993 | * |
| 12994 | * Return: QDF_STATUS - success or error status |
| 12995 | */ |
| 12996 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 12997 | struct fips_params *param) |
| 12998 | { |
| 12999 | unsigned char *key_unaligned, *data_unaligned; |
| 13000 | int c; |
| 13001 | u_int8_t *key_aligned = NULL; |
| 13002 | u_int8_t *data_aligned = NULL; |
| 13003 | |
| 13004 | /* Assigning unaligned space to copy the key */ |
| 13005 | key_unaligned = qdf_mem_malloc( |
| 13006 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 13007 | data_unaligned = qdf_mem_malloc( |
| 13008 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 13009 | |
| 13010 | /* Checking if kmalloc is succesful to allocate space */ |
| 13011 | if (key_unaligned == NULL) |
| 13012 | return QDF_STATUS_SUCCESS; |
| 13013 | /* Checking if space is aligned */ |
| 13014 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 13015 | /* align to 4 */ |
| 13016 | key_aligned = |
| 13017 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 13018 | FIPS_ALIGN); |
| 13019 | } else { |
| 13020 | key_aligned = (u_int8_t *)key_unaligned; |
| 13021 | } |
| 13022 | |
| 13023 | /* memset and copy content from key to key aligned */ |
| 13024 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 13025 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 13026 | |
| 13027 | /* print a hexdump for host debug */ |
| 13028 | print_hex_dump(KERN_DEBUG, |
| 13029 | "\t Aligned and Copied Key:@@@@ ", |
| 13030 | DUMP_PREFIX_NONE, |
| 13031 | 16, 1, key_aligned, param->key_len, true); |
| 13032 | |
| 13033 | /* Checking if kmalloc is succesful to allocate space */ |
| 13034 | if (data_unaligned == NULL) |
| 13035 | return QDF_STATUS_SUCCESS; |
| 13036 | /* Checking of space is aligned */ |
| 13037 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 13038 | /* align to 4 */ |
| 13039 | data_aligned = |
| 13040 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 13041 | FIPS_ALIGN); |
| 13042 | } else { |
| 13043 | data_aligned = (u_int8_t *)data_unaligned; |
| 13044 | } |
| 13045 | |
| 13046 | /* memset and copy content from data to data aligned */ |
| 13047 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 13048 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 13049 | |
| 13050 | /* print a hexdump for host debug */ |
| 13051 | print_hex_dump(KERN_DEBUG, |
| 13052 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 13053 | DUMP_PREFIX_NONE, |
| 13054 | 16, 1, data_aligned, param->data_len, true); |
| 13055 | |
| 13056 | /* converting to little Endian both key_aligned and |
| 13057 | * data_aligned*/ |
| 13058 | for (c = 0; c < param->key_len/4; c++) { |
| 13059 | *((u_int32_t *)key_aligned+c) = |
| 13060 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 13061 | } |
| 13062 | for (c = 0; c < param->data_len/4; c++) { |
| 13063 | *((u_int32_t *)data_aligned+c) = |
| 13064 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 13065 | } |
| 13066 | |
| 13067 | /* update endian data to key and data vectors */ |
| 13068 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 13069 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 13070 | |
| 13071 | /* clean up allocated spaces */ |
| 13072 | qdf_mem_free(key_unaligned); |
| 13073 | key_unaligned = NULL; |
| 13074 | key_aligned = NULL; |
| 13075 | |
| 13076 | qdf_mem_free(data_unaligned); |
| 13077 | data_unaligned = NULL; |
| 13078 | data_aligned = NULL; |
| 13079 | |
| 13080 | return QDF_STATUS_SUCCESS; |
| 13081 | } |
| 13082 | #else |
| 13083 | /** |
| 13084 | * fips_align_data_be() - DUMMY for LE platform |
| 13085 | * |
| 13086 | * Return: QDF_STATUS - success |
| 13087 | */ |
| 13088 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 13089 | struct fips_params *param) |
| 13090 | { |
| 13091 | return QDF_STATUS_SUCCESS; |
| 13092 | } |
| 13093 | #endif |
| 13094 | |
| 13095 | |
| 13096 | /** |
| 13097 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 13098 | * @wmi_handle: wmi handle |
| 13099 | * @param: pointer to hold pdev fips param |
| 13100 | * |
| 13101 | * Return: 0 for success or error code |
| 13102 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13103 | static QDF_STATUS |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13104 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 13105 | struct fips_params *param) |
| 13106 | { |
| 13107 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 13108 | wmi_buf_t buf; |
| 13109 | uint8_t *buf_ptr; |
| 13110 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 13111 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 13112 | |
| 13113 | /* Length TLV placeholder for array of bytes */ |
| 13114 | len += WMI_TLV_HDR_SIZE; |
| 13115 | if (param->data_len) |
| 13116 | len += (param->data_len*sizeof(uint8_t)); |
| 13117 | |
| 13118 | /* |
| 13119 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 13120 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 13121 | * wmi_pdev_fips_cmd structure |
| 13122 | */ |
| 13123 | |
| 13124 | /* do sanity on the input */ |
| 13125 | if (!(((param->data_len & 0xF) == 0) && |
| 13126 | ((param->data_len > 0) && |
| 13127 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 13128 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 13129 | return QDF_STATUS_E_INVAL; |
| 13130 | } |
| 13131 | |
| 13132 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13133 | if (!buf) { |
| 13134 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 13135 | return QDF_STATUS_E_FAILURE; |
| 13136 | } |
| 13137 | |
| 13138 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13139 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 13140 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13141 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 13142 | WMITLV_GET_STRUCT_TLVLEN |
| 13143 | (wmi_pdev_fips_cmd_fixed_param)); |
| 13144 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13145 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13146 | param->pdev_id); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13147 | if (param->key != NULL && param->data != NULL) { |
| 13148 | cmd->key_len = param->key_len; |
| 13149 | cmd->data_len = param->data_len; |
| 13150 | cmd->fips_cmd = !!(param->op); |
| 13151 | |
| 13152 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 13153 | return QDF_STATUS_E_FAILURE; |
| 13154 | |
| 13155 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 13156 | |
| 13157 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 13158 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 13159 | cmd->mode = param->mode; |
| 13160 | } else { |
| 13161 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 13162 | } |
| 13163 | qdf_print(KERN_ERR "Key len = %d, Data len = %d\n", |
| 13164 | cmd->key_len, cmd->data_len); |
| 13165 | |
| 13166 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 13167 | cmd->key, cmd->key_len, true); |
| 13168 | buf_ptr += sizeof(*cmd); |
| 13169 | |
| 13170 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 13171 | |
| 13172 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13173 | if (param->data_len) |
| 13174 | qdf_mem_copy(buf_ptr, |
| 13175 | (uint8_t *) param->data, param->data_len); |
| 13176 | |
| 13177 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 13178 | 16, 1, buf_ptr, cmd->data_len, true); |
| 13179 | |
| 13180 | buf_ptr += param->data_len; |
| 13181 | |
| 13182 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13183 | WMI_PDEV_FIPS_CMDID); |
| 13184 | qdf_print("%s return value %d\n", __func__, retval); |
| 13185 | } else { |
| 13186 | qdf_print("\n%s:%d Key or Data is NULL\n", __func__, __LINE__); |
| 13187 | wmi_buf_free(buf); |
| 13188 | retval = -QDF_STATUS_E_BADMSG; |
| 13189 | } |
| 13190 | |
| 13191 | return retval; |
| 13192 | } |
| 13193 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13194 | #ifdef WLAN_PMO_ENABLE |
| 13195 | /** |
| 13196 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 13197 | * @wmi_handle: wmi handle |
| 13198 | * @vdev_id: vdev id |
| 13199 | * @bitmap: Event bitmap |
| 13200 | * @enable: enable/disable |
| 13201 | * |
| 13202 | * Return: CDF status |
| 13203 | */ |
| 13204 | static QDF_STATUS send_add_wow_wakeup_event_cmd_tlv(wmi_unified_t wmi_handle, |
| 13205 | uint32_t vdev_id, |
Ravi Kumar Bokka | ce4ac39 | 2017-03-23 17:20:31 +0530 | [diff] [blame] | 13206 | uint32_t *bitmap, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13207 | bool enable) |
| 13208 | { |
| 13209 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 13210 | uint16_t len; |
| 13211 | wmi_buf_t buf; |
| 13212 | int ret; |
| 13213 | |
| 13214 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 13215 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13216 | if (!buf) { |
| 13217 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13218 | return QDF_STATUS_E_NOMEM; |
| 13219 | } |
| 13220 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 13221 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13222 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 13223 | WMITLV_GET_STRUCT_TLVLEN |
| 13224 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 13225 | cmd->vdev_id = vdev_id; |
| 13226 | cmd->is_add = enable; |
Ravi Kumar Bokka | ce4ac39 | 2017-03-23 17:20:31 +0530 | [diff] [blame] | 13227 | qdf_mem_copy(&(cmd->event_bitmaps[0]), bitmap, sizeof(uint32_t) * |
| 13228 | WMI_WOW_MAX_EVENT_BM_LEN); |
| 13229 | |
| 13230 | WMI_LOGD("Wakeup pattern 0x%x%x%x%x %s in fw", cmd->event_bitmaps[0], |
| 13231 | cmd->event_bitmaps[1], cmd->event_bitmaps[2], |
| 13232 | cmd->event_bitmaps[3], enable ? "enabled" : "disabled"); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13233 | |
| 13234 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13235 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 13236 | if (ret) { |
| 13237 | WMI_LOGE("Failed to config wow wakeup event"); |
| 13238 | wmi_buf_free(buf); |
| 13239 | return QDF_STATUS_E_FAILURE; |
| 13240 | } |
| 13241 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13242 | return QDF_STATUS_SUCCESS; |
| 13243 | } |
| 13244 | |
| 13245 | /** |
| 13246 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 13247 | * @wmi_handle: wmi handle |
| 13248 | * @vdev_id: vdev id |
| 13249 | * @ptrn_id: pattern id |
| 13250 | * @ptrn: pattern |
| 13251 | * @ptrn_len: pattern length |
| 13252 | * @ptrn_offset: pattern offset |
| 13253 | * @mask: mask |
| 13254 | * @mask_len: mask length |
| 13255 | * @user: true for user configured pattern and false for default pattern |
| 13256 | * @default_patterns: default patterns |
| 13257 | * |
| 13258 | * Return: CDF status |
| 13259 | */ |
| 13260 | static QDF_STATUS send_wow_patterns_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
| 13261 | uint8_t vdev_id, uint8_t ptrn_id, |
| 13262 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 13263 | uint8_t ptrn_offset, const uint8_t *mask, |
| 13264 | uint8_t mask_len, bool user, |
| 13265 | uint8_t default_patterns) |
| 13266 | { |
| 13267 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 13268 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 13269 | wmi_buf_t buf; |
| 13270 | uint8_t *buf_ptr; |
| 13271 | int32_t len; |
| 13272 | int ret; |
| 13273 | |
| 13274 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 13275 | WMI_TLV_HDR_SIZE + |
| 13276 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 13277 | WMI_TLV_HDR_SIZE + |
| 13278 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 13279 | WMI_TLV_HDR_SIZE + |
| 13280 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 13281 | WMI_TLV_HDR_SIZE + |
| 13282 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 13283 | WMI_TLV_HDR_SIZE + |
| 13284 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 13285 | |
| 13286 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13287 | if (!buf) { |
| 13288 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13289 | return QDF_STATUS_E_NOMEM; |
| 13290 | } |
| 13291 | |
| 13292 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 13293 | buf_ptr = (uint8_t *) cmd; |
| 13294 | |
| 13295 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13296 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 13297 | WMITLV_GET_STRUCT_TLVLEN |
| 13298 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 13299 | cmd->vdev_id = vdev_id; |
| 13300 | cmd->pattern_id = ptrn_id; |
| 13301 | |
| 13302 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 13303 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 13304 | |
| 13305 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13306 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 13307 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13308 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 13309 | |
| 13310 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 13311 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 13312 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 13313 | |
| 13314 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 13315 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
| 13316 | |
| 13317 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 13318 | bitmap_pattern->pattern_len = ptrn_len; |
| 13319 | |
| 13320 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 13321 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 13322 | |
| 13323 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 13324 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 13325 | |
| 13326 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 13327 | bitmap_pattern->pattern_id = ptrn_id; |
| 13328 | |
| 13329 | WMI_LOGI("vdev: %d, ptrn id: %d, ptrn len: %d, ptrn offset: %d user %d", |
| 13330 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 13331 | bitmap_pattern->pattern_offset, user); |
| 13332 | WMI_LOGI("Pattern : "); |
| 13333 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 13334 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 13335 | |
| 13336 | WMI_LOGI("Mask : "); |
| 13337 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 13338 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
| 13339 | |
| 13340 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 13341 | |
| 13342 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 13343 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13344 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13345 | |
| 13346 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 13347 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13348 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13349 | |
| 13350 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 13351 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13352 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13353 | |
| 13354 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 13355 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 13356 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13357 | |
| 13358 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 13359 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 13360 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13361 | *(A_UINT32 *) buf_ptr = 0; |
| 13362 | |
| 13363 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13364 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 13365 | if (ret) { |
| 13366 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
| 13367 | wmi_buf_free(buf); |
| 13368 | return QDF_STATUS_E_FAILURE; |
| 13369 | } |
| 13370 | |
| 13371 | return QDF_STATUS_SUCCESS; |
| 13372 | } |
| 13373 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13374 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13375 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 13376 | * @wmi_handle: wmi handle |
| 13377 | * @offload_req: offload request |
| 13378 | * @buf_ptr: buffer pointer |
| 13379 | * |
| 13380 | * To fill ARP offload data to firmware |
| 13381 | * when target goes to wow mode. |
| 13382 | * |
| 13383 | * Return: None |
| 13384 | */ |
| 13385 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13386 | struct pmo_arp_offload_params *offload_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13387 | { |
| 13388 | |
| 13389 | int i; |
| 13390 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13391 | bool enable_or_disable = offload_req->enable; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13392 | |
| 13393 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13394 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 13395 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13396 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 13397 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 13398 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 13399 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 13400 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 13401 | |
| 13402 | /* Fill data for ARP and NS in the first tupple for LA */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13403 | if ((enable_or_disable & PMO_OFFLOAD_ENABLE) && (i == 0)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13404 | /* Copy the target ip addr and flags */ |
| 13405 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 13406 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13407 | offload_req->host_ipv4_addr, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13408 | WMI_IPV4_ADDR_LEN); |
| 13409 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13410 | offload_req->host_ipv4_addr); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13411 | } |
| 13412 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 13413 | } |
| 13414 | } |
| 13415 | |
| 13416 | #ifdef WLAN_NS_OFFLOAD |
| 13417 | /** |
| 13418 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 13419 | * @wmi|_handle: wmi handle |
| 13420 | * @offload_req: offload request |
| 13421 | * @buf_ptr: buffer pointer |
| 13422 | * |
| 13423 | * To fill NS offload data to firmware |
| 13424 | * when target goes to wow mode. |
| 13425 | * |
| 13426 | * Return: None |
| 13427 | */ |
| 13428 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13429 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13430 | { |
| 13431 | |
| 13432 | int i; |
| 13433 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13434 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13435 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13436 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 13437 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13438 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 13439 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 13440 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 13441 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 13442 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 13443 | |
| 13444 | /* |
| 13445 | * Fill data only for NS offload in the first ARP tuple for LA |
| 13446 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13447 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13448 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 13449 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13450 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13451 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13452 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13453 | sizeof(WMI_IPV6_ADDR)); |
| 13454 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13455 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13456 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13457 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13458 | ns_tuple->flags |= |
| 13459 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 13460 | } |
| 13461 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13462 | i, &ns_req->self_ipv6_addr[i], |
| 13463 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13464 | |
| 13465 | /* target MAC is optional, check if it is valid, |
| 13466 | * if this is not valid, the target will use the known |
| 13467 | * local MAC address rather than the tuple |
| 13468 | */ |
| 13469 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13470 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13471 | &ns_tuple->target_mac); |
| 13472 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 13473 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 13474 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 13475 | } |
| 13476 | } |
| 13477 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 13478 | } |
| 13479 | } |
| 13480 | |
| 13481 | |
| 13482 | /** |
| 13483 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 13484 | * @wmi: wmi handle |
| 13485 | * @offload_req: offload request |
| 13486 | * @buf_ptr: buffer pointer |
| 13487 | * |
| 13488 | * To fill extended NS offload extended data to firmware |
| 13489 | * when target goes to wow mode. |
| 13490 | * |
| 13491 | * Return: None |
| 13492 | */ |
| 13493 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13494 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13495 | { |
| 13496 | int i; |
| 13497 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 13498 | uint32_t count, num_ns_ext_tuples; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13499 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13500 | count = ns_req->num_ns_offload_count; |
| 13501 | num_ns_ext_tuples = ns_req->num_ns_offload_count - |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13502 | WMI_MAX_NS_OFFLOADS; |
| 13503 | |
| 13504 | /* Populate extended NS offload tuples */ |
| 13505 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13506 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 13507 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13508 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 13509 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 13510 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 13511 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 13512 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 13513 | |
| 13514 | /* |
| 13515 | * Fill data only for NS offload in the first ARP tuple for LA |
| 13516 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13517 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13518 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 13519 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13520 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13521 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13522 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13523 | sizeof(WMI_IPV6_ADDR)); |
| 13524 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13525 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13526 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13527 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13528 | ns_tuple->flags |= |
| 13529 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 13530 | } |
| 13531 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13532 | i, &ns_req->self_ipv6_addr[i], |
| 13533 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13534 | |
| 13535 | /* target MAC is optional, check if it is valid, |
| 13536 | * if this is not valid, the target will use the |
| 13537 | * known local MAC address rather than the tuple |
| 13538 | */ |
| 13539 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13540 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13541 | &ns_tuple->target_mac); |
| 13542 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 13543 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 13544 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 13545 | } |
| 13546 | } |
| 13547 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 13548 | } |
| 13549 | } |
| 13550 | #else |
| 13551 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13552 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13553 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13554 | } |
| 13555 | |
| 13556 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13557 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13558 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13559 | } |
| 13560 | #endif |
| 13561 | |
| 13562 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13563 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 13564 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13565 | * @arp_offload_req: arp offload request |
| 13566 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13567 | * @arp_only: flag |
| 13568 | * |
| 13569 | * To configure ARP NS off load data to firmware |
| 13570 | * when target goes to wow mode. |
| 13571 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13572 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13573 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13574 | 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] | 13575 | struct pmo_arp_offload_params *arp_offload_req, |
| 13576 | struct pmo_ns_offload_params *ns_offload_req, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13577 | uint8_t vdev_id) |
| 13578 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13579 | int32_t res; |
| 13580 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13581 | A_UINT8 *buf_ptr; |
| 13582 | wmi_buf_t buf; |
| 13583 | int32_t len; |
| 13584 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 13585 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13586 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13587 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13588 | /* |
| 13589 | * TLV place holder size for array of NS tuples |
| 13590 | * TLV place holder size for array of ARP tuples |
| 13591 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13592 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 13593 | WMI_TLV_HDR_SIZE + |
| 13594 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 13595 | WMI_TLV_HDR_SIZE + |
| 13596 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13597 | |
| 13598 | /* |
| 13599 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 13600 | * extra length for extended NS offload tuples which follows ARP offload |
| 13601 | * tuples. Host needs to fill this structure in following format: |
| 13602 | * 2 NS ofload tuples |
| 13603 | * 2 ARP offload tuples |
| 13604 | * N numbers of extended NS offload tuples if HDD has given more than |
| 13605 | * 2 NS offload addresses |
| 13606 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13607 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13608 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13609 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 13610 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13611 | } |
| 13612 | |
| 13613 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13614 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13615 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13616 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13617 | } |
| 13618 | |
| 13619 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 13620 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 13621 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13622 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 13623 | WMITLV_GET_STRUCT_TLVLEN |
| 13624 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 13625 | cmd->flags = 0; |
| 13626 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13627 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13628 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13629 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13630 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13631 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13632 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 13633 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 13634 | if (num_ns_ext_tuples) |
| 13635 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13636 | |
| 13637 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13638 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 13639 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13640 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13641 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13642 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13643 | } |
| 13644 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13645 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13646 | } |
| 13647 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13648 | /** |
| 13649 | * send_enable_enhance_multicast_offload_tlv() - send enhance multicast offload |
| 13650 | * @wmi_handle: wmi handle |
| 13651 | * @vdev_id: vdev id |
| 13652 | * @action: true for enable else false |
| 13653 | * |
| 13654 | * To enable enhance multicast offload to firmware |
| 13655 | * when target goes to wow mode. |
| 13656 | * |
| 13657 | * Return: QDF Status |
| 13658 | */ |
| 13659 | |
| 13660 | static |
| 13661 | QDF_STATUS send_enable_enhance_multicast_offload_tlv( |
| 13662 | wmi_unified_t wmi_handle, |
| 13663 | uint8_t vdev_id, bool action) |
| 13664 | { |
| 13665 | QDF_STATUS status; |
| 13666 | wmi_buf_t buf; |
| 13667 | wmi_config_enhanced_mcast_filter_cmd_fixed_param *cmd; |
| 13668 | |
| 13669 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13670 | if (!buf) { |
| 13671 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 13672 | return QDF_STATUS_E_NOMEM; |
| 13673 | } |
| 13674 | |
| 13675 | cmd = (wmi_config_enhanced_mcast_filter_cmd_fixed_param *) |
| 13676 | wmi_buf_data(buf); |
| 13677 | |
| 13678 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13679 | WMITLV_TAG_STRUC_wmi_config_enhanced_mcast_filter_fixed_param, |
| 13680 | WMITLV_GET_STRUCT_TLVLEN( |
| 13681 | wmi_config_enhanced_mcast_filter_cmd_fixed_param)); |
| 13682 | |
| 13683 | cmd->vdev_id = vdev_id; |
| 13684 | cmd->enable = ((action == 0) ? ENHANCED_MCAST_FILTER_DISABLED : |
| 13685 | ENHANCED_MCAST_FILTER_ENABLED); |
| 13686 | WMI_LOGD("%s: config enhance multicast offload action %d for vdev %d", |
| 13687 | __func__, action, vdev_id); |
| 13688 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13689 | sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID); |
| 13690 | if (status != QDF_STATUS_SUCCESS) { |
| 13691 | qdf_nbuf_free(buf); |
| 13692 | WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID", |
| 13693 | __func__); |
| 13694 | } |
| 13695 | |
| 13696 | return status; |
| 13697 | } |
| 13698 | |
| 13699 | /** |
| 13700 | * extract_gtk_rsp_event_tlv() - extract gtk rsp params from event |
| 13701 | * @wmi_handle: wmi handle |
| 13702 | * @param evt_buf: pointer to event buffer |
| 13703 | * @param hdr: Pointer to hold header |
| 13704 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 13705 | * |
| 13706 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13707 | */ |
| 13708 | static QDF_STATUS extract_gtk_rsp_event_tlv(wmi_unified_t wmi_handle, |
| 13709 | void *evt_buf, struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len) |
| 13710 | { |
| 13711 | WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *fixed_param; |
| 13712 | WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *param_buf; |
| 13713 | |
| 13714 | param_buf = (WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *)evt_buf; |
| 13715 | if (!param_buf) { |
| 13716 | WMI_LOGE("gtk param_buf is NULL"); |
| 13717 | return QDF_STATUS_E_INVAL; |
| 13718 | } |
| 13719 | |
| 13720 | if (len < sizeof(WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param)) { |
| 13721 | WMI_LOGE("Invalid length for GTK status"); |
| 13722 | return QDF_STATUS_E_INVAL; |
| 13723 | } |
| 13724 | |
| 13725 | fixed_param = (WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *) |
| 13726 | param_buf->fixed_param; |
| 13727 | gtk_rsp_param->vdev_id = fixed_param->vdev_id; |
| 13728 | gtk_rsp_param->status_flag = QDF_STATUS_SUCCESS; |
| 13729 | gtk_rsp_param->refresh_cnt = fixed_param->refresh_cnt; |
| 13730 | qdf_mem_copy(>k_rsp_param->replay_counter, |
| 13731 | &fixed_param->replay_counter, |
| 13732 | GTK_REPLAY_COUNTER_BYTES); |
| 13733 | |
| 13734 | return QDF_STATUS_SUCCESS; |
| 13735 | |
| 13736 | } |
| 13737 | |
| 13738 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 13739 | /** |
| 13740 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 13741 | * @wmi_handle: wmi handle |
| 13742 | * @vdev_id: vdev id |
| 13743 | * |
| 13744 | * Return: CDF status |
| 13745 | */ |
| 13746 | static QDF_STATUS send_wow_sta_ra_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13747 | uint8_t vdev_id, uint8_t default_pattern, |
| 13748 | uint16_t rate_limit_interval) |
| 13749 | { |
| 13750 | |
| 13751 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 13752 | wmi_buf_t buf; |
| 13753 | uint8_t *buf_ptr; |
| 13754 | int32_t len; |
| 13755 | int ret; |
| 13756 | |
| 13757 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 13758 | WMI_TLV_HDR_SIZE + |
| 13759 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 13760 | WMI_TLV_HDR_SIZE + |
| 13761 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 13762 | WMI_TLV_HDR_SIZE + |
| 13763 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 13764 | WMI_TLV_HDR_SIZE + |
| 13765 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 13766 | WMI_TLV_HDR_SIZE + |
| 13767 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 13768 | |
| 13769 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13770 | if (!buf) { |
| 13771 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13772 | return QDF_STATUS_E_NOMEM; |
| 13773 | } |
| 13774 | |
| 13775 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 13776 | buf_ptr = (uint8_t *) cmd; |
| 13777 | |
| 13778 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13779 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 13780 | WMITLV_GET_STRUCT_TLVLEN |
| 13781 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 13782 | cmd->vdev_id = vdev_id; |
| 13783 | cmd->pattern_id = default_pattern, |
| 13784 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 13785 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 13786 | |
| 13787 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 13788 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13789 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13790 | |
| 13791 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 13792 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13793 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13794 | |
| 13795 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 13796 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13797 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13798 | |
| 13799 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 13800 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13801 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13802 | |
| 13803 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 13804 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 13805 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13806 | |
| 13807 | /* Fill TLV for ra_ratelimit_interval. */ |
| 13808 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 13809 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13810 | |
| 13811 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 13812 | |
| 13813 | WMI_LOGD("%s: send RA rate limit [%d] to fw vdev = %d", __func__, |
| 13814 | rate_limit_interval, vdev_id); |
| 13815 | |
| 13816 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13817 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 13818 | if (ret) { |
| 13819 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
| 13820 | wmi_buf_free(buf); |
| 13821 | return QDF_STATUS_E_FAILURE; |
| 13822 | } |
| 13823 | |
| 13824 | return QDF_STATUS_SUCCESS; |
| 13825 | |
| 13826 | } |
| 13827 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 13828 | |
| 13829 | /** |
| 13830 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 13831 | * @wmi_handle: wmi handle |
| 13832 | * @vdev_id: vdev id |
| 13833 | * @multicastAddr: mcast address |
| 13834 | * @clearList: clear list flag |
| 13835 | * |
| 13836 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13837 | */ |
| 13838 | static QDF_STATUS send_add_clear_mcbc_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13839 | uint8_t vdev_id, |
| 13840 | struct qdf_mac_addr multicast_addr, |
| 13841 | bool clearList) |
| 13842 | { |
| 13843 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 13844 | wmi_buf_t buf; |
| 13845 | int err; |
| 13846 | |
| 13847 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13848 | if (!buf) { |
| 13849 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 13850 | return QDF_STATUS_E_NOMEM; |
| 13851 | } |
| 13852 | |
| 13853 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
| 13854 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 13855 | |
| 13856 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13857 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 13858 | WMITLV_GET_STRUCT_TLVLEN |
| 13859 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 13860 | cmd->action = |
| 13861 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 13862 | cmd->vdev_id = vdev_id; |
| 13863 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
| 13864 | |
| 13865 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 13866 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 13867 | |
| 13868 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 13869 | sizeof(*cmd), |
| 13870 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 13871 | if (err) { |
| 13872 | WMI_LOGE("Failed to send set_param cmd"); |
| 13873 | wmi_buf_free(buf); |
| 13874 | return QDF_STATUS_E_FAILURE; |
| 13875 | } |
| 13876 | |
| 13877 | return QDF_STATUS_SUCCESS; |
| 13878 | } |
| 13879 | |
| 13880 | /** |
| 13881 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 13882 | * @wmi_handle: wmi handle |
| 13883 | * @vdev_id: vdev id |
| 13884 | * @params: GTK offload parameters |
| 13885 | * |
| 13886 | * Return: CDF status |
| 13887 | */ |
| 13888 | static |
| 13889 | QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
| 13890 | struct pmo_gtk_req *params, |
| 13891 | bool enable_offload, |
| 13892 | uint32_t gtk_offload_opcode) |
| 13893 | { |
| 13894 | int len; |
| 13895 | wmi_buf_t buf; |
| 13896 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 13897 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13898 | |
| 13899 | WMI_LOGD("%s Enter", __func__); |
| 13900 | |
| 13901 | len = sizeof(*cmd); |
| 13902 | |
| 13903 | /* alloc wmi buffer */ |
| 13904 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13905 | if (!buf) { |
| 13906 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 13907 | status = QDF_STATUS_E_NOMEM; |
| 13908 | goto out; |
| 13909 | } |
| 13910 | |
| 13911 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 13912 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13913 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 13914 | WMITLV_GET_STRUCT_TLVLEN |
| 13915 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 13916 | |
| 13917 | cmd->vdev_id = vdev_id; |
| 13918 | |
| 13919 | /* Request target to enable GTK offload */ |
| 13920 | if (enable_offload == PMO_GTK_OFFLOAD_ENABLE) { |
| 13921 | cmd->flags = gtk_offload_opcode; |
| 13922 | |
| 13923 | /* Copy the keys and replay counter */ |
| 13924 | qdf_mem_copy(cmd->KCK, params->kck, PMO_KCK_LEN); |
| 13925 | qdf_mem_copy(cmd->KEK, params->kek, PMO_KEK_LEN); |
| 13926 | qdf_mem_copy(cmd->replay_counter, ¶ms->replay_counter, |
| 13927 | GTK_REPLAY_COUNTER_BYTES); |
| 13928 | } else { |
| 13929 | cmd->flags = gtk_offload_opcode; |
| 13930 | } |
| 13931 | |
| 13932 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 13933 | |
| 13934 | /* send the wmi command */ |
| 13935 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13936 | WMI_GTK_OFFLOAD_CMDID)) { |
| 13937 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
| 13938 | wmi_buf_free(buf); |
| 13939 | status = QDF_STATUS_E_FAILURE; |
| 13940 | } |
| 13941 | |
| 13942 | out: |
| 13943 | WMI_LOGD("%s Exit", __func__); |
| 13944 | return status; |
| 13945 | } |
| 13946 | |
| 13947 | /** |
| 13948 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 13949 | * @wmi_handle: wmi handle |
| 13950 | * @params: GTK offload params |
| 13951 | * |
| 13952 | * Return: CDF status |
| 13953 | */ |
| 13954 | static QDF_STATUS send_process_gtk_offload_getinfo_cmd_tlv( |
| 13955 | wmi_unified_t wmi_handle, |
| 13956 | uint8_t vdev_id, |
| 13957 | uint64_t offload_req_opcode) |
| 13958 | { |
| 13959 | int len; |
| 13960 | wmi_buf_t buf; |
| 13961 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 13962 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13963 | |
| 13964 | len = sizeof(*cmd); |
| 13965 | |
| 13966 | /* alloc wmi buffer */ |
| 13967 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13968 | if (!buf) { |
| 13969 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 13970 | status = QDF_STATUS_E_NOMEM; |
| 13971 | goto out; |
| 13972 | } |
| 13973 | |
| 13974 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 13975 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13976 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 13977 | WMITLV_GET_STRUCT_TLVLEN |
| 13978 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 13979 | |
| 13980 | /* Request for GTK offload status */ |
| 13981 | cmd->flags = offload_req_opcode; |
| 13982 | cmd->vdev_id = vdev_id; |
| 13983 | |
| 13984 | /* send the wmi command */ |
| 13985 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13986 | WMI_GTK_OFFLOAD_CMDID)) { |
| 13987 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
| 13988 | wmi_buf_free(buf); |
| 13989 | status = QDF_STATUS_E_FAILURE; |
| 13990 | } |
| 13991 | |
| 13992 | out: |
| 13993 | return status; |
| 13994 | } |
| 13995 | |
| 13996 | /** |
| 13997 | * send_action_frame_patterns_cmd_tlv() - send wmi cmd of action filter params |
| 13998 | * @wmi_handle: wmi handler |
| 13999 | * @action_params: pointer to action_params |
| 14000 | * |
| 14001 | * Return: 0 for success, otherwise appropriate error code |
| 14002 | */ |
| 14003 | static QDF_STATUS send_action_frame_patterns_cmd_tlv(wmi_unified_t wmi_handle, |
| 14004 | struct pmo_action_wakeup_set_params *action_params) |
| 14005 | { |
| 14006 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *cmd; |
| 14007 | wmi_buf_t buf; |
| 14008 | int i; |
| 14009 | int32_t err; |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14010 | uint32_t len = 0, *cmd_args; |
| 14011 | uint8_t *buf_ptr; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14012 | |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14013 | len = (PMO_SUPPORTED_ACTION_CATE * sizeof(A_UINT32)) |
| 14014 | + WMI_TLV_HDR_SIZE + sizeof(*cmd); |
| 14015 | buf = wmi_buf_alloc(wmi_handle, len); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14016 | if (!buf) { |
| 14017 | WMI_LOGE("Failed to allocate buffer to send action filter cmd"); |
| 14018 | return QDF_STATUS_E_NOMEM; |
| 14019 | } |
| 14020 | 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] | 14021 | buf_ptr = (uint8_t *)cmd; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14022 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14023 | WMITLV_TAG_STRUC_wmi_wow_set_action_wake_up_cmd_fixed_param, |
| 14024 | WMITLV_GET_STRUCT_TLVLEN( |
| 14025 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param)); |
| 14026 | |
| 14027 | cmd->vdev_id = action_params->vdev_id; |
| 14028 | cmd->operation = action_params->operation; |
| 14029 | |
| 14030 | for (i = 0; i < MAX_SUPPORTED_ACTION_CATEGORY_ELE_LIST; i++) |
| 14031 | cmd->action_category_map[i] = |
| 14032 | action_params->action_category_map[i]; |
| 14033 | |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14034 | buf_ptr += sizeof(WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param); |
| 14035 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14036 | (PMO_SUPPORTED_ACTION_CATE * sizeof(A_UINT32))); |
| 14037 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14038 | cmd_args = (uint32_t *) buf_ptr; |
| 14039 | for (i = 0; i < PMO_SUPPORTED_ACTION_CATE; i++) |
| 14040 | cmd_args[i] = action_params->action_per_category[i]; |
| 14041 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14042 | err = wmi_unified_cmd_send(wmi_handle, buf, |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14043 | len, WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14044 | if (err) { |
| 14045 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
| 14046 | wmi_buf_free(buf); |
| 14047 | return QDF_STATUS_E_FAILURE; |
| 14048 | } |
| 14049 | |
| 14050 | return QDF_STATUS_SUCCESS; |
| 14051 | } |
| 14052 | |
| 14053 | #ifdef FEATURE_WLAN_LPHB |
| 14054 | |
| 14055 | /** |
| 14056 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 14057 | * @wmi_handle: wmi handle |
| 14058 | * @lphb_conf_req: configuration info |
| 14059 | * |
| 14060 | * Return: CDF status |
| 14061 | */ |
| 14062 | static QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle, |
| 14063 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 14064 | { |
| 14065 | QDF_STATUS status; |
| 14066 | wmi_buf_t buf = NULL; |
| 14067 | uint8_t *buf_ptr; |
| 14068 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 14069 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 14070 | |
| 14071 | |
| 14072 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14073 | if (!buf) { |
| 14074 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14075 | return QDF_STATUS_E_NOMEM; |
| 14076 | } |
| 14077 | |
| 14078 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14079 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 14080 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 14081 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 14082 | WMITLV_GET_STRUCT_TLVLEN |
| 14083 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 14084 | |
| 14085 | /* fill in values */ |
| 14086 | hb_enable_fp->vdev_id = params->session; |
| 14087 | hb_enable_fp->enable = params->enable; |
| 14088 | hb_enable_fp->item = params->item; |
| 14089 | hb_enable_fp->session = params->session; |
| 14090 | |
| 14091 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14092 | len, WMI_HB_SET_ENABLE_CMDID); |
| 14093 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14094 | WMI_LOGE("cmd_send WMI_HB_SET_ENABLE returned Error %d", |
| 14095 | status); |
| 14096 | wmi_buf_free(buf); |
| 14097 | } |
| 14098 | |
| 14099 | return status; |
| 14100 | } |
| 14101 | |
| 14102 | /** |
| 14103 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 14104 | * @wmi_handle: wmi handle |
| 14105 | * @lphb_conf_req: lphb config request |
| 14106 | * |
| 14107 | * Return: CDF status |
| 14108 | */ |
| 14109 | static QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 14110 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 14111 | { |
| 14112 | QDF_STATUS status; |
| 14113 | wmi_buf_t buf = NULL; |
| 14114 | uint8_t *buf_ptr; |
| 14115 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 14116 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 14117 | |
| 14118 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14119 | if (!buf) { |
| 14120 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14121 | return QDF_STATUS_E_NOMEM; |
| 14122 | } |
| 14123 | |
| 14124 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14125 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 14126 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 14127 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 14128 | WMITLV_GET_STRUCT_TLVLEN |
| 14129 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 14130 | |
| 14131 | /* fill in values */ |
| 14132 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14133 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 14134 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 14135 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 14136 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 14137 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 14138 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 14139 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 14140 | hb_tcp_params_fp->session = lphb_conf_req->session; |
| 14141 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
| 14142 | &lphb_conf_req->gateway_mac, |
| 14143 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 14144 | |
| 14145 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14146 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
| 14147 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14148 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", |
| 14149 | status); |
| 14150 | wmi_buf_free(buf); |
| 14151 | } |
| 14152 | |
| 14153 | return status; |
| 14154 | } |
| 14155 | |
| 14156 | /** |
| 14157 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 14158 | * @wmi_handle: wmi handle |
| 14159 | * @lphb_conf_req: lphb config request |
| 14160 | * |
| 14161 | * Return: CDF status |
| 14162 | */ |
| 14163 | static |
| 14164 | QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14165 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 14166 | { |
| 14167 | QDF_STATUS status; |
| 14168 | wmi_buf_t buf = NULL; |
| 14169 | uint8_t *buf_ptr; |
| 14170 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 14171 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 14172 | |
| 14173 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14174 | if (!buf) { |
| 14175 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14176 | return QDF_STATUS_E_NOMEM; |
| 14177 | } |
| 14178 | |
| 14179 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14180 | hb_tcp_filter_fp = |
| 14181 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 14182 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 14183 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 14184 | WMITLV_GET_STRUCT_TLVLEN |
| 14185 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 14186 | |
| 14187 | /* fill in values */ |
| 14188 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 14189 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 14190 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 14191 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 14192 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 14193 | (void *)&g_hb_tcp_filter_fp->filter, |
| 14194 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 14195 | |
| 14196 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14197 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 14198 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14199 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", |
| 14200 | status); |
| 14201 | wmi_buf_free(buf); |
| 14202 | } |
| 14203 | |
| 14204 | return status; |
| 14205 | } |
| 14206 | |
| 14207 | /** |
| 14208 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 14209 | * @wmi_handle: wmi handle |
| 14210 | * @lphb_conf_req: lphb config request |
| 14211 | * |
| 14212 | * Return: CDF status |
| 14213 | */ |
| 14214 | static QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 14215 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 14216 | { |
| 14217 | QDF_STATUS status; |
| 14218 | wmi_buf_t buf = NULL; |
| 14219 | uint8_t *buf_ptr; |
| 14220 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 14221 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 14222 | |
| 14223 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14224 | if (!buf) { |
| 14225 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14226 | return QDF_STATUS_E_NOMEM; |
| 14227 | } |
| 14228 | |
| 14229 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14230 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 14231 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 14232 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 14233 | WMITLV_GET_STRUCT_TLVLEN |
| 14234 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 14235 | |
| 14236 | /* fill in values */ |
| 14237 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14238 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 14239 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 14240 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 14241 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 14242 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 14243 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 14244 | hb_udp_params_fp->session = lphb_conf_req->session; |
| 14245 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
| 14246 | &lphb_conf_req->gateway_mac, |
| 14247 | sizeof(lphb_conf_req->gateway_mac)); |
| 14248 | |
| 14249 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14250 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
| 14251 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14252 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", |
| 14253 | status); |
| 14254 | wmi_buf_free(buf); |
| 14255 | } |
| 14256 | |
| 14257 | return status; |
| 14258 | } |
| 14259 | |
| 14260 | /** |
| 14261 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 14262 | * @wmi_handle: wmi handle |
| 14263 | * @lphb_conf_req: lphb config request |
| 14264 | * |
| 14265 | * Return: CDF status |
| 14266 | */ |
| 14267 | static |
| 14268 | QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14269 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 14270 | { |
| 14271 | QDF_STATUS status; |
| 14272 | wmi_buf_t buf = NULL; |
| 14273 | uint8_t *buf_ptr; |
| 14274 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 14275 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 14276 | |
| 14277 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14278 | if (!buf) { |
| 14279 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14280 | return QDF_STATUS_E_NOMEM; |
| 14281 | } |
| 14282 | |
| 14283 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14284 | hb_udp_filter_fp = |
| 14285 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 14286 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 14287 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 14288 | WMITLV_GET_STRUCT_TLVLEN |
| 14289 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 14290 | |
| 14291 | /* fill in values */ |
| 14292 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14293 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 14294 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 14295 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 14296 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 14297 | (void *)&lphb_conf_req->filter, |
| 14298 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 14299 | |
| 14300 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14301 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 14302 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14303 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", |
| 14304 | status); |
| 14305 | wmi_buf_free(buf); |
| 14306 | } |
| 14307 | |
| 14308 | return status; |
| 14309 | } |
| 14310 | #endif /* FEATURE_WLAN_LPHB */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14311 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14312 | static QDF_STATUS send_conf_hw_filter_cmd_tlv(wmi_unified_t wmi, |
| 14313 | struct pmo_hw_filter_params *req) |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14314 | { |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14315 | QDF_STATUS status; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14316 | wmi_hw_data_filter_cmd_fixed_param *cmd; |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14317 | wmi_buf_t wmi_buf; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14318 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14319 | if (!req) { |
| 14320 | WMI_LOGE("req is null"); |
| 14321 | return QDF_STATUS_E_INVAL; |
| 14322 | } |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14323 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14324 | wmi_buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 14325 | if (!wmi_buf) { |
| 14326 | WMI_LOGE(FL("Out of memory")); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14327 | return QDF_STATUS_E_NOMEM; |
| 14328 | } |
| 14329 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14330 | 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] | 14331 | WMITLV_SET_HDR(&cmd->tlv_header, |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14332 | WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param, |
| 14333 | WMITLV_GET_STRUCT_TLVLEN(wmi_hw_data_filter_cmd_fixed_param)); |
| 14334 | cmd->vdev_id = req->vdev_id; |
| 14335 | cmd->enable = req->mode != PMO_HW_FILTER_DISABLED; |
| 14336 | cmd->hw_filter_bitmap = req->mode; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14337 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14338 | WMI_LOGD("configure hw filter (vdev_id: %d, mode: %d)", |
| 14339 | req->vdev_id, req->mode); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14340 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14341 | status = wmi_unified_cmd_send(wmi, wmi_buf, sizeof(*cmd), |
| 14342 | WMI_HW_DATA_FILTER_CMDID); |
| 14343 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14344 | WMI_LOGE("Failed to configure hw filter"); |
| 14345 | wmi_buf_free(wmi_buf); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14346 | } |
| 14347 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14348 | return status; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14349 | } |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame] | 14350 | |
| 14351 | /** |
| 14352 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter |
| 14353 | * @wmi_handle: wmi handle |
| 14354 | * @vdev_id: vdev id |
| 14355 | * @enable: Flag to enable/disable packet filter |
| 14356 | * |
| 14357 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14358 | */ |
| 14359 | static QDF_STATUS send_enable_disable_packet_filter_cmd_tlv( |
| 14360 | wmi_unified_t wmi_handle, uint8_t vdev_id, bool enable) |
| 14361 | { |
| 14362 | int32_t len; |
| 14363 | int ret = 0; |
| 14364 | wmi_buf_t buf; |
| 14365 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 14366 | |
| 14367 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 14368 | |
| 14369 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14370 | if (!buf) { |
| 14371 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 14372 | return QDF_STATUS_E_NOMEM; |
| 14373 | } |
| 14374 | |
| 14375 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 14376 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14377 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 14378 | WMITLV_GET_STRUCT_TLVLEN( |
| 14379 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 14380 | |
| 14381 | cmd->vdev_id = vdev_id; |
| 14382 | if (enable) |
| 14383 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 14384 | else |
| 14385 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 14386 | |
| 14387 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
| 14388 | __func__, cmd->enable, vdev_id); |
| 14389 | |
| 14390 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14391 | WMI_PACKET_FILTER_ENABLE_CMDID); |
| 14392 | if (ret) { |
| 14393 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
| 14394 | wmi_buf_free(buf); |
| 14395 | } |
| 14396 | |
| 14397 | return ret; |
| 14398 | } |
| 14399 | |
| 14400 | /** |
| 14401 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 14402 | * @wmi_handle: wmi handle |
| 14403 | * @vdev_id: vdev id |
| 14404 | * @rcv_filter_param: Packet filter parameters |
| 14405 | * @filter_id: Filter id |
| 14406 | * @enable: Flag to add/delete packet filter configuration |
| 14407 | * |
| 14408 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14409 | */ |
| 14410 | static QDF_STATUS send_config_packet_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14411 | uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param, |
| 14412 | uint8_t filter_id, bool enable) |
| 14413 | { |
| 14414 | int len, i; |
| 14415 | int err = 0; |
| 14416 | wmi_buf_t buf; |
| 14417 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 14418 | |
| 14419 | |
| 14420 | /* allocate the memory */ |
| 14421 | len = sizeof(*cmd); |
| 14422 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14423 | if (!buf) { |
| 14424 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 14425 | return QDF_STATUS_E_NOMEM; |
| 14426 | } |
| 14427 | |
| 14428 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 14429 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14430 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 14431 | WMITLV_GET_STRUCT_TLVLEN |
| 14432 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 14433 | |
| 14434 | cmd->vdev_id = vdev_id; |
| 14435 | cmd->filter_id = filter_id; |
| 14436 | if (enable) |
| 14437 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 14438 | else |
| 14439 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 14440 | |
| 14441 | if (enable) { |
| 14442 | cmd->num_params = QDF_MIN( |
| 14443 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 14444 | rcv_filter_param->num_params); |
| 14445 | cmd->filter_type = rcv_filter_param->filter_type; |
| 14446 | cmd->coalesce_time = rcv_filter_param->coalesce_time; |
| 14447 | |
| 14448 | for (i = 0; i < cmd->num_params; i++) { |
| 14449 | cmd->paramsData[i].proto_type = |
| 14450 | rcv_filter_param->params_data[i].protocol_layer; |
| 14451 | cmd->paramsData[i].cmp_type = |
| 14452 | rcv_filter_param->params_data[i].compare_flag; |
| 14453 | cmd->paramsData[i].data_length = |
| 14454 | rcv_filter_param->params_data[i].data_length; |
| 14455 | cmd->paramsData[i].data_offset = |
| 14456 | rcv_filter_param->params_data[i].data_offset; |
| 14457 | memcpy(&cmd->paramsData[i].compareData, |
| 14458 | rcv_filter_param->params_data[i].compare_data, |
| 14459 | sizeof(cmd->paramsData[i].compareData)); |
| 14460 | memcpy(&cmd->paramsData[i].dataMask, |
| 14461 | rcv_filter_param->params_data[i].data_mask, |
| 14462 | sizeof(cmd->paramsData[i].dataMask)); |
| 14463 | } |
| 14464 | } |
| 14465 | |
| 14466 | WMI_LOGE("Packet filter action %d filter with id: %d, num_params=%d", |
| 14467 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 14468 | /* send the command along with data */ |
| 14469 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14470 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 14471 | if (err) { |
| 14472 | WMI_LOGE("Failed to send pkt_filter cmd"); |
| 14473 | wmi_buf_free(buf); |
| 14474 | return QDF_STATUS_E_FAILURE; |
| 14475 | } |
| 14476 | |
| 14477 | return QDF_STATUS_SUCCESS; |
| 14478 | } |
Ravi Kumar Bokka | 8f2c92f | 2017-03-23 15:22:51 +0530 | [diff] [blame] | 14479 | #endif /* End of WLAN_PMO_ENABLE */ |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14480 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14481 | /** |
| 14482 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 14483 | * @wmi_handle: wmi handle |
| 14484 | * @request: SSID hotlist set request |
| 14485 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14486 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14487 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14488 | static QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14489 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 14490 | struct ssid_hotlist_request_params *request) |
| 14491 | { |
| 14492 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 14493 | wmi_buf_t wmi_buf; |
| 14494 | uint32_t len; |
| 14495 | uint32_t array_size; |
| 14496 | uint8_t *buf_ptr; |
| 14497 | |
| 14498 | /* length of fixed portion */ |
| 14499 | len = sizeof(*cmd); |
| 14500 | |
| 14501 | /* length of variable portion */ |
| 14502 | array_size = |
| 14503 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 14504 | len += WMI_TLV_HDR_SIZE + array_size; |
| 14505 | |
| 14506 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14507 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14508 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 14509 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14510 | } |
| 14511 | |
| 14512 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 14513 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 14514 | buf_ptr; |
| 14515 | WMITLV_SET_HDR |
| 14516 | (&cmd->tlv_header, |
| 14517 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 14518 | WMITLV_GET_STRUCT_TLVLEN |
| 14519 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 14520 | |
| 14521 | cmd->request_id = request->request_id; |
| 14522 | cmd->requestor_id = 0; |
| 14523 | cmd->vdev_id = request->session_id; |
| 14524 | cmd->table_id = 0; |
| 14525 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 14526 | cmd->total_entries = request->ssid_count; |
| 14527 | cmd->num_entries_in_page = request->ssid_count; |
| 14528 | cmd->first_entry_index = 0; |
| 14529 | |
| 14530 | buf_ptr += sizeof(*cmd); |
| 14531 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 14532 | |
| 14533 | if (request->ssid_count) { |
| 14534 | wmi_extscan_hotlist_ssid_entry *entry; |
| 14535 | int i; |
| 14536 | |
| 14537 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14538 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 14539 | for (i = 0; i < request->ssid_count; i++) { |
| 14540 | WMITLV_SET_HDR |
| 14541 | (entry, |
| 14542 | WMITLV_TAG_ARRAY_STRUC, |
| 14543 | WMITLV_GET_STRUCT_TLVLEN |
| 14544 | (wmi_extscan_hotlist_ssid_entry)); |
| 14545 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14546 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14547 | request->ssids[i].ssid.mac_ssid, |
| 14548 | request->ssids[i].ssid.length); |
| 14549 | entry->band = request->ssids[i].band; |
| 14550 | entry->min_rssi = request->ssids[i].rssi_low; |
| 14551 | entry->max_rssi = request->ssids[i].rssi_high; |
| 14552 | entry++; |
| 14553 | } |
| 14554 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 14555 | } else { |
| 14556 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 14557 | } |
| 14558 | |
| 14559 | if (wmi_unified_cmd_send |
| 14560 | (wmi_handle, wmi_buf, len, |
| 14561 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14562 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14563 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14564 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14565 | } |
| 14566 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14567 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14568 | } |
| 14569 | |
| 14570 | /** |
| 14571 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 14572 | * @wmi_handle: wmi handle |
| 14573 | * @vdev_id: vdev id |
| 14574 | * |
| 14575 | * This function sends roam synch complete event to fw. |
| 14576 | * |
| 14577 | * Return: CDF STATUS |
| 14578 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14579 | 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] | 14580 | uint8_t vdev_id) |
| 14581 | { |
| 14582 | wmi_roam_synch_complete_fixed_param *cmd; |
| 14583 | wmi_buf_t wmi_buf; |
| 14584 | uint8_t *buf_ptr; |
| 14585 | uint16_t len; |
| 14586 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 14587 | |
| 14588 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14589 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14590 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 14591 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14592 | } |
| 14593 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 14594 | buf_ptr = (uint8_t *) cmd; |
| 14595 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14596 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 14597 | WMITLV_GET_STRUCT_TLVLEN |
| 14598 | (wmi_roam_synch_complete_fixed_param)); |
| 14599 | cmd->vdev_id = vdev_id; |
| 14600 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14601 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14602 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14603 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14604 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14605 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14606 | } |
| 14607 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14608 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14609 | } |
| 14610 | |
| 14611 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 14612 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 14613 | * @wmi_handle: wmi handle |
| 14614 | * @wmi_fwtest: fw test command |
| 14615 | * |
| 14616 | * This function sends fw test command to fw. |
| 14617 | * |
| 14618 | * Return: CDF STATUS |
| 14619 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14620 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 14621 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 14622 | struct set_fwtest_params *wmi_fwtest) |
| 14623 | { |
| 14624 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 14625 | wmi_buf_t wmi_buf; |
| 14626 | uint16_t len; |
| 14627 | |
| 14628 | len = sizeof(*cmd); |
| 14629 | |
| 14630 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14631 | if (!wmi_buf) { |
| 14632 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 14633 | return QDF_STATUS_E_NOMEM; |
| 14634 | } |
| 14635 | |
| 14636 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 14637 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14638 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 14639 | WMITLV_GET_STRUCT_TLVLEN( |
| 14640 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 14641 | cmd->param_id = wmi_fwtest->arg; |
| 14642 | cmd->param_value = wmi_fwtest->value; |
| 14643 | |
| 14644 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14645 | WMI_FWTEST_CMDID)) { |
| 14646 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 14647 | qdf_nbuf_free(wmi_buf); |
| 14648 | return QDF_STATUS_E_FAILURE; |
| 14649 | } |
| 14650 | |
| 14651 | return QDF_STATUS_SUCCESS; |
| 14652 | } |
| 14653 | |
| 14654 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14655 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 14656 | * @wmi_handle: wmi handle |
| 14657 | * @wmi_utest: unit test command |
| 14658 | * |
| 14659 | * This function send unit test command to fw. |
| 14660 | * |
| 14661 | * Return: CDF STATUS |
| 14662 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14663 | 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] | 14664 | struct wmi_unit_test_cmd *wmi_utest) |
| 14665 | { |
| 14666 | wmi_unit_test_cmd_fixed_param *cmd; |
| 14667 | wmi_buf_t wmi_buf; |
| 14668 | uint8_t *buf_ptr; |
| 14669 | int i; |
| 14670 | uint16_t len, args_tlv_len; |
| 14671 | A_UINT32 *unit_test_cmd_args; |
| 14672 | |
| 14673 | args_tlv_len = |
| 14674 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 14675 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 14676 | |
| 14677 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14678 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14679 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 14680 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14681 | } |
| 14682 | |
| 14683 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 14684 | buf_ptr = (uint8_t *) cmd; |
| 14685 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14686 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 14687 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 14688 | cmd->vdev_id = wmi_utest->vdev_id; |
| 14689 | cmd->module_id = wmi_utest->module_id; |
| 14690 | cmd->num_args = wmi_utest->num_args; |
| 14691 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 14692 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14693 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 14694 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14695 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14696 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 14697 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14698 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14699 | } |
| 14700 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14701 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14702 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14703 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14704 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14705 | } |
| 14706 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14707 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14708 | } |
| 14709 | |
| 14710 | /** |
| 14711 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 14712 | * @wmi_handle: wma handle |
| 14713 | * @roaminvoke: roam invoke command |
| 14714 | * |
| 14715 | * Send roam invoke command to fw for fastreassoc. |
| 14716 | * |
| 14717 | * Return: CDF STATUS |
| 14718 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14719 | 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] | 14720 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 14721 | uint32_t ch_hz) |
| 14722 | { |
| 14723 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 14724 | wmi_buf_t wmi_buf; |
| 14725 | u_int8_t *buf_ptr; |
| 14726 | u_int16_t len, args_tlv_len; |
| 14727 | A_UINT32 *channel_list; |
| 14728 | wmi_mac_addr *bssid_list; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14729 | wmi_tlv_buf_len_param *buf_len_tlv; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14730 | |
| 14731 | /* Host sends only one channel and one bssid */ |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14732 | args_tlv_len = (4 * WMI_TLV_HDR_SIZE) + sizeof(A_UINT32) + |
| 14733 | sizeof(wmi_mac_addr) + sizeof(wmi_tlv_buf_len_param) + |
| 14734 | roundup(roaminvoke->frame_len, sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14735 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 14736 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14737 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14738 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 14739 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14740 | } |
| 14741 | |
| 14742 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 14743 | buf_ptr = (u_int8_t *) cmd; |
| 14744 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14745 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 14746 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 14747 | cmd->vdev_id = roaminvoke->vdev_id; |
Arif Hussain | 7698b6d | 2016-12-15 20:05:36 -0800 | [diff] [blame] | 14748 | cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_REPORT_FAILURE); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14749 | |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 14750 | if (roaminvoke->frame_len) { |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14751 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_SKIP; |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 14752 | /* packing 1 beacon/probe_rsp frame with WMI cmd */ |
| 14753 | cmd->num_buf = 1; |
| 14754 | } else { |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14755 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_FIXED_CH; |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 14756 | cmd->num_buf = 0; |
| 14757 | } |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14758 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14759 | cmd->roam_ap_sel_mode = 0; |
| 14760 | cmd->roam_delay = 0; |
| 14761 | cmd->num_chan = 1; |
| 14762 | cmd->num_bssid = 1; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14763 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14764 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 14765 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14766 | (sizeof(u_int32_t))); |
| 14767 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 14768 | *channel_list = ch_hz; |
| 14769 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 14770 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 14771 | (sizeof(wmi_mac_addr))); |
| 14772 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 14773 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14774 | |
| 14775 | /* move to next tlv i.e. bcn_prb_buf_list */ |
| 14776 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_mac_addr); |
| 14777 | |
| 14778 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 14779 | sizeof(wmi_tlv_buf_len_param)); |
| 14780 | |
| 14781 | buf_len_tlv = (wmi_tlv_buf_len_param *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 14782 | buf_len_tlv->buf_len = roaminvoke->frame_len; |
| 14783 | |
| 14784 | /* move to next tlv i.e. bcn_prb_frm */ |
| 14785 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_tlv_buf_len_param); |
| 14786 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 14787 | roundup(roaminvoke->frame_len, sizeof(uint32_t))); |
| 14788 | |
| 14789 | /* copy frame after the header */ |
| 14790 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
| 14791 | roaminvoke->frame_buf, |
| 14792 | roaminvoke->frame_len); |
| 14793 | |
| 14794 | WMI_LOGD(FL("bcn/prb_rsp frame, length: %d"), roaminvoke->frame_len); |
| 14795 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 14796 | buf_ptr + WMI_TLV_HDR_SIZE, |
| 14797 | roaminvoke->frame_len); |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 14798 | WMI_LOGD(FL("flag:%d, MODE scn:%d, ap:%d, dly:%d, n_ch:%d, n_bssid:%d"), |
| 14799 | cmd->flags, cmd->roam_scan_mode, |
| 14800 | cmd->roam_ap_sel_mode, cmd->roam_delay, |
| 14801 | cmd->num_chan, cmd->num_bssid); |
| 14802 | WMI_LOGD(FL("BSSID: %pM, channel: %d"), roaminvoke->bssid, ch_hz); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14803 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14804 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14805 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14806 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14807 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14808 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14809 | } |
| 14810 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14811 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14812 | } |
| 14813 | |
| 14814 | /** |
| 14815 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 14816 | * @wmi_handle: wmi handle |
| 14817 | * @command: command |
| 14818 | * @vdev_id: vdev id |
| 14819 | * |
| 14820 | * This function set roam offload command to fw. |
| 14821 | * |
| 14822 | * Return: CDF status |
| 14823 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14824 | 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] | 14825 | uint32_t command, uint32_t vdev_id) |
| 14826 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14827 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14828 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 14829 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14830 | int len; |
| 14831 | uint8_t *buf_ptr; |
| 14832 | |
| 14833 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 14834 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14835 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14836 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14837 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14838 | } |
| 14839 | |
| 14840 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14841 | |
| 14842 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 14843 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 14844 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 14845 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 14846 | cmd_fp->vdev_id = vdev_id; |
| 14847 | cmd_fp->command_arg = command; |
| 14848 | |
| 14849 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14850 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14851 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14852 | 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] | 14853 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14854 | goto error; |
| 14855 | } |
| 14856 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14857 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 14858 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14859 | |
| 14860 | error: |
| 14861 | wmi_buf_free(buf); |
| 14862 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14863 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14864 | } |
| 14865 | |
| 14866 | /** |
| 14867 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 14868 | * @wmi_handle: wmi handle |
| 14869 | * @ap_profile_p: ap profile |
| 14870 | * @vdev_id: vdev id |
| 14871 | * |
| 14872 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 14873 | * |
| 14874 | * Return: CDF status |
| 14875 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14876 | static QDF_STATUS send_roam_scan_offload_ap_profile_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14877 | wmi_ap_profile *ap_profile_p, |
| 14878 | uint32_t vdev_id) |
| 14879 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14880 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14881 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14882 | int len; |
| 14883 | uint8_t *buf_ptr; |
| 14884 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 14885 | |
| 14886 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 14887 | |
| 14888 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14889 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14890 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14891 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14892 | } |
| 14893 | |
| 14894 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14895 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 14896 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 14897 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 14898 | WMITLV_GET_STRUCT_TLVLEN |
| 14899 | (wmi_roam_ap_profile_fixed_param)); |
| 14900 | /* fill in threshold values */ |
| 14901 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 14902 | roam_ap_profile_fp->id = 0; |
| 14903 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 14904 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14905 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14906 | WMITLV_SET_HDR(buf_ptr, |
| 14907 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 14908 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 14909 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14910 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14911 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14912 | 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] | 14913 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14914 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14915 | } |
| 14916 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14917 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14918 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14919 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14920 | } |
| 14921 | |
| 14922 | /** |
| 14923 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 14924 | * @wmi_handle: wmi handle |
| 14925 | * @scan_period: scan period |
| 14926 | * @scan_age: scan age |
| 14927 | * @vdev_id: vdev id |
| 14928 | * |
| 14929 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 14930 | * |
| 14931 | * Return: CDF status |
| 14932 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14933 | 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] | 14934 | uint32_t scan_period, |
| 14935 | uint32_t scan_age, |
| 14936 | uint32_t vdev_id) |
| 14937 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14938 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14939 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14940 | int len; |
| 14941 | uint8_t *buf_ptr; |
| 14942 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 14943 | |
| 14944 | /* Send scan period values */ |
| 14945 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 14946 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14947 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14948 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14949 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14950 | } |
| 14951 | |
| 14952 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14953 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 14954 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 14955 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 14956 | WMITLV_GET_STRUCT_TLVLEN |
| 14957 | (wmi_roam_scan_period_fixed_param)); |
| 14958 | /* fill in scan period values */ |
| 14959 | scan_period_fp->vdev_id = vdev_id; |
| 14960 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 14961 | scan_period_fp->roam_scan_age = scan_age; |
| 14962 | |
| 14963 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14964 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14965 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14966 | 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] | 14967 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14968 | goto error; |
| 14969 | } |
| 14970 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14971 | 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] | 14972 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14973 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14974 | error: |
| 14975 | wmi_buf_free(buf); |
| 14976 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14977 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14978 | } |
| 14979 | |
| 14980 | /** |
| 14981 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 14982 | * @wmi_handle: wmi handle |
| 14983 | * @chan_count: channel count |
| 14984 | * @chan_list: channel list |
| 14985 | * @list_type: list type |
| 14986 | * @vdev_id: vdev id |
| 14987 | * |
| 14988 | * Set roam offload channel list. |
| 14989 | * |
| 14990 | * Return: CDF status |
| 14991 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14992 | 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] | 14993 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 14994 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14995 | uint8_t list_type, uint32_t vdev_id) |
| 14996 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14997 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14998 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14999 | int len, list_tlv_len; |
| 15000 | int i; |
| 15001 | uint8_t *buf_ptr; |
| 15002 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 15003 | A_UINT32 *roam_chan_list_array; |
| 15004 | |
| 15005 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15006 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15007 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15008 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15009 | } |
| 15010 | /* Channel list is a table of 2 TLV's */ |
| 15011 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 15012 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 15013 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15014 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15015 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15016 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15017 | } |
| 15018 | |
| 15019 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15020 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 15021 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 15022 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 15023 | WMITLV_GET_STRUCT_TLVLEN |
| 15024 | (wmi_roam_chan_list_fixed_param)); |
| 15025 | chan_list_fp->vdev_id = vdev_id; |
| 15026 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 15027 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15028 | /* external app is controlling channel list */ |
| 15029 | chan_list_fp->chan_list_type = |
| 15030 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 15031 | } else { |
| 15032 | /* umac supplied occupied channel list in LFR */ |
| 15033 | chan_list_fp->chan_list_type = |
| 15034 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 15035 | } |
| 15036 | |
| 15037 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 15038 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15039 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 15040 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15041 | WMI_LOGD("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15042 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 15043 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 15044 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15045 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15046 | } |
| 15047 | |
| 15048 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15049 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15050 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15051 | 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] | 15052 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15053 | goto error; |
| 15054 | } |
| 15055 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15056 | WMI_LOGD("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15057 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15058 | error: |
| 15059 | wmi_buf_free(buf); |
| 15060 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15061 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15062 | } |
| 15063 | |
| 15064 | /** |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15065 | * send_per_roam_config_cmd_tlv() - set per roaming config to FW |
| 15066 | * @wmi_handle: wmi handle |
| 15067 | * @req_buf: per roam config buffer |
| 15068 | * |
| 15069 | * Return: QDF status |
| 15070 | */ |
| 15071 | static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 15072 | struct wmi_per_roam_config_req *req_buf) |
| 15073 | { |
| 15074 | wmi_buf_t buf = NULL; |
| 15075 | QDF_STATUS status; |
| 15076 | int len; |
| 15077 | uint8_t *buf_ptr; |
| 15078 | wmi_roam_per_config_fixed_param *wmi_per_config; |
| 15079 | |
| 15080 | len = sizeof(wmi_roam_per_config_fixed_param); |
| 15081 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15082 | if (!buf) { |
| 15083 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15084 | return QDF_STATUS_E_NOMEM; |
| 15085 | } |
| 15086 | |
| 15087 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15088 | wmi_per_config = |
| 15089 | (wmi_roam_per_config_fixed_param *) buf_ptr; |
| 15090 | WMITLV_SET_HDR(&wmi_per_config->tlv_header, |
| 15091 | WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param, |
| 15092 | WMITLV_GET_STRUCT_TLVLEN |
| 15093 | (wmi_roam_per_config_fixed_param)); |
| 15094 | |
| 15095 | /* fill in per roam config values */ |
| 15096 | wmi_per_config->vdev_id = req_buf->vdev_id; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15097 | |
| 15098 | wmi_per_config->enable = req_buf->per_config.enable; |
| 15099 | wmi_per_config->high_rate_thresh = |
| 15100 | (req_buf->per_config.tx_high_rate_thresh << 16) | |
| 15101 | (req_buf->per_config.rx_high_rate_thresh & 0x0000ffff); |
| 15102 | wmi_per_config->low_rate_thresh = |
| 15103 | (req_buf->per_config.tx_low_rate_thresh << 16) | |
| 15104 | (req_buf->per_config.rx_low_rate_thresh & 0x0000ffff); |
| 15105 | wmi_per_config->pkt_err_rate_thresh_pct = |
| 15106 | (req_buf->per_config.tx_rate_thresh_percnt << 16) | |
| 15107 | (req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff); |
| 15108 | 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] | 15109 | wmi_per_config->pkt_err_rate_mon_time = |
| 15110 | (req_buf->per_config.tx_per_mon_time << 16) | |
| 15111 | (req_buf->per_config.rx_per_mon_time & 0x0000ffff); |
Selvaraj, Sridhar | ba7e361 | 2017-05-17 16:05:15 +0530 | [diff] [blame] | 15112 | wmi_per_config->min_candidate_rssi = |
| 15113 | req_buf->per_config.min_candidate_rssi; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15114 | |
| 15115 | /* Send per roam config parameters */ |
| 15116 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15117 | len, WMI_ROAM_PER_CONFIG_CMDID); |
| 15118 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15119 | WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d", |
| 15120 | status); |
| 15121 | wmi_buf_free(buf); |
| 15122 | return status; |
| 15123 | } |
| 15124 | |
| 15125 | WMI_LOGI(FL("per roam enable=%d, vdev=%d"), |
| 15126 | req_buf->per_config.enable, req_buf->vdev_id); |
| 15127 | return QDF_STATUS_SUCCESS; |
| 15128 | } |
| 15129 | |
| 15130 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15131 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 15132 | * @wmi_handle: wmi handle |
| 15133 | * @rssi_change_thresh: RSSI Change threshold |
| 15134 | * @bcn_rssi_weight: beacon RSSI weight |
| 15135 | * @vdev_id: vdev id |
| 15136 | * |
| 15137 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 15138 | * |
| 15139 | * Return: CDF status |
| 15140 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15141 | 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] | 15142 | uint32_t vdev_id, |
| 15143 | int32_t rssi_change_thresh, |
| 15144 | uint32_t bcn_rssi_weight, |
| 15145 | uint32_t hirssi_delay_btw_scans) |
| 15146 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15147 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15148 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15149 | int len; |
| 15150 | uint8_t *buf_ptr; |
| 15151 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 15152 | |
| 15153 | /* Send rssi change parameters */ |
| 15154 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 15155 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15156 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15157 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15158 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15159 | } |
| 15160 | |
| 15161 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15162 | rssi_change_fp = |
| 15163 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 15164 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 15165 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 15166 | WMITLV_GET_STRUCT_TLVLEN |
| 15167 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 15168 | /* fill in rssi change threshold (hysteresis) values */ |
| 15169 | rssi_change_fp->vdev_id = vdev_id; |
| 15170 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 15171 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 15172 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 15173 | |
| 15174 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15175 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15176 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15177 | 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] | 15178 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15179 | goto error; |
| 15180 | } |
| 15181 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15182 | 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] | 15183 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15184 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 15185 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15186 | error: |
| 15187 | wmi_buf_free(buf); |
| 15188 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15189 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15190 | } |
| 15191 | |
| 15192 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 15193 | * @wmi_handle: wmi handle. |
| 15194 | * @cmd: size of command structure. |
| 15195 | * @per_entry_size: per entry size. |
| 15196 | * |
| 15197 | * This utility function calculates how many hotlist entries can |
| 15198 | * fit in one page. |
| 15199 | * |
| 15200 | * Return: number of entries |
| 15201 | */ |
| 15202 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 15203 | size_t cmd_size, |
| 15204 | size_t per_entry_size) |
| 15205 | { |
| 15206 | uint32_t avail_space = 0; |
| 15207 | int num_entries = 0; |
| 15208 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 15209 | |
| 15210 | /* Calculate number of hotlist entries that can |
| 15211 | * be passed in wma message request. |
| 15212 | */ |
| 15213 | avail_space = max_msg_len - cmd_size; |
| 15214 | num_entries = avail_space / per_entry_size; |
| 15215 | return num_entries; |
| 15216 | } |
| 15217 | |
| 15218 | /** |
| 15219 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 15220 | * @wmi_handle: wmi handle |
| 15221 | * @photlist: hotlist command params |
| 15222 | * @buf_len: buffer length |
| 15223 | * |
| 15224 | * This function fills individual elements for hotlist request and |
| 15225 | * TLV for bssid entries |
| 15226 | * |
| 15227 | * Return: CDF Status. |
| 15228 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15229 | 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] | 15230 | struct ext_scan_setbssi_hotlist_params * |
| 15231 | photlist, int *buf_len) |
| 15232 | { |
| 15233 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 15234 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 15235 | struct ap_threshold_params *src_ap = photlist->ap; |
| 15236 | wmi_buf_t buf; |
| 15237 | uint8_t *buf_ptr; |
| 15238 | |
| 15239 | int j, index = 0; |
| 15240 | int cmd_len = 0; |
| 15241 | int num_entries; |
| 15242 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 15243 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15244 | int len = sizeof(*cmd); |
| 15245 | |
| 15246 | len += WMI_TLV_HDR_SIZE; |
| 15247 | cmd_len = len; |
| 15248 | |
| 15249 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 15250 | cmd_len, |
| 15251 | sizeof(*dest_hotlist)); |
| 15252 | /* setbssid hotlist expects the bssid list |
| 15253 | * to be non zero value |
| 15254 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 15255 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 15256 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15257 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15258 | } |
| 15259 | |
| 15260 | /* Split the hot list entry pages and send multiple command |
| 15261 | * requests if the buffer reaches the maximum request size |
| 15262 | */ |
| 15263 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15264 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15265 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 15266 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15267 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15268 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 15269 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15270 | } |
| 15271 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15272 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 15273 | buf_ptr; |
| 15274 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15275 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 15276 | WMITLV_GET_STRUCT_TLVLEN |
| 15277 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 15278 | |
| 15279 | /* Multiple requests are sent until the num_entries_in_page |
| 15280 | * matches the total_entries |
| 15281 | */ |
| 15282 | cmd->request_id = photlist->requestId; |
| 15283 | cmd->vdev_id = photlist->sessionId; |
| 15284 | cmd->total_entries = numap; |
| 15285 | cmd->mode = 1; |
| 15286 | cmd->num_entries_in_page = min_entries; |
| 15287 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 15288 | cmd->first_entry_index = index; |
| 15289 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15290 | 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] | 15291 | __func__, cmd->vdev_id, cmd->total_entries, |
| 15292 | cmd->num_entries_in_page, |
| 15293 | cmd->lost_ap_scan_count); |
| 15294 | |
| 15295 | buf_ptr += sizeof(*cmd); |
| 15296 | WMITLV_SET_HDR(buf_ptr, |
| 15297 | WMITLV_TAG_ARRAY_STRUC, |
| 15298 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 15299 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 15300 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 15301 | |
| 15302 | /* Populate bssid, channel info and rssi |
| 15303 | * for the bssid's that are sent as hotlists. |
| 15304 | */ |
| 15305 | for (j = 0; j < min_entries; j++) { |
| 15306 | WMITLV_SET_HDR(dest_hotlist, |
| 15307 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 15308 | WMITLV_GET_STRUCT_TLVLEN |
| 15309 | (wmi_extscan_hotlist_entry)); |
| 15310 | |
| 15311 | dest_hotlist->min_rssi = src_ap->low; |
| 15312 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 15313 | &dest_hotlist->bssid); |
| 15314 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15315 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15316 | __func__, dest_hotlist->channel, |
| 15317 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15318 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15319 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 15320 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 15321 | dest_hotlist->bssid.mac_addr47to32); |
| 15322 | dest_hotlist++; |
| 15323 | src_ap++; |
| 15324 | } |
| 15325 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 15326 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 15327 | |
| 15328 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15329 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15330 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15331 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15332 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15333 | } |
| 15334 | index = index + min_entries; |
| 15335 | num_entries = numap - min_entries; |
| 15336 | len = cmd_len; |
| 15337 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15338 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15339 | } |
| 15340 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15341 | /** |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 15342 | * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW |
| 15343 | * @wmi_handle: the WMI handle |
| 15344 | * @vdev_id: the Id of the vdev to apply the configuration to |
| 15345 | * @ucast_mode: the active BPF mode to configure for unicast packets |
| 15346 | * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast |
| 15347 | * packets |
| 15348 | * |
| 15349 | * Return: QDF status |
| 15350 | */ |
| 15351 | static QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 15352 | uint8_t vdev_id, |
| 15353 | enum wmi_host_active_bpf_mode ucast_mode, |
| 15354 | enum wmi_host_active_bpf_mode mcast_bcast_mode) |
| 15355 | { |
| 15356 | const WMITLV_TAG_ID tag_id = |
| 15357 | WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; |
| 15358 | const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( |
| 15359 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param); |
| 15360 | QDF_STATUS status; |
| 15361 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; |
| 15362 | wmi_buf_t buf; |
| 15363 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15364 | 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] | 15365 | vdev_id, ucast_mode, mcast_bcast_mode); |
| 15366 | |
| 15367 | /* allocate command buffer */ |
| 15368 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 15369 | if (!buf) { |
| 15370 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 15371 | return QDF_STATUS_E_NOMEM; |
| 15372 | } |
| 15373 | |
| 15374 | /* set TLV header */ |
| 15375 | cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); |
| 15376 | WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); |
| 15377 | |
| 15378 | /* populate data */ |
| 15379 | cmd->vdev_id = vdev_id; |
| 15380 | cmd->uc_mode = ucast_mode; |
| 15381 | cmd->mcbc_mode = mcast_bcast_mode; |
| 15382 | |
| 15383 | /* send to FW */ |
| 15384 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 15385 | WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); |
| 15386 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15387 | WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", |
| 15388 | status); |
| 15389 | wmi_buf_free(buf); |
| 15390 | return status; |
| 15391 | } |
| 15392 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15393 | WMI_LOGD("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 15394 | |
| 15395 | return QDF_STATUS_SUCCESS; |
| 15396 | } |
| 15397 | |
| 15398 | /** |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15399 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 15400 | * @wmi_handle: wmi handle |
| 15401 | * @param: wmi power debug parameter |
| 15402 | * |
| 15403 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 15404 | * |
| 15405 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15406 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 15407 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 15408 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15409 | { |
| 15410 | wmi_buf_t buf = NULL; |
| 15411 | QDF_STATUS status; |
| 15412 | int len, args_tlv_len; |
| 15413 | uint8_t *buf_ptr; |
| 15414 | uint8_t i; |
| 15415 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 15416 | uint32_t *cmd_args; |
| 15417 | |
| 15418 | /* Prepare and send power debug cmd parameters */ |
| 15419 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 15420 | len = sizeof(*cmd) + args_tlv_len; |
| 15421 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15422 | if (!buf) { |
| 15423 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15424 | return QDF_STATUS_E_NOMEM; |
| 15425 | } |
| 15426 | |
| 15427 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15428 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 15429 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15430 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 15431 | WMITLV_GET_STRUCT_TLVLEN |
| 15432 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 15433 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15434 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 15435 | param->pdev_id); |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15436 | cmd->module_id = param->module_id; |
| 15437 | cmd->num_args = param->num_args; |
| 15438 | buf_ptr += sizeof(*cmd); |
| 15439 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15440 | (param->num_args * sizeof(uint32_t))); |
| 15441 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 15442 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 15443 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 15444 | cmd_args[i] = param->args[i]; |
| 15445 | WMI_LOGI("%d,", param->args[i]); |
| 15446 | } |
| 15447 | |
| 15448 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15449 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 15450 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15451 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 15452 | status); |
| 15453 | goto error; |
| 15454 | } |
| 15455 | |
| 15456 | return QDF_STATUS_SUCCESS; |
| 15457 | error: |
| 15458 | wmi_buf_free(buf); |
| 15459 | |
| 15460 | return status; |
| 15461 | } |
| 15462 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15463 | /* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15464 | * @wmi_handle: pointer to wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15465 | * @buf_ptr: pointer to current position in init command buffer |
| 15466 | * @len: pointer to length. This will be updated with current lenght of cmd |
| 15467 | * @param: point host parameters for init command |
| 15468 | * |
| 15469 | * Return: Updated pointer of buf_ptr. |
| 15470 | */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15471 | static inline uint8_t *copy_hw_mode_in_init_cmd(struct wmi_unified *wmi_handle, |
| 15472 | uint8_t *buf_ptr, int *len, struct wmi_init_cmd_param *param) |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15473 | { |
| 15474 | uint16_t idx; |
| 15475 | |
| 15476 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { |
| 15477 | wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode; |
| 15478 | wmi_pdev_band_to_mac *band_to_mac; |
| 15479 | |
| 15480 | hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *) |
| 15481 | (buf_ptr + sizeof(wmi_init_cmd_fixed_param) + |
| 15482 | sizeof(wmi_resource_config) + |
| 15483 | WMI_TLV_HDR_SIZE + (param->num_mem_chunks * |
| 15484 | sizeof(wlan_host_memory_chunk))); |
| 15485 | |
| 15486 | WMITLV_SET_HDR(&hw_mode->tlv_header, |
| 15487 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 15488 | (WMITLV_GET_STRUCT_TLVLEN |
| 15489 | (wmi_pdev_set_hw_mode_cmd_fixed_param))); |
| 15490 | |
| 15491 | hw_mode->hw_mode_index = param->hw_mode_id; |
| 15492 | hw_mode->num_band_to_mac = param->num_band_to_mac; |
| 15493 | |
| 15494 | buf_ptr = (uint8_t *) (hw_mode + 1); |
| 15495 | band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr + |
| 15496 | WMI_TLV_HDR_SIZE); |
| 15497 | for (idx = 0; idx < param->num_band_to_mac; idx++) { |
| 15498 | WMITLV_SET_HDR(&band_to_mac[idx].tlv_header, |
| 15499 | WMITLV_TAG_STRUC_wmi_pdev_band_to_mac, |
| 15500 | WMITLV_GET_STRUCT_TLVLEN |
| 15501 | (wmi_pdev_band_to_mac)); |
| 15502 | band_to_mac[idx].pdev_id = |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15503 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 15504 | param->band_to_mac[idx].pdev_id); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15505 | band_to_mac[idx].start_freq = |
| 15506 | param->band_to_mac[idx].start_freq; |
| 15507 | band_to_mac[idx].end_freq = |
| 15508 | param->band_to_mac[idx].end_freq; |
| 15509 | } |
| 15510 | *len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 15511 | (param->num_band_to_mac * |
| 15512 | sizeof(wmi_pdev_band_to_mac)) + |
| 15513 | WMI_TLV_HDR_SIZE; |
| 15514 | |
| 15515 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 15516 | (param->num_band_to_mac * |
| 15517 | sizeof(wmi_pdev_band_to_mac))); |
| 15518 | } |
| 15519 | |
| 15520 | return buf_ptr; |
| 15521 | } |
| 15522 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15523 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15524 | * send_multiple_vdev_restart_req_cmd_tlv() - send multiple vdev restart req |
| 15525 | * @wmi_handle: wmi handle |
| 15526 | * @param: wmi multiple vdev restart req param |
| 15527 | * |
| 15528 | * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw. |
| 15529 | * |
| 15530 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15531 | */ |
| 15532 | static QDF_STATUS send_multiple_vdev_restart_req_cmd_tlv( |
| 15533 | wmi_unified_t wmi_handle, |
| 15534 | struct multiple_vdev_restart_params *param) |
| 15535 | { |
| 15536 | wmi_buf_t buf; |
| 15537 | QDF_STATUS qdf_status; |
| 15538 | wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *cmd; |
| 15539 | int i; |
| 15540 | uint8_t *buf_ptr; |
| 15541 | uint32_t *vdev_ids; |
| 15542 | wmi_channel *chan_info; |
| 15543 | struct channel_param *tchan_info; |
| 15544 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 15545 | |
| 15546 | len += sizeof(wmi_channel); |
| 15547 | if (param->num_vdevs) |
| 15548 | len += sizeof(uint32_t) * param->num_vdevs; |
| 15549 | |
| 15550 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15551 | if (!buf) { |
| 15552 | WMI_LOGE("Failed to allocate memory\n"); |
| 15553 | qdf_status = QDF_STATUS_E_NOMEM; |
| 15554 | goto end; |
| 15555 | } |
| 15556 | |
| 15557 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 15558 | cmd = (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *) |
| 15559 | buf_ptr; |
| 15560 | |
| 15561 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15562 | WMITLV_TAG_STRUC_wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param, |
| 15563 | WMITLV_GET_STRUCT_TLVLEN |
| 15564 | (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15565 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 15566 | param->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15567 | cmd->requestor_id = param->requestor_id; |
| 15568 | cmd->disable_hw_ack = param->disable_hw_ack; |
| 15569 | cmd->cac_duration_ms = param->cac_duration_ms; |
| 15570 | cmd->num_vdevs = param->num_vdevs; |
| 15571 | |
| 15572 | buf_ptr += sizeof(*cmd); |
| 15573 | |
| 15574 | WMITLV_SET_HDR(buf_ptr, |
| 15575 | WMITLV_TAG_ARRAY_UINT32, |
| 15576 | sizeof(A_UINT32) * param->num_vdevs); |
| 15577 | vdev_ids = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15578 | for (i = 0; i < param->num_vdevs; i++) { |
| 15579 | vdev_ids[i] = param->vdev_ids[i]; |
| 15580 | } |
| 15581 | |
| 15582 | buf_ptr += (sizeof(A_UINT32) * param->num_vdevs) + WMI_TLV_HDR_SIZE; |
| 15583 | |
| 15584 | WMITLV_SET_HDR(buf_ptr, |
| 15585 | WMITLV_TAG_STRUC_wmi_channel, |
| 15586 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
Sathish Kumar | 3e28e00 | 2017-03-07 15:53:04 +0530 | [diff] [blame] | 15587 | chan_info = (wmi_channel *)buf_ptr; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15588 | tchan_info = &(param->ch_param); |
| 15589 | chan_info->mhz = tchan_info->mhz; |
| 15590 | chan_info->band_center_freq1 = tchan_info->cfreq1; |
| 15591 | chan_info->band_center_freq2 = tchan_info->cfreq2; |
| 15592 | if (tchan_info->is_chan_passive) |
| 15593 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15594 | WMI_CHAN_FLAG_PASSIVE); |
| 15595 | if (tchan_info->allow_vht) |
| 15596 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15597 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 15598 | else if (tchan_info->allow_ht) |
| 15599 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15600 | WMI_CHAN_FLAG_ALLOW_HT); |
| 15601 | WMI_SET_CHANNEL_MODE(chan_info, tchan_info->phy_mode); |
| 15602 | WMI_SET_CHANNEL_MIN_POWER(chan_info, tchan_info->minpower); |
| 15603 | WMI_SET_CHANNEL_MAX_POWER(chan_info, tchan_info->maxpower); |
| 15604 | WMI_SET_CHANNEL_REG_POWER(chan_info, tchan_info->maxregpower); |
| 15605 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, tchan_info->antennamax); |
| 15606 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, tchan_info->reg_class_id); |
| 15607 | |
| 15608 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15609 | WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID); |
| 15610 | |
| 15611 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 15612 | WMI_LOGE("%s: Failed to send\n", __func__); |
| 15613 | wmi_buf_free(buf); |
| 15614 | } |
| 15615 | |
| 15616 | end: |
| 15617 | return qdf_status; |
| 15618 | } |
| 15619 | |
| 15620 | /** |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 15621 | * send_dfs_phyerr_offload_en_cmd_tlv() - send dfs phyerr offload enable cmd |
| 15622 | * @wmi_handle: wmi handle |
| 15623 | * @pdev_id: pdev id |
| 15624 | * |
| 15625 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID command to firmware. |
| 15626 | * |
| 15627 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15628 | */ |
| 15629 | static QDF_STATUS send_dfs_phyerr_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 15630 | uint32_t pdev_id) |
| 15631 | { |
| 15632 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *cmd; |
| 15633 | wmi_buf_t buf; |
| 15634 | uint16_t len; |
| 15635 | QDF_STATUS ret; |
| 15636 | |
| 15637 | len = sizeof(*cmd); |
| 15638 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15639 | |
| 15640 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 15641 | |
| 15642 | if (!buf) { |
| 15643 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15644 | return QDF_STATUS_E_NOMEM; |
| 15645 | } |
| 15646 | |
| 15647 | cmd = (wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *) |
| 15648 | wmi_buf_data(buf); |
| 15649 | |
| 15650 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15651 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param, |
| 15652 | WMITLV_GET_STRUCT_TLVLEN( |
| 15653 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param)); |
| 15654 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15655 | 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] | 15656 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15657 | WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 15658 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 15659 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 15660 | __func__, ret, pdev_id); |
| 15661 | wmi_buf_free(buf); |
| 15662 | return QDF_STATUS_E_FAILURE; |
| 15663 | } |
| 15664 | |
| 15665 | return QDF_STATUS_SUCCESS; |
| 15666 | } |
| 15667 | |
| 15668 | /** |
| 15669 | * send_dfs_phyerr_offload_dis_cmd_tlv() - send dfs phyerr offload disable cmd |
| 15670 | * @wmi_handle: wmi handle |
| 15671 | * @pdev_id: pdev id |
| 15672 | * |
| 15673 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID command to firmware. |
| 15674 | * |
| 15675 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15676 | */ |
| 15677 | static QDF_STATUS send_dfs_phyerr_offload_dis_cmd_tlv(wmi_unified_t wmi_handle, |
| 15678 | uint32_t pdev_id) |
| 15679 | { |
| 15680 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *cmd; |
| 15681 | wmi_buf_t buf; |
| 15682 | uint16_t len; |
| 15683 | QDF_STATUS ret; |
| 15684 | |
| 15685 | len = sizeof(*cmd); |
| 15686 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15687 | |
| 15688 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 15689 | |
| 15690 | if (!buf) { |
| 15691 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15692 | return QDF_STATUS_E_NOMEM; |
| 15693 | } |
| 15694 | |
| 15695 | cmd = (wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *) |
| 15696 | wmi_buf_data(buf); |
| 15697 | |
| 15698 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15699 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param, |
| 15700 | WMITLV_GET_STRUCT_TLVLEN( |
| 15701 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param)); |
| 15702 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15703 | 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] | 15704 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15705 | WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 15706 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 15707 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 15708 | __func__, ret, pdev_id); |
| 15709 | wmi_buf_free(buf); |
| 15710 | return QDF_STATUS_E_FAILURE; |
| 15711 | } |
| 15712 | |
| 15713 | return QDF_STATUS_SUCCESS; |
| 15714 | } |
| 15715 | |
| 15716 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15717 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 15718 | * @wmi_handle: wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15719 | * @param param: pointer to wmi init param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15720 | * |
| 15721 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15722 | */ |
| 15723 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15724 | struct wmi_init_cmd_param *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15725 | { |
| 15726 | wmi_buf_t buf; |
| 15727 | wmi_init_cmd_fixed_param *cmd; |
| 15728 | wmi_abi_version my_vers; |
| 15729 | int num_whitelist; |
| 15730 | uint8_t *buf_ptr; |
| 15731 | wmi_resource_config *resource_cfg; |
| 15732 | wlan_host_memory_chunk *host_mem_chunks; |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15733 | uint32_t mem_chunk_len = 0, hw_mode_len = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15734 | uint16_t idx; |
| 15735 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15736 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15737 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15738 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + |
| 15739 | WMI_TLV_HDR_SIZE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15740 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15741 | |
| 15742 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) |
| 15743 | hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 15744 | WMI_TLV_HDR_SIZE + |
| 15745 | (param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac)); |
| 15746 | |
| 15747 | 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] | 15748 | if (!buf) { |
| 15749 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 15750 | return QDF_STATUS_E_FAILURE; |
| 15751 | } |
| 15752 | |
| 15753 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15754 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 15755 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 15756 | |
| 15757 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 15758 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 15759 | + WMI_TLV_HDR_SIZE); |
| 15760 | |
| 15761 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15762 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 15763 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 15764 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15765 | wmi_copy_resource_config(resource_cfg, param->res_cfg); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15766 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 15767 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 15768 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 15769 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15770 | for (idx = 0; idx < param->num_mem_chunks; ++idx) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15771 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 15772 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 15773 | WMITLV_GET_STRUCT_TLVLEN |
| 15774 | (wlan_host_memory_chunk)); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15775 | host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr; |
| 15776 | host_mem_chunks[idx].size = param->mem_chunks[idx].len; |
| 15777 | host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id; |
Vivek | f85a42b | 2017-06-21 11:38:28 +0530 | [diff] [blame] | 15778 | QDF_TRACE(QDF_MODULE_ID_ANY, QDF_TRACE_LEVEL_DEBUG, |
| 15779 | "chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15780 | idx, host_mem_chunks[idx].size, |
| 15781 | host_mem_chunks[idx].ptr); |
| 15782 | } |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15783 | cmd->num_host_mem_chunks = param->num_mem_chunks; |
| 15784 | len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 15785 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15786 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 15787 | WMITLV_TAG_ARRAY_STRUC, |
| 15788 | (sizeof(wlan_host_memory_chunk) * |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15789 | param->num_mem_chunks)); |
| 15790 | |
| 15791 | /* Fill hw mode id config */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15792 | 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] | 15793 | |
| 15794 | num_whitelist = sizeof(version_whitelist) / |
| 15795 | sizeof(wmi_whitelist_version_info); |
| 15796 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 15797 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 15798 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 15799 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 15800 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 15801 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 15802 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 15803 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15804 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 15805 | &my_vers, |
| 15806 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 15807 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 15808 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15809 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 15810 | __func__, |
| 15811 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 15812 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 15813 | cmd->host_abi_vers.abi_version_ns_0, |
| 15814 | cmd->host_abi_vers.abi_version_ns_1, |
| 15815 | cmd->host_abi_vers.abi_version_ns_2, |
| 15816 | cmd->host_abi_vers.abi_version_ns_3); |
| 15817 | |
| 15818 | /* Save version sent from host - |
| 15819 | * Will be used to check ready event |
| 15820 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 15821 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15822 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 15823 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 15824 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15825 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 15826 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 15827 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 15828 | ret); |
| 15829 | wmi_buf_free(buf); |
| 15830 | } |
| 15831 | return ret; |
| 15832 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15833 | } |
| 15834 | |
| 15835 | /** |
| 15836 | * save_service_bitmap_tlv() - save service bitmap |
| 15837 | * @wmi_handle: wmi handle |
| 15838 | * @param evt_buf: pointer to event buffer |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15839 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15840 | * |
| 15841 | * Return: None |
| 15842 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 15843 | #ifndef CONFIG_MCL |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 15844 | static |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15845 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 15846 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15847 | { |
| 15848 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15849 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 15850 | |
| 15851 | qdf_mem_copy(wmi_handle->wmi_service_bitmap, |
| 15852 | param_buf->wmi_service_bitmap, |
| 15853 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15854 | |
| 15855 | if (bitmap_buf) |
| 15856 | qdf_mem_copy(bitmap_buf, |
| 15857 | param_buf->wmi_service_bitmap, |
| 15858 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15859 | } |
| 15860 | #else |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 15861 | static |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15862 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 15863 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15864 | { |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15865 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15866 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15867 | |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15868 | if (bitmap_buf) |
| 15869 | qdf_mem_copy(bitmap_buf, |
| 15870 | param_buf->wmi_service_bitmap, |
| 15871 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
| 15872 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15873 | #endif |
| 15874 | |
| 15875 | /** |
| 15876 | * is_service_enabled_tlv() - Check if service enabled |
| 15877 | * @param wmi_handle: wmi handle |
| 15878 | * @param service_id: service identifier |
| 15879 | * |
| 15880 | * Return: 1 enabled, 0 disabled |
| 15881 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 15882 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15883 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 15884 | uint32_t service_id) |
| 15885 | { |
| 15886 | return WMI_SERVICE_IS_ENABLED(wmi_handle->wmi_service_bitmap, |
| 15887 | service_id); |
| 15888 | } |
| 15889 | #else |
| 15890 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 15891 | uint32_t service_id) |
| 15892 | { |
| 15893 | return false; |
| 15894 | } |
| 15895 | #endif |
| 15896 | |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 15897 | static inline void copy_ht_cap_info(uint32_t ev_target_cap, |
| 15898 | struct wlan_psoc_target_capability_info *cap) |
| 15899 | { |
| 15900 | /* except LDPC all flags are common betwen legacy and here |
| 15901 | * also IBFEER is not defined for TLV |
| 15902 | */ |
| 15903 | cap->ht_cap_info |= ev_target_cap & ( |
| 15904 | WMI_HT_CAP_ENABLED |
| 15905 | | WMI_HT_CAP_HT20_SGI |
| 15906 | | WMI_HT_CAP_DYNAMIC_SMPS |
| 15907 | | WMI_HT_CAP_TX_STBC |
| 15908 | | WMI_HT_CAP_TX_STBC_MASK_SHIFT |
| 15909 | | WMI_HT_CAP_RX_STBC |
| 15910 | | WMI_HT_CAP_RX_STBC_MASK_SHIFT |
| 15911 | | WMI_HT_CAP_LDPC |
| 15912 | | WMI_HT_CAP_L_SIG_TXOP_PROT |
| 15913 | | WMI_HT_CAP_MPDU_DENSITY |
| 15914 | | WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT |
| 15915 | | WMI_HT_CAP_HT40_SGI); |
| 15916 | if (ev_target_cap & WMI_HT_CAP_LDPC) |
| 15917 | cap->ht_cap_info |= WMI_HOST_HT_CAP_RX_LDPC | |
| 15918 | WMI_HOST_HT_CAP_TX_LDPC; |
| 15919 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15920 | /** |
| 15921 | * extract_service_ready_tlv() - extract service ready event |
| 15922 | * @wmi_handle: wmi handle |
| 15923 | * @param evt_buf: pointer to received event buffer |
| 15924 | * @param cap: pointer to hold target capability information extracted from even |
| 15925 | * |
| 15926 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15927 | */ |
| 15928 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15929 | void *evt_buf, struct wlan_psoc_target_capability_info *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15930 | { |
| 15931 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15932 | wmi_service_ready_event_fixed_param *ev; |
| 15933 | |
| 15934 | |
| 15935 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 15936 | |
| 15937 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 15938 | if (!ev) { |
| 15939 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 15940 | return QDF_STATUS_E_FAILURE; |
| 15941 | } |
| 15942 | |
| 15943 | cap->phy_capability = ev->phy_capability; |
| 15944 | cap->max_frag_entry = ev->max_frag_entry; |
| 15945 | cap->num_rf_chains = ev->num_rf_chains; |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 15946 | copy_ht_cap_info(ev->ht_cap_info, cap); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15947 | cap->vht_cap_info = ev->vht_cap_info; |
| 15948 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 15949 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 15950 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 15951 | cap->sys_cap_info = ev->sys_cap_info; |
| 15952 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 15953 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 15954 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 15955 | cap->max_supported_macs = ev->max_supported_macs; |
| 15956 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 15957 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 15958 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 15959 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 15960 | |
| 15961 | return QDF_STATUS_SUCCESS; |
| 15962 | } |
| 15963 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 15964 | /* convert_wireless_modes_tlv() - Convert REGDMN_MODE values sent by target |
| 15965 | * to host internal WMI_HOST_REGDMN_MODE values. |
| 15966 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 15967 | * host currently. Add this in the future if required. |
| 15968 | * 11AX (Phase II) : 11ax related values are not currently |
| 15969 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 15970 | * finalize the advertisement mechanism. |
| 15971 | * @target_wireless_mode: target wireless mode received in message |
| 15972 | * |
| 15973 | * Return: returns the host internal wireless mode. |
| 15974 | */ |
| 15975 | static inline uint32_t convert_wireless_modes_tlv(uint32_t target_wireless_mode) |
| 15976 | { |
| 15977 | |
| 15978 | uint32_t wireless_modes = 0; |
| 15979 | |
| 15980 | if (target_wireless_mode & REGDMN_MODE_11A) |
| 15981 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 15982 | |
| 15983 | if (target_wireless_mode & REGDMN_MODE_TURBO) |
| 15984 | wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 15985 | |
| 15986 | if (target_wireless_mode & REGDMN_MODE_11B) |
| 15987 | wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 15988 | |
| 15989 | if (target_wireless_mode & REGDMN_MODE_PUREG) |
| 15990 | wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 15991 | |
| 15992 | if (target_wireless_mode & REGDMN_MODE_11G) |
| 15993 | wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 15994 | |
| 15995 | if (target_wireless_mode & REGDMN_MODE_108G) |
| 15996 | wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 15997 | |
| 15998 | if (target_wireless_mode & REGDMN_MODE_108A) |
| 15999 | wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 16000 | |
| 16001 | if (target_wireless_mode & REGDMN_MODE_XR) |
| 16002 | wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 16003 | |
| 16004 | if (target_wireless_mode & REGDMN_MODE_11A_HALF_RATE) |
| 16005 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 16006 | |
| 16007 | if (target_wireless_mode & REGDMN_MODE_11A_QUARTER_RATE) |
| 16008 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 16009 | |
| 16010 | if (target_wireless_mode & REGDMN_MODE_11NG_HT20) |
| 16011 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 16012 | |
| 16013 | if (target_wireless_mode & REGDMN_MODE_11NA_HT20) |
| 16014 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 16015 | |
| 16016 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40PLUS) |
| 16017 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 16018 | |
| 16019 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40MINUS) |
| 16020 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 16021 | |
| 16022 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40PLUS) |
| 16023 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 16024 | |
| 16025 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40MINUS) |
| 16026 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 16027 | |
| 16028 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT20) |
| 16029 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 16030 | |
| 16031 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40PLUS) |
| 16032 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 16033 | |
| 16034 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40MINUS) |
| 16035 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 16036 | |
| 16037 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80) |
| 16038 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 16039 | |
| 16040 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT160) |
| 16041 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 16042 | |
| 16043 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80_80) |
| 16044 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 16045 | |
| 16046 | return wireless_modes; |
| 16047 | } |
| 16048 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16049 | /** |
| 16050 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 16051 | * @wmi_handle: wmi handle |
| 16052 | * @param evt_buf: Pointer to event buffer |
| 16053 | * @param cap: pointer to hold HAL reg capabilities |
| 16054 | * |
| 16055 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16056 | */ |
| 16057 | 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] | 16058 | void *evt_buf, struct wlan_psoc_hal_reg_capability *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16059 | { |
| 16060 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16061 | |
| 16062 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16063 | |
| 16064 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 16065 | sizeof(uint32_t)), |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16066 | sizeof(struct wlan_psoc_hal_reg_capability)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16067 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 16068 | cap->wireless_modes = convert_wireless_modes_tlv( |
| 16069 | param_buf->hal_reg_capabilities->wireless_modes); |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 16070 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16071 | return QDF_STATUS_SUCCESS; |
| 16072 | } |
| 16073 | |
| 16074 | /** |
| 16075 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 16076 | * @wmi_handle: wmi handle |
| 16077 | * @param evt_buf: pointer to event buffer |
| 16078 | * @param num_entries: pointer to hold number of entries requested |
| 16079 | * |
| 16080 | * Return: Number of entries requested |
| 16081 | */ |
| 16082 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 16083 | void *evt_buf, uint8_t *num_entries) |
| 16084 | { |
| 16085 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16086 | wmi_service_ready_event_fixed_param *ev; |
| 16087 | |
| 16088 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16089 | |
| 16090 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 16091 | if (!ev) { |
| 16092 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16093 | return NULL; |
| 16094 | } |
| 16095 | |
| 16096 | *num_entries = ev->num_mem_reqs; |
| 16097 | |
| 16098 | return (host_mem_req *)param_buf->mem_reqs; |
| 16099 | } |
| 16100 | |
| 16101 | /** |
| 16102 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 16103 | * ready function |
| 16104 | * @wmi_handle: wmi handle |
| 16105 | * @param evt_buf: pointer to event buffer |
| 16106 | * |
| 16107 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16108 | */ |
| 16109 | static QDF_STATUS |
| 16110 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 16111 | { |
| 16112 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16113 | wmi_service_ready_event_fixed_param *ev; |
| 16114 | |
| 16115 | |
| 16116 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16117 | |
| 16118 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 16119 | if (!ev) { |
| 16120 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16121 | return QDF_STATUS_E_FAILURE; |
| 16122 | } |
| 16123 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16124 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16125 | /*Save fw version from service ready message */ |
| 16126 | /*This will be used while sending INIT message */ |
| 16127 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 16128 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16129 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16130 | return QDF_STATUS_SUCCESS; |
| 16131 | } |
| 16132 | |
| 16133 | /** |
| 16134 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 16135 | * @wmi_handle: wmi handle |
| 16136 | * @param evt_buf: Pointer to event buffer |
| 16137 | * |
| 16138 | * Return: ready status |
| 16139 | */ |
| 16140 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 16141 | void *evt_buf) |
| 16142 | { |
| 16143 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16144 | wmi_ready_event_fixed_param *ev = NULL; |
| 16145 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16146 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16147 | ev = param_buf->fixed_param; |
| 16148 | |
| 16149 | qdf_print("%s:%d\n", __func__, ev->status); |
| 16150 | |
| 16151 | return ev->status; |
| 16152 | } |
| 16153 | |
| 16154 | /** |
| 16155 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 16156 | * @wmi_handle: wmi handle |
| 16157 | * @param evt_buf: pointer to event buffer |
| 16158 | * @param macaddr: Pointer to hold MAC address |
| 16159 | * |
| 16160 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16161 | */ |
| 16162 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 16163 | void *evt_buf, uint8_t *macaddr) |
| 16164 | { |
| 16165 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16166 | wmi_ready_event_fixed_param *ev = NULL; |
| 16167 | |
| 16168 | |
| 16169 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16170 | ev = param_buf->fixed_param; |
| 16171 | |
| 16172 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 16173 | |
| 16174 | return QDF_STATUS_SUCCESS; |
| 16175 | } |
| 16176 | |
| 16177 | /** |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 16178 | * ready_extract_mac_addr_list_tlv() - extract MAC address list from ready event |
| 16179 | * @wmi_handle: wmi handle |
| 16180 | * @param evt_buf: pointer to event buffer |
| 16181 | * @param macaddr: Pointer to hold number of MAC addresses |
| 16182 | * |
| 16183 | * Return: Pointer to addr list |
| 16184 | */ |
| 16185 | static wmi_host_mac_addr *ready_extract_mac_addr_list_tlv(wmi_unified_t wmi_hamdle, |
| 16186 | void *evt_buf, uint8_t *num_mac) |
| 16187 | { |
| 16188 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16189 | wmi_ready_event_fixed_param *ev = NULL; |
| 16190 | |
| 16191 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16192 | ev = param_buf->fixed_param; |
| 16193 | |
| 16194 | *num_mac = ev->num_extra_mac_addr; |
| 16195 | |
| 16196 | return (wmi_host_mac_addr *) param_buf->mac_addr_list; |
| 16197 | } |
| 16198 | |
| 16199 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16200 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 16201 | * @wmi_handle: wmi handle |
| 16202 | * @param evt_buf: pointer to event buffer |
| 16203 | * |
| 16204 | * Return: length |
| 16205 | */ |
| 16206 | 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] | 16207 | void *evt_buf, uint32_t *len) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16208 | { |
| 16209 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 16210 | |
| 16211 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 16212 | |
| 16213 | *len = param_buf->num_bufp; |
| 16214 | |
| 16215 | return param_buf->bufp; |
| 16216 | } |
| 16217 | |
| 16218 | /** |
| 16219 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 16220 | * @wmi_handle: wmi handle |
| 16221 | * @param evt_buf: pointer to event buffer |
| 16222 | * @param vdev_rsp: Pointer to hold vdev response |
| 16223 | * |
| 16224 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16225 | */ |
| 16226 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 16227 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 16228 | { |
| 16229 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 16230 | wmi_vdev_start_response_event_fixed_param *ev; |
| 16231 | |
| 16232 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 16233 | if (!param_buf) { |
| 16234 | qdf_print("Invalid start response event buffer\n"); |
| 16235 | return QDF_STATUS_E_INVAL; |
| 16236 | } |
| 16237 | |
| 16238 | ev = param_buf->fixed_param; |
| 16239 | if (!ev) { |
| 16240 | qdf_print("Invalid start response event buffer\n"); |
| 16241 | return QDF_STATUS_E_INVAL; |
| 16242 | } |
| 16243 | |
| 16244 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 16245 | |
| 16246 | vdev_rsp->vdev_id = ev->vdev_id; |
| 16247 | vdev_rsp->requestor_id = ev->requestor_id; |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 16248 | switch (ev->resp_type) { |
| 16249 | case WMI_VDEV_START_RESP_EVENT: |
| 16250 | vdev_rsp->resp_type = WMI_HOST_VDEV_START_RESP_EVENT; |
| 16251 | break; |
| 16252 | case WMI_VDEV_RESTART_RESP_EVENT: |
| 16253 | vdev_rsp->resp_type = WMI_HOST_VDEV_RESTART_RESP_EVENT; |
| 16254 | break; |
| 16255 | default: |
| 16256 | qdf_print("Invalid start response event buffer\n"); |
| 16257 | break; |
| 16258 | }; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16259 | vdev_rsp->status = ev->status; |
| 16260 | vdev_rsp->chain_mask = ev->chain_mask; |
| 16261 | vdev_rsp->smps_mode = ev->smps_mode; |
| 16262 | vdev_rsp->mac_id = ev->mac_id; |
| 16263 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 16264 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 16265 | |
| 16266 | return QDF_STATUS_SUCCESS; |
| 16267 | } |
| 16268 | |
| 16269 | /** |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16270 | * extract_tbttoffset_num_vdevs_tlv() - extract tbtt offset num vdev |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16271 | * @wmi_handle: wmi handle |
| 16272 | * @param evt_buf: pointer to event buffer |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16273 | * @param num_vdevs: Pointer to hold num vdev |
| 16274 | * |
| 16275 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16276 | */ |
| 16277 | static QDF_STATUS extract_tbttoffset_num_vdevs_tlv(void *wmi_hdl, |
| 16278 | void *evt_buf, uint32_t *num_vdevs) |
| 16279 | { |
| 16280 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16281 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 16282 | uint32_t vdev_map; |
| 16283 | |
| 16284 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16285 | if (!param_buf) { |
| 16286 | qdf_print("Invalid tbtt update ext event buffer\n"); |
| 16287 | return QDF_STATUS_E_INVAL; |
| 16288 | } |
| 16289 | tbtt_offset_event = param_buf->fixed_param; |
| 16290 | vdev_map = tbtt_offset_event->vdev_map; |
| 16291 | *num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map); |
| 16292 | |
| 16293 | return QDF_STATUS_SUCCESS; |
| 16294 | } |
| 16295 | |
| 16296 | /** |
| 16297 | * extract_ext_tbttoffset_num_vdevs_tlv() - extract ext tbtt offset num vdev |
| 16298 | * @wmi_handle: wmi handle |
| 16299 | * @param evt_buf: pointer to event buffer |
| 16300 | * @param num_vdevs: Pointer to hold num vdev |
| 16301 | * |
| 16302 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16303 | */ |
| 16304 | static QDF_STATUS extract_ext_tbttoffset_num_vdevs_tlv(void *wmi_hdl, |
| 16305 | void *evt_buf, uint32_t *num_vdevs) |
| 16306 | { |
| 16307 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16308 | wmi_tbtt_offset_ext_event_fixed_param *tbtt_offset_ext_event; |
| 16309 | |
| 16310 | param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16311 | if (!param_buf) { |
| 16312 | qdf_print("Invalid tbtt update ext event buffer\n"); |
| 16313 | return QDF_STATUS_E_INVAL; |
| 16314 | } |
| 16315 | tbtt_offset_ext_event = param_buf->fixed_param; |
| 16316 | |
| 16317 | *num_vdevs = tbtt_offset_ext_event->num_vdevs; |
| 16318 | |
| 16319 | return QDF_STATUS_SUCCESS; |
| 16320 | } |
| 16321 | |
| 16322 | /** |
| 16323 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset param |
| 16324 | * @wmi_handle: wmi handle |
| 16325 | * @param evt_buf: pointer to event buffer |
| 16326 | * @param idx: Index refering to a vdev |
| 16327 | * @param tbtt_param: Pointer to tbttoffset event param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16328 | * |
| 16329 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16330 | */ |
| 16331 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16332 | void *evt_buf, uint8_t idx, |
| 16333 | struct tbttoffset_params *tbtt_param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16334 | { |
| 16335 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16336 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16337 | uint32_t vdev_map; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16338 | |
| 16339 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 16340 | if (!param_buf) { |
| 16341 | qdf_print("Invalid tbtt update event buffer\n"); |
| 16342 | return QDF_STATUS_E_INVAL; |
| 16343 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16344 | |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16345 | tbtt_offset_event = param_buf->fixed_param; |
| 16346 | vdev_map = tbtt_offset_event->vdev_map; |
| 16347 | tbtt_param->vdev_id = wmi_vdev_map_to_vdev_id(vdev_map, idx); |
| 16348 | if (tbtt_param->vdev_id == WLAN_INVALID_VDEV_ID) |
| 16349 | return QDF_STATUS_E_INVAL; |
| 16350 | tbtt_param->tbttoffset = |
| 16351 | param_buf->tbttoffset_list[tbtt_param->vdev_id]; |
| 16352 | |
| 16353 | return QDF_STATUS_SUCCESS; |
| 16354 | } |
| 16355 | |
| 16356 | /** |
| 16357 | * extract_ext_tbttoffset_update_params_tlv() - extract ext tbtt offset param |
| 16358 | * @wmi_handle: wmi handle |
| 16359 | * @param evt_buf: pointer to event buffer |
| 16360 | * @param idx: Index refering to a vdev |
| 16361 | * @param tbtt_param: Pointer to tbttoffset event param |
| 16362 | * |
| 16363 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16364 | */ |
| 16365 | static QDF_STATUS extract_ext_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 16366 | void *evt_buf, uint8_t idx, |
| 16367 | struct tbttoffset_params *tbtt_param) |
| 16368 | { |
| 16369 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16370 | wmi_tbtt_offset_info *tbtt_offset_info; |
| 16371 | |
| 16372 | param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16373 | if (!param_buf) { |
| 16374 | qdf_print("Invalid tbtt update event buffer\n"); |
| 16375 | return QDF_STATUS_E_INVAL; |
| 16376 | } |
| 16377 | tbtt_offset_info = ¶m_buf->tbtt_offset_info[idx]; |
| 16378 | |
| 16379 | tbtt_param->vdev_id = tbtt_offset_info->vdev_id; |
| 16380 | tbtt_param->tbttoffset = tbtt_offset_info->tbttoffset; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16381 | |
| 16382 | return QDF_STATUS_SUCCESS; |
| 16383 | } |
| 16384 | |
| 16385 | /** |
| 16386 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 16387 | * @wmi_handle: wmi handle |
| 16388 | * @param evt_buf: pointer to event buffer |
| 16389 | * @param hdr: Pointer to hold header |
| 16390 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 16391 | * |
| 16392 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16393 | */ |
| 16394 | 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] | 16395 | void *evt_buf, struct mgmt_rx_event_params *hdr, |
| 16396 | uint8_t **bufp) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16397 | { |
| 16398 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 16399 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 16400 | |
| 16401 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 16402 | if (!param_tlvs) { |
| 16403 | WMI_LOGE("Get NULL point message from FW"); |
| 16404 | return QDF_STATUS_E_INVAL; |
| 16405 | } |
| 16406 | |
| 16407 | ev_hdr = param_tlvs->hdr; |
| 16408 | if (!hdr) { |
| 16409 | WMI_LOGE("Rx event is NULL"); |
| 16410 | return QDF_STATUS_E_INVAL; |
| 16411 | } |
| 16412 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16413 | hdr->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16414 | ev_hdr->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16415 | |
| 16416 | hdr->channel = ev_hdr->channel; |
| 16417 | hdr->snr = ev_hdr->snr; |
| 16418 | hdr->rate = ev_hdr->rate; |
| 16419 | hdr->phy_mode = ev_hdr->phy_mode; |
| 16420 | hdr->buf_len = ev_hdr->buf_len; |
| 16421 | hdr->status = ev_hdr->status; |
| 16422 | hdr->flags = ev_hdr->flags; |
| 16423 | hdr->rssi = ev_hdr->rssi; |
| 16424 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 16425 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 16426 | |
| 16427 | *bufp = param_tlvs->bufp; |
| 16428 | |
| 16429 | return QDF_STATUS_SUCCESS; |
| 16430 | } |
| 16431 | |
| 16432 | /** |
| 16433 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 16434 | * @wmi_handle: wmi handle |
| 16435 | * @param evt_buf: pointer to event buffer |
| 16436 | * @param vdev_id: Pointer to hold vdev identifier |
| 16437 | * |
| 16438 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16439 | */ |
| 16440 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 16441 | void *evt_buf, uint32_t *vdev_id) |
| 16442 | { |
| 16443 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 16444 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 16445 | |
| 16446 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 16447 | if (!param_buf) { |
| 16448 | WMI_LOGE("Invalid event buffer"); |
| 16449 | return QDF_STATUS_E_INVAL; |
| 16450 | } |
| 16451 | resp_event = param_buf->fixed_param; |
| 16452 | *vdev_id = resp_event->vdev_id; |
| 16453 | |
| 16454 | return QDF_STATUS_SUCCESS; |
| 16455 | } |
| 16456 | |
| 16457 | /** |
| 16458 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 16459 | * @wmi_handle: wmi handle |
| 16460 | * @param evt_buf: pointer to event buffer |
| 16461 | * @param param: Pointer to hold roam param |
| 16462 | * |
| 16463 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16464 | */ |
| 16465 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 16466 | void *evt_buf, wmi_host_roam_event *param) |
| 16467 | { |
| 16468 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 16469 | wmi_roam_event_fixed_param *evt; |
| 16470 | |
| 16471 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 16472 | if (!param_buf) { |
| 16473 | WMI_LOGE("Invalid roam event buffer"); |
| 16474 | return QDF_STATUS_E_INVAL; |
| 16475 | } |
| 16476 | |
| 16477 | evt = param_buf->fixed_param; |
| 16478 | qdf_mem_zero(param, sizeof(*param)); |
| 16479 | |
| 16480 | param->vdev_id = evt->vdev_id; |
| 16481 | param->reason = evt->reason; |
| 16482 | param->rssi = evt->rssi; |
| 16483 | |
| 16484 | return QDF_STATUS_SUCCESS; |
| 16485 | } |
| 16486 | |
| 16487 | /** |
| 16488 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 16489 | * @wmi_handle: wmi handle |
| 16490 | * @param evt_buf: pointer to event buffer |
| 16491 | * @param param: Pointer to hold vdev scan param |
| 16492 | * |
| 16493 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16494 | */ |
| 16495 | 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] | 16496 | void *evt_buf, struct scan_event *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16497 | { |
| 16498 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 16499 | wmi_scan_event_fixed_param *evt = NULL; |
| 16500 | |
| 16501 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 16502 | evt = param_buf->fixed_param; |
| 16503 | |
| 16504 | qdf_mem_zero(param, sizeof(*param)); |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16505 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16506 | switch (evt->event) { |
| 16507 | case WMI_SCAN_EVENT_STARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16508 | param->type = SCAN_EVENT_TYPE_STARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16509 | break; |
| 16510 | case WMI_SCAN_EVENT_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16511 | param->type = SCAN_EVENT_TYPE_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16512 | break; |
| 16513 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16514 | param->type = SCAN_EVENT_TYPE_BSS_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16515 | break; |
| 16516 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16517 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16518 | break; |
| 16519 | case WMI_SCAN_EVENT_DEQUEUED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16520 | param->type = SCAN_EVENT_TYPE_DEQUEUED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16521 | break; |
| 16522 | case WMI_SCAN_EVENT_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16523 | param->type = SCAN_EVENT_TYPE_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16524 | break; |
| 16525 | case WMI_SCAN_EVENT_START_FAILED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16526 | param->type = SCAN_EVENT_TYPE_START_FAILED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16527 | break; |
| 16528 | case WMI_SCAN_EVENT_RESTARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16529 | param->type = SCAN_EVENT_TYPE_RESTARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16530 | break; |
Sreelakshmi Konamki | 76d62af | 2017-05-25 18:11:03 +0530 | [diff] [blame] | 16531 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16532 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16533 | break; |
| 16534 | case WMI_SCAN_EVENT_MAX: |
| 16535 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16536 | param->type = SCAN_EVENT_TYPE_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16537 | break; |
| 16538 | }; |
| 16539 | |
| 16540 | switch (evt->reason) { |
| 16541 | case WMI_SCAN_REASON_NONE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16542 | param->reason = SCAN_REASON_NONE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16543 | break; |
| 16544 | case WMI_SCAN_REASON_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16545 | param->reason = SCAN_REASON_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16546 | break; |
| 16547 | case WMI_SCAN_REASON_CANCELLED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16548 | param->reason = SCAN_REASON_CANCELLED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16549 | break; |
| 16550 | case WMI_SCAN_REASON_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16551 | param->reason = SCAN_REASON_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16552 | break; |
| 16553 | case WMI_SCAN_REASON_TIMEDOUT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16554 | param->reason = SCAN_REASON_TIMEDOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16555 | break; |
| 16556 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16557 | param->reason = SCAN_REASON_INTERNAL_FAILURE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16558 | break; |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16559 | case WMI_SCAN_REASON_SUSPENDED: |
| 16560 | param->reason = SCAN_REASON_SUSPENDED; |
| 16561 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16562 | case WMI_SCAN_REASON_MAX: |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16563 | param->reason = SCAN_REASON_MAX; |
| 16564 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16565 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16566 | param->reason = SCAN_REASON_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16567 | break; |
| 16568 | }; |
| 16569 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16570 | param->chan_freq = evt->channel_freq; |
| 16571 | param->requester = evt->requestor; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16572 | param->scan_id = evt->scan_id; |
| 16573 | param->vdev_id = evt->vdev_id; |
Sathish Kumar | b863315 | 2017-08-11 15:00:04 +0530 | [diff] [blame] | 16574 | param->timestamp = evt->tsf_timestamp; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16575 | |
| 16576 | return QDF_STATUS_SUCCESS; |
| 16577 | } |
| 16578 | |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 16579 | #ifdef CONVERGED_TDLS_ENABLE |
| 16580 | /** |
| 16581 | * extract_vdev_tdls_ev_param_tlv() - extract vdev tdls param from event |
| 16582 | * @wmi_handle: wmi handle |
| 16583 | * @param evt_buf: pointer to event buffer |
| 16584 | * @param param: Pointer to hold vdev tdls param |
| 16585 | * |
| 16586 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16587 | */ |
| 16588 | static QDF_STATUS extract_vdev_tdls_ev_param_tlv(wmi_unified_t wmi_handle, |
| 16589 | void *evt_buf, struct tdls_event_info *param) |
| 16590 | { |
| 16591 | WMI_TDLS_PEER_EVENTID_param_tlvs *param_buf; |
| 16592 | wmi_tdls_peer_event_fixed_param *evt; |
| 16593 | |
| 16594 | param_buf = (WMI_TDLS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 16595 | if (!param_buf) { |
| 16596 | WMI_LOGE("%s: NULL param_buf", __func__); |
| 16597 | return QDF_STATUS_E_NULL_VALUE; |
| 16598 | } |
| 16599 | |
| 16600 | evt = param_buf->fixed_param; |
| 16601 | |
| 16602 | qdf_mem_zero(param, sizeof(*param)); |
| 16603 | |
| 16604 | param->vdev_id = evt->vdev_id; |
| 16605 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&evt->peer_macaddr, |
| 16606 | param->peermac.bytes); |
| 16607 | switch (evt->peer_status) { |
| 16608 | case WMI_TDLS_SHOULD_DISCOVER: |
| 16609 | param->message_type = TDLS_SHOULD_DISCOVER; |
| 16610 | break; |
| 16611 | case WMI_TDLS_SHOULD_TEARDOWN: |
| 16612 | param->message_type = TDLS_SHOULD_TEARDOWN; |
| 16613 | break; |
| 16614 | case WMI_TDLS_PEER_DISCONNECTED: |
| 16615 | param->message_type = TDLS_PEER_DISCONNECTED; |
| 16616 | break; |
| 16617 | case WMI_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
| 16618 | param->message_type = TDLS_CONNECTION_TRACKER_NOTIFY; |
| 16619 | break; |
| 16620 | default: |
| 16621 | WMI_LOGE("%s: Discarding unknown tdls event %d from target", |
| 16622 | __func__, evt->peer_status); |
| 16623 | return QDF_STATUS_E_INVAL; |
| 16624 | }; |
| 16625 | |
| 16626 | switch (evt->peer_reason) { |
| 16627 | case WMI_TDLS_TEARDOWN_REASON_TX: |
| 16628 | param->peer_reason = TDLS_TEARDOWN_TX; |
| 16629 | break; |
| 16630 | case WMI_TDLS_TEARDOWN_REASON_RSSI: |
| 16631 | param->peer_reason = TDLS_TEARDOWN_RSSI; |
| 16632 | break; |
| 16633 | case WMI_TDLS_TEARDOWN_REASON_SCAN: |
| 16634 | param->peer_reason = TDLS_TEARDOWN_SCAN; |
| 16635 | break; |
| 16636 | case WMI_TDLS_DISCONNECTED_REASON_PEER_DELETE: |
| 16637 | param->peer_reason = TDLS_DISCONNECTED_PEER_DELETE; |
| 16638 | break; |
| 16639 | case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: |
| 16640 | param->peer_reason = TDLS_TEARDOWN_PTR_TIMEOUT; |
| 16641 | break; |
| 16642 | case WMI_TDLS_TEARDOWN_REASON_BAD_PTR: |
| 16643 | param->peer_reason = TDLS_TEARDOWN_BAD_PTR; |
| 16644 | break; |
| 16645 | case WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE: |
| 16646 | param->peer_reason = TDLS_TEARDOWN_NO_RSP; |
| 16647 | break; |
| 16648 | case WMI_TDLS_ENTER_BUF_STA: |
| 16649 | param->peer_reason = TDLS_PEER_ENTER_BUF_STA; |
| 16650 | break; |
| 16651 | case WMI_TDLS_EXIT_BUF_STA: |
| 16652 | param->peer_reason = TDLS_PEER_EXIT_BUF_STA; |
| 16653 | break; |
| 16654 | case WMI_TDLS_ENTER_BT_BUSY_MODE: |
| 16655 | param->peer_reason = TDLS_ENTER_BT_BUSY; |
| 16656 | break; |
| 16657 | case WMI_TDLS_EXIT_BT_BUSY_MODE: |
| 16658 | param->peer_reason = TDLS_EXIT_BT_BUSY; |
| 16659 | break; |
| 16660 | case WMI_TDLS_SCAN_STARTED_EVENT: |
| 16661 | param->peer_reason = TDLS_SCAN_STARTED; |
| 16662 | break; |
| 16663 | case WMI_TDLS_SCAN_COMPLETED_EVENT: |
| 16664 | param->peer_reason = TDLS_SCAN_COMPLETED; |
| 16665 | break; |
| 16666 | |
| 16667 | default: |
| 16668 | WMI_LOGE("%s: unknown reason %d in tdls event %d from target", |
| 16669 | __func__, evt->peer_reason, evt->peer_status); |
| 16670 | return QDF_STATUS_E_INVAL; |
| 16671 | }; |
| 16672 | |
| 16673 | WMI_LOGD("%s: tdls event, peer: %pM, type: 0x%x, reason: %d, vdev: %d", |
| 16674 | __func__, param->peermac.bytes, param->message_type, |
| 16675 | param->peer_reason, param->vdev_id); |
| 16676 | |
| 16677 | return QDF_STATUS_SUCCESS; |
| 16678 | } |
| 16679 | #endif |
| 16680 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16681 | /** |
| 16682 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 16683 | * @wmi_handle: wmi handle |
| 16684 | * @param evt_buf: pointer to event buffer |
| 16685 | * @param param: Pointer to hold MGMT TX completion params |
| 16686 | * |
| 16687 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16688 | */ |
| 16689 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 16690 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 16691 | { |
| 16692 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 16693 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 16694 | |
| 16695 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 16696 | evt_buf; |
| 16697 | if (!param_buf) { |
| 16698 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 16699 | return QDF_STATUS_E_INVAL; |
| 16700 | } |
| 16701 | cmpl_params = param_buf->fixed_param; |
| 16702 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16703 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16704 | cmpl_params->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16705 | param->desc_id = cmpl_params->desc_id; |
| 16706 | param->status = cmpl_params->status; |
| 16707 | |
| 16708 | return QDF_STATUS_SUCCESS; |
| 16709 | } |
| 16710 | |
| 16711 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 16712 | * extract_offchan_data_tx_compl_param_tlv() - |
| 16713 | * extract Offchan data tx completion event params |
| 16714 | * @wmi_handle: wmi handle |
| 16715 | * @param evt_buf: pointer to event buffer |
| 16716 | * @param param: Pointer to hold offchan data TX completion params |
| 16717 | * |
| 16718 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16719 | */ |
| 16720 | static QDF_STATUS extract_offchan_data_tx_compl_param_tlv( |
| 16721 | wmi_unified_t wmi_handle, void *evt_buf, |
| 16722 | struct wmi_host_offchan_data_tx_compl_event *param) |
| 16723 | { |
| 16724 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 16725 | wmi_offchan_data_tx_compl_event_fixed_param *cmpl_params; |
| 16726 | |
| 16727 | param_buf = (WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *) |
| 16728 | evt_buf; |
| 16729 | if (!param_buf) { |
| 16730 | WMI_LOGE("%s: Invalid offchan data Tx compl event", __func__); |
| 16731 | return QDF_STATUS_E_INVAL; |
| 16732 | } |
| 16733 | cmpl_params = param_buf->fixed_param; |
| 16734 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16735 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16736 | cmpl_params->pdev_id); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 16737 | param->desc_id = cmpl_params->desc_id; |
| 16738 | param->status = cmpl_params->status; |
| 16739 | |
| 16740 | return QDF_STATUS_SUCCESS; |
| 16741 | } |
| 16742 | |
| 16743 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16744 | * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count |
| 16745 | * status tlv |
| 16746 | * @wmi_handle: wmi handle |
| 16747 | * @param evt_buf: pointer to event buffer |
| 16748 | * @param param: Pointer to hold csa switch count status event param |
| 16749 | * |
| 16750 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16751 | */ |
| 16752 | static QDF_STATUS extract_pdev_csa_switch_count_status_tlv( |
| 16753 | wmi_unified_t wmi_handle, |
| 16754 | void *evt_buf, |
| 16755 | struct pdev_csa_switch_count_status *param) |
| 16756 | { |
| 16757 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *param_buf; |
| 16758 | wmi_pdev_csa_switch_count_status_event_fixed_param *csa_status; |
| 16759 | |
| 16760 | param_buf = (WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *) |
| 16761 | evt_buf; |
| 16762 | if (!param_buf) { |
| 16763 | WMI_LOGE("%s: Invalid CSA status event\n", __func__); |
| 16764 | return QDF_STATUS_E_INVAL; |
| 16765 | } |
| 16766 | |
| 16767 | csa_status = param_buf->fixed_param; |
| 16768 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16769 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16770 | csa_status->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16771 | param->current_switch_count = csa_status->current_switch_count; |
| 16772 | param->num_vdevs = csa_status->num_vdevs; |
| 16773 | param->vdev_ids = param_buf->vdev_ids; |
| 16774 | |
| 16775 | return QDF_STATUS_SUCCESS; |
| 16776 | } |
| 16777 | |
| 16778 | /** |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16779 | * extract_swba_num_vdevs_tlv() - extract swba num vdevs from event |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16780 | * @wmi_handle: wmi handle |
| 16781 | * @param evt_buf: pointer to event buffer |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16782 | * @param num_vdevs: Pointer to hold num vdevs |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16783 | * |
| 16784 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16785 | */ |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16786 | static QDF_STATUS extract_swba_num_vdevs_tlv(wmi_unified_t wmi_handle, |
| 16787 | void *evt_buf, uint32_t *num_vdevs) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16788 | { |
| 16789 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 16790 | wmi_host_swba_event_fixed_param *swba_event; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16791 | uint32_t vdev_map; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16792 | |
| 16793 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 16794 | if (!param_buf) { |
| 16795 | WMI_LOGE("Invalid swba event buffer"); |
| 16796 | return QDF_STATUS_E_INVAL; |
| 16797 | } |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16798 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16799 | swba_event = param_buf->fixed_param; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16800 | *num_vdevs = swba_event->num_vdevs; |
| 16801 | if (!(*num_vdevs)) { |
| 16802 | vdev_map = swba_event->vdev_map; |
| 16803 | *num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map); |
| 16804 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16805 | |
| 16806 | return QDF_STATUS_SUCCESS; |
| 16807 | } |
| 16808 | |
| 16809 | /** |
| 16810 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 16811 | * @wmi_handle: wmi handle |
| 16812 | * @param evt_buf: pointer to event buffer |
| 16813 | * @param idx: Index to bcn info |
| 16814 | * @param tim_info: Pointer to hold tim info |
| 16815 | * |
| 16816 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16817 | */ |
| 16818 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 16819 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 16820 | { |
| 16821 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 16822 | wmi_tim_info *tim_info_ev; |
| 16823 | |
| 16824 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 16825 | if (!param_buf) { |
| 16826 | WMI_LOGE("Invalid swba event buffer"); |
| 16827 | return QDF_STATUS_E_INVAL; |
| 16828 | } |
| 16829 | |
| 16830 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 16831 | |
| 16832 | tim_info->tim_len = tim_info_ev->tim_len; |
| 16833 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 16834 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 16835 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 16836 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 16837 | 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] | 16838 | tim_info->vdev_id = tim_info_ev->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16839 | |
| 16840 | return QDF_STATUS_SUCCESS; |
| 16841 | } |
| 16842 | |
| 16843 | /** |
| 16844 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 16845 | * @wmi_handle: wmi handle |
| 16846 | * @param evt_buf: pointer to event buffer |
| 16847 | * @param idx: Index to bcn info |
| 16848 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 16849 | * |
| 16850 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16851 | */ |
| 16852 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 16853 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 16854 | { |
| 16855 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 16856 | wmi_p2p_noa_info *p2p_noa_info; |
| 16857 | uint8_t i = 0; |
| 16858 | |
| 16859 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 16860 | if (!param_buf) { |
| 16861 | WMI_LOGE("Invalid swba event buffer"); |
| 16862 | return QDF_STATUS_E_INVAL; |
| 16863 | } |
| 16864 | |
| 16865 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 16866 | |
| 16867 | p2p_desc->modified = false; |
| 16868 | p2p_desc->num_descriptors = 0; |
| 16869 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 16870 | p2p_desc->modified = true; |
| 16871 | p2p_desc->index = |
| 16872 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 16873 | p2p_desc->oppPS = |
| 16874 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 16875 | p2p_desc->ctwindow = |
| 16876 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 16877 | p2p_desc->num_descriptors = |
| 16878 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 16879 | (p2p_noa_info); |
| 16880 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 16881 | p2p_desc->noa_descriptors[i].type_count = |
| 16882 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 16883 | type_count; |
| 16884 | p2p_desc->noa_descriptors[i].duration = |
| 16885 | p2p_noa_info->noa_descriptors[i].duration; |
| 16886 | p2p_desc->noa_descriptors[i].interval = |
| 16887 | p2p_noa_info->noa_descriptors[i].interval; |
| 16888 | p2p_desc->noa_descriptors[i].start_time = |
| 16889 | p2p_noa_info->noa_descriptors[i].start_time; |
| 16890 | } |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16891 | p2p_desc->vdev_id = p2p_noa_info->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16892 | } |
| 16893 | |
| 16894 | return QDF_STATUS_SUCCESS; |
| 16895 | } |
| 16896 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 16897 | #ifdef CONVERGED_P2P_ENABLE |
| 16898 | /** |
| 16899 | * extract_p2p_noa_ev_param_tlv() - extract p2p noa information from event |
| 16900 | * @wmi_handle: wmi handle |
| 16901 | * @param evt_buf: pointer to event buffer |
| 16902 | * @param param: Pointer to hold p2p noa info |
| 16903 | * |
| 16904 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16905 | */ |
| 16906 | static QDF_STATUS extract_p2p_noa_ev_param_tlv( |
| 16907 | wmi_unified_t wmi_handle, void *evt_buf, |
| 16908 | struct p2p_noa_info *param) |
| 16909 | { |
| 16910 | WMI_P2P_NOA_EVENTID_param_tlvs *param_tlvs; |
| 16911 | wmi_p2p_noa_event_fixed_param *fixed_param; |
| 16912 | uint8_t i; |
| 16913 | wmi_p2p_noa_info *wmi_noa_info; |
| 16914 | uint8_t *buf_ptr; |
| 16915 | uint32_t descriptors; |
| 16916 | |
| 16917 | param_tlvs = (WMI_P2P_NOA_EVENTID_param_tlvs *) evt_buf; |
| 16918 | if (!param_tlvs) { |
| 16919 | WMI_LOGE("%s: Invalid P2P NoA event buffer", __func__); |
| 16920 | return QDF_STATUS_E_INVAL; |
| 16921 | } |
| 16922 | |
| 16923 | if (!param) { |
| 16924 | WMI_LOGE("noa information param is null"); |
| 16925 | return QDF_STATUS_E_INVAL; |
| 16926 | } |
| 16927 | |
| 16928 | fixed_param = param_tlvs->fixed_param; |
| 16929 | buf_ptr = (uint8_t *) fixed_param; |
| 16930 | buf_ptr += sizeof(wmi_p2p_noa_event_fixed_param); |
| 16931 | wmi_noa_info = (wmi_p2p_noa_info *) (buf_ptr); |
| 16932 | |
| 16933 | if (!WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(wmi_noa_info)) { |
| 16934 | WMI_LOGE("%s: noa attr is not modified", __func__); |
| 16935 | return QDF_STATUS_E_INVAL; |
| 16936 | } |
| 16937 | |
| 16938 | param->vdev_id = fixed_param->vdev_id; |
| 16939 | param->index = |
| 16940 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(wmi_noa_info); |
| 16941 | param->opps_ps = |
| 16942 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(wmi_noa_info); |
| 16943 | param->ct_window = |
| 16944 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(wmi_noa_info); |
| 16945 | descriptors = WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET(wmi_noa_info); |
| 16946 | param->num_desc = (uint8_t) descriptors; |
| 16947 | |
| 16948 | WMI_LOGD("%s:index %u, opps_ps %u, ct_window %u, num_descriptors = %u", __func__, |
| 16949 | param->index, param->opps_ps, param->ct_window, |
| 16950 | param->num_desc); |
| 16951 | for (i = 0; i < param->num_desc; i++) { |
| 16952 | param->noa_desc[i].type_count = |
| 16953 | (uint8_t) wmi_noa_info->noa_descriptors[i]. |
| 16954 | type_count; |
| 16955 | param->noa_desc[i].duration = |
| 16956 | wmi_noa_info->noa_descriptors[i].duration; |
| 16957 | param->noa_desc[i].interval = |
| 16958 | wmi_noa_info->noa_descriptors[i].interval; |
| 16959 | param->noa_desc[i].start_time = |
| 16960 | wmi_noa_info->noa_descriptors[i].start_time; |
| 16961 | WMI_LOGD("%s:NoA descriptor[%d] type_count %u, duration %u, interval %u, start_time = %u", |
| 16962 | __func__, i, param->noa_desc[i].type_count, |
| 16963 | param->noa_desc[i].duration, |
| 16964 | param->noa_desc[i].interval, |
| 16965 | param->noa_desc[i].start_time); |
| 16966 | } |
| 16967 | |
| 16968 | return QDF_STATUS_SUCCESS; |
| 16969 | } |
| 16970 | |
| 16971 | /** |
| 16972 | * extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop |
| 16973 | * information from event |
| 16974 | * @wmi_handle: wmi handle |
| 16975 | * @param evt_buf: pointer to event buffer |
| 16976 | * @param param: Pointer to hold p2p lo stop event information |
| 16977 | * |
| 16978 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16979 | */ |
| 16980 | static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv( |
| 16981 | wmi_unified_t wmi_handle, void *evt_buf, |
| 16982 | struct p2p_lo_event *param) |
| 16983 | { |
| 16984 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *param_tlvs; |
| 16985 | wmi_p2p_lo_stopped_event_fixed_param *lo_param; |
| 16986 | |
| 16987 | param_tlvs = (WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *) |
| 16988 | evt_buf; |
| 16989 | if (!param_tlvs) { |
| 16990 | WMI_LOGE("%s: Invalid P2P lo stop event buffer", __func__); |
| 16991 | return QDF_STATUS_E_INVAL; |
| 16992 | } |
| 16993 | |
| 16994 | if (!param) { |
| 16995 | WMI_LOGE("lo stop event param is null"); |
| 16996 | return QDF_STATUS_E_INVAL; |
| 16997 | } |
| 16998 | |
| 16999 | lo_param = param_tlvs->fixed_param; |
| 17000 | param->vdev_id = lo_param->vdev_id; |
| 17001 | param->reason_code = lo_param->reason; |
| 17002 | WMI_LOGD("%s: vdev_id:%d, reason:%d", __func__, |
| 17003 | param->vdev_id, param->reason_code); |
| 17004 | |
| 17005 | return QDF_STATUS_SUCCESS; |
| 17006 | } |
| 17007 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 17008 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17009 | /** |
| 17010 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 17011 | * @wmi_handle: wmi handle |
| 17012 | * @param evt_buf: pointer to event buffer |
| 17013 | * @param ev: Pointer to hold peer param |
| 17014 | * |
| 17015 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17016 | */ |
| 17017 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 17018 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 17019 | { |
| 17020 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 17021 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 17022 | |
| 17023 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 17024 | kickout_event = param_buf->fixed_param; |
| 17025 | |
| 17026 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 17027 | ev->peer_macaddr); |
| 17028 | |
| 17029 | ev->reason = kickout_event->reason; |
| 17030 | ev->rssi = kickout_event->rssi; |
| 17031 | |
| 17032 | return QDF_STATUS_SUCCESS; |
| 17033 | } |
| 17034 | |
| 17035 | /** |
| 17036 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 17037 | * @wmi_handle: wmi handle |
| 17038 | * @param evt_buf: pointer to event buffer |
| 17039 | * @param stats_param: Pointer to hold stats count |
| 17040 | * |
| 17041 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17042 | */ |
| 17043 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 17044 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 17045 | { |
| 17046 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17047 | wmi_stats_event_fixed_param *ev; |
| 17048 | |
| 17049 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17050 | |
| 17051 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17052 | if (!ev) { |
| 17053 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 17054 | return QDF_STATUS_E_FAILURE; |
| 17055 | } |
| 17056 | |
| 17057 | switch (ev->stats_id) { |
| 17058 | case WMI_REQUEST_PEER_STAT: |
| 17059 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 17060 | break; |
| 17061 | |
| 17062 | case WMI_REQUEST_AP_STAT: |
| 17063 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 17064 | break; |
| 17065 | |
| 17066 | case WMI_REQUEST_PDEV_STAT: |
| 17067 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 17068 | break; |
| 17069 | |
| 17070 | case WMI_REQUEST_VDEV_STAT: |
| 17071 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 17072 | break; |
| 17073 | |
| 17074 | case WMI_REQUEST_BCNFLT_STAT: |
| 17075 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 17076 | break; |
| 17077 | |
| 17078 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 17079 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 17080 | break; |
| 17081 | |
| 17082 | default: |
| 17083 | stats_param->stats_id = 0; |
| 17084 | break; |
| 17085 | |
| 17086 | } |
| 17087 | |
| 17088 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 17089 | stats_param->num_pdev_ext_stats = 0; |
| 17090 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 17091 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 17092 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 17093 | stats_param->num_chan_stats = ev->num_chan_stats; |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 17094 | stats_param->pdev_id = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17095 | |
| 17096 | return QDF_STATUS_SUCCESS; |
| 17097 | } |
| 17098 | |
| 17099 | /** |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 17100 | * extract_pdev_tx_stats() - extract pdev tx stats from event |
| 17101 | */ |
| 17102 | static void extract_pdev_tx_stats(wmi_host_dbg_tx_stats *tx, struct wlan_dbg_tx_stats *tx_stats) |
| 17103 | { |
| 17104 | /* Tx Stats */ |
| 17105 | tx->comp_queued = tx_stats->comp_queued; |
| 17106 | tx->comp_delivered = tx_stats->comp_delivered; |
| 17107 | tx->msdu_enqued = tx_stats->msdu_enqued; |
| 17108 | tx->mpdu_enqued = tx_stats->mpdu_enqued; |
| 17109 | tx->wmm_drop = tx_stats->wmm_drop; |
| 17110 | tx->local_enqued = tx_stats->local_enqued; |
| 17111 | tx->local_freed = tx_stats->local_freed; |
| 17112 | tx->hw_queued = tx_stats->hw_queued; |
| 17113 | tx->hw_reaped = tx_stats->hw_reaped; |
| 17114 | tx->underrun = tx_stats->underrun; |
| 17115 | tx->tx_abort = tx_stats->tx_abort; |
| 17116 | tx->mpdus_requed = tx_stats->mpdus_requed; |
| 17117 | tx->data_rc = tx_stats->data_rc; |
| 17118 | tx->self_triggers = tx_stats->self_triggers; |
| 17119 | tx->sw_retry_failure = tx_stats->sw_retry_failure; |
| 17120 | tx->illgl_rate_phy_err = tx_stats->illgl_rate_phy_err; |
| 17121 | tx->pdev_cont_xretry = tx_stats->pdev_cont_xretry; |
| 17122 | tx->pdev_tx_timeout = tx_stats->pdev_tx_timeout; |
| 17123 | tx->pdev_resets = tx_stats->pdev_resets; |
| 17124 | tx->stateless_tid_alloc_failure = tx_stats->stateless_tid_alloc_failure; |
| 17125 | tx->phy_underrun = tx_stats->phy_underrun; |
| 17126 | tx->txop_ovf = tx_stats->txop_ovf; |
| 17127 | |
| 17128 | return; |
| 17129 | } |
| 17130 | |
| 17131 | |
| 17132 | /** |
| 17133 | * extract_pdev_rx_stats() - extract pdev rx stats from event |
| 17134 | */ |
| 17135 | static void extract_pdev_rx_stats(wmi_host_dbg_rx_stats *rx, struct wlan_dbg_rx_stats *rx_stats) |
| 17136 | { |
| 17137 | /* Rx Stats */ |
| 17138 | rx->mid_ppdu_route_change = rx_stats->mid_ppdu_route_change; |
| 17139 | rx->status_rcvd = rx_stats->status_rcvd; |
| 17140 | rx->r0_frags = rx_stats->r0_frags; |
| 17141 | rx->r1_frags = rx_stats->r1_frags; |
| 17142 | rx->r2_frags = rx_stats->r2_frags; |
| 17143 | /* Only TLV */ |
| 17144 | rx->r3_frags = 0; |
| 17145 | rx->htt_msdus = rx_stats->htt_msdus; |
| 17146 | rx->htt_mpdus = rx_stats->htt_mpdus; |
| 17147 | rx->loc_msdus = rx_stats->loc_msdus; |
| 17148 | rx->loc_mpdus = rx_stats->loc_mpdus; |
| 17149 | rx->oversize_amsdu = rx_stats->oversize_amsdu; |
| 17150 | rx->phy_errs = rx_stats->phy_errs; |
| 17151 | rx->phy_err_drop = rx_stats->phy_err_drop; |
| 17152 | rx->mpdu_errs = rx_stats->mpdu_errs; |
| 17153 | |
| 17154 | return; |
| 17155 | } |
| 17156 | |
| 17157 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17158 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 17159 | * @wmi_handle: wmi handle |
| 17160 | * @param evt_buf: pointer to event buffer |
| 17161 | * @param index: Index into pdev stats |
| 17162 | * @param pdev_stats: Pointer to hold pdev stats |
| 17163 | * |
| 17164 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17165 | */ |
| 17166 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 17167 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 17168 | { |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 17169 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17170 | wmi_stats_event_fixed_param *ev_param; |
| 17171 | uint8_t *data; |
| 17172 | |
| 17173 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17174 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17175 | |
| 17176 | data = param_buf->data; |
| 17177 | |
| 17178 | if (index < ev_param->num_pdev_stats) { |
| 17179 | wmi_pdev_stats *ev = (wmi_pdev_stats *) ((data) + |
| 17180 | (index * sizeof(wmi_pdev_stats))); |
| 17181 | |
| 17182 | pdev_stats->chan_nf = ev->chan_nf; |
| 17183 | pdev_stats->tx_frame_count = ev->tx_frame_count; |
| 17184 | pdev_stats->rx_frame_count = ev->rx_frame_count; |
| 17185 | pdev_stats->rx_clear_count = ev->rx_clear_count; |
| 17186 | pdev_stats->cycle_count = ev->cycle_count; |
| 17187 | pdev_stats->phy_err_count = ev->phy_err_count; |
| 17188 | pdev_stats->chan_tx_pwr = ev->chan_tx_pwr; |
| 17189 | |
| 17190 | extract_pdev_tx_stats(&(pdev_stats->pdev_stats.tx), |
| 17191 | &(ev->pdev_stats.tx)); |
| 17192 | extract_pdev_rx_stats(&(pdev_stats->pdev_stats.rx), |
| 17193 | &(ev->pdev_stats.rx)); |
| 17194 | } |
| 17195 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17196 | return QDF_STATUS_SUCCESS; |
| 17197 | } |
| 17198 | |
| 17199 | /** |
| 17200 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 17201 | * @wmi_handle: wmi handle |
| 17202 | * @param evt_buf: pointer to event buffer |
| 17203 | * @param index: Index into extended pdev stats |
| 17204 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 17205 | * |
| 17206 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17207 | */ |
| 17208 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 17209 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 17210 | { |
| 17211 | return QDF_STATUS_SUCCESS; |
| 17212 | } |
| 17213 | |
| 17214 | /** |
| 17215 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 17216 | * @wmi_handle: wmi handle |
| 17217 | * @param evt_buf: pointer to event buffer |
| 17218 | * @param index: Index into vdev stats |
| 17219 | * @param vdev_stats: Pointer to hold vdev stats |
| 17220 | * |
| 17221 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17222 | */ |
| 17223 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 17224 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 17225 | { |
| 17226 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17227 | wmi_stats_event_fixed_param *ev_param; |
| 17228 | uint8_t *data; |
| 17229 | |
| 17230 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17231 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17232 | data = (uint8_t *) param_buf->data; |
| 17233 | |
| 17234 | if (index < ev_param->num_vdev_stats) { |
| 17235 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 17236 | ((ev_param->num_pdev_stats) * |
| 17237 | sizeof(wmi_pdev_stats)) + |
| 17238 | (index * sizeof(wmi_vdev_stats))); |
| 17239 | |
| 17240 | vdev_stats->vdev_id = ev->vdev_id; |
| 17241 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 17242 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 17243 | |
| 17244 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 17245 | sizeof(ev->tx_frm_cnt)); |
| 17246 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 17247 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 17248 | ev->multiple_retry_cnt, |
| 17249 | sizeof(ev->multiple_retry_cnt)); |
| 17250 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 17251 | sizeof(ev->fail_cnt)); |
| 17252 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 17253 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 17254 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 17255 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 17256 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 17257 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 17258 | sizeof(ev->tx_rate_history)); |
| 17259 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 17260 | sizeof(ev->bcn_rssi_history)); |
| 17261 | |
| 17262 | } |
| 17263 | |
| 17264 | return QDF_STATUS_SUCCESS; |
| 17265 | } |
| 17266 | |
| 17267 | /** |
| 17268 | * extract_peer_stats_tlv() - extract peer stats from event |
| 17269 | * @wmi_handle: wmi handle |
| 17270 | * @param evt_buf: pointer to event buffer |
| 17271 | * @param index: Index into peer stats |
| 17272 | * @param peer_stats: Pointer to hold peer stats |
| 17273 | * |
| 17274 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17275 | */ |
| 17276 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 17277 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 17278 | { |
| 17279 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17280 | wmi_stats_event_fixed_param *ev_param; |
| 17281 | uint8_t *data; |
| 17282 | |
| 17283 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17284 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17285 | data = (uint8_t *) param_buf->data; |
| 17286 | |
| 17287 | if (index < ev_param->num_peer_stats) { |
| 17288 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 17289 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 17290 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 17291 | (index * sizeof(wmi_peer_stats))); |
| 17292 | |
| 17293 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 17294 | |
| 17295 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 17296 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 17297 | |
| 17298 | peer_stats->peer_rssi = ev->peer_rssi; |
| 17299 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 17300 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 17301 | } |
| 17302 | |
| 17303 | return QDF_STATUS_SUCCESS; |
| 17304 | } |
| 17305 | |
| 17306 | /** |
| 17307 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 17308 | * @wmi_handle: wmi handle |
| 17309 | * @param evt_buf: pointer to event buffer |
| 17310 | * @param index: Index into bcn fault stats |
| 17311 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 17312 | * |
| 17313 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17314 | */ |
| 17315 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 17316 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 17317 | { |
| 17318 | return QDF_STATUS_SUCCESS; |
| 17319 | } |
| 17320 | |
| 17321 | /** |
| 17322 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 17323 | * @wmi_handle: wmi handle |
| 17324 | * @param evt_buf: pointer to event buffer |
| 17325 | * @param index: Index into extended peer stats |
| 17326 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 17327 | * |
| 17328 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17329 | */ |
| 17330 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 17331 | void *evt_buf, uint32_t index, |
| 17332 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 17333 | { |
| 17334 | return QDF_STATUS_SUCCESS; |
| 17335 | } |
| 17336 | |
| 17337 | /** |
| 17338 | * extract_chan_stats_tlv() - extract chan stats from event |
| 17339 | * @wmi_handle: wmi handle |
| 17340 | * @param evt_buf: pointer to event buffer |
| 17341 | * @param index: Index into chan stats |
| 17342 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 17343 | * |
| 17344 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17345 | */ |
| 17346 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 17347 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 17348 | { |
| 17349 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17350 | wmi_stats_event_fixed_param *ev_param; |
| 17351 | uint8_t *data; |
| 17352 | |
| 17353 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17354 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17355 | data = (uint8_t *) param_buf->data; |
| 17356 | |
| 17357 | if (index < ev_param->num_chan_stats) { |
| 17358 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 17359 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 17360 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 17361 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 17362 | (index * sizeof(wmi_chan_stats))); |
| 17363 | |
| 17364 | |
| 17365 | /* Non-TLV doesnt have num_chan_stats */ |
| 17366 | chan_stats->chan_mhz = ev->chan_mhz; |
| 17367 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 17368 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 17369 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 17370 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 17371 | } |
| 17372 | |
| 17373 | return QDF_STATUS_SUCCESS; |
| 17374 | } |
| 17375 | |
| 17376 | /** |
| 17377 | * extract_profile_ctx_tlv() - extract profile context from event |
| 17378 | * @wmi_handle: wmi handle |
| 17379 | * @param evt_buf: pointer to event buffer |
| 17380 | * @idx: profile stats index to extract |
| 17381 | * @param profile_ctx: Pointer to hold profile context |
| 17382 | * |
| 17383 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17384 | */ |
| 17385 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 17386 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 17387 | { |
| 17388 | return QDF_STATUS_SUCCESS; |
| 17389 | } |
| 17390 | |
| 17391 | /** |
| 17392 | * extract_profile_data_tlv() - extract profile data from event |
| 17393 | * @wmi_handle: wmi handle |
| 17394 | * @param evt_buf: pointer to event buffer |
| 17395 | * @param profile_data: Pointer to hold profile data |
| 17396 | * |
| 17397 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17398 | */ |
| 17399 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 17400 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 17401 | { |
| 17402 | |
| 17403 | return QDF_STATUS_SUCCESS; |
| 17404 | } |
| 17405 | |
| 17406 | /** |
| 17407 | * extract_chan_info_event_tlv() - extract chan information from event |
| 17408 | * @wmi_handle: wmi handle |
| 17409 | * @param evt_buf: pointer to event buffer |
| 17410 | * @param chan_info: Pointer to hold chan information |
| 17411 | * |
| 17412 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17413 | */ |
| 17414 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 17415 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 17416 | { |
| 17417 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 17418 | wmi_chan_info_event_fixed_param *ev; |
| 17419 | |
| 17420 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 17421 | |
| 17422 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 17423 | if (!ev) { |
| 17424 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 17425 | return QDF_STATUS_E_FAILURE; |
| 17426 | } |
| 17427 | |
| 17428 | chan_info->err_code = ev->err_code; |
| 17429 | chan_info->freq = ev->freq; |
| 17430 | chan_info->cmd_flags = ev->cmd_flags; |
| 17431 | chan_info->noise_floor = ev->noise_floor; |
| 17432 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 17433 | chan_info->cycle_count = ev->cycle_count; |
Sathish Kumar | 87db1bd | 2017-05-08 12:35:55 +0530 | [diff] [blame] | 17434 | chan_info->pdev_id = wlan_get_pdev_id_from_vdev_id( |
| 17435 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 17436 | ev->vdev_id, WLAN_SCAN_ID); |
Kiran Venkatappa | da3eae6 | 2017-08-10 17:48:37 +0530 | [diff] [blame] | 17437 | chan_info->chan_tx_pwr_range = ev->chan_tx_pwr_range; |
| 17438 | chan_info->chan_tx_pwr_tp = ev->chan_tx_pwr_tp; |
| 17439 | chan_info->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 17440 | chan_info->rx_11b_mode_data_duration = ev->rx_11b_mode_data_duration; |
| 17441 | chan_info->tx_frame_cnt = ev->tx_frame_cnt; |
| 17442 | chan_info->rx_frame_count = ev->rx_frame_count; |
| 17443 | chan_info->mac_clk_mhz = ev->mac_clk_mhz; |
| 17444 | chan_info->vdev_id = ev->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17445 | |
| 17446 | return QDF_STATUS_SUCCESS; |
| 17447 | } |
| 17448 | |
| 17449 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17450 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 17451 | * @wmi_handle: WMI handle |
| 17452 | * @param evt_buf: Pointer to event buffer |
| 17453 | * @param param: Pointer to hold data |
| 17454 | * |
| 17455 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 17456 | */ |
| 17457 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 17458 | uint8_t *evt_buf, |
| 17459 | struct wmi_host_pdev_utf_event *event) |
| 17460 | { |
| 17461 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17462 | struct wmi_host_utf_seg_header_info *seg_hdr; |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17463 | |
| 17464 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 17465 | event->data = param_buf->data; |
| 17466 | event->datalen = param_buf->num_data; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17467 | seg_hdr = (struct wmi_host_utf_seg_header_info *)param_buf->data; |
Kiran Venkatappa | 15978c6 | 2017-02-28 12:42:36 +0530 | [diff] [blame] | 17468 | /* Set pdev_id=1 until FW adds support to include pdev_id */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17469 | event->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17470 | seg_hdr->pdev_id); |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17471 | |
| 17472 | return QDF_STATUS_SUCCESS; |
| 17473 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17474 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17475 | /** |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17476 | * extract_chainmask_tables_tlv() - extract chain mask tables from event |
| 17477 | * @wmi_handle: wmi handle |
| 17478 | * @param evt_buf: pointer to event buffer |
| 17479 | * @param param: Pointer to hold evt buf |
| 17480 | * |
| 17481 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17482 | */ |
| 17483 | static QDF_STATUS extract_chainmask_tables_tlv(wmi_unified_t wmi_handle, |
| 17484 | uint8_t *event, struct wlan_psoc_host_chainmask_table *chainmask_table) |
| 17485 | { |
| 17486 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17487 | WMI_MAC_PHY_CHAINMASK_CAPABILITY *chainmask_caps; |
| 17488 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17489 | uint8_t i = 0, j = 0; |
| 17490 | |
| 17491 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17492 | if (!param_buf) |
| 17493 | return QDF_STATUS_E_INVAL; |
| 17494 | |
| 17495 | hw_caps = param_buf->soc_hw_mode_caps; |
| 17496 | if (!hw_caps) |
| 17497 | return QDF_STATUS_E_INVAL; |
| 17498 | |
| 17499 | if (!hw_caps->num_chainmask_tables) |
| 17500 | return QDF_STATUS_E_INVAL; |
| 17501 | |
| 17502 | chainmask_caps = param_buf->mac_phy_chainmask_caps; |
| 17503 | |
| 17504 | if (chainmask_caps == NULL) |
| 17505 | return QDF_STATUS_E_INVAL; |
| 17506 | |
| 17507 | for (i = 0; i < hw_caps->num_chainmask_tables; i++) { |
| 17508 | |
| 17509 | qdf_print("Dumping chain mask combo data for table : %d\n", i); |
| 17510 | for (j = 0; j < chainmask_table[i].num_valid_chainmasks; j++) { |
| 17511 | |
| 17512 | chainmask_table[i].cap_list[j].chainmask = |
| 17513 | chainmask_caps->chainmask; |
| 17514 | |
| 17515 | chainmask_table[i].cap_list[j].supports_chan_width_20 = |
| 17516 | WMI_SUPPORT_CHAN_WIDTH_20_GET(chainmask_caps->supported_flags); |
| 17517 | |
| 17518 | chainmask_table[i].cap_list[j].supports_chan_width_40 = |
| 17519 | WMI_SUPPORT_CHAN_WIDTH_40_GET(chainmask_caps->supported_flags); |
| 17520 | |
| 17521 | chainmask_table[i].cap_list[j].supports_chan_width_80 = |
| 17522 | WMI_SUPPORT_CHAN_WIDTH_80_GET(chainmask_caps->supported_flags); |
| 17523 | |
| 17524 | chainmask_table[i].cap_list[j].supports_chan_width_160 = |
| 17525 | WMI_SUPPORT_CHAN_WIDTH_160_GET(chainmask_caps->supported_flags); |
| 17526 | |
| 17527 | chainmask_table[i].cap_list[j].supports_chan_width_80P80 = |
| 17528 | WMI_SUPPORT_CHAN_WIDTH_80P80_GET(chainmask_caps->supported_flags); |
| 17529 | |
| 17530 | chainmask_table[i].cap_list[j].chain_mask_2G = |
| 17531 | WMI_SUPPORT_CHAIN_MASK_2G_GET(chainmask_caps->supported_flags); |
| 17532 | |
| 17533 | chainmask_table[i].cap_list[j].chain_mask_5G = |
| 17534 | WMI_SUPPORT_CHAIN_MASK_5G_GET(chainmask_caps->supported_flags); |
| 17535 | |
| 17536 | chainmask_table[i].cap_list[j].chain_mask_tx = |
| 17537 | WMI_SUPPORT_CHAIN_MASK_TX_GET(chainmask_caps->supported_flags); |
| 17538 | |
| 17539 | chainmask_table[i].cap_list[j].chain_mask_rx = |
| 17540 | WMI_SUPPORT_CHAIN_MASK_RX_GET(chainmask_caps->supported_flags); |
| 17541 | |
| 17542 | chainmask_table[i].cap_list[j].supports_aDFS = |
| 17543 | WMI_SUPPORT_CHAIN_MASK_ADFS_GET(chainmask_caps->supported_flags); |
| 17544 | |
| 17545 | qdf_print("supported_flags: 0x%08x chainmasks: 0x%08x\n", |
| 17546 | chainmask_caps->supported_flags, |
| 17547 | chainmask_caps->chainmask |
| 17548 | ); |
| 17549 | chainmask_caps++; |
| 17550 | } |
| 17551 | } |
| 17552 | |
| 17553 | return QDF_STATUS_SUCCESS; |
| 17554 | } |
| 17555 | |
| 17556 | /** |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17557 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 17558 | * from event |
| 17559 | * @wmi_handle: wmi handle |
| 17560 | * @param evt_buf: pointer to event buffer |
| 17561 | * @param param: Pointer to hold evt buf |
| 17562 | * |
| 17563 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17564 | */ |
| 17565 | 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] | 17566 | uint8_t *event, struct wlan_psoc_host_service_ext_param *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17567 | { |
| 17568 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17569 | wmi_service_ready_ext_event_fixed_param *ev; |
| 17570 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17571 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17572 | WMI_MAC_PHY_CHAINMASK_COMBO *chain_mask_combo; |
| 17573 | uint8_t i = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17574 | |
| 17575 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17576 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17577 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17578 | |
| 17579 | ev = param_buf->fixed_param; |
| 17580 | if (!ev) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17581 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17582 | |
| 17583 | /* Move this to host based bitmap */ |
| 17584 | param->default_conc_scan_config_bits = |
| 17585 | ev->default_conc_scan_config_bits; |
| 17586 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 17587 | param->he_cap_info = ev->he_cap_info; |
| 17588 | param->mpdu_density = ev->mpdu_density; |
| 17589 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 17590 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 17591 | |
| 17592 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17593 | if (hw_caps) |
| 17594 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 17595 | else |
| 17596 | param->num_hw_modes = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17597 | |
| 17598 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17599 | if (reg_caps) |
| 17600 | param->num_phy = reg_caps->num_phy; |
| 17601 | else |
| 17602 | param->num_phy = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17603 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 17604 | if (hw_caps) { |
| 17605 | param->num_chainmask_tables = hw_caps->num_chainmask_tables; |
| 17606 | qdf_print("Num chain mask tables: %d\n", hw_caps->num_chainmask_tables); |
| 17607 | } else |
| 17608 | param->num_chainmask_tables = 0; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17609 | |
| 17610 | chain_mask_combo = param_buf->mac_phy_chainmask_combo; |
| 17611 | |
| 17612 | if (chain_mask_combo == NULL) |
| 17613 | return QDF_STATUS_SUCCESS; |
| 17614 | |
| 17615 | qdf_print("Dumping chain mask combo data\n"); |
| 17616 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 17617 | for (i = 0; i < param->num_chainmask_tables; i++) { |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17618 | |
| 17619 | qdf_print("table_id : %d Num valid chainmasks: %d\n", |
| 17620 | chain_mask_combo->chainmask_table_id, |
| 17621 | chain_mask_combo->num_valid_chainmask |
| 17622 | ); |
| 17623 | |
| 17624 | param->chainmask_table[i].table_id = |
| 17625 | chain_mask_combo->chainmask_table_id; |
| 17626 | param->chainmask_table[i].num_valid_chainmasks = |
| 17627 | chain_mask_combo->num_valid_chainmask; |
| 17628 | chain_mask_combo++; |
| 17629 | } |
| 17630 | qdf_print("chain mask combo end\n"); |
| 17631 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17632 | return QDF_STATUS_SUCCESS; |
| 17633 | } |
| 17634 | |
| 17635 | /** |
| 17636 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 17637 | * extract HW mode cap from service ready event |
| 17638 | * @wmi_handle: wmi handle |
| 17639 | * @param evt_buf: pointer to event buffer |
| 17640 | * @param param: Pointer to hold evt buf |
| 17641 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 17642 | * |
| 17643 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17644 | */ |
| 17645 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 17646 | wmi_unified_t wmi_handle, |
| 17647 | uint8_t *event, uint8_t hw_mode_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 17648 | struct wlan_psoc_host_hw_mode_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17649 | { |
| 17650 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17651 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17652 | |
| 17653 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17654 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17655 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17656 | |
| 17657 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17658 | if (!hw_caps) |
| 17659 | return QDF_STATUS_E_INVAL; |
| 17660 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17661 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17662 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17663 | |
| 17664 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 17665 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 17666 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17667 | param->hw_mode_config_type = |
| 17668 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 17669 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17670 | return QDF_STATUS_SUCCESS; |
| 17671 | } |
| 17672 | |
| 17673 | /** |
| 17674 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 17675 | * extract MAC phy cap from service ready event |
| 17676 | * @wmi_handle: wmi handle |
| 17677 | * @param evt_buf: pointer to event buffer |
| 17678 | * @param param: Pointer to hold evt buf |
| 17679 | * @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] | 17680 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17681 | * |
| 17682 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17683 | */ |
| 17684 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 17685 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17686 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 17687 | struct wlan_psoc_host_mac_phy_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17688 | { |
| 17689 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17690 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17691 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17692 | uint32_t phy_map; |
| 17693 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17694 | |
| 17695 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17696 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17697 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17698 | |
| 17699 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17700 | if (!hw_caps) |
| 17701 | return QDF_STATUS_E_INVAL; |
| 17702 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17703 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 17704 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 17705 | break; |
| 17706 | |
| 17707 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 17708 | while (phy_map) { |
| 17709 | phy_map >>= 1; |
| 17710 | phy_idx++; |
| 17711 | } |
| 17712 | } |
| 17713 | |
| 17714 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17715 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17716 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17717 | phy_idx += phy_id; |
| 17718 | if (phy_idx >= param_buf->num_mac_phy_caps) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17719 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17720 | |
| 17721 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17722 | |
| 17723 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17724 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17725 | mac_phy_caps->pdev_id); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17726 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17727 | param->supports_11b = |
| 17728 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 17729 | param->supports_11g = |
| 17730 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 17731 | param->supports_11a = |
| 17732 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 17733 | param->supports_11n = |
| 17734 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 17735 | param->supports_11ac = |
| 17736 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 17737 | param->supports_11ax = |
| 17738 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17739 | |
| 17740 | param->supported_bands = mac_phy_caps->supported_bands; |
| 17741 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 17742 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 17743 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 17744 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 17745 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 17746 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 17747 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 17748 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 17749 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 17750 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 17751 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 17752 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 17753 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 17754 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 17755 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 17756 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 17757 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
Kris Muthusamy | 61fe369 | 2017-02-20 02:35:47 -0800 | [diff] [blame] | 17758 | qdf_mem_copy(¶m->he_cap_phy_info_2G, |
| 17759 | &mac_phy_caps->he_cap_phy_info_2G, |
| 17760 | sizeof(param->he_cap_phy_info_2G)); |
| 17761 | qdf_mem_copy(¶m->he_cap_phy_info_5G, |
| 17762 | &mac_phy_caps->he_cap_phy_info_5G, |
| 17763 | sizeof(param->he_cap_phy_info_5G)); |
| 17764 | qdf_mem_copy(¶m->he_ppet2G, &mac_phy_caps->he_ppet2G, |
| 17765 | sizeof(param->he_ppet2G)); |
| 17766 | qdf_mem_copy(¶m->he_ppet5G, &mac_phy_caps->he_ppet5G, |
| 17767 | sizeof(param->he_ppet5G)); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17768 | param->chainmask_table_id = mac_phy_caps->chainmask_table_id; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17769 | |
| 17770 | return QDF_STATUS_SUCCESS; |
| 17771 | } |
| 17772 | |
| 17773 | /** |
| 17774 | * extract_reg_cap_service_ready_ext_tlv() - |
| 17775 | * extract REG cap from service ready event |
| 17776 | * @wmi_handle: wmi handle |
| 17777 | * @param evt_buf: pointer to event buffer |
| 17778 | * @param param: Pointer to hold evt buf |
| 17779 | * @param phy_idx: phy idx should be less than num_mode |
| 17780 | * |
| 17781 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17782 | */ |
| 17783 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 17784 | wmi_unified_t wmi_handle, |
| 17785 | uint8_t *event, uint8_t phy_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 17786 | struct wlan_psoc_host_hal_reg_capabilities_ext *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17787 | { |
| 17788 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17789 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 17790 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 17791 | |
| 17792 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17793 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17794 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17795 | |
| 17796 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17797 | if (!reg_caps) |
| 17798 | return QDF_STATUS_E_INVAL; |
| 17799 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17800 | if (phy_idx >= reg_caps->num_phy) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17801 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17802 | |
| 17803 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 17804 | |
| 17805 | param->phy_id = ext_reg_cap->phy_id; |
| 17806 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 17807 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 17808 | param->regcap1 = ext_reg_cap->regcap1; |
| 17809 | param->regcap2 = ext_reg_cap->regcap2; |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 17810 | param->wireless_modes = convert_wireless_modes_tlv( |
| 17811 | ext_reg_cap->wireless_modes); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17812 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 17813 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 17814 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 17815 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 17816 | |
| 17817 | return QDF_STATUS_SUCCESS; |
| 17818 | } |
| 17819 | |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 17820 | /** |
| 17821 | * extract_dcs_interference_type_tlv() - extract dcs interference type |
| 17822 | * from event |
| 17823 | * @wmi_handle: wmi handle |
| 17824 | * @param evt_buf: pointer to event buffer |
| 17825 | * @param param: Pointer to hold dcs interference param |
| 17826 | * |
| 17827 | * Return: 0 for success or error code |
| 17828 | */ |
| 17829 | static QDF_STATUS extract_dcs_interference_type_tlv( |
| 17830 | wmi_unified_t wmi_handle, |
| 17831 | void *evt_buf, struct wmi_host_dcs_interference_param *param) |
| 17832 | { |
| 17833 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 17834 | |
| 17835 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 17836 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17837 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 17838 | |
| 17839 | param->interference_type = param_buf->fixed_param->interference_type; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17840 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17841 | param_buf->fixed_param->pdev_id); |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 17842 | |
| 17843 | return QDF_STATUS_SUCCESS; |
| 17844 | } |
| 17845 | |
| 17846 | /* |
| 17847 | * extract_dcs_cw_int_tlv() - extract dcs cw interference from event |
| 17848 | * @wmi_handle: wmi handle |
| 17849 | * @param evt_buf: pointer to event buffer |
| 17850 | * @param cw_int: Pointer to hold cw interference |
| 17851 | * |
| 17852 | * Return: 0 for success or error code |
| 17853 | */ |
| 17854 | static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle, |
| 17855 | void *evt_buf, |
| 17856 | wmi_host_ath_dcs_cw_int *cw_int) |
| 17857 | { |
| 17858 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 17859 | wlan_dcs_cw_int *ev; |
| 17860 | |
| 17861 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 17862 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17863 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 17864 | |
| 17865 | ev = param_buf->cw_int; |
| 17866 | |
| 17867 | cw_int->channel = ev->channel; |
| 17868 | |
| 17869 | return QDF_STATUS_SUCCESS; |
| 17870 | } |
| 17871 | |
| 17872 | /** |
| 17873 | * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event |
| 17874 | * @wmi_handle: wmi handle |
| 17875 | * @param evt_buf: pointer to event buffer |
| 17876 | * @param wlan_stat: Pointer to hold wlan stats |
| 17877 | * |
| 17878 | * Return: 0 for success or error code |
| 17879 | */ |
| 17880 | static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle, |
| 17881 | void *evt_buf, |
| 17882 | wmi_host_dcs_im_tgt_stats_t *wlan_stat) |
| 17883 | { |
| 17884 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 17885 | wlan_dcs_im_tgt_stats_t *ev; |
| 17886 | |
| 17887 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 17888 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17889 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 17890 | |
| 17891 | ev = param_buf->wlan_stat; |
| 17892 | wlan_stat->reg_tsf32 = ev->reg_tsf32; |
| 17893 | wlan_stat->last_ack_rssi = ev->last_ack_rssi; |
| 17894 | wlan_stat->tx_waste_time = ev->tx_waste_time; |
| 17895 | wlan_stat->rx_time = ev->rx_time; |
| 17896 | wlan_stat->phyerr_cnt = ev->phyerr_cnt; |
| 17897 | wlan_stat->mib_stats.listen_time = ev->listen_time; |
| 17898 | wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt; |
| 17899 | wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt; |
| 17900 | wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt; |
| 17901 | wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt; |
| 17902 | wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt; |
| 17903 | wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt; |
| 17904 | wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt; |
| 17905 | wlan_stat->chan_nf = ev->chan_nf; |
| 17906 | wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 17907 | |
| 17908 | return QDF_STATUS_SUCCESS; |
| 17909 | } |
| 17910 | |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 17911 | /** |
| 17912 | * extract_thermal_stats_tlv() - extract thermal stats from event |
| 17913 | * @wmi_handle: wmi handle |
| 17914 | * @param evt_buf: Pointer to event buffer |
| 17915 | * @param temp: Pointer to hold extracted temperature |
| 17916 | * @param level: Pointer to hold extracted level |
| 17917 | * |
| 17918 | * Return: 0 for success or error code |
| 17919 | */ |
| 17920 | static QDF_STATUS |
| 17921 | extract_thermal_stats_tlv(wmi_unified_t wmi_handle, |
| 17922 | void *evt_buf, uint32_t *temp, |
| 17923 | uint32_t *level, uint32_t *pdev_id) |
| 17924 | { |
| 17925 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 17926 | wmi_therm_throt_stats_event_fixed_param *tt_stats_event; |
| 17927 | |
| 17928 | param_buf = |
| 17929 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17930 | if (!param_buf) |
| 17931 | return QDF_STATUS_E_INVAL; |
| 17932 | |
| 17933 | tt_stats_event = param_buf->fixed_param; |
| 17934 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17935 | *pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17936 | tt_stats_event->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 17937 | *temp = tt_stats_event->temp; |
| 17938 | *level = tt_stats_event->level; |
| 17939 | |
| 17940 | return QDF_STATUS_SUCCESS; |
| 17941 | } |
| 17942 | |
| 17943 | /** |
| 17944 | * extract_thermal_level_stats_tlv() - extract thermal level stats from event |
| 17945 | * @wmi_handle: wmi handle |
| 17946 | * @param evt_buf: pointer to event buffer |
| 17947 | * @param idx: Index to level stats |
| 17948 | * @param levelcount: Pointer to hold levelcount |
| 17949 | * @param dccount: Pointer to hold dccount |
| 17950 | * |
| 17951 | * Return: 0 for success or error code |
| 17952 | */ |
| 17953 | static QDF_STATUS |
| 17954 | extract_thermal_level_stats_tlv(wmi_unified_t wmi_handle, |
| 17955 | void *evt_buf, uint8_t idx, uint32_t *levelcount, |
| 17956 | uint32_t *dccount) |
| 17957 | { |
| 17958 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 17959 | wmi_therm_throt_level_stats_info *tt_level_info; |
| 17960 | |
| 17961 | param_buf = |
| 17962 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17963 | if (!param_buf) |
| 17964 | return QDF_STATUS_E_INVAL; |
| 17965 | |
| 17966 | tt_level_info = param_buf->therm_throt_level_stats_info; |
| 17967 | |
| 17968 | if (idx < THERMAL_LEVELS) { |
| 17969 | *levelcount = tt_level_info[idx].level_count; |
| 17970 | *dccount = tt_level_info[idx].dc_count; |
| 17971 | return QDF_STATUS_SUCCESS; |
| 17972 | } |
| 17973 | |
| 17974 | return QDF_STATUS_E_FAILURE; |
| 17975 | } |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 17976 | #ifdef BIG_ENDIAN_HOST |
| 17977 | /** |
| 17978 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 17979 | * @param data_len - data length |
| 17980 | * @param data - pointer to data |
| 17981 | * |
| 17982 | * Return: QDF_STATUS - success or error status |
| 17983 | */ |
| 17984 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 17985 | { |
| 17986 | uint8_t *data_aligned = NULL; |
| 17987 | int c; |
| 17988 | unsigned char *data_unaligned; |
| 17989 | |
| 17990 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 17991 | FIPS_ALIGN)); |
| 17992 | /* Assigning unaligned space to copy the data */ |
| 17993 | /* Checking if kmalloc does succesful allocation */ |
| 17994 | if (data_unaligned == NULL) |
| 17995 | return QDF_STATUS_E_FAILURE; |
| 17996 | |
| 17997 | /* Checking if space is alligned */ |
| 17998 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 17999 | /* align the data space */ |
| 18000 | data_aligned = |
| 18001 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 18002 | } else { |
| 18003 | data_aligned = (u_int8_t *)data_unaligned; |
| 18004 | } |
| 18005 | |
| 18006 | /* memset and copy content from data to data aligned */ |
| 18007 | OS_MEMSET(data_aligned, 0, data_len); |
| 18008 | OS_MEMCPY(data_aligned, data, data_len); |
| 18009 | /* Endianness to LE */ |
| 18010 | for (c = 0; c < data_len/4; c++) { |
| 18011 | *((u_int32_t *)data_aligned + c) = |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 18012 | qdf_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 18013 | } |
| 18014 | |
| 18015 | /* Copy content to event->data */ |
| 18016 | OS_MEMCPY(data, data_aligned, data_len); |
| 18017 | |
| 18018 | /* clean up allocated space */ |
| 18019 | qdf_mem_free(data_unaligned); |
| 18020 | data_aligned = NULL; |
| 18021 | data_unaligned = NULL; |
| 18022 | |
| 18023 | /*************************************************************/ |
| 18024 | |
| 18025 | return QDF_STATUS_SUCCESS; |
| 18026 | } |
| 18027 | #else |
| 18028 | /** |
| 18029 | * fips_conv_data_be() - DUMMY for LE platform |
| 18030 | * |
| 18031 | * Return: QDF_STATUS - success |
| 18032 | */ |
| 18033 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 18034 | { |
| 18035 | return QDF_STATUS_SUCCESS; |
| 18036 | } |
| 18037 | #endif |
| 18038 | |
| 18039 | /** |
| 18040 | * extract_fips_event_data_tlv() - extract fips event data |
| 18041 | * @wmi_handle: wmi handle |
| 18042 | * @param evt_buf: pointer to event buffer |
| 18043 | * @param param: pointer FIPS event params |
| 18044 | * |
| 18045 | * Return: 0 for success or error code |
| 18046 | */ |
| 18047 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 18048 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 18049 | { |
| 18050 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 18051 | wmi_pdev_fips_event_fixed_param *event; |
| 18052 | |
| 18053 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 18054 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 18055 | |
| 18056 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 18057 | QDF_STATUS_SUCCESS) |
| 18058 | return QDF_STATUS_E_FAILURE; |
| 18059 | |
| 18060 | param->data = (uint32_t *)param_buf->data; |
| 18061 | param->data_len = event->data_len; |
| 18062 | param->error_status = event->error_status; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18063 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18064 | event->pdev_id); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 18065 | |
| 18066 | return QDF_STATUS_SUCCESS; |
| 18067 | } |
| 18068 | |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 18069 | /* |
| 18070 | * extract_peer_delete_response_event_tlv() - extract peer delete response event |
| 18071 | * @wmi_handle: wmi handle |
| 18072 | * @param evt_buf: pointer to event buffer |
| 18073 | * @param vdev_id: Pointer to hold vdev_id |
| 18074 | * @param mac_addr: Pointer to hold peer mac address |
| 18075 | * |
| 18076 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18077 | */ |
| 18078 | static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl, |
| 18079 | void *evt_buf, struct wmi_host_peer_delete_response_event *param) |
| 18080 | { |
| 18081 | WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 18082 | wmi_peer_delete_resp_event_fixed_param *ev; |
| 18083 | |
| 18084 | param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf; |
| 18085 | |
| 18086 | ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param; |
| 18087 | if (!ev) { |
| 18088 | WMI_LOGE("%s: Invalid peer_delete response\n", __func__); |
| 18089 | return QDF_STATUS_E_FAILURE; |
| 18090 | } |
| 18091 | |
| 18092 | param->vdev_id = ev->vdev_id; |
| 18093 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr, |
| 18094 | ¶m->mac_address.bytes[0]); |
| 18095 | |
| 18096 | return QDF_STATUS_SUCCESS; |
| 18097 | } |
| 18098 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18099 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 18100 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 18101 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18102 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18103 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18104 | return false; |
| 18105 | } |
| 18106 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 18107 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 18108 | { |
| 18109 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 18110 | |
| 18111 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 18112 | |
| 18113 | switch (set_cmd->param_id) { |
| 18114 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 18115 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 18116 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 18117 | default: |
| 18118 | break; |
| 18119 | } |
| 18120 | |
| 18121 | return 0; |
| 18122 | } |
| 18123 | |
| 18124 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 18125 | { |
| 18126 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 18127 | |
| 18128 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 18129 | |
| 18130 | switch (ps_cmd->param) { |
| 18131 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 18132 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 18133 | case WMI_STA_PS_ENABLE_QPOWER: |
| 18134 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 18135 | default: |
| 18136 | break; |
| 18137 | } |
| 18138 | |
| 18139 | return 0; |
| 18140 | } |
| 18141 | |
| 18142 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 18143 | uint32_t cmd_id) |
| 18144 | { |
| 18145 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 18146 | return 0; |
| 18147 | |
| 18148 | switch (cmd_id) { |
| 18149 | case WMI_VDEV_SET_PARAM_CMDID: |
| 18150 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 18151 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 18152 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 18153 | default: |
| 18154 | break; |
| 18155 | } |
| 18156 | |
| 18157 | return 0; |
| 18158 | } |
| 18159 | |
| 18160 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 18161 | { |
| 18162 | uint16_t tag = 0; |
| 18163 | |
| 18164 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
| 18165 | pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", |
| 18166 | __func__); |
| 18167 | return tag; |
| 18168 | } |
| 18169 | |
| 18170 | if (wmi_handle->tag_crash_inject) |
| 18171 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 18172 | |
| 18173 | wmi_handle->tag_crash_inject = false; |
| 18174 | return tag; |
| 18175 | } |
| 18176 | |
| 18177 | /** |
| 18178 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 18179 | * @wmi_handle: WMI handle |
| 18180 | * @buf: WMI buffer |
| 18181 | * @cmd_id: WMI command Id |
| 18182 | * |
| 18183 | * Return htc_tx_tag |
| 18184 | */ |
| 18185 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 18186 | wmi_buf_t buf, |
| 18187 | uint32_t cmd_id) |
| 18188 | { |
| 18189 | uint16_t htc_tx_tag = 0; |
| 18190 | |
| 18191 | switch (cmd_id) { |
| 18192 | case WMI_WOW_ENABLE_CMDID: |
| 18193 | case WMI_PDEV_SUSPEND_CMDID: |
| 18194 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 18195 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 18196 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 18197 | case WMI_PDEV_RESUME_CMDID: |
| 18198 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 18199 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 18200 | #ifdef FEATURE_WLAN_D0WOW |
| 18201 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 18202 | #endif |
| 18203 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 18204 | break; |
| 18205 | case WMI_FORCE_FW_HANG_CMDID: |
| 18206 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 18207 | break; |
| 18208 | case WMI_VDEV_SET_PARAM_CMDID: |
| 18209 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 18210 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 18211 | default: |
| 18212 | break; |
| 18213 | } |
| 18214 | |
| 18215 | return htc_tx_tag; |
| 18216 | } |
| 18217 | |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18218 | /** |
| 18219 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 18220 | * from event |
| 18221 | * @wmi_handle: wmi handle |
| 18222 | * @param evt_buf: pointer to event buffer |
| 18223 | * @param ch_hopping: Pointer to hold channel hopping param |
| 18224 | * |
| 18225 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18226 | */ |
| 18227 | static QDF_STATUS extract_channel_hopping_event_tlv( |
| 18228 | wmi_unified_t wmi_handle, void *evt_buf, |
| 18229 | wmi_host_pdev_channel_hopping_event *ch_hopping) |
| 18230 | { |
| 18231 | WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *param_buf; |
| 18232 | wmi_pdev_channel_hopping_event_fixed_param *event; |
| 18233 | |
| 18234 | param_buf = (WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *)evt_buf; |
| 18235 | event = (wmi_pdev_channel_hopping_event_fixed_param *) |
| 18236 | param_buf->fixed_param; |
| 18237 | |
| 18238 | ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter; |
| 18239 | ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18240 | ch_hopping->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18241 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18242 | |
| 18243 | return QDF_STATUS_SUCCESS; |
| 18244 | } |
| 18245 | |
| 18246 | /** |
| 18247 | * extract_pdev_tpc_ev_param_tlv() - extract tpc param from event |
| 18248 | * @wmi_handle: wmi handle |
| 18249 | * @param evt_buf: pointer to event buffer |
| 18250 | * @param param: Pointer to hold tpc param |
| 18251 | * |
| 18252 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18253 | */ |
| 18254 | static QDF_STATUS extract_pdev_tpc_ev_param_tlv(wmi_unified_t wmi_handle, |
| 18255 | void *evt_buf, |
| 18256 | wmi_host_pdev_tpc_event *param) |
| 18257 | { |
| 18258 | WMI_PDEV_TPC_EVENTID_param_tlvs *param_buf; |
| 18259 | wmi_pdev_tpc_event_fixed_param *event; |
| 18260 | |
| 18261 | param_buf = (WMI_PDEV_TPC_EVENTID_param_tlvs *)evt_buf; |
| 18262 | event = (wmi_pdev_tpc_event_fixed_param *)param_buf->fixed_param; |
| 18263 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18264 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18265 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18266 | qdf_mem_copy(param->tpc, param_buf->tpc, sizeof(param->tpc)); |
| 18267 | |
| 18268 | return QDF_STATUS_SUCCESS; |
| 18269 | } |
| 18270 | |
| 18271 | |
| 18272 | #ifdef BIG_ENDIAN_HOST |
| 18273 | /** |
| 18274 | * wds_addr_ev_conv_data_be() - LE to BE conversion of wds addr event |
| 18275 | * @param data_len - data length |
| 18276 | * @param data - pointer to data |
| 18277 | * |
| 18278 | * Return: QDF_STATUS - success or error status |
| 18279 | */ |
| 18280 | static QDF_STATUS wds_addr_ev_conv_data_be(uint16_t data_len, uint8_t *ev) |
| 18281 | { |
| 18282 | uint8_t *datap = (uint8_t *)ev; |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 18283 | int i; |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18284 | /* Skip swapping the first word */ |
| 18285 | datap += sizeof(uint32_t); |
| 18286 | for (i = 0; i < ((data_len / sizeof(uint32_t))-1); |
| 18287 | i++, datap += sizeof(uint32_t)) { |
| 18288 | *(uint32_t *)datap = qdf_le32_to_cpu(*(uint32_t *)datap); |
| 18289 | } |
| 18290 | |
| 18291 | return QDF_STATUS_SUCCESS; |
| 18292 | } |
| 18293 | #else |
| 18294 | /** |
| 18295 | * wds_addr_ev_conv_data_be() - Dummy operation for LE platforms |
| 18296 | * @param data_len - data length |
| 18297 | * @param data - pointer to data |
| 18298 | * |
| 18299 | * Return: QDF_STATUS - success or error status |
| 18300 | */ |
| 18301 | static QDF_STATUS wds_addr_ev_conv_data_be(uint32_t data_len, uint8_t *ev) |
| 18302 | { |
| 18303 | return QDF_STATUS_SUCCESS; |
| 18304 | } |
| 18305 | #endif |
| 18306 | |
| 18307 | /** |
| 18308 | * extract_wds_addr_event_tlv() - extract wds address from event |
| 18309 | * @wmi_handle: wmi handle |
| 18310 | * @param evt_buf: pointer to event buffer |
| 18311 | * @param wds_ev: Pointer to hold wds address |
| 18312 | * |
| 18313 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18314 | */ |
| 18315 | static QDF_STATUS extract_wds_addr_event_tlv(wmi_unified_t wmi_handle, |
| 18316 | void *evt_buf, |
| 18317 | uint16_t len, wds_addr_event_t *wds_ev) |
| 18318 | { |
| 18319 | WMI_WDS_PEER_EVENTID_param_tlvs *param_buf; |
| 18320 | wmi_wds_addr_event_fixed_param *ev; |
| 18321 | int i; |
| 18322 | |
| 18323 | param_buf = (WMI_WDS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 18324 | ev = (wmi_wds_addr_event_fixed_param *)param_buf->fixed_param; |
| 18325 | |
| 18326 | if (wds_addr_ev_conv_data_be(len, (uint8_t *)ev) != QDF_STATUS_SUCCESS) |
| 18327 | return QDF_STATUS_E_FAILURE; |
| 18328 | |
| 18329 | qdf_mem_copy(wds_ev->event_type, ev->event_type, |
| 18330 | sizeof(wds_ev->event_type)); |
| 18331 | for (i = 0; i < 4; i++) { |
| 18332 | wds_ev->peer_mac[i] = |
| 18333 | ((u_int8_t *)&(ev->peer_mac.mac_addr31to0))[i]; |
| 18334 | wds_ev->dest_mac[i] = |
| 18335 | ((u_int8_t *)&(ev->dest_mac.mac_addr31to0))[i]; |
| 18336 | } |
| 18337 | for (i = 0; i < 2; i++) { |
| 18338 | wds_ev->peer_mac[4+i] = |
| 18339 | ((u_int8_t *)&(ev->peer_mac.mac_addr47to32))[i]; |
| 18340 | wds_ev->dest_mac[4+i] = |
| 18341 | ((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i]; |
| 18342 | } |
| 18343 | return QDF_STATUS_SUCCESS; |
| 18344 | } |
| 18345 | |
| 18346 | /** |
| 18347 | * extract_peer_sta_ps_statechange_ev_tlv() - extract peer sta ps state |
| 18348 | * from event |
| 18349 | * @wmi_handle: wmi handle |
| 18350 | * @param evt_buf: pointer to event buffer |
| 18351 | * @param ev: Pointer to hold peer param and ps state |
| 18352 | * |
| 18353 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18354 | */ |
| 18355 | static QDF_STATUS extract_peer_sta_ps_statechange_ev_tlv(wmi_unified_t wmi_handle, |
| 18356 | void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev) |
| 18357 | { |
| 18358 | WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf; |
| 18359 | wmi_peer_sta_ps_statechange_event_fixed_param *event; |
| 18360 | |
| 18361 | param_buf = (WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *)evt_buf; |
| 18362 | event = (wmi_peer_sta_ps_statechange_event_fixed_param *) |
| 18363 | param_buf->fixed_param; |
| 18364 | |
| 18365 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, ev->peer_macaddr); |
| 18366 | ev->peer_ps_state = event->peer_ps_state; |
| 18367 | |
| 18368 | return QDF_STATUS_SUCCESS; |
| 18369 | } |
| 18370 | |
| 18371 | /** |
| 18372 | * extract_inst_rssi_stats_event_tlv() - extract inst rssi stats from event |
| 18373 | * @wmi_handle: wmi handle |
| 18374 | * @param evt_buf: pointer to event buffer |
| 18375 | * @param inst_rssi_resp: Pointer to hold inst rssi response |
| 18376 | * |
| 18377 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18378 | */ |
| 18379 | static QDF_STATUS extract_inst_rssi_stats_event_tlv( |
| 18380 | wmi_unified_t wmi_handle, void *evt_buf, |
| 18381 | wmi_host_inst_stats_resp *inst_rssi_resp) |
| 18382 | { |
| 18383 | WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf; |
| 18384 | wmi_inst_rssi_stats_resp_fixed_param *event; |
| 18385 | |
| 18386 | param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf; |
| 18387 | event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param; |
| 18388 | |
| 18389 | qdf_mem_copy(&(inst_rssi_resp->peer_macaddr), |
| 18390 | &(event->peer_macaddr), sizeof(wmi_mac_addr)); |
| 18391 | inst_rssi_resp->iRSSI = event->iRSSI; |
| 18392 | |
| 18393 | return QDF_STATUS_SUCCESS; |
| 18394 | } |
| 18395 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18396 | static struct cur_reg_rule |
| 18397 | *create_reg_rules_from_wmi(uint32_t num_reg_rules, |
| 18398 | wmi_regulatory_rule_struct *wmi_reg_rule) |
| 18399 | { |
| 18400 | struct cur_reg_rule *reg_rule_ptr; |
| 18401 | uint32_t count; |
| 18402 | |
| 18403 | reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); |
| 18404 | |
| 18405 | if (NULL == reg_rule_ptr) { |
| 18406 | WMI_LOGE("memory allocation failure"); |
| 18407 | return NULL; |
| 18408 | } |
| 18409 | |
| 18410 | for (count = 0; count < num_reg_rules; count++) { |
| 18411 | reg_rule_ptr[count].start_freq = |
| 18412 | WMI_REG_RULE_START_FREQ_GET( |
| 18413 | wmi_reg_rule[count].freq_info); |
| 18414 | reg_rule_ptr[count].end_freq = |
| 18415 | WMI_REG_RULE_END_FREQ_GET( |
| 18416 | wmi_reg_rule[count].freq_info); |
| 18417 | reg_rule_ptr[count].max_bw = |
| 18418 | WMI_REG_RULE_MAX_BW_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18419 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18420 | reg_rule_ptr[count].reg_power = |
| 18421 | WMI_REG_RULE_REG_POWER_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18422 | wmi_reg_rule[count].bw_pwr_info); |
Abhijit Pradhan | b5a1d24 | 2017-04-27 20:36:31 +0530 | [diff] [blame] | 18423 | reg_rule_ptr[count].ant_gain = |
| 18424 | WMI_REG_RULE_ANTENNA_GAIN_GET( |
| 18425 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18426 | reg_rule_ptr[count].flags = |
| 18427 | WMI_REG_RULE_FLAGS_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18428 | wmi_reg_rule[count].flag_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18429 | } |
| 18430 | |
| 18431 | return reg_rule_ptr; |
| 18432 | } |
| 18433 | |
| 18434 | static QDF_STATUS extract_reg_chan_list_update_event_tlv( |
| 18435 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18436 | struct cur_regulatory_info *reg_info, uint32_t len) |
| 18437 | { |
| 18438 | WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *param_buf; |
| 18439 | wmi_reg_chan_list_cc_event_fixed_param *chan_list_event_hdr; |
| 18440 | wmi_regulatory_rule_struct *wmi_reg_rule; |
| 18441 | uint32_t num_2g_reg_rules, num_5g_reg_rules; |
| 18442 | |
| 18443 | WMI_LOGD("processing regulatory channel list"); |
| 18444 | |
| 18445 | param_buf = (WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *)evt_buf; |
| 18446 | if (!param_buf) { |
| 18447 | WMI_LOGE("invalid channel list event buf"); |
| 18448 | return QDF_STATUS_E_FAILURE; |
| 18449 | } |
| 18450 | |
| 18451 | chan_list_event_hdr = param_buf->fixed_param; |
| 18452 | |
| 18453 | reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; |
| 18454 | reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; |
| 18455 | qdf_mem_copy(reg_info->alpha2, &(chan_list_event_hdr->alpha2), |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 18456 | REG_ALPHA2_LEN); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18457 | reg_info->dfs_region = chan_list_event_hdr->dfs_region; |
| 18458 | reg_info->phybitmap = chan_list_event_hdr->phybitmap; |
Amar Singhal | a2d575f | 2017-05-04 17:12:34 -0700 | [diff] [blame] | 18459 | reg_info->offload_enabled = true; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 18460 | reg_info->num_phy = chan_list_event_hdr->num_phy; |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 18461 | reg_info->phy_id = chan_list_event_hdr->phy_id; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 18462 | reg_info->ctry_code = chan_list_event_hdr->country_id; |
| 18463 | reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; |
| 18464 | if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS) |
| 18465 | reg_info->status_code = REG_SET_CC_STATUS_PASS; |
| 18466 | else if (chan_list_event_hdr->status_code == |
| 18467 | WMI_REG_CURRENT_ALPHA2_NOT_FOUND) |
| 18468 | reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND; |
| 18469 | else if (chan_list_event_hdr->status_code == |
| 18470 | WMI_REG_INIT_ALPHA2_NOT_FOUND) |
| 18471 | reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND; |
| 18472 | else if (chan_list_event_hdr->status_code == |
| 18473 | WMI_REG_SET_CC_CHANGE_NOT_ALLOWED) |
| 18474 | reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED; |
| 18475 | else if (chan_list_event_hdr->status_code == |
| 18476 | WMI_REG_SET_CC_STATUS_NO_MEMORY) |
| 18477 | reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY; |
| 18478 | else if (chan_list_event_hdr->status_code == |
| 18479 | WMI_REG_SET_CC_STATUS_FAIL) |
| 18480 | reg_info->status_code = REG_SET_CC_STATUS_FAIL; |
| 18481 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18482 | reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; |
| 18483 | reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; |
| 18484 | reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; |
| 18485 | reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; |
| 18486 | |
| 18487 | num_2g_reg_rules = reg_info->num_2g_reg_rules; |
| 18488 | num_5g_reg_rules = reg_info->num_5g_reg_rules; |
| 18489 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18490 | WMI_LOGD("%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", |
| 18491 | __func__, reg_info->alpha2, reg_info->dfs_region, |
| 18492 | reg_info->min_bw_2g, reg_info->max_bw_2g, |
| 18493 | reg_info->min_bw_5g, reg_info->max_bw_5g); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18494 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18495 | WMI_LOGD("%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__, |
| 18496 | num_2g_reg_rules, num_5g_reg_rules); |
Kiran Kumar Lokere | dd64e04 | 2017-03-31 15:50:26 -0700 | [diff] [blame] | 18497 | wmi_reg_rule = |
| 18498 | (wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr |
| 18499 | + sizeof(wmi_reg_chan_list_cc_event_fixed_param) |
| 18500 | + WMI_TLV_HDR_SIZE); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18501 | reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, |
| 18502 | wmi_reg_rule); |
| 18503 | wmi_reg_rule += num_2g_reg_rules; |
| 18504 | |
| 18505 | reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, |
| 18506 | wmi_reg_rule); |
| 18507 | |
| 18508 | WMI_LOGD("processed regulatory channel list"); |
| 18509 | |
| 18510 | return QDF_STATUS_SUCCESS; |
| 18511 | } |
| 18512 | |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 18513 | static QDF_STATUS extract_reg_11d_new_country_event_tlv( |
| 18514 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18515 | struct reg_11d_new_country *reg_11d_country, uint32_t len) |
| 18516 | { |
| 18517 | wmi_11d_new_country_event_fixed_param *reg_11d_country_event; |
| 18518 | WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *param_buf; |
| 18519 | |
| 18520 | param_buf = (WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *)evt_buf; |
| 18521 | if (!param_buf) { |
| 18522 | WMI_LOGE("invalid 11d country event buf"); |
| 18523 | return QDF_STATUS_E_FAILURE; |
| 18524 | } |
| 18525 | |
| 18526 | reg_11d_country_event = param_buf->fixed_param; |
| 18527 | |
| 18528 | qdf_mem_copy(reg_11d_country->alpha2, |
| 18529 | ®_11d_country_event->new_alpha2, REG_ALPHA2_LEN); |
| 18530 | |
| 18531 | WMI_LOGD("processed 11d country event, new cc %s", |
| 18532 | reg_11d_country->alpha2); |
| 18533 | |
| 18534 | return QDF_STATUS_SUCCESS; |
| 18535 | } |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 18536 | |
| 18537 | static QDF_STATUS extract_reg_ch_avoid_event_tlv( |
| 18538 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18539 | struct ch_avoid_ind_type *ch_avoid_ind, uint32_t len) |
| 18540 | { |
| 18541 | wmi_avoid_freq_ranges_event_fixed_param *afr_fixed_param; |
| 18542 | wmi_avoid_freq_range_desc *afr_desc; |
| 18543 | uint32_t num_freq_ranges, freq_range_idx; |
| 18544 | WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *param_buf = |
| 18545 | (WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *) evt_buf; |
| 18546 | |
| 18547 | if (!param_buf) { |
| 18548 | WMI_LOGE("Invalid channel avoid event buffer"); |
| 18549 | return QDF_STATUS_E_INVAL; |
| 18550 | } |
| 18551 | |
| 18552 | afr_fixed_param = param_buf->fixed_param; |
| 18553 | if (!afr_fixed_param) { |
| 18554 | WMI_LOGE("Invalid channel avoid event fixed param buffer"); |
| 18555 | return QDF_STATUS_E_INVAL; |
| 18556 | } |
| 18557 | |
| 18558 | if (!ch_avoid_ind) { |
| 18559 | WMI_LOGE("Invalid channel avoid indication buffer"); |
| 18560 | return QDF_STATUS_E_INVAL; |
| 18561 | } |
| 18562 | num_freq_ranges = (afr_fixed_param->num_freq_ranges > |
| 18563 | CH_AVOID_MAX_RANGE) ? CH_AVOID_MAX_RANGE : |
| 18564 | afr_fixed_param->num_freq_ranges; |
| 18565 | |
| 18566 | WMI_LOGD("Channel avoid event received with %d ranges", |
| 18567 | num_freq_ranges); |
| 18568 | |
| 18569 | ch_avoid_ind->ch_avoid_range_cnt = num_freq_ranges; |
| 18570 | afr_desc = (wmi_avoid_freq_range_desc *)(param_buf->avd_freq_range); |
| 18571 | for (freq_range_idx = 0; freq_range_idx < num_freq_ranges; |
| 18572 | freq_range_idx++) { |
| 18573 | ch_avoid_ind->avoid_freq_range[freq_range_idx].start_freq = |
| 18574 | afr_desc->start_freq; |
| 18575 | ch_avoid_ind->avoid_freq_range[freq_range_idx].end_freq = |
| 18576 | afr_desc->end_freq; |
| 18577 | WMI_LOGD("range %d tlv id %u, start freq %u, end freq %u", |
| 18578 | freq_range_idx, afr_desc->tlv_header, |
| 18579 | afr_desc->start_freq, afr_desc->end_freq); |
| 18580 | afr_desc++; |
| 18581 | } |
| 18582 | |
| 18583 | return QDF_STATUS_SUCCESS; |
| 18584 | } |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18585 | #ifdef DFS_COMPONENT_ENABLE |
| 18586 | /** |
| 18587 | * extract_dfs_cac_complete_event_tlv() - extract cac complete event |
| 18588 | * @wmi_handle: wma handle |
| 18589 | * @evt_buf: event buffer |
| 18590 | * @vdev_id: vdev id |
| 18591 | * @len: length of buffer |
| 18592 | * |
| 18593 | * Return: 0 for success or error code |
| 18594 | */ |
| 18595 | static QDF_STATUS extract_dfs_cac_complete_event_tlv(wmi_unified_t wmi_handle, |
| 18596 | uint8_t *evt_buf, |
| 18597 | uint32_t *vdev_id, |
| 18598 | uint32_t len) |
| 18599 | { |
| 18600 | WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *param_tlvs; |
| 18601 | wmi_vdev_dfs_cac_complete_event_fixed_param *cac_event; |
| 18602 | |
| 18603 | param_tlvs = (WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *) evt_buf; |
| 18604 | if (!param_tlvs) { |
| 18605 | WMI_LOGE("invalid cac complete event buf"); |
| 18606 | return QDF_STATUS_E_FAILURE; |
| 18607 | } |
| 18608 | |
| 18609 | cac_event = param_tlvs->fixed_param; |
| 18610 | *vdev_id = cac_event->vdev_id; |
| 18611 | WMI_LOGD("processed cac complete event vdev %d", *vdev_id); |
| 18612 | |
| 18613 | return QDF_STATUS_SUCCESS; |
| 18614 | } |
| 18615 | |
| 18616 | /** |
| 18617 | * extract_dfs_radar_detection_event_tlv() - extract radar found event |
| 18618 | * @wmi_handle: wma handle |
| 18619 | * @evt_buf: event buffer |
| 18620 | * @radar_found: radar found event info |
| 18621 | * @len: length of buffer |
| 18622 | * |
| 18623 | * Return: 0 for success or error code |
| 18624 | */ |
| 18625 | static QDF_STATUS extract_dfs_radar_detection_event_tlv( |
| 18626 | wmi_unified_t wmi_handle, |
| 18627 | uint8_t *evt_buf, |
| 18628 | struct radar_found_info *radar_found, |
| 18629 | uint32_t len) |
| 18630 | { |
| 18631 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *param_tlv; |
| 18632 | wmi_pdev_dfs_radar_detection_event_fixed_param *radar_event; |
| 18633 | |
| 18634 | param_tlv = (WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *) evt_buf; |
| 18635 | if (!param_tlv) { |
| 18636 | WMI_LOGE("invalid radar detection event buf"); |
| 18637 | return QDF_STATUS_E_FAILURE; |
| 18638 | } |
| 18639 | |
| 18640 | radar_event = param_tlv->fixed_param; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18641 | radar_found->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18642 | radar_event->pdev_id); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18643 | radar_found->detection_mode = radar_event->detection_mode; |
| 18644 | radar_found->freq_offset = radar_event->chan_freq; |
| 18645 | radar_found->chan_width = radar_event->chan_width; |
| 18646 | radar_found->detector_id = radar_event->detector_id; |
| 18647 | radar_found->segment_id = radar_event->segment_id; |
| 18648 | radar_found->timestamp = radar_event->timestamp; |
| 18649 | radar_found->is_chirp = radar_event->is_chirp; |
| 18650 | |
| 18651 | WMI_LOGD("processed radar found event pdev %d", radar_event->pdev_id); |
| 18652 | |
| 18653 | return QDF_STATUS_SUCCESS; |
| 18654 | } |
| 18655 | #endif |
| 18656 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18657 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18658 | * convert_host_pdev_id_to_target_pdev_id_legacy() - Convert pdev_id from |
| 18659 | * host to target defines. For legacy there is not conversion |
| 18660 | * required. Just return pdev_id as it is. |
| 18661 | * @param pdev_id: host pdev_id to be converted. |
| 18662 | * Return: target pdev_id after conversion. |
| 18663 | */ |
| 18664 | static uint32_t convert_host_pdev_id_to_target_pdev_id_legacy( |
| 18665 | uint32_t pdev_id) |
| 18666 | { |
| 18667 | if (pdev_id == WMI_HOST_PDEV_ID_SOC) |
| 18668 | return WMI_PDEV_ID_SOC; |
| 18669 | |
| 18670 | /*No conversion required*/ |
| 18671 | return pdev_id; |
| 18672 | } |
| 18673 | |
| 18674 | /** |
| 18675 | * convert_target_pdev_id_to_host_pdev_id_legacy() - Convert pdev_id from |
| 18676 | * target to host defines. For legacy there is not conversion |
| 18677 | * required. Just return pdev_id as it is. |
| 18678 | * @param pdev_id: target pdev_id to be converted. |
| 18679 | * Return: host pdev_id after conversion. |
| 18680 | */ |
| 18681 | static uint32_t convert_target_pdev_id_to_host_pdev_id_legacy( |
| 18682 | uint32_t pdev_id) |
| 18683 | { |
| 18684 | /*No conversion required*/ |
| 18685 | return pdev_id; |
| 18686 | } |
| 18687 | |
| 18688 | /** |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18689 | * send_set_country_cmd_tlv() - WMI scan channel list function |
| 18690 | * @param wmi_handle : handle to WMI. |
| 18691 | * @param param : pointer to hold scan channel list parameter |
| 18692 | * |
| 18693 | * Return: 0 on success and -ve on failure. |
| 18694 | */ |
| 18695 | static QDF_STATUS send_set_country_cmd_tlv(wmi_unified_t wmi_handle, |
| 18696 | struct set_country *params) |
| 18697 | { |
| 18698 | wmi_buf_t buf; |
| 18699 | QDF_STATUS qdf_status; |
| 18700 | wmi_set_current_country_cmd_fixed_param *cmd; |
| 18701 | uint16_t len = sizeof(*cmd); |
| 18702 | |
| 18703 | buf = wmi_buf_alloc(wmi_handle, len); |
| 18704 | if (!buf) { |
| 18705 | WMI_LOGE("Failed to allocate memory"); |
| 18706 | qdf_status = QDF_STATUS_E_NOMEM; |
| 18707 | goto end; |
| 18708 | } |
| 18709 | |
| 18710 | cmd = (wmi_set_current_country_cmd_fixed_param *)wmi_buf_data(buf); |
| 18711 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 18712 | WMITLV_TAG_STRUC_wmi_set_current_country_cmd_fixed_param, |
| 18713 | WMITLV_GET_STRUCT_TLVLEN |
| 18714 | (wmi_set_current_country_cmd_fixed_param)); |
| 18715 | |
| 18716 | WMI_LOGD("setting cuurnet country to %s", params->country); |
| 18717 | |
| 18718 | qdf_mem_copy((uint8_t *)&cmd->new_alpha2, params->country, 3); |
| 18719 | |
| 18720 | cmd->pdev_id = params->pdev_id; |
| 18721 | |
| 18722 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 18723 | buf, len, WMI_SET_CURRENT_COUNTRY_CMDID); |
| 18724 | |
| 18725 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 18726 | WMI_LOGE("Failed to send WMI_SET_CURRENT_COUNTRY_CMDID"); |
| 18727 | wmi_buf_free(buf); |
| 18728 | } |
| 18729 | |
| 18730 | end: |
| 18731 | return qdf_status; |
| 18732 | } |
| 18733 | |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 18734 | #define WMI_REG_COUNTRY_ALPHA_SET(alpha, val0, val1, val2) do { \ |
| 18735 | WMI_SET_BITS(alpha, 0, 8, val0); \ |
| 18736 | WMI_SET_BITS(alpha, 8, 8, val1); \ |
| 18737 | WMI_SET_BITS(alpha, 16, 8, val2); \ |
| 18738 | } while (0) |
| 18739 | |
| 18740 | static QDF_STATUS send_user_country_code_cmd_tlv(wmi_unified_t wmi_handle, |
| 18741 | uint8_t pdev_id, struct cc_regdmn_s *rd) |
| 18742 | { |
| 18743 | wmi_set_init_country_cmd_fixed_param *cmd; |
| 18744 | uint16_t len; |
| 18745 | wmi_buf_t buf; |
| 18746 | int ret; |
| 18747 | |
| 18748 | len = sizeof(wmi_set_init_country_cmd_fixed_param); |
| 18749 | buf = wmi_buf_alloc(wmi_handle, len); |
| 18750 | if (!buf) { |
| 18751 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 18752 | return QDF_STATUS_E_NOMEM; |
| 18753 | } |
| 18754 | cmd = (wmi_set_init_country_cmd_fixed_param *) wmi_buf_data(buf); |
| 18755 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 18756 | WMITLV_TAG_STRUC_wmi_set_init_country_cmd_fixed_param, |
| 18757 | WMITLV_GET_STRUCT_TLVLEN |
| 18758 | (wmi_set_init_country_cmd_fixed_param)); |
| 18759 | |
| 18760 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
| 18761 | |
| 18762 | if (rd->flags == CC_IS_SET) { |
| 18763 | cmd->countrycode_type = WMI_COUNTRYCODE_COUNTRY_ID; |
| 18764 | cmd->country_code.country_id = rd->cc.country_code; |
| 18765 | } else if (rd->flags == ALPHA_IS_SET) { |
| 18766 | cmd->countrycode_type = WMI_COUNTRYCODE_ALPHA2; |
| 18767 | WMI_REG_COUNTRY_ALPHA_SET(cmd->country_code.alpha2, |
| 18768 | rd->cc.alpha[0], |
| 18769 | rd->cc.alpha[1], |
| 18770 | rd->cc.alpha[2]); |
| 18771 | } else if (rd->flags == REGDMN_IS_SET) { |
| 18772 | cmd->countrycode_type = WMI_COUNTRYCODE_DOMAIN_CODE; |
| 18773 | cmd->country_code.domain_code = rd->cc.regdmn_id; |
| 18774 | } |
| 18775 | |
| 18776 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 18777 | WMI_SET_INIT_COUNTRY_CMDID); |
| 18778 | if (ret) { |
| 18779 | WMI_LOGE("Failed to config wow wakeup event"); |
| 18780 | wmi_buf_free(buf); |
| 18781 | return QDF_STATUS_E_FAILURE; |
| 18782 | } |
| 18783 | |
| 18784 | return QDF_STATUS_SUCCESS; |
| 18785 | } |
| 18786 | |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 18787 | /** |
| 18788 | * send_limit_off_chan_cmd_tlv() - send wmi cmd of limit off chan |
| 18789 | * configuration params |
| 18790 | * @wmi_handle: wmi handler |
| 18791 | * @limit_off_chan_param: pointer to wmi_off_chan_param |
| 18792 | * |
| 18793 | * Return: 0 for success and non zero for failure |
| 18794 | */ |
| 18795 | static |
| 18796 | QDF_STATUS send_limit_off_chan_cmd_tlv(wmi_unified_t wmi_handle, |
| 18797 | struct wmi_limit_off_chan_param *limit_off_chan_param) |
| 18798 | { |
| 18799 | wmi_vdev_limit_offchan_cmd_fixed_param *cmd; |
| 18800 | wmi_buf_t buf; |
| 18801 | uint32_t len = sizeof(*cmd); |
| 18802 | int err; |
| 18803 | |
| 18804 | buf = wmi_buf_alloc(wmi_handle, len); |
| 18805 | if (!buf) { |
| 18806 | WMI_LOGP("%s: failed to allocate memory for limit off chan cmd", |
| 18807 | __func__); |
| 18808 | return QDF_STATUS_E_NOMEM; |
| 18809 | } |
| 18810 | |
| 18811 | cmd = (wmi_vdev_limit_offchan_cmd_fixed_param *)wmi_buf_data(buf); |
| 18812 | |
| 18813 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 18814 | WMITLV_TAG_STRUC_wmi_vdev_limit_offchan_cmd_fixed_param, |
| 18815 | WMITLV_GET_STRUCT_TLVLEN( |
| 18816 | wmi_vdev_limit_offchan_cmd_fixed_param)); |
| 18817 | |
| 18818 | cmd->vdev_id = limit_off_chan_param->vdev_id; |
| 18819 | |
| 18820 | cmd->flags &= 0; |
| 18821 | if (limit_off_chan_param->status) |
| 18822 | cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_ENABLE; |
| 18823 | if (limit_off_chan_param->skip_dfs_chans) |
| 18824 | cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_SKIP_DFS; |
| 18825 | |
| 18826 | cmd->max_offchan_time = limit_off_chan_param->max_offchan_time; |
| 18827 | cmd->rest_time = limit_off_chan_param->rest_time; |
| 18828 | |
| 18829 | WMI_LOGE("%s: vdev_id=%d, flags =%x, max_offchan_time=%d, rest_time=%d", |
| 18830 | __func__, cmd->vdev_id, cmd->flags, cmd->max_offchan_time, |
| 18831 | cmd->rest_time); |
| 18832 | |
| 18833 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 18834 | len, WMI_VDEV_LIMIT_OFFCHAN_CMDID); |
| 18835 | if (QDF_IS_STATUS_ERROR(err)) { |
| 18836 | WMI_LOGE("Failed to send limit off chan cmd err=%d", err); |
| 18837 | wmi_buf_free(buf); |
| 18838 | return QDF_STATUS_E_FAILURE; |
| 18839 | } |
| 18840 | |
| 18841 | return QDF_STATUS_SUCCESS; |
| 18842 | } |
| 18843 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18844 | struct wmi_ops tlv_ops = { |
| 18845 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 18846 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 18847 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 18848 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 18849 | .send_hidden_ssid_vdev_restart_cmd = |
| 18850 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18851 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 18852 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 18853 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 18854 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18855 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 18856 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 18857 | .send_peer_rx_reorder_queue_setup_cmd = |
| 18858 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 18859 | .send_peer_rx_reorder_queue_remove_cmd = |
| 18860 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 18861 | .send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv, |
| 18862 | .send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv, |
| 18863 | .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] | 18864 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 18865 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 18866 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 18867 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 18868 | .send_resume_cmd = send_resume_cmd_tlv, |
| 18869 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 18870 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 18871 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 18872 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 18873 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 18874 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 18875 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 18876 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 18877 | .send_packet_log_disable_cmd = send_packet_log_disable_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18878 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 18879 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18880 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 18881 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 18882 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 18883 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 18884 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 18885 | .send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 18886 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 18887 | .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] | 18888 | .send_set_sta_uapsd_auto_trig_cmd = |
| 18889 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 18890 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 18891 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 18892 | .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] | 18893 | #ifdef CONVERGED_P2P_ENABLE |
| 18894 | .send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv, |
| 18895 | .send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv, |
| 18896 | #endif |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 18897 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 18898 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 18899 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 18900 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 18901 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 18902 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 18903 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 18904 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 18905 | .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] | 18906 | .send_ocb_start_timing_advert_cmd = |
| 18907 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 18908 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 18909 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 18910 | .send_set_mcc_channel_time_latency_cmd = |
| 18911 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 18912 | .send_set_mcc_channel_time_quota_cmd = |
| 18913 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 18914 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 18915 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 18916 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 18917 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 18918 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 18919 | .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] | 18920 | .send_probe_rsp_tmpl_send_cmd = |
| 18921 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 18922 | .send_p2p_go_set_beacon_ie_cmd = |
| 18923 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 18924 | .send_setup_install_key_cmd = |
| 18925 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 18926 | .send_set_gateway_params_cmd = |
| 18927 | send_set_gateway_params_cmd_tlv, |
| 18928 | .send_set_rssi_monitoring_cmd = |
| 18929 | send_set_rssi_monitoring_cmd_tlv, |
| 18930 | .send_scan_probe_setoui_cmd = |
| 18931 | send_scan_probe_setoui_cmd_tlv, |
| 18932 | .send_reset_passpoint_network_list_cmd = |
| 18933 | send_reset_passpoint_network_list_cmd_tlv, |
| 18934 | .send_set_passpoint_network_list_cmd = |
| 18935 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 18936 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 18937 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 18938 | .send_roam_mawc_params_cmd = send_roam_mawc_params_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 18939 | .send_roam_scan_filter_cmd = |
| 18940 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 18941 | .send_set_epno_network_list_cmd = |
| 18942 | send_set_epno_network_list_cmd_tlv, |
| 18943 | .send_ipa_offload_control_cmd = |
| 18944 | send_ipa_offload_control_cmd_tlv, |
| 18945 | .send_extscan_get_capabilities_cmd = |
| 18946 | send_extscan_get_capabilities_cmd_tlv, |
| 18947 | .send_extscan_get_cached_results_cmd = |
| 18948 | send_extscan_get_cached_results_cmd_tlv, |
| 18949 | .send_extscan_stop_change_monitor_cmd = |
| 18950 | send_extscan_stop_change_monitor_cmd_tlv, |
| 18951 | .send_extscan_start_change_monitor_cmd = |
| 18952 | send_extscan_start_change_monitor_cmd_tlv, |
| 18953 | .send_extscan_stop_hotlist_monitor_cmd = |
| 18954 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 18955 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 18956 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 18957 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 18958 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 18959 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
| 18960 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 18961 | .send_nlo_mawc_cmd = send_nlo_mawc_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 18962 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 18963 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 18964 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 18965 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 18966 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 18967 | .send_congestion_cmd = send_congestion_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 18968 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 18969 | .send_snr_cmd = send_snr_cmd_tlv, |
| 18970 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 18971 | #ifdef WLAN_PMO_ENABLE |
| 18972 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 18973 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 18974 | .send_enable_arp_ns_offload_cmd = send_enable_arp_ns_offload_cmd_tlv, |
| 18975 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 18976 | .send_conf_hw_filter_cmd = send_conf_hw_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 18977 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 18978 | .send_process_gtk_offload_getinfo_cmd = |
| 18979 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 18980 | .send_enable_enhance_multicast_offload_cmd = |
| 18981 | send_enable_enhance_multicast_offload_tlv, |
| 18982 | .extract_gtk_rsp_event = extract_gtk_rsp_event_tlv, |
| 18983 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 18984 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
| 18985 | #endif |
| 18986 | .send_action_frame_patterns_cmd = send_action_frame_patterns_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 18987 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 18988 | .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] | 18989 | .send_lphb_config_tcp_pkt_filter_cmd = |
| 18990 | send_lphb_config_tcp_pkt_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 18991 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 18992 | .send_lphb_config_udp_pkt_filter_cmd = |
| 18993 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame] | 18994 | .send_enable_disable_packet_filter_cmd = |
| 18995 | send_enable_disable_packet_filter_cmd_tlv, |
| 18996 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 18997 | #endif /* End of WLAN_PMO_ENABLE */ |
| 18998 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 18999 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 19000 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 19001 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 19002 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 19003 | .send_roam_scan_offload_mode_cmd = |
| 19004 | send_roam_scan_offload_mode_cmd_tlv, |
| 19005 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 19006 | .send_roam_scan_offload_ap_profile_cmd = |
| 19007 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 19008 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19009 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 19010 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19011 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 19012 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 19013 | #ifdef WLAN_FEATURE_CIF_CFR |
| 19014 | .send_oem_dma_cfg_cmd = send_oem_dma_cfg_cmd_tlv, |
| 19015 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19016 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 19017 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19018 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 19019 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 19020 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 19021 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 19022 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19023 | .send_process_add_periodic_tx_ptrn_cmd = |
| 19024 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 19025 | .send_process_del_periodic_tx_ptrn_cmd = |
| 19026 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 19027 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 19028 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 19029 | .send_set_app_type2_params_in_fw_cmd = |
| 19030 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 19031 | .send_set_auto_shutdown_timer_cmd = |
| 19032 | send_set_auto_shutdown_timer_cmd_tlv, |
| 19033 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 19034 | .send_process_dhcpserver_offload_cmd = |
| 19035 | send_process_dhcpserver_offload_cmd_tlv, |
| 19036 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 19037 | .send_process_ch_avoid_update_cmd = |
| 19038 | send_process_ch_avoid_update_cmd_tlv, |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 19039 | .send_pdev_set_regdomain_cmd = |
| 19040 | send_pdev_set_regdomain_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19041 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 19042 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 19043 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 19044 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 19045 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 19046 | .send_process_set_ie_info_cmd = send_process_set_ie_info_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 19047 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19048 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 19049 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19050 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19051 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19052 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19053 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19054 | .send_set_base_macaddr_indicate_cmd = |
| 19055 | send_set_base_macaddr_indicate_cmd_tlv, |
| 19056 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 19057 | .send_enable_specific_fw_logs_cmd = |
| 19058 | send_enable_specific_fw_logs_cmd_tlv, |
| 19059 | .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] | 19060 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 19061 | .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] | 19062 | .send_pdev_set_dual_mac_config_cmd = |
| 19063 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19064 | .send_app_type1_params_in_fw_cmd = |
| 19065 | send_app_type1_params_in_fw_cmd_tlv, |
| 19066 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 19067 | .send_process_roam_synch_complete_cmd = |
| 19068 | send_process_roam_synch_complete_cmd_tlv, |
| 19069 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 19070 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 19071 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19072 | .send_roam_scan_offload_scan_period_cmd = |
| 19073 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 19074 | .send_roam_scan_offload_chan_list_cmd = |
| 19075 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 19076 | .send_roam_scan_offload_rssi_change_cmd = |
| 19077 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 19078 | .send_get_buf_extscan_hotlist_cmd = |
| 19079 | send_get_buf_extscan_hotlist_cmd_tlv, |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 19080 | .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] | 19081 | .send_adapt_dwelltime_params_cmd = |
| 19082 | send_adapt_dwelltime_params_cmd_tlv, |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 19083 | .send_dbs_scan_sel_params_cmd = |
| 19084 | send_dbs_scan_sel_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19085 | .init_cmd_send = init_cmd_send_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 19086 | .send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv, |
| 19087 | .send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv, |
| 19088 | .send_set_ctl_table_cmd = send_set_ctl_table_cmd_tlv, |
| 19089 | .send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv, |
| 19090 | .send_packet_power_info_get_cmd = send_packet_power_info_get_cmd_tlv, |
| 19091 | .send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv, |
| 19092 | .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, |
| 19093 | .send_vdev_set_neighbour_rx_cmd = send_vdev_set_neighbour_rx_cmd_tlv, |
| 19094 | .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] | 19095 | .send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv, |
| 19096 | .send_smart_ant_set_training_info_cmd = |
| 19097 | send_smart_ant_set_training_info_cmd_tlv, |
| 19098 | .send_smart_ant_set_node_config_cmd = |
| 19099 | send_smart_ant_set_node_config_cmd_tlv, |
| 19100 | .send_set_atf_cmd = send_set_atf_cmd_tlv, |
| 19101 | .send_vdev_set_fwtest_param_cmd = send_vdev_set_fwtest_param_cmd_tlv, |
| 19102 | .send_set_qboost_param_cmd = send_set_qboost_param_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 19103 | .send_gpio_config_cmd = send_gpio_config_cmd_tlv, |
| 19104 | .send_gpio_output_cmd = send_gpio_output_cmd_tlv, |
| 19105 | .send_phyerr_disable_cmd = send_phyerr_disable_cmd_tlv, |
| 19106 | .send_phyerr_enable_cmd = send_phyerr_enable_cmd_tlv, |
| 19107 | .send_nf_dbr_dbm_info_get_cmd = send_nf_dbr_dbm_info_get_cmd_tlv, |
| 19108 | .send_set_ht_ie_cmd = send_set_ht_ie_cmd_tlv, |
| 19109 | .send_set_vht_ie_cmd = send_set_vht_ie_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 19110 | .send_set_quiet_mode_cmd = send_set_quiet_mode_cmd_tlv, |
| 19111 | .send_set_bwf_cmd = send_set_bwf_cmd_tlv, |
| 19112 | .send_mcast_group_update_cmd = send_mcast_group_update_cmd_tlv, |
| 19113 | .send_vdev_spectral_configure_cmd = |
| 19114 | send_vdev_spectral_configure_cmd_tlv, |
| 19115 | .send_vdev_spectral_enable_cmd = |
| 19116 | send_vdev_spectral_enable_cmd_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 19117 | .send_thermal_mitigation_param_cmd = |
| 19118 | send_thermal_mitigation_param_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 19119 | .send_pdev_qvit_cmd = send_pdev_qvit_cmd_tlv, |
| 19120 | .send_wmm_update_cmd = send_wmm_update_cmd_tlv, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 19121 | .send_process_update_edca_param_cmd = |
| 19122 | send_process_update_edca_param_cmd_tlv, |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 19123 | .send_coex_config_cmd = send_coex_config_cmd_tlv, |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 19124 | .send_set_country_cmd = send_set_country_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19125 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 19126 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 19127 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 19128 | .save_service_bitmap = save_service_bitmap_tlv, |
| 19129 | .is_service_enabled = is_service_enabled_tlv, |
| 19130 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 19131 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 19132 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 19133 | .ready_extract_mac_addr_list = ready_extract_mac_addr_list_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19134 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 19135 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 19136 | .extract_tbttoffset_update_params = |
| 19137 | extract_tbttoffset_update_params_tlv, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19138 | .extract_ext_tbttoffset_update_params = |
| 19139 | extract_ext_tbttoffset_update_params_tlv, |
| 19140 | .extract_tbttoffset_num_vdevs = |
| 19141 | extract_tbttoffset_num_vdevs_tlv, |
| 19142 | .extract_ext_tbttoffset_num_vdevs = |
| 19143 | extract_ext_tbttoffset_num_vdevs_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19144 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 19145 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 19146 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 19147 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 19148 | #ifdef CONVERGED_TDLS_ENABLE |
| 19149 | .extract_vdev_tdls_ev_param = extract_vdev_tdls_ev_param_tlv, |
| 19150 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19151 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19152 | .extract_swba_num_vdevs = extract_swba_num_vdevs_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19153 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 19154 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 19155 | #ifdef CONVERGED_P2P_ENABLE |
| 19156 | .extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv, |
| 19157 | .extract_p2p_lo_stop_ev_param = |
| 19158 | extract_p2p_lo_stop_ev_param_tlv, |
| 19159 | #endif |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19160 | .extract_offchan_data_tx_compl_param = |
| 19161 | extract_offchan_data_tx_compl_param_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19162 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 19163 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 19164 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 19165 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 19166 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 19167 | .extract_peer_stats = extract_peer_stats_tlv, |
| 19168 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 19169 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 19170 | .extract_chan_stats = extract_chan_stats_tlv, |
| 19171 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 19172 | .extract_profile_data = extract_profile_data_tlv, |
| 19173 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 19174 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 19175 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 19176 | .send_encrypt_decrypt_send_cmd = |
| 19177 | send_encrypt_decrypt_send_cmd_tlv, |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 19178 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 19179 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 19180 | .send_multiple_vdev_restart_req_cmd = |
| 19181 | send_multiple_vdev_restart_req_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19182 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 19183 | .extract_hw_mode_cap_service_ready_ext = |
| 19184 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 19185 | .extract_mac_phy_cap_service_ready_ext = |
| 19186 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 19187 | .extract_reg_cap_service_ready_ext = |
| 19188 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 19189 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 19190 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 19191 | .extract_dcs_interference_type = extract_dcs_interference_type_tlv, |
| 19192 | .extract_dcs_cw_int = extract_dcs_cw_int_tlv, |
| 19193 | .extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 19194 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 19195 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 19196 | .extract_peer_delete_response_event = |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19197 | extract_peer_delete_response_event_tlv, |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 19198 | .is_management_record = is_management_record_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 19199 | .extract_pdev_csa_switch_count_status = |
| 19200 | extract_pdev_csa_switch_count_status_tlv, |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 19201 | .extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv, |
| 19202 | .extract_wds_addr_event = extract_wds_addr_event_tlv, |
| 19203 | .extract_peer_sta_ps_statechange_ev = |
| 19204 | extract_peer_sta_ps_statechange_ev_tlv, |
| 19205 | .extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv, |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 19206 | .send_per_roam_config_cmd = send_per_roam_config_cmd_tlv, |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 19207 | .send_dfs_phyerr_offload_en_cmd = send_dfs_phyerr_offload_en_cmd_tlv, |
| 19208 | .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] | 19209 | .extract_reg_chan_list_update_event = |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 19210 | extract_reg_chan_list_update_event_tlv, |
| 19211 | .extract_chainmask_tables = |
| 19212 | extract_chainmask_tables_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 19213 | .extract_thermal_stats = extract_thermal_stats_tlv, |
| 19214 | .extract_thermal_level_stats = extract_thermal_level_stats_tlv, |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19215 | #ifdef DFS_COMPONENT_ENABLE |
| 19216 | .extract_dfs_cac_complete_event = extract_dfs_cac_complete_event_tlv, |
| 19217 | .extract_dfs_radar_detection_event = |
| 19218 | extract_dfs_radar_detection_event_tlv, |
| 19219 | #endif |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 19220 | .convert_pdev_id_host_to_target = |
| 19221 | convert_host_pdev_id_to_target_pdev_id_legacy, |
| 19222 | .convert_pdev_id_target_to_host = |
| 19223 | convert_target_pdev_id_to_host_pdev_id_legacy, |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 19224 | |
| 19225 | .send_start_11d_scan_cmd = send_start_11d_scan_cmd_tlv, |
| 19226 | .send_stop_11d_scan_cmd = send_stop_11d_scan_cmd_tlv, |
| 19227 | .extract_reg_11d_new_country_event = |
| 19228 | extract_reg_11d_new_country_event_tlv, |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 19229 | .send_user_country_code_cmd = send_user_country_code_cmd_tlv, |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 19230 | .send_limit_off_chan_cmd = |
| 19231 | send_limit_off_chan_cmd_tlv, |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 19232 | .extract_reg_ch_avoid_event = |
| 19233 | extract_reg_ch_avoid_event_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19234 | }; |
| 19235 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19236 | /** |
| 19237 | * populate_tlv_event_id() - populates wmi event ids |
| 19238 | * |
| 19239 | * @param event_ids: Pointer to hold event ids |
| 19240 | * Return: None |
| 19241 | */ |
| 19242 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 19243 | { |
| 19244 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 19245 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 19246 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 19247 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 19248 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 19249 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 19250 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 19251 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 19252 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 19253 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 19254 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 19255 | event_ids[wmi_service_ready_ext_event_id] = |
| 19256 | WMI_SERVICE_READY_EXT_EVENTID; |
| 19257 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 19258 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 19259 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 19260 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 19261 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 19262 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 19263 | |
| 19264 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 19265 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 19266 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 19267 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 19268 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 19269 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 19270 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 19271 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 19272 | event_ids[wmi_peer_delete_response_event_id] = |
| 19273 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19274 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 19275 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 19276 | event_ids[wmi_tbttoffset_update_event_id] = |
| 19277 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19278 | event_ids[wmi_ext_tbttoffset_update_event_id] = |
| 19279 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19280 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 19281 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 19282 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 19283 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 19284 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 19285 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 19286 | |
| 19287 | event_ids[wmi_tx_delba_complete_event_id] = |
| 19288 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 19289 | event_ids[wmi_tx_addba_complete_event_id] = |
| 19290 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 19291 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 19292 | |
| 19293 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 19294 | |
| 19295 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 19296 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 19297 | |
| 19298 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 19299 | |
| 19300 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 19301 | |
| 19302 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
Wu Gao | 84ed340 | 2017-03-15 19:12:20 +0800 | [diff] [blame] | 19303 | event_ids[wmi_p2p_lo_stop_event_id] = |
| 19304 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19305 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 19306 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 19307 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 19308 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 19309 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 19310 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 19311 | |
| 19312 | event_ids[wmi_rtt_meas_report_event_id] = |
| 19313 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 19314 | event_ids[wmi_tsf_meas_report_event_id] = |
| 19315 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 19316 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 19317 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 19318 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 19319 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 19320 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 19321 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 19322 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 19323 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 19324 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 19325 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 19326 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 19327 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 19328 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 19329 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 19330 | |
| 19331 | event_ids[wmi_gtk_offload_status_event_id] = |
| 19332 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 19333 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 19334 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 19335 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 19336 | |
| 19337 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 19338 | |
| 19339 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 19340 | |
| 19341 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 19342 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 19343 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 19344 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 19345 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 19346 | event_ids[wmi_wlan_profile_data_event_id] = |
| 19347 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 19348 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 19349 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 19350 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 19351 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 19352 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 19353 | |
| 19354 | event_ids[wmi_diag_container_event_id] = |
| 19355 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 19356 | |
| 19357 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 19358 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 19359 | |
| 19360 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 19361 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 19362 | |
| 19363 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 19364 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 19365 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 19366 | |
| 19367 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 19368 | |
| 19369 | /** Set OCB Sched Response, deprecated */ |
| 19370 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 19371 | |
| 19372 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 19373 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 19374 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 19375 | |
| 19376 | /* GPIO Event */ |
| 19377 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 19378 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 19379 | |
| 19380 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 19381 | event_ids[wmi_rfkill_state_change_event_id] = |
| 19382 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 19383 | |
| 19384 | /* TDLS Event */ |
| 19385 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 19386 | |
| 19387 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 19388 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 19389 | event_ids[wmi_batch_scan_result_event_id] = |
| 19390 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 19391 | /* OEM Event */ |
| 19392 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 19393 | event_ids[wmi_oem_meas_report_event_id] = |
| 19394 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 19395 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 19396 | |
| 19397 | /* NAN Event */ |
| 19398 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 19399 | |
| 19400 | /* LPI Event */ |
| 19401 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 19402 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 19403 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 19404 | |
| 19405 | /* ExtScan events */ |
| 19406 | event_ids[wmi_extscan_start_stop_event_id] = |
| 19407 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 19408 | event_ids[wmi_extscan_operation_event_id] = |
| 19409 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 19410 | event_ids[wmi_extscan_table_usage_event_id] = |
| 19411 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 19412 | event_ids[wmi_extscan_cached_results_event_id] = |
| 19413 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 19414 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 19415 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 19416 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 19417 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 19418 | event_ids[wmi_extscan_capabilities_event_id] = |
| 19419 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 19420 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 19421 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 19422 | |
| 19423 | /* mDNS offload events */ |
| 19424 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 19425 | |
| 19426 | /* SAP Authentication offload events */ |
| 19427 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 19428 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 19429 | |
| 19430 | /** Out-of-context-of-bss (OCB) events */ |
| 19431 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 19432 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 19433 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 19434 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 19435 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 19436 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 19437 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 19438 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 19439 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 19440 | /* System-On-Chip events */ |
| 19441 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 19442 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 19443 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 19444 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 19445 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 19446 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 19447 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 19448 | event_ids[wmi_pdev_csa_switch_count_status_event_id] = |
| 19449 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID; |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 19450 | 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] | 19451 | event_ids[wmi_inst_rssi_stats_event_id] = WMI_INST_RSSI_STATS_EVENTID; |
| 19452 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 19453 | event_ids[wmi_peer_sta_ps_statechg_event_id] = |
| 19454 | WMI_PEER_STA_PS_STATECHG_EVENTID; |
| 19455 | event_ids[wmi_pdev_channel_hopping_event_id] = |
| 19456 | WMI_PDEV_CHANNEL_HOPPING_EVENTID; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19457 | event_ids[wmi_offchan_data_tx_completion_event] = |
| 19458 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19459 | event_ids[wmi_dfs_cac_complete_id] = WMI_VDEV_DFS_CAC_COMPLETE_EVENTID; |
| 19460 | event_ids[wmi_dfs_radar_detection_event_id] = |
| 19461 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID; |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 19462 | event_ids[wmi_tt_stats_event_id] = WMI_THERM_THROT_STATS_EVENTID; |
Amar Singhal | 7db15c8 | 2017-05-19 16:39:34 -0700 | [diff] [blame] | 19463 | 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] | 19464 | event_ids[wmi_pdev_tpc_event_id] = WMI_PDEV_TPC_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19465 | } |
| 19466 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 19467 | #ifndef CONFIG_MCL |
| 19468 | /** |
| 19469 | * populate_tlv_service() - populates wmi services |
| 19470 | * |
| 19471 | * @param wmi_service: Pointer to hold wmi_service |
| 19472 | * Return: None |
| 19473 | */ |
| 19474 | static void populate_tlv_service(uint32_t *wmi_service) |
| 19475 | { |
| 19476 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
| 19477 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 19478 | wmi_service[wmi_service_roam_scan_offload] = |
| 19479 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 19480 | wmi_service[wmi_service_bcn_miss_offload] = |
| 19481 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 19482 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 19483 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 19484 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 19485 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 19486 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 19487 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 19488 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 19489 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 19490 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 19491 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 19492 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 19493 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 19494 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 19495 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 19496 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 19497 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 19498 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 19499 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 19500 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 19501 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 19502 | wmi_service[wmi_service_packet_power_save] = |
| 19503 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 19504 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 19505 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 19506 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 19507 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 19508 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 19509 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 19510 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 19511 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 19512 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 19513 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 19514 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 19515 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 19516 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 19517 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 19518 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 19519 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 19520 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 19521 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 19522 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 19523 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 19524 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 19525 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 19526 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 19527 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 19528 | wmi_service[wmi_service_lte_ant_share_support] = |
| 19529 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 19530 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 19531 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 19532 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 19533 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 19534 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 19535 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 19536 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 19537 | wmi_service[wmi_service_bcn_txrate_override] = |
| 19538 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 19539 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 19540 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 19541 | wmi_service[wmi_service_estimate_linkspeed] = |
| 19542 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 19543 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 19544 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 19545 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 19546 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 19547 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 19548 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 19549 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 19550 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 19551 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 19552 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 19553 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 19554 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 19555 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 19556 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 19557 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 19558 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 19559 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 19560 | wmi_service[wmi_service_sap_auth_offload] = |
| 19561 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 19562 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 19563 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 19564 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 19565 | wmi_service[wmi_service_ap_arpns_offload] = |
| 19566 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 19567 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 19568 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 19569 | wmi_service[wmi_service_packet_filter_offload] = |
| 19570 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 19571 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 19572 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 19573 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 19574 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 19575 | wmi_service[wmi_service_multiple_vdev_restart] = |
| 19576 | WMI_SERVICE_MULTIPLE_VDEV_RESTART; |
| 19577 | |
| 19578 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 19579 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 19580 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 19581 | WMI_SERVICE_UNAVAILABLE; |
| 19582 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 19583 | WMI_SERVICE_UNAVAILABLE; |
| 19584 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 19585 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 19586 | wmi_service[wmi_service_atf] = WMI_SERVICE_ATF; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 19587 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 19588 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 19589 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 19590 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 19591 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 19592 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 19593 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 19594 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 19595 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 19596 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 19597 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 19598 | WMI_SERVICE_UNAVAILABLE; |
| 19599 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 19600 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 19601 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 19602 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
| 19603 | wmi_service[wmi_service_4_wire_coex_support] = WMI_SERVICE_UNAVAILABLE; |
| 19604 | wmi_service[wmi_service_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
Kiran Venkatappa | 95c82a6 | 2017-05-10 14:34:17 +0530 | [diff] [blame] | 19605 | wmi_service[wmi_service_peer_assoc_conf] = WMI_SERVICE_PEER_ASSOC_CONF; |
| 19606 | wmi_service[wmi_service_egap] = WMI_SERVICE_EGAP; |
| 19607 | wmi_service[wmi_service_sta_pmf_offload] = WMI_SERVICE_STA_PMF_OFFLOAD; |
| 19608 | wmi_service[wmi_service_unified_wow_capability] = |
| 19609 | WMI_SERVICE_UNIFIED_WOW_CAPABILITY; |
| 19610 | wmi_service[wmi_service_enterprise_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
| 19611 | wmi_service[wmi_service_bpf_offload] = WMI_SERVICE_BPF_OFFLOAD; |
| 19612 | wmi_service[wmi_service_sync_delete_cmds] = |
| 19613 | WMI_SERVICE_SYNC_DELETE_CMDS; |
| 19614 | wmi_service[wmi_service_ratectrl_limit_max_min_rates] = |
| 19615 | WMI_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES; |
| 19616 | wmi_service[wmi_service_nan_data] = WMI_SERVICE_NAN_DATA; |
| 19617 | wmi_service[wmi_service_nan_rtt] = WMI_SERVICE_NAN_RTT; |
| 19618 | wmi_service[wmi_service_11ax] = WMI_SERVICE_11AX; |
| 19619 | wmi_service[wmi_service_deprecated_replace] = |
| 19620 | WMI_SERVICE_DEPRECATED_REPLACE; |
| 19621 | wmi_service[wmi_service_tdls_conn_tracker_in_host_mode] = |
| 19622 | WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE; |
| 19623 | wmi_service[wmi_service_enhanced_mcast_filter] = |
| 19624 | WMI_SERVICE_ENHANCED_MCAST_FILTER; |
| 19625 | wmi_service[wmi_service_half_rate_quarter_rate_support] = |
| 19626 | WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT; |
| 19627 | wmi_service[wmi_service_vdev_rx_filter] = WMI_SERVICE_VDEV_RX_FILTER; |
| 19628 | wmi_service[wmi_service_p2p_listen_offload_support] = |
| 19629 | WMI_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT; |
| 19630 | wmi_service[wmi_service_mark_first_wakeup_packet] = |
| 19631 | WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET; |
| 19632 | wmi_service[wmi_service_multiple_mcast_filter_set] = |
| 19633 | WMI_SERVICE_MULTIPLE_MCAST_FILTER_SET; |
| 19634 | wmi_service[wmi_service_host_managed_rx_reorder] = |
| 19635 | WMI_SERVICE_HOST_MANAGED_RX_REORDER; |
| 19636 | wmi_service[wmi_service_flash_rdwr_support] = |
| 19637 | WMI_SERVICE_FLASH_RDWR_SUPPORT; |
| 19638 | wmi_service[wmi_service_wlan_stats_report] = |
| 19639 | WMI_SERVICE_WLAN_STATS_REPORT; |
| 19640 | wmi_service[wmi_service_tx_msdu_id_new_partition_support] = |
| 19641 | WMI_SERVICE_TX_MSDU_ID_NEW_PARTITION_SUPPORT; |
| 19642 | wmi_service[wmi_service_dfs_phyerr_offload] = |
| 19643 | WMI_SERVICE_DFS_PHYERR_OFFLOAD; |
| 19644 | wmi_service[wmi_service_rcpi_support] = WMI_SERVICE_RCPI_SUPPORT; |
| 19645 | wmi_service[wmi_service_fw_mem_dump_support] = |
| 19646 | WMI_SERVICE_FW_MEM_DUMP_SUPPORT; |
| 19647 | wmi_service[wmi_service_peer_stats_info] = WMI_SERVICE_PEER_STATS_INFO; |
| 19648 | wmi_service[wmi_service_regulatory_db] = WMI_SERVICE_REGULATORY_DB; |
| 19649 | wmi_service[wmi_service_11d_offload] = WMI_SERVICE_11D_OFFLOAD; |
| 19650 | wmi_service[wmi_service_hw_data_filtering] = |
| 19651 | WMI_SERVICE_HW_DATA_FILTERING; |
| 19652 | wmi_service[wmi_service_pkt_routing] = WMI_SERVICE_PKT_ROUTING; |
| 19653 | 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] | 19654 | wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_CHAN_LOAD_INFO; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 19655 | wmi_service[wmi_service_extended_nss_support] = |
| 19656 | WMI_SERVICE_EXTENDED_NSS_SUPPORT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 19657 | } |
| 19658 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19659 | /** |
| 19660 | * populate_pdev_param_tlv() - populates pdev params |
| 19661 | * |
| 19662 | * @param pdev_param: Pointer to hold pdev params |
| 19663 | * Return: None |
| 19664 | */ |
| 19665 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 19666 | { |
| 19667 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 19668 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 19669 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 19670 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 19671 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 19672 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 19673 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 19674 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 19675 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 19676 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 19677 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 19678 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 19679 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 19680 | pdev_param[wmi_pdev_param_protection_mode] = |
| 19681 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 19682 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 19683 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 19684 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 19685 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 19686 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 19687 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 19688 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 19689 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 19690 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 19691 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 19692 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 19693 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 19694 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 19695 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 19696 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 19697 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 19698 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 19699 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 19700 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 19701 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 19702 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 19703 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 19704 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 19705 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 19706 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 19707 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 19708 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 19709 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 19710 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 19711 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 19712 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 19713 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 19714 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 19715 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 19716 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 19717 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 19718 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 19719 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 19720 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 19721 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 19722 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 19723 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 19724 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 19725 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 19726 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 19727 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 19728 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 19729 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 19730 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 19731 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 19732 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 19733 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 19734 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 19735 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 19736 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 19737 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 19738 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 19739 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 19740 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 19741 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 19742 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 19743 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 19744 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 19745 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 19746 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 19747 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 19748 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 19749 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 19750 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 19751 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 19752 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 19753 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 19754 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 19755 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 19756 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 19757 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 19758 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 19759 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 19760 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 19761 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 19762 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 19763 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 19764 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 19765 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 19766 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 19767 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 19768 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 19769 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 19770 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 19771 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 19772 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 19773 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 19774 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 19775 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 19776 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 19777 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 19778 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 19779 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 19780 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 19781 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 19782 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 19783 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 19784 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 19785 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 19786 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 19787 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 19788 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 19789 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 19790 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 19791 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 19792 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 19793 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 19794 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 19795 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 19796 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 19797 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 19798 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19799 | pdev_param[wmi_pdev_param_rx_filter] = WMI_PDEV_PARAM_RX_FILTER; |
| 19800 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = |
| 19801 | WMI_PDEV_SET_MCAST_TO_UCAST_TID; |
Sathish Kumar | d99852a | 2017-07-08 12:32:27 +0530 | [diff] [blame] | 19802 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = |
| 19803 | WMI_PDEV_PARAM_MGMT_RETRY_LIMIT; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19804 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_PDEV_PARAM_AGGR_BURST; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19805 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19806 | WMI_PDEV_PEER_STA_PS_STATECHG_ENABLE; |
| 19807 | pdev_param[wmi_pdev_param_proxy_sta_mode] = |
| 19808 | WMI_PDEV_PARAM_PROXY_STA_MODE; |
| 19809 | pdev_param[wmi_pdev_param_mu_group_policy] = |
| 19810 | WMI_PDEV_PARAM_MU_GROUP_POLICY; |
| 19811 | pdev_param[wmi_pdev_param_noise_detection] = |
| 19812 | WMI_PDEV_PARAM_NOISE_DETECTION; |
| 19813 | pdev_param[wmi_pdev_param_noise_threshold] = |
| 19814 | WMI_PDEV_PARAM_NOISE_THRESHOLD; |
| 19815 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_PDEV_PARAM_DPD_ENABLE; |
| 19816 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = |
| 19817 | WMI_PDEV_PARAM_SET_MCAST_BCAST_ECHO; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 19818 | pdev_param[wmi_pdev_param_atf_strict_sch] = |
| 19819 | WMI_PDEV_PARAM_ATF_STRICT_SCH; |
| 19820 | pdev_param[wmi_pdev_param_atf_sched_duration] = |
| 19821 | WMI_PDEV_PARAM_ATF_SCHED_DURATION; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19822 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_PDEV_PARAM_ANT_PLZN; |
| 19823 | pdev_param[wmi_pdev_param_sensitivity_level] = |
| 19824 | WMI_PDEV_PARAM_SENSITIVITY_LEVEL; |
| 19825 | pdev_param[wmi_pdev_param_signed_txpower_2g] = |
| 19826 | WMI_PDEV_PARAM_SIGNED_TXPOWER_2G; |
| 19827 | pdev_param[wmi_pdev_param_signed_txpower_5g] = |
| 19828 | WMI_PDEV_PARAM_SIGNED_TXPOWER_5G; |
Karunakar Dasineni | 39a5ff7 | 2017-08-10 12:12:28 -0700 | [diff] [blame] | 19829 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = |
| 19830 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMSDU; |
| 19831 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = |
| 19832 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMPDU; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19833 | pdev_param[wmi_pdev_param_cca_threshold] = |
| 19834 | WMI_PDEV_PARAM_CCA_THRESHOLD; |
| 19835 | pdev_param[wmi_pdev_param_rts_fixed_rate] = |
| 19836 | WMI_PDEV_PARAM_RTS_FIXED_RATE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19837 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19838 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_PDEV_PARAM_PDEV_RESET; |
| 19839 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = |
| 19840 | WMI_PDEV_PARAM_WAPI_MBSSID_OFFSET; |
| 19841 | pdev_param[wmi_pdev_param_arp_srcaddr] = |
| 19842 | WMI_PDEV_PARAM_ARP_DBG_SRCADDR; |
| 19843 | pdev_param[wmi_pdev_param_arp_dstaddr] = |
| 19844 | WMI_PDEV_PARAM_ARP_DBG_DSTADDR; |
| 19845 | pdev_param[wmi_pdev_param_txpower_decr_db] = |
| 19846 | WMI_PDEV_PARAM_TXPOWER_DECR_DB; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19847 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 19848 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 19849 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = |
| 19850 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCH; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19851 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 19852 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCALING_FACTOR; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19853 | pdev_param[wmi_pdev_param_cust_txpower_scale] = |
| 19854 | WMI_PDEV_PARAM_CUST_TXPOWER_SCALE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 19855 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = |
| 19856 | WMI_PDEV_PARAM_ATF_DYNAMIC_ENABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19857 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 19858 | WMI_UNAVAILABLE_PARAM; |
| 19859 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 19860 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19861 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_PDEV_PARAM_ANTENNA_GAIN; |
| 19862 | pdev_param[wmi_pdev_param_block_interbss] = |
| 19863 | WMI_PDEV_PARAM_BLOCK_INTERBSS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19864 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19865 | WMI_PDEV_PARAM_SET_DISABLE_RESET_CMDID; |
| 19866 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = |
| 19867 | WMI_PDEV_PARAM_SET_MSDU_TTL_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19868 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19869 | WMI_PDEV_PARAM_TXBF_SOUND_PERIOD_CMDID; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 19870 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 19871 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 19872 | 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] | 19873 | pdev_param[wmi_pdev_param_mesh_mcast_enable] = |
| 19874 | WMI_PDEV_PARAM_MESH_MCAST_ENABLE; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 19875 | pdev_param[wmi_pdev_param_set_promisc_mode_cmdid] = |
| 19876 | WMI_PDEV_PARAM_SET_PROMISC_MODE_CMDID; |
| 19877 | pdev_param[wmi_pdev_param_set_ppdu_duration_cmdid] = |
| 19878 | WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID; |
| 19879 | pdev_param[wmi_pdev_param_igmpmld_ac_override] = |
| 19880 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
| 19881 | pdev_param[wmi_pdev_param_remove_mcast2ucast_buffer] = |
| 19882 | WMI_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER; |
| 19883 | pdev_param[wmi_pdev_param_set_mcast2ucast_buffer] = |
| 19884 | WMI_PDEV_PARAM_SET_MCAST2UCAST_BUFFER; |
| 19885 | pdev_param[wmi_pdev_param_set_mcast2ucast_mode] = |
| 19886 | WMI_PDEV_PARAM_SET_MCAST2UCAST_MODE; |
| 19887 | pdev_param[wmi_pdev_param_smart_antenna_default_antenna] = |
| 19888 | WMI_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA; |
| 19889 | pdev_param[wmi_pdev_param_fast_channel_reset] = |
| 19890 | WMI_PDEV_PARAM_FAST_CHANNEL_RESET; |
| 19891 | pdev_param[wmi_pdev_param_rx_decap_mode] = WMI_PDEV_PARAM_RX_DECAP_MODE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19892 | } |
| 19893 | |
| 19894 | /** |
| 19895 | * populate_vdev_param_tlv() - populates vdev params |
| 19896 | * |
| 19897 | * @param vdev_param: Pointer to hold vdev params |
| 19898 | * Return: None |
| 19899 | */ |
| 19900 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 19901 | { |
| 19902 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 19903 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 19904 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 19905 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 19906 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 19907 | vdev_param[wmi_vdev_param_listen_interval] = |
| 19908 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 19909 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 19910 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 19911 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 19912 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 19913 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 19914 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 19915 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 19916 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 19917 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 19918 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 19919 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 19920 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 19921 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 19922 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 19923 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 19924 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 19925 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 19926 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 19927 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 19928 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 19929 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 19930 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 19931 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 19932 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 19933 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 19934 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 19935 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 19936 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 19937 | vdev_param[wmi_vdev_param_protection_mode] = |
| 19938 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 19939 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 19940 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 19941 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 19942 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 19943 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 19944 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 19945 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 19946 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 19947 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 19948 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 19949 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 19950 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 19951 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 19952 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 19953 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 19954 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 19955 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 19956 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 19957 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 19958 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 19959 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 19960 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 19961 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 19962 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 19963 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 19964 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 19965 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 19966 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 19967 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 19968 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 19969 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 19970 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 19971 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 19972 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 19973 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 19974 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 19975 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 19976 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 19977 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 19978 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 19979 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 19980 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 19981 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 19982 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 19983 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 19984 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 19985 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 19986 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 19987 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 19988 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 19989 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 19990 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 19991 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 19992 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 19993 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 19994 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 19995 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 19996 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 19997 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 19998 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 19999 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 20000 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 20001 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 20002 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 20003 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 20004 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 20005 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 20006 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 20007 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 20008 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 20009 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 20010 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 20011 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 20012 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 20013 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 20014 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 20015 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 20016 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 20017 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 20018 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 20019 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 20020 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 20021 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 20022 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 20023 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 20024 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 20025 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 20026 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 20027 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 20028 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Kalyan Tallapragada | d9a6abd | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 20029 | 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] | 20030 | vdev_param[wmi_vdev_param_he_dcm_enable] = WMI_VDEV_PARAM_HE_DCM; |
| 20031 | vdev_param[wmi_vdev_param_he_range_ext_enable] = |
| 20032 | WMI_VDEV_PARAM_HE_RANGE_EXT; |
| 20033 | vdev_param[wmi_vdev_param_he_bss_color] = WMI_VDEV_PARAM_BSS_COLOR; |
| 20034 | vdev_param[wmi_vdev_param_set_hemu_mode] = WMI_VDEV_PARAM_SET_HEMU_MODE; |
Kiran Venkatappa | 1f9d67d | 2017-03-13 15:11:44 +0530 | [diff] [blame] | 20035 | vdev_param[wmi_vdev_param_sensor_ap] = WMI_VDEV_PARAM_SENSOR_AP; |
| 20036 | vdev_param[wmi_vdev_param_dtim_enable_cts] = |
| 20037 | WMI_VDEV_PARAM_DTIM_ENABLE_CTS; |
| 20038 | vdev_param[wmi_vdev_param_atf_ssid_sched_policy] = |
| 20039 | WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY; |
| 20040 | vdev_param[wmi_vdev_param_disable_dyn_bw_rts] = |
| 20041 | WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS; |
Sathish Kumar | 2ac4070 | 2017-03-22 19:18:45 +0530 | [diff] [blame] | 20042 | vdev_param[wmi_vdev_param_mcast2ucast_set] = |
| 20043 | WMI_VDEV_PARAM_MCAST2UCAST_SET; |
| 20044 | vdev_param[wmi_vdev_param_rc_num_retries] = |
| 20045 | WMI_VDEV_PARAM_RC_NUM_RETRIES; |
| 20046 | vdev_param[wmi_vdev_param_cabq_maxdur] = WMI_VDEV_PARAM_CABQ_MAXDUR; |
| 20047 | vdev_param[wmi_vdev_param_mfptest_set] = WMI_VDEV_PARAM_MFPTEST_SET; |
| 20048 | vdev_param[wmi_vdev_param_rts_fixed_rate] = |
| 20049 | WMI_VDEV_PARAM_RTS_FIXED_RATE; |
| 20050 | vdev_param[wmi_vdev_param_vht_sgimask] = WMI_VDEV_PARAM_VHT_SGIMASK; |
| 20051 | vdev_param[wmi_vdev_param_vht80_ratemask] = |
| 20052 | WMI_VDEV_PARAM_VHT80_RATEMASK; |
| 20053 | vdev_param[wmi_vdev_param_proxy_sta] = WMI_VDEV_PARAM_PROXY_STA; |
| 20054 | vdev_param[wmi_vdev_param_bw_nss_ratemask] = |
| 20055 | WMI_VDEV_PARAM_BW_NSS_RATEMASK; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20056 | } |
| 20057 | #endif |
| 20058 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20059 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20060 | * populate_target_defines_tlv() - Populate target defines and params |
| 20061 | * @wmi_handle: pointer to wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20062 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20063 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20064 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 20065 | #ifndef CONFIG_MCL |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20066 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20067 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20068 | populate_tlv_service(wmi_handle->services); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20069 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 20070 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 20071 | } |
| 20072 | #else |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20073 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
| 20074 | { } |
| 20075 | #endif |
| 20076 | |
| 20077 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 20078 | * convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from |
| 20079 | * host to target defines. |
| 20080 | * @param pdev_id: host pdev_id to be converted. |
| 20081 | * Return: target pdev_id after conversion. |
| 20082 | */ |
| 20083 | static uint32_t convert_host_pdev_id_to_target_pdev_id(uint32_t pdev_id) |
| 20084 | { |
| 20085 | switch (pdev_id) { |
| 20086 | case WMI_HOST_PDEV_ID_SOC: |
| 20087 | return WMI_PDEV_ID_SOC; |
| 20088 | case WMI_HOST_PDEV_ID_0: |
| 20089 | return WMI_PDEV_ID_1ST; |
| 20090 | case WMI_HOST_PDEV_ID_1: |
| 20091 | return WMI_PDEV_ID_2ND; |
| 20092 | case WMI_HOST_PDEV_ID_2: |
| 20093 | return WMI_PDEV_ID_3RD; |
| 20094 | } |
| 20095 | |
| 20096 | QDF_ASSERT(0); |
| 20097 | |
| 20098 | return WMI_PDEV_ID_SOC; |
| 20099 | } |
| 20100 | |
| 20101 | /** |
| 20102 | * convert_target_pdev_id_to_host_pdev_id() - Convert pdev_id from |
| 20103 | * target to host defines. |
| 20104 | * @param pdev_id: target pdev_id to be converted. |
| 20105 | * Return: host pdev_id after conversion. |
| 20106 | */ |
| 20107 | static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id) |
| 20108 | { |
| 20109 | switch (pdev_id) { |
| 20110 | case WMI_PDEV_ID_SOC: |
| 20111 | return WMI_HOST_PDEV_ID_SOC; |
| 20112 | case WMI_PDEV_ID_1ST: |
| 20113 | return WMI_HOST_PDEV_ID_0; |
| 20114 | case WMI_PDEV_ID_2ND: |
| 20115 | return WMI_HOST_PDEV_ID_1; |
| 20116 | case WMI_PDEV_ID_3RD: |
| 20117 | return WMI_HOST_PDEV_ID_2; |
| 20118 | } |
| 20119 | |
| 20120 | QDF_ASSERT(0); |
| 20121 | |
| 20122 | return WMI_HOST_PDEV_ID_SOC; |
| 20123 | } |
| 20124 | |
| 20125 | /** |
| 20126 | * wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion |
| 20127 | * |
| 20128 | * Return None. |
| 20129 | */ |
| 20130 | void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle) |
| 20131 | { |
| 20132 | wmi_handle->ops->convert_pdev_id_host_to_target = |
| 20133 | convert_host_pdev_id_to_target_pdev_id; |
| 20134 | wmi_handle->ops->convert_pdev_id_target_to_host = |
| 20135 | convert_target_pdev_id_to_host_pdev_id; |
| 20136 | } |
| 20137 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20138 | * wmi_tlv_attach() - Attach TLV APIs |
| 20139 | * |
| 20140 | * Return: None |
| 20141 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20142 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20143 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20144 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20145 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 20146 | wmi_handle->log_info.buf_offset_command = 2; |
| 20147 | wmi_handle->log_info.buf_offset_event = 4; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20148 | #endif |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20149 | populate_tlv_events_id(wmi_handle->wmi_events); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20150 | populate_target_defines_tlv(wmi_handle); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20151 | } |