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" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 33 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 34 | #ifdef CONVERGED_P2P_ENABLE |
| 35 | #include "wlan_p2p_public_struct.h" |
| 36 | #endif |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 37 | |
| 38 | /* copy_vdev_create_pdev_id() - copy pdev from host params to target command |
| 39 | * buffer. |
| 40 | * @cmd: pointer target vdev create command buffer |
| 41 | * @param: pointer host params for vdev create |
| 42 | * |
| 43 | * Return: None |
| 44 | */ |
| 45 | #ifdef CONFIG_MCL |
| 46 | static inline void copy_vdev_create_pdev_id( |
| 47 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 48 | struct vdev_create_params *param) |
| 49 | { |
| 50 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 51 | } |
| 52 | #else |
| 53 | static inline void copy_vdev_create_pdev_id( |
| 54 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 55 | struct vdev_create_params *param) |
| 56 | { |
| 57 | cmd->pdev_id = param->pdev_id; |
| 58 | } |
| 59 | #endif |
| 60 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 61 | /** |
| 62 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 63 | * @wmi_handle: wmi handle |
| 64 | * @param: pointer to hold vdev create parameter |
| 65 | * @macaddr: vdev mac address |
| 66 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 67 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 68 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 69 | 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] | 70 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 71 | struct vdev_create_params *param) |
| 72 | { |
| 73 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 74 | wmi_buf_t buf; |
| 75 | int32_t len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 76 | QDF_STATUS ret; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 77 | int num_bands = 2; |
| 78 | uint8_t *buf_ptr; |
| 79 | wmi_vdev_txrx_streams *txrx_streams; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 80 | |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 81 | len += (num_bands * sizeof(*txrx_streams) + WMI_TLV_HDR_SIZE); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 82 | buf = wmi_buf_alloc(wmi_handle, len); |
| 83 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 84 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 85 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 86 | } |
| 87 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 88 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 89 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 90 | WMITLV_GET_STRUCT_TLVLEN |
| 91 | (wmi_vdev_create_cmd_fixed_param)); |
| 92 | cmd->vdev_id = param->if_id; |
| 93 | cmd->vdev_type = param->type; |
| 94 | cmd->vdev_subtype = param->subtype; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 95 | cmd->num_cfg_txrx_streams = num_bands; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 96 | copy_vdev_create_pdev_id(cmd, param); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 97 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 98 | 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] | 99 | __func__, param->if_id, |
| 100 | macaddr[0], macaddr[1], macaddr[2], |
| 101 | macaddr[3], macaddr[4], macaddr[5]); |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 102 | buf_ptr = (uint8_t *)cmd + sizeof(*cmd); |
| 103 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 104 | (num_bands * sizeof(wmi_vdev_txrx_streams))); |
| 105 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 106 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 107 | 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] | 108 | param->type, param->subtype, |
| 109 | param->nss_2g, param->nss_5g); |
| 110 | txrx_streams = (wmi_vdev_txrx_streams *)buf_ptr; |
| 111 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_2G; |
| 112 | txrx_streams->supported_tx_streams = param->nss_2g; |
| 113 | txrx_streams->supported_rx_streams = param->nss_2g; |
| 114 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 115 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 116 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
| 117 | |
| 118 | txrx_streams++; |
| 119 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_5G; |
| 120 | txrx_streams->supported_tx_streams = param->nss_5g; |
| 121 | txrx_streams->supported_rx_streams = param->nss_5g; |
| 122 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 123 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 124 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 125 | 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] | 126 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 127 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 128 | wmi_buf_free(buf); |
| 129 | } |
| 130 | |
| 131 | return ret; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 136 | * @wmi_handle: wmi handle |
| 137 | * @if_id: vdev id |
| 138 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 139 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 140 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 141 | 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] | 142 | uint8_t if_id) |
| 143 | { |
| 144 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 145 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 146 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 147 | |
| 148 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 149 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 150 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 151 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 155 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 156 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 157 | WMITLV_GET_STRUCT_TLVLEN |
| 158 | (wmi_vdev_delete_cmd_fixed_param)); |
| 159 | cmd->vdev_id = if_id; |
| 160 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 161 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 162 | WMI_VDEV_DELETE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 163 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 164 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 165 | wmi_buf_free(buf); |
| 166 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 167 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 168 | |
| 169 | return ret; |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 174 | * @wmi: wmi handle |
| 175 | * @vdev_id: vdev id |
| 176 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 177 | * Return: QDF_STATUS_SUCCESS for success or erro code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 178 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 179 | static QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 180 | uint8_t vdev_id) |
| 181 | { |
| 182 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 183 | wmi_buf_t buf; |
| 184 | int32_t len = sizeof(*cmd); |
| 185 | |
| 186 | buf = wmi_buf_alloc(wmi, len); |
| 187 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 188 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 189 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 190 | } |
| 191 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 192 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 193 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 194 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 195 | cmd->vdev_id = vdev_id; |
| 196 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 197 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 198 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 199 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 200 | } |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 201 | WMI_LOGD("%s:vdev id = %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 202 | |
| 203 | return 0; |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 208 | * @wmi: wmi handle |
| 209 | * @vdev_id: vdev id |
| 210 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 211 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 212 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 213 | 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] | 214 | { |
| 215 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 216 | wmi_buf_t buf; |
| 217 | int32_t len = sizeof(*cmd); |
| 218 | |
| 219 | buf = wmi_buf_alloc(wmi, len); |
| 220 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 221 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 222 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 223 | } |
| 224 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 225 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 226 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 227 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 228 | cmd->vdev_id = vdev_id; |
| 229 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 230 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 231 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 232 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 233 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 234 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 235 | |
| 236 | return 0; |
| 237 | } |
| 238 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 239 | #ifdef CONFIG_MCL |
| 240 | static inline void copy_channel_info( |
| 241 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 242 | wmi_channel *chan, |
| 243 | struct vdev_start_params *req) |
| 244 | { |
| 245 | chan->mhz = req->chan_freq; |
| 246 | |
| 247 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 248 | |
| 249 | chan->band_center_freq1 = req->band_center_freq1; |
| 250 | chan->band_center_freq2 = req->band_center_freq2; |
| 251 | |
| 252 | if (req->is_half_rate) |
| 253 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 254 | else if (req->is_quarter_rate) |
| 255 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 256 | |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 257 | if (req->is_dfs && req->flag_dfs) { |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 258 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 259 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 260 | } |
| 261 | |
| 262 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 263 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 264 | |
| 265 | } |
| 266 | #else |
| 267 | static inline void copy_channel_info( |
| 268 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 269 | wmi_channel *chan, |
| 270 | struct vdev_start_params *req) |
| 271 | { |
| 272 | chan->mhz = req->channel.mhz; |
| 273 | |
| 274 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 275 | |
| 276 | chan->band_center_freq1 = req->channel.cfreq1; |
| 277 | chan->band_center_freq2 = req->channel.cfreq2; |
| 278 | |
| 279 | if (req->channel.half_rate) |
| 280 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 281 | else if (req->channel.quarter_rate) |
| 282 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 283 | |
| 284 | if (req->channel.dfs_set) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 285 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 286 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 287 | } |
| 288 | |
| 289 | /* FIXME: Find out min, max and regulatory power levels */ |
| 290 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
| 291 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxpower); |
| 292 | |
| 293 | } |
| 294 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 295 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 296 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 297 | * @wmi_handle: wmi handle |
| 298 | * @req: vdev start params |
| 299 | * |
| 300 | * Return: QDF status |
| 301 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 302 | 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] | 303 | struct vdev_start_params *req) |
| 304 | { |
| 305 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 306 | wmi_buf_t buf; |
| 307 | wmi_channel *chan; |
| 308 | int32_t len, ret; |
| 309 | uint8_t *buf_ptr; |
| 310 | |
| 311 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 312 | buf = wmi_buf_alloc(wmi_handle, len); |
| 313 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 314 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 315 | return QDF_STATUS_E_NOMEM; |
| 316 | } |
| 317 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 318 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 319 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 320 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 321 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 322 | WMITLV_GET_STRUCT_TLVLEN |
| 323 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 324 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 325 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 326 | cmd->vdev_id = req->vdev_id; |
| 327 | |
| 328 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 329 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 330 | |
| 331 | cmd->beacon_interval = req->beacon_intval; |
| 332 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 333 | |
| 334 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 335 | cmd->beacon_interval = req->beacon_intval; |
| 336 | cmd->dtim_period = req->dtim_period; |
| 337 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 338 | /* Copy the SSID */ |
| 339 | if (req->ssid.length) { |
| 340 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 341 | cmd->ssid.ssid_len = req->ssid.length; |
| 342 | else |
| 343 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 344 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 345 | cmd->ssid.ssid_len); |
| 346 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 347 | |
| 348 | if (req->hidden_ssid) |
| 349 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 350 | |
| 351 | if (req->pmf_enabled) |
| 352 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 353 | } |
| 354 | |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 355 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 356 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 357 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 358 | cmd->cac_duration_ms = req->cac_duration_ms; |
| 359 | cmd->regdomain = req->regdomain; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 360 | cmd->he_ops = req->he_ops; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 361 | |
| 362 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 363 | sizeof(wmi_channel)); |
| 364 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 365 | cmd->num_noa_descriptors * |
| 366 | sizeof(wmi_p2p_noa_descriptor)); |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 367 | WMI_LOGA("%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] | 368 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 369 | "reg_info_1: 0x%x reg_info_2: 0x%x, req->max_txpow: 0x%x " |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 370 | "Tx SS %d, Rx SS %d, cac %d, regd %d, HE ops: %d", |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 371 | __func__, req->vdev_id, chan->mhz, req->chan_mode, chan->info, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 372 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 373 | chan->band_center_freq1, chan->band_center_freq2, |
| 374 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 375 | req->preferred_tx_streams, req->preferred_rx_streams, |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 376 | req->cac_duration_ms, req->regdomain, req->he_ops); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 377 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 378 | if (req->is_restart) |
| 379 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 380 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 381 | else |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 382 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 383 | WMI_VDEV_START_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 384 | if (ret) { |
| 385 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 386 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 387 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 388 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 389 | |
| 390 | return QDF_STATUS_SUCCESS; |
| 391 | } |
| 392 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 393 | /** |
| 394 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 395 | * @wmi_handle: wmi handle |
| 396 | * @restart_params: vdev restart params |
| 397 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 398 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 399 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 400 | 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] | 401 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 402 | { |
| 403 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 404 | wmi_buf_t buf; |
| 405 | wmi_channel *chan; |
| 406 | int32_t len; |
| 407 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 408 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 409 | |
| 410 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 411 | buf = wmi_buf_alloc(wmi_handle, len); |
| 412 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 413 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 414 | return QDF_STATUS_E_NOMEM; |
| 415 | } |
| 416 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 417 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 418 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 419 | |
| 420 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 421 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 422 | WMITLV_GET_STRUCT_TLVLEN |
| 423 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 424 | |
| 425 | WMITLV_SET_HDR(&chan->tlv_header, |
| 426 | WMITLV_TAG_STRUC_wmi_channel, |
| 427 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 428 | |
| 429 | cmd->vdev_id = restart_params->session_id; |
| 430 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 431 | qdf_mem_copy(cmd->ssid.ssid, |
| 432 | restart_params->ssid, |
| 433 | cmd->ssid.ssid_len); |
| 434 | cmd->flags = restart_params->flags; |
| 435 | cmd->requestor_id = restart_params->requestor_id; |
| 436 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 437 | |
| 438 | chan->mhz = restart_params->mhz; |
| 439 | chan->band_center_freq1 = |
| 440 | restart_params->band_center_freq1; |
| 441 | chan->band_center_freq2 = |
| 442 | restart_params->band_center_freq2; |
| 443 | chan->info = restart_params->info; |
| 444 | chan->reg_info_1 = restart_params->reg_info_1; |
| 445 | chan->reg_info_2 = restart_params->reg_info_2; |
| 446 | |
| 447 | cmd->num_noa_descriptors = 0; |
| 448 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 449 | sizeof(wmi_channel)); |
| 450 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 451 | cmd->num_noa_descriptors * |
| 452 | sizeof(wmi_p2p_noa_descriptor)); |
| 453 | |
| 454 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 455 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 456 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 457 | wmi_buf_free(buf); |
| 458 | return QDF_STATUS_E_FAILURE; |
| 459 | } |
| 460 | return QDF_STATUS_SUCCESS; |
| 461 | } |
| 462 | |
| 463 | |
| 464 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 465 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 466 | * @wmi: wmi handle |
| 467 | * @peer_addr: peer mac address |
| 468 | * @param: pointer to hold peer flush tid parameter |
| 469 | * |
| 470 | * Return: 0 for sucess or error code |
| 471 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 472 | 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] | 473 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 474 | struct peer_flush_params *param) |
| 475 | { |
| 476 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 477 | wmi_buf_t buf; |
| 478 | int32_t len = sizeof(*cmd); |
| 479 | |
| 480 | buf = wmi_buf_alloc(wmi, len); |
| 481 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 482 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 483 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 484 | } |
| 485 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 486 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 487 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 488 | WMITLV_GET_STRUCT_TLVLEN |
| 489 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 490 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 491 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 492 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 493 | 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] | 494 | peer_addr, param->vdev_id, |
| 495 | param->peer_tid_bitmap); |
| 496 | 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] | 497 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 498 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 499 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | return 0; |
| 503 | } |
| 504 | |
| 505 | /** |
| 506 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 507 | * @wmi: wmi handle |
| 508 | * @peer_addr: peer mac addr |
| 509 | * @vdev_id: vdev id |
| 510 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 511 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 512 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 513 | static QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 514 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 515 | uint8_t vdev_id) |
| 516 | { |
| 517 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 518 | wmi_buf_t buf; |
| 519 | int32_t len = sizeof(*cmd); |
| 520 | buf = wmi_buf_alloc(wmi, len); |
| 521 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 522 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 523 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 524 | } |
| 525 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 526 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 527 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 528 | WMITLV_GET_STRUCT_TLVLEN |
| 529 | (wmi_peer_delete_cmd_fixed_param)); |
| 530 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 531 | cmd->vdev_id = vdev_id; |
| 532 | |
Orhan K AKYILDIZ | c8d1c4b | 2017-01-10 14:32:18 -0800 | [diff] [blame] | 533 | 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] | 534 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 535 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 536 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 537 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 538 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 539 | |
| 540 | return 0; |
| 541 | } |
| 542 | |
| 543 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 544 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 545 | * to target id. |
| 546 | * @targ_paramid: Target parameter id to hold the result. |
| 547 | * @peer_param_id: host param id. |
| 548 | * |
| 549 | * Return: QDF_STATUS_SUCCESS for success |
| 550 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
| 551 | */ |
| 552 | #ifdef CONFIG_MCL |
| 553 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 554 | uint32_t *targ_paramid, |
| 555 | uint32_t peer_param_id) |
| 556 | { |
| 557 | *targ_paramid = peer_param_id; |
| 558 | return QDF_STATUS_SUCCESS; |
| 559 | } |
| 560 | #else |
| 561 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 562 | uint32_t *targ_paramid, |
| 563 | uint32_t peer_param_id) |
| 564 | { |
| 565 | switch (peer_param_id) { |
| 566 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 567 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 568 | break; |
| 569 | case WMI_HOST_PEER_AMPDU: |
| 570 | *targ_paramid = WMI_PEER_AMPDU; |
| 571 | break; |
| 572 | case WMI_HOST_PEER_AUTHORIZE: |
| 573 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 574 | break; |
| 575 | case WMI_HOST_PEER_CHWIDTH: |
| 576 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 577 | break; |
| 578 | case WMI_HOST_PEER_NSS: |
| 579 | *targ_paramid = WMI_PEER_NSS; |
| 580 | break; |
| 581 | case WMI_HOST_PEER_USE_4ADDR: |
| 582 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 583 | break; |
| 584 | case WMI_HOST_PEER_MEMBERSHIP: |
| 585 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 586 | break; |
| 587 | case WMI_HOST_PEER_USERPOS: |
| 588 | *targ_paramid = WMI_PEER_USERPOS; |
| 589 | break; |
| 590 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 591 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 592 | break; |
| 593 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 594 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 595 | break; |
| 596 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 597 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 598 | break; |
| 599 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 600 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 601 | break; |
| 602 | case WMI_HOST_PEER_PHYMODE: |
| 603 | *targ_paramid = WMI_PEER_PHYMODE; |
| 604 | break; |
| 605 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 606 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 607 | break; |
| 608 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 609 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 610 | break; |
| 611 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 612 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 613 | break; |
| 614 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 615 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 616 | break; |
| 617 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 618 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 619 | break; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 620 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 621 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 622 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 623 | default: |
| 624 | return QDF_STATUS_E_NOSUPPORT; |
| 625 | } |
| 626 | |
| 627 | return QDF_STATUS_SUCCESS; |
| 628 | } |
| 629 | #endif |
| 630 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 631 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 632 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 633 | * @peer_addr: peer mac address |
| 634 | * @param : pointer to hold peer set parameter |
| 635 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 636 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 637 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 638 | static QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 639 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 640 | struct peer_set_params *param) |
| 641 | { |
| 642 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 643 | wmi_buf_t buf; |
| 644 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 645 | uint32_t param_id; |
| 646 | |
| 647 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 648 | param->param_id) != QDF_STATUS_SUCCESS) |
| 649 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 650 | |
| 651 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 652 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 653 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 654 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 655 | } |
| 656 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 657 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 658 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 659 | WMITLV_GET_STRUCT_TLVLEN |
| 660 | (wmi_peer_set_param_cmd_fixed_param)); |
| 661 | cmd->vdev_id = param->vdev_id; |
| 662 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 663 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 664 | cmd->param_value = param->param_value; |
| 665 | err = wmi_unified_cmd_send(wmi, buf, |
| 666 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 667 | WMI_PEER_SET_PARAM_CMDID); |
| 668 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 669 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 670 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 671 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 672 | } |
| 673 | |
| 674 | return 0; |
| 675 | } |
| 676 | |
| 677 | /** |
| 678 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 679 | * @wmi: wmi handle |
| 680 | * @bssid: bssid |
| 681 | * @vdev_up_params: pointer to hold vdev up parameter |
| 682 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 683 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 684 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 685 | static QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 686 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 687 | struct vdev_up_params *params) |
| 688 | { |
| 689 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 690 | wmi_buf_t buf; |
| 691 | int32_t len = sizeof(*cmd); |
| 692 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 693 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 694 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 695 | params->vdev_id, params->assoc_id, bssid); |
| 696 | buf = wmi_buf_alloc(wmi, len); |
| 697 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 698 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 699 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 700 | } |
| 701 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 702 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 703 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 704 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 705 | cmd->vdev_id = params->vdev_id; |
| 706 | cmd->vdev_assoc_id = params->assoc_id; |
| 707 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 708 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 709 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 710 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 711 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 712 | } |
| 713 | |
| 714 | return 0; |
| 715 | } |
| 716 | |
| 717 | /** |
| 718 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 719 | * @wmi: wmi handle |
| 720 | * @peer_addr: peer mac address |
| 721 | * @peer_type: peer type |
| 722 | * @vdev_id: vdev id |
| 723 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 724 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 725 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 726 | static QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 727 | struct peer_create_params *param) |
| 728 | { |
| 729 | wmi_peer_create_cmd_fixed_param *cmd; |
| 730 | wmi_buf_t buf; |
| 731 | int32_t len = sizeof(*cmd); |
| 732 | |
| 733 | buf = wmi_buf_alloc(wmi, len); |
| 734 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 735 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 736 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 737 | } |
| 738 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 739 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 740 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 741 | WMITLV_GET_STRUCT_TLVLEN |
| 742 | (wmi_peer_create_cmd_fixed_param)); |
| 743 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 744 | cmd->peer_type = param->peer_type; |
| 745 | cmd->vdev_id = param->vdev_id; |
| 746 | |
| 747 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 748 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 749 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 750 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 751 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 752 | 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] | 753 | param->vdev_id); |
| 754 | |
| 755 | return 0; |
| 756 | } |
| 757 | |
| 758 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 759 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 760 | * command to fw |
| 761 | * @wmi: wmi handle |
| 762 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 763 | * |
| 764 | * Return: 0 for success or error code |
| 765 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 766 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 767 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 768 | struct rx_reorder_queue_setup_params *param) |
| 769 | { |
| 770 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 771 | wmi_buf_t buf; |
| 772 | int32_t len = sizeof(*cmd); |
| 773 | |
| 774 | buf = wmi_buf_alloc(wmi, len); |
| 775 | if (!buf) { |
| 776 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 777 | return QDF_STATUS_E_NOMEM; |
| 778 | } |
| 779 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 780 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 781 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 782 | WMITLV_GET_STRUCT_TLVLEN |
| 783 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 784 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 785 | cmd->vdev_id = param->vdev_id; |
| 786 | cmd->tid = param->tid; |
| 787 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 788 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 789 | cmd->queue_no = param->queue_no; |
| 790 | |
| 791 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 792 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 793 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 794 | __func__); |
| 795 | qdf_nbuf_free(buf); |
| 796 | return QDF_STATUS_E_FAILURE; |
| 797 | } |
| 798 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 799 | param->peer_macaddr, param->vdev_id, param->tid); |
| 800 | |
| 801 | return QDF_STATUS_SUCCESS; |
| 802 | } |
| 803 | |
| 804 | /** |
| 805 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 806 | * command to fw |
| 807 | * @wmi: wmi handle |
| 808 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 809 | * |
| 810 | * Return: 0 for success or error code |
| 811 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 812 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 813 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 814 | struct rx_reorder_queue_remove_params *param) |
| 815 | { |
| 816 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 817 | wmi_buf_t buf; |
| 818 | int32_t len = sizeof(*cmd); |
| 819 | |
| 820 | buf = wmi_buf_alloc(wmi, len); |
| 821 | if (!buf) { |
| 822 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 823 | return QDF_STATUS_E_NOMEM; |
| 824 | } |
| 825 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 826 | wmi_buf_data(buf); |
| 827 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 828 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 829 | WMITLV_GET_STRUCT_TLVLEN |
| 830 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 831 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 832 | cmd->vdev_id = param->vdev_id; |
| 833 | cmd->tid_mask = param->peer_tid_bitmap; |
| 834 | |
| 835 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 836 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 837 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 838 | __func__); |
| 839 | qdf_nbuf_free(buf); |
| 840 | return QDF_STATUS_E_FAILURE; |
| 841 | } |
| 842 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 843 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 844 | |
| 845 | return QDF_STATUS_SUCCESS; |
| 846 | } |
| 847 | |
| 848 | /** |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 849 | * send_peer_add_wds_entry_cmd_tlv() - send peer add command to fw |
| 850 | * @wmi_handle: wmi handle |
| 851 | * @param: pointer holding peer details |
| 852 | * |
| 853 | * Return: 0 for success or error code |
| 854 | */ |
| 855 | static QDF_STATUS send_peer_add_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 856 | struct peer_add_wds_entry_params *param) |
| 857 | { |
| 858 | wmi_peer_add_wds_entry_cmd_fixed_param *cmd; |
| 859 | wmi_buf_t buf; |
| 860 | int len = sizeof(*cmd); |
| 861 | |
| 862 | buf = wmi_buf_alloc(wmi_handle, len); |
| 863 | if (!buf) { |
| 864 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 865 | return QDF_STATUS_E_FAILURE; |
| 866 | } |
| 867 | cmd = (wmi_peer_add_wds_entry_cmd_fixed_param *) wmi_buf_data(buf); |
| 868 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 869 | WMITLV_TAG_STRUC_wmi_peer_add_wds_entry_cmd_fixed_param, |
| 870 | WMITLV_GET_STRUCT_TLVLEN |
| 871 | (wmi_peer_add_wds_entry_cmd_fixed_param)); |
| 872 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 873 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 874 | cmd->flags = param->flags; |
| 875 | |
| 876 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 877 | WMI_PEER_ADD_WDS_ENTRY_CMDID); |
| 878 | } |
| 879 | |
| 880 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 881 | * 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] | 882 | * @wmi_handle: wmi handle |
| 883 | * @param: pointer holding peer details |
| 884 | * |
| 885 | * Return: 0 for success or error code |
| 886 | */ |
| 887 | static QDF_STATUS send_peer_del_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 888 | struct peer_del_wds_entry_params *param) |
| 889 | { |
| 890 | wmi_peer_remove_wds_entry_cmd_fixed_param *cmd; |
| 891 | wmi_buf_t buf; |
| 892 | int len = sizeof(*cmd); |
| 893 | |
| 894 | buf = wmi_buf_alloc(wmi_handle, len); |
| 895 | if (!buf) { |
| 896 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 897 | return QDF_STATUS_E_NOMEM; |
| 898 | } |
| 899 | cmd = (wmi_peer_remove_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 900 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 901 | WMITLV_TAG_STRUC_wmi_peer_remove_wds_entry_cmd_fixed_param, |
| 902 | WMITLV_GET_STRUCT_TLVLEN |
| 903 | (wmi_peer_remove_wds_entry_cmd_fixed_param)); |
| 904 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 905 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 906 | WMI_PEER_REMOVE_WDS_ENTRY_CMDID); |
| 907 | } |
| 908 | |
| 909 | /** |
| 910 | * send_peer_update_wds_entry_cmd_non_tlv() - send peer update command to fw |
| 911 | * @wmi_handle: wmi handle |
| 912 | * @param: pointer holding peer details |
| 913 | * |
| 914 | * Return: 0 for success or error code |
| 915 | */ |
| 916 | static QDF_STATUS send_peer_update_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 917 | struct peer_update_wds_entry_params *param) |
| 918 | { |
| 919 | wmi_peer_update_wds_entry_cmd_fixed_param *cmd; |
| 920 | wmi_buf_t buf; |
| 921 | int len = sizeof(*cmd); |
| 922 | |
| 923 | buf = wmi_buf_alloc(wmi_handle, len); |
| 924 | if (!buf) { |
| 925 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 926 | return QDF_STATUS_E_NOMEM; |
| 927 | } |
| 928 | |
| 929 | /* wmi_buf_alloc returns zeroed command buffer */ |
| 930 | cmd = (wmi_peer_update_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 931 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 932 | WMITLV_TAG_STRUC_wmi_peer_update_wds_entry_cmd_fixed_param, |
| 933 | WMITLV_GET_STRUCT_TLVLEN |
| 934 | (wmi_peer_update_wds_entry_cmd_fixed_param)); |
| 935 | cmd->flags = (param->flags) ? WMI_WDS_FLAG_STATIC : 0; |
| 936 | if (param->wds_macaddr) |
| 937 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->wds_macaddr, |
| 938 | &cmd->wds_macaddr); |
| 939 | if (param->peer_macaddr) |
| 940 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, |
| 941 | &cmd->peer_macaddr); |
| 942 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 943 | WMI_PEER_UPDATE_WDS_ENTRY_CMDID); |
| 944 | } |
| 945 | |
| 946 | |
| 947 | |
| 948 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 949 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 950 | * @wmi_handle: wmi handle |
| 951 | * @value: value |
| 952 | * @mac_id: mac id to have radio context |
| 953 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 954 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 955 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 956 | 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] | 957 | uint32_t value, uint8_t mac_id) |
| 958 | { |
| 959 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 960 | wmi_buf_t buf; |
| 961 | int32_t len = sizeof(*cmd); |
| 962 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 963 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 964 | |
| 965 | buf = wmi_buf_alloc(wmi_handle, len); |
| 966 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 967 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 968 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 969 | } |
| 970 | |
| 971 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 972 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 973 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 974 | WMITLV_GET_STRUCT_TLVLEN |
| 975 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Kiran Venkatappa | 72da3b0 | 2017-03-28 22:45:27 +0530 | [diff] [blame] | 976 | cmd->pdev_id = mac_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 977 | cmd->enable = value; |
| 978 | |
| 979 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 980 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 981 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 982 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 983 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 984 | } |
| 985 | |
| 986 | return 0; |
| 987 | } |
| 988 | |
| 989 | /** |
| 990 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 991 | * @wmi_handle: wmi handle |
| 992 | * @param: pointer to pdev_utf_params |
| 993 | * @mac_id: mac id to have radio context |
| 994 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 995 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 996 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 997 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 998 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 999 | struct pdev_utf_params *param, |
| 1000 | uint8_t mac_id) |
| 1001 | { |
| 1002 | wmi_buf_t buf; |
| 1003 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 1004 | /* if param->len is 0 no data is sent, return error */ |
| 1005 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1006 | static uint8_t msgref = 1; |
| 1007 | uint8_t segNumber = 0, segInfo, numSegments; |
| 1008 | uint16_t chunk_len, total_bytes; |
| 1009 | uint8_t *bufpos; |
| 1010 | struct seg_hdr_info segHdrInfo; |
| 1011 | |
| 1012 | bufpos = param->utf_payload; |
| 1013 | total_bytes = param->len; |
| 1014 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 1015 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 1016 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 1017 | |
| 1018 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 1019 | numSegments++; |
| 1020 | |
| 1021 | while (param->len) { |
| 1022 | if (param->len > MAX_WMI_UTF_LEN) |
| 1023 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 1024 | else |
| 1025 | chunk_len = param->len; |
| 1026 | |
| 1027 | buf = wmi_buf_alloc(wmi_handle, |
| 1028 | (chunk_len + sizeof(segHdrInfo) + |
| 1029 | WMI_TLV_HDR_SIZE)); |
| 1030 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1031 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1032 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1033 | } |
| 1034 | |
| 1035 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 1036 | |
| 1037 | segHdrInfo.len = total_bytes; |
| 1038 | segHdrInfo.msgref = msgref; |
| 1039 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 1040 | segHdrInfo.segmentInfo = segInfo; |
| 1041 | segHdrInfo.pad = 0; |
| 1042 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1043 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1044 | " segHdrInfo.segmentInfo = %d", |
| 1045 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 1046 | segHdrInfo.segmentInfo); |
| 1047 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1048 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1049 | "chunk len %d", __func__, total_bytes, segNumber, |
| 1050 | numSegments, chunk_len); |
| 1051 | |
| 1052 | segNumber++; |
| 1053 | |
| 1054 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 1055 | (chunk_len + sizeof(segHdrInfo))); |
| 1056 | cmd += WMI_TLV_HDR_SIZE; |
| 1057 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 1058 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 1059 | |
| 1060 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 1061 | (chunk_len + sizeof(segHdrInfo) + |
| 1062 | WMI_TLV_HDR_SIZE), |
| 1063 | WMI_PDEV_UTF_CMDID); |
| 1064 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1065 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1066 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1067 | wmi_buf_free(buf); |
| 1068 | break; |
| 1069 | } |
| 1070 | |
| 1071 | param->len -= chunk_len; |
| 1072 | bufpos += chunk_len; |
| 1073 | } |
| 1074 | |
| 1075 | msgref++; |
| 1076 | |
| 1077 | return ret; |
| 1078 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1079 | #ifdef CONFIG_MCL |
| 1080 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1081 | uint32_t host_param) |
| 1082 | { |
| 1083 | return host_param; |
| 1084 | } |
| 1085 | #else |
| 1086 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1087 | uint32_t host_param) |
| 1088 | { |
| 1089 | if (host_param < wmi_pdev_param_max) |
| 1090 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1091 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1092 | return WMI_UNAVAILABLE_PARAM; |
| 1093 | } |
| 1094 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1095 | /** |
| 1096 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 1097 | * @wmi_handle: wmi handle |
| 1098 | * @param: pointer to pdev parameter |
| 1099 | * @mac_id: radio context |
| 1100 | * |
| 1101 | * Return: 0 on success, errno on failure |
| 1102 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1103 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1104 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 1105 | struct pdev_params *param, |
| 1106 | uint8_t mac_id) |
| 1107 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1108 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1109 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 1110 | wmi_buf_t buf; |
| 1111 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1112 | uint32_t pdev_param; |
| 1113 | |
| 1114 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 1115 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1116 | WMI_LOGW("%s: Unavailable param %d\n", |
| 1117 | __func__, param->param_id); |
| 1118 | return QDF_STATUS_E_INVAL; |
| 1119 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1120 | |
| 1121 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1122 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1123 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1124 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1125 | } |
| 1126 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1127 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1128 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 1129 | WMITLV_GET_STRUCT_TLVLEN |
| 1130 | (wmi_pdev_set_param_cmd_fixed_param)); |
Kiran Venkatappa | 72da3b0 | 2017-03-28 22:45:27 +0530 | [diff] [blame] | 1131 | cmd->pdev_id = mac_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1132 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1133 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1134 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1135 | param->param_value); |
| 1136 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1137 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1138 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1139 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1140 | wmi_buf_free(buf); |
| 1141 | } |
| 1142 | return ret; |
| 1143 | } |
| 1144 | |
| 1145 | /** |
| 1146 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1147 | * @param wmi_handle : handle to WMI. |
| 1148 | * @param param : pointer to hold suspend parameter |
| 1149 | * @mac_id: radio context |
| 1150 | * |
| 1151 | * Return 0 on success and -ve on failure. |
| 1152 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1153 | static QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1154 | struct suspend_params *param, |
| 1155 | uint8_t mac_id) |
| 1156 | { |
| 1157 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1158 | wmi_buf_t wmibuf; |
| 1159 | uint32_t len = sizeof(*cmd); |
| 1160 | int32_t ret; |
| 1161 | |
| 1162 | /* |
| 1163 | * send the comand to Target to ignore the |
| 1164 | * PCIE reset so as to ensure that Host and target |
| 1165 | * states are in sync |
| 1166 | */ |
| 1167 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1168 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1169 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1170 | |
| 1171 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1172 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1173 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1174 | WMITLV_GET_STRUCT_TLVLEN |
| 1175 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1176 | if (param->disable_target_intr) |
| 1177 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1178 | else |
| 1179 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
| 1180 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1181 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1182 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1183 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1184 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1185 | } |
| 1186 | |
| 1187 | return ret; |
| 1188 | } |
| 1189 | |
| 1190 | /** |
| 1191 | * send_resume_cmd_tlv() - WMI resume function |
| 1192 | * @param wmi_handle : handle to WMI. |
| 1193 | * @mac_id: radio context |
| 1194 | * |
| 1195 | * Return: 0 on success and -ve on failure. |
| 1196 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1197 | static QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1198 | uint8_t mac_id) |
| 1199 | { |
| 1200 | wmi_buf_t wmibuf; |
| 1201 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1202 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1203 | |
| 1204 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1205 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1206 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1207 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1208 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1209 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1210 | WMITLV_GET_STRUCT_TLVLEN |
| 1211 | (wmi_pdev_resume_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 1212 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1213 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1214 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1215 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1216 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1217 | wmi_buf_free(wmibuf); |
| 1218 | } |
| 1219 | |
| 1220 | return ret; |
| 1221 | } |
| 1222 | |
| 1223 | /** |
| 1224 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1225 | * @param wmi_handle : handle to WMI. |
| 1226 | * @param param : pointer to hold wow enable parameter |
| 1227 | * @mac_id: radio context |
| 1228 | * |
| 1229 | * Return: 0 on success and -ve on failure. |
| 1230 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1231 | 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] | 1232 | struct wow_cmd_params *param, |
| 1233 | uint8_t mac_id) |
| 1234 | { |
| 1235 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1236 | wmi_buf_t buf; |
| 1237 | int32_t len; |
| 1238 | int32_t ret; |
| 1239 | |
| 1240 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1241 | |
| 1242 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1243 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1244 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1245 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1246 | } |
| 1247 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1248 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1249 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1250 | WMITLV_GET_STRUCT_TLVLEN |
| 1251 | (wmi_wow_enable_cmd_fixed_param)); |
| 1252 | cmd->enable = param->enable; |
| 1253 | if (param->can_suspend_link) |
| 1254 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1255 | else |
| 1256 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1257 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1258 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1259 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1260 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1261 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1262 | |
| 1263 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1264 | WMI_WOW_ENABLE_CMDID); |
| 1265 | if (ret) |
| 1266 | wmi_buf_free(buf); |
| 1267 | |
| 1268 | return ret; |
| 1269 | } |
| 1270 | |
| 1271 | /** |
| 1272 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1273 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1274 | * @peer_addr: peer mac address |
| 1275 | * @param: pointer to ap_ps parameter structure |
| 1276 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1277 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1278 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1279 | 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] | 1280 | uint8_t *peer_addr, |
| 1281 | struct ap_ps_params *param) |
| 1282 | { |
| 1283 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1284 | wmi_buf_t buf; |
| 1285 | int32_t err; |
| 1286 | |
| 1287 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1288 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1289 | 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] | 1290 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1291 | } |
| 1292 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1293 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1294 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1295 | WMITLV_GET_STRUCT_TLVLEN |
| 1296 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1297 | cmd->vdev_id = param->vdev_id; |
| 1298 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1299 | cmd->param = param->param; |
| 1300 | cmd->value = param->value; |
| 1301 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1302 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1303 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1304 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1305 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1306 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1307 | } |
| 1308 | |
| 1309 | return 0; |
| 1310 | } |
| 1311 | |
| 1312 | /** |
| 1313 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1314 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1315 | * @peer_addr: peer mac address |
| 1316 | * @param: pointer to sta_ps parameter structure |
| 1317 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1318 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1319 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1320 | 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] | 1321 | struct sta_ps_params *param) |
| 1322 | { |
| 1323 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1324 | wmi_buf_t buf; |
| 1325 | int32_t len = sizeof(*cmd); |
| 1326 | |
| 1327 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1328 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1329 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1330 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1331 | } |
| 1332 | |
| 1333 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1334 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1335 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1336 | WMITLV_GET_STRUCT_TLVLEN |
| 1337 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1338 | cmd->vdev_id = param->vdev_id; |
| 1339 | cmd->param = param->param; |
| 1340 | cmd->value = param->value; |
| 1341 | |
| 1342 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1343 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1344 | 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] | 1345 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1346 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1347 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1348 | } |
| 1349 | |
| 1350 | return 0; |
| 1351 | } |
| 1352 | |
| 1353 | /** |
| 1354 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1355 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1356 | * @param: ponirt to crash inject paramter structure |
| 1357 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1358 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1359 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1360 | 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] | 1361 | struct crash_inject *param) |
| 1362 | { |
| 1363 | int32_t ret = 0; |
| 1364 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1365 | uint16_t len = sizeof(*cmd); |
| 1366 | wmi_buf_t buf; |
| 1367 | |
| 1368 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1369 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1370 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1371 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1372 | } |
| 1373 | |
| 1374 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1375 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1376 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1377 | WMITLV_GET_STRUCT_TLVLEN |
| 1378 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1379 | cmd->type = param->type; |
| 1380 | cmd->delay_time_ms = param->delay_time_ms; |
| 1381 | |
| 1382 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1383 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1384 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1385 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1386 | __func__, ret); |
| 1387 | wmi_buf_free(buf); |
| 1388 | } |
| 1389 | |
| 1390 | return ret; |
| 1391 | } |
| 1392 | |
| 1393 | /** |
| 1394 | * send_dbglog_cmd_tlv() - set debug log level |
| 1395 | * @param wmi_handle : handle to WMI. |
| 1396 | * @param param : pointer to hold dbglog level parameter |
| 1397 | * |
| 1398 | * Return: 0 on success and -ve on failure. |
| 1399 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1400 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1401 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1402 | struct dbglog_params *dbglog_param) |
| 1403 | { |
| 1404 | wmi_buf_t buf; |
| 1405 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
| 1406 | A_STATUS status = A_OK; |
| 1407 | int32_t i; |
| 1408 | int32_t len; |
| 1409 | int8_t *buf_ptr; |
| 1410 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1411 | |
| 1412 | ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
| 1413 | |
| 1414 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1415 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1416 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1417 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1418 | if (buf == NULL) |
| 1419 | return A_NO_MEMORY; |
| 1420 | |
| 1421 | configmsg = |
| 1422 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1423 | buf_ptr = (int8_t *) configmsg; |
| 1424 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1425 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1426 | WMITLV_GET_STRUCT_TLVLEN |
| 1427 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1428 | configmsg->dbg_log_param = dbglog_param->param; |
| 1429 | configmsg->value = dbglog_param->val; |
| 1430 | /* Filling in the data part of second tlv -- should |
| 1431 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1432 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1433 | sizeof |
| 1434 | (wmi_debug_log_config_cmd_fixed_param) |
| 1435 | + WMI_TLV_HDR_SIZE); |
| 1436 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1437 | WMITLV_TAG_ARRAY_UINT32, |
| 1438 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1439 | if (dbglog_param->module_id_bitmap) { |
| 1440 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1441 | module_id_bitmap_array[i] = |
| 1442 | dbglog_param->module_id_bitmap[i]; |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1447 | len, WMI_DBGLOG_CFG_CMDID); |
| 1448 | |
| 1449 | if (status != A_OK) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1450 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1451 | |
| 1452 | return status; |
| 1453 | } |
| 1454 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1455 | #ifdef CONFIG_MCL |
| 1456 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1457 | uint32_t host_param) |
| 1458 | { |
| 1459 | return host_param; |
| 1460 | } |
| 1461 | #else |
| 1462 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1463 | uint32_t host_param) |
| 1464 | { |
| 1465 | if (host_param < wmi_vdev_param_max) |
| 1466 | return wmi_handle->vdev_param[host_param]; |
| 1467 | |
| 1468 | return WMI_UNAVAILABLE_PARAM; |
| 1469 | } |
| 1470 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1471 | /** |
| 1472 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1473 | * @param wmi_handle : handle to WMI. |
| 1474 | * @param macaddr : MAC address |
| 1475 | * @param param : pointer to hold vdev set parameter |
| 1476 | * |
| 1477 | * Return: 0 on success and -ve on failure. |
| 1478 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1479 | 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] | 1480 | struct vdev_set_params *param) |
| 1481 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1482 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1483 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1484 | wmi_buf_t buf; |
| 1485 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1486 | uint32_t vdev_param; |
| 1487 | |
| 1488 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1489 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1490 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1491 | param->param_id); |
| 1492 | return QDF_STATUS_E_INVAL; |
| 1493 | |
| 1494 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1495 | |
| 1496 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1497 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1498 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1499 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1500 | } |
| 1501 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1502 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1503 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1504 | WMITLV_GET_STRUCT_TLVLEN |
| 1505 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1506 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1507 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1508 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1509 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1510 | param->if_id, param->param_id, param->param_value); |
| 1511 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1512 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1513 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1514 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1515 | wmi_buf_free(buf); |
| 1516 | } |
| 1517 | |
| 1518 | return ret; |
| 1519 | } |
| 1520 | |
| 1521 | /** |
| 1522 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1523 | * @param wmi_handle : handle to WMI. |
| 1524 | * @param macaddr : MAC address |
| 1525 | * @param param : pointer to hold stats request parameter |
| 1526 | * |
| 1527 | * Return: 0 on success and -ve on failure. |
| 1528 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1529 | 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] | 1530 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1531 | struct stats_request_params *param) |
| 1532 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1533 | int32_t ret; |
| 1534 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1535 | wmi_buf_t buf; |
| 1536 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1537 | |
| 1538 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1539 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1540 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1541 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1542 | } |
| 1543 | |
| 1544 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1545 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1546 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1547 | WMITLV_GET_STRUCT_TLVLEN |
| 1548 | (wmi_request_stats_cmd_fixed_param)); |
| 1549 | cmd->stats_id = param->stats_id; |
| 1550 | cmd->vdev_id = param->vdev_id; |
| 1551 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1552 | WMI_REQUEST_STATS_CMDID); |
| 1553 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1554 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1555 | wmi_buf_free(buf); |
| 1556 | } |
| 1557 | |
| 1558 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1559 | } |
| 1560 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1561 | #ifdef CONFIG_WIN |
| 1562 | /** |
| 1563 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1564 | * @param wmi_handle : handle to WMI. |
| 1565 | * @param macaddr : MAC address |
| 1566 | * @param param : pointer to hold stats request parameter |
| 1567 | * |
| 1568 | * Return: 0 on success and -ve on failure. |
| 1569 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1570 | static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1571 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT) |
| 1572 | { |
| 1573 | return 0; |
| 1574 | } |
| 1575 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1576 | /** |
| 1577 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1578 | * @param wmi_handle : handle to WMI. |
| 1579 | * @param macaddr : MAC address |
| 1580 | * @param param : pointer to hold stats request parameter |
| 1581 | * |
| 1582 | * Return: 0 on success and -ve on failure. |
| 1583 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1584 | 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] | 1585 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1586 | struct packet_enable_params *param) |
| 1587 | { |
| 1588 | return 0; |
| 1589 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1590 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1591 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1592 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1593 | /** |
| 1594 | * send_beacon_send_cmd_tlv() - WMI beacon send function |
| 1595 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1596 | * @param param : pointer to hold beacon send cmd parameter |
| 1597 | * |
| 1598 | * Return: 0 on success and -ve on failure. |
| 1599 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1600 | static QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1601 | struct beacon_params *param) |
| 1602 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1603 | int32_t ret; |
| 1604 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1605 | wmi_bcn_prb_info *bcn_prb_info; |
| 1606 | wmi_buf_t wmi_buf; |
| 1607 | uint8_t *buf_ptr; |
| 1608 | uint32_t wmi_buf_len; |
| 1609 | |
| 1610 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1611 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1612 | param->tmpl_len_aligned; |
| 1613 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1614 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1615 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1616 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1617 | } |
| 1618 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1619 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1620 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1621 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1622 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1623 | cmd->vdev_id = param->vdev_id; |
| 1624 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1625 | cmd->buf_len = param->tmpl_len; |
| 1626 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1627 | |
| 1628 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1629 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1630 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1631 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1632 | bcn_prb_info->caps = 0; |
| 1633 | bcn_prb_info->erp = 0; |
| 1634 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1635 | |
| 1636 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1637 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1638 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1639 | |
| 1640 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1641 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1642 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1643 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1644 | wmi_buf_free(wmi_buf); |
| 1645 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1646 | return 0; |
| 1647 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1648 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1649 | 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] | 1650 | struct beacon_params *param) |
| 1651 | { |
| 1652 | return 0; |
| 1653 | } |
| 1654 | |
| 1655 | /** |
| 1656 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1657 | * @param wmi_handle : handle to WMI. |
| 1658 | * @param param : pointer to hold beacon send cmd parameter |
| 1659 | * |
| 1660 | * Return: 0 on success and -ve on failure. |
| 1661 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1662 | 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] | 1663 | struct beacon_tmpl_params *param) |
| 1664 | { |
| 1665 | int32_t ret; |
| 1666 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1667 | wmi_bcn_prb_info *bcn_prb_info; |
| 1668 | wmi_buf_t wmi_buf; |
| 1669 | uint8_t *buf_ptr; |
| 1670 | uint32_t wmi_buf_len; |
| 1671 | |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1672 | WMI_LOGI("%s\n", __func__); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1673 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1674 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1675 | param->tmpl_len_aligned; |
| 1676 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1677 | if (!wmi_buf) { |
| 1678 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1679 | return QDF_STATUS_E_NOMEM; |
| 1680 | } |
| 1681 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1682 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1683 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1684 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1685 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1686 | cmd->vdev_id = param->vdev_id; |
| 1687 | cmd->tim_ie_offset = param->tim_ie_offset; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1688 | cmd->csa_switch_count_offset = param->csa_switch_count_offset; |
| 1689 | cmd->ext_csa_switch_count_offset = param->ext_csa_switch_count_offset; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1690 | cmd->buf_len = param->tmpl_len; |
| 1691 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1692 | |
| 1693 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1694 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1695 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1696 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1697 | bcn_prb_info->caps = 0; |
| 1698 | bcn_prb_info->erp = 0; |
| 1699 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1700 | |
| 1701 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1702 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1703 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1704 | |
| 1705 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1706 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1707 | if (ret) { |
| 1708 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1709 | wmi_buf_free(wmi_buf); |
| 1710 | } |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1711 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1712 | return 0; |
| 1713 | } |
| 1714 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1715 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1716 | #ifdef CONFIG_MCL |
| 1717 | static inline void copy_peer_flags_tlv( |
| 1718 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1719 | struct peer_assoc_params *param) |
| 1720 | { |
| 1721 | cmd->peer_flags = param->peer_flags; |
| 1722 | } |
| 1723 | #else |
| 1724 | static inline void copy_peer_flags_tlv( |
| 1725 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1726 | struct peer_assoc_params *param) |
| 1727 | { |
| 1728 | /* |
| 1729 | * The target only needs a subset of the flags maintained in the host. |
| 1730 | * Just populate those flags and send it down |
| 1731 | */ |
| 1732 | cmd->peer_flags = 0; |
| 1733 | |
| 1734 | /* |
| 1735 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1736 | */ |
| 1737 | if (param->is_wme_set) { |
| 1738 | |
| 1739 | if (param->qos_flag) |
| 1740 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1741 | if (param->apsd_flag) |
| 1742 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1743 | if (param->ht_flag) |
| 1744 | cmd->peer_flags |= WMI_PEER_HT; |
| 1745 | if (param->bw_40) |
| 1746 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1747 | if (param->bw_80) |
| 1748 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1749 | if (param->bw_160) |
| 1750 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1751 | |
| 1752 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1753 | * for HT as well |
| 1754 | **/ |
| 1755 | if (param->stbc_flag) |
| 1756 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1757 | |
| 1758 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1759 | * for HT as well |
| 1760 | **/ |
| 1761 | if (param->ldpc_flag) |
| 1762 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1763 | |
| 1764 | if (param->static_mimops_flag) |
| 1765 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1766 | if (param->dynamic_mimops_flag) |
| 1767 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1768 | if (param->spatial_mux_flag) |
| 1769 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1770 | if (param->vht_flag) |
| 1771 | cmd->peer_flags |= WMI_PEER_VHT; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1772 | if (param->he_flag) |
| 1773 | cmd->peer_flags |= WMI_PEER_HE; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1774 | } |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1775 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1776 | /* |
| 1777 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1778 | * (during re-association). |
| 1779 | * Authorization will be done for these modes on key installation. |
| 1780 | */ |
| 1781 | if (param->auth_flag) |
| 1782 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1783 | if (param->need_ptk_4_way) |
| 1784 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1785 | else |
| 1786 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1787 | if (param->need_gtk_2_way) |
| 1788 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1789 | /* safe mode bypass the 4-way handshake */ |
| 1790 | if (param->safe_mode_enabled) |
| 1791 | cmd->peer_flags &= |
| 1792 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1793 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1794 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1795 | * it |
| 1796 | * if (param->amsdu_disable) Add after FW support |
| 1797 | **/ |
| 1798 | |
| 1799 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1800 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1801 | * iwpriv |
| 1802 | **/ |
| 1803 | if (param->peer_ht_rates.num_rates == 0) |
| 1804 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1805 | } |
| 1806 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1807 | |
| 1808 | #ifdef CONFIG_MCL |
| 1809 | static inline void copy_peer_mac_addr_tlv( |
| 1810 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1811 | struct peer_assoc_params *param) |
| 1812 | { |
| 1813 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1814 | sizeof(param->peer_macaddr)); |
| 1815 | } |
| 1816 | #else |
| 1817 | static inline void copy_peer_mac_addr_tlv( |
| 1818 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1819 | struct peer_assoc_params *param) |
| 1820 | { |
| 1821 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 1822 | } |
| 1823 | #endif |
| 1824 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1825 | /** |
| 1826 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1827 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1828 | * @param param : pointer to peer assoc parameter |
| 1829 | * |
| 1830 | * Return: 0 on success and -ve on failure. |
| 1831 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1832 | 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] | 1833 | struct peer_assoc_params *param) |
| 1834 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1835 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1836 | wmi_vht_rate_set *mcs; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1837 | wmi_he_rate_set *he_mcs; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1838 | wmi_buf_t buf; |
| 1839 | int32_t len; |
| 1840 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1841 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1842 | uint32_t peer_legacy_rates_align; |
| 1843 | uint32_t peer_ht_rates_align; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1844 | int32_t i; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1845 | |
| 1846 | |
| 1847 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1848 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1849 | |
| 1850 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1851 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
| 1852 | WMI_TLV_HDR_SIZE + |
| 1853 | (peer_ht_rates_align * sizeof(uint8_t)) + |
| 1854 | sizeof(wmi_vht_rate_set) + |
| 1855 | (sizeof(wmi_he_rate_set) * param->peer_he_mcs_count |
| 1856 | + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1857 | |
| 1858 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1859 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1860 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1861 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1862 | } |
| 1863 | |
| 1864 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1865 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1866 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1867 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1868 | WMITLV_GET_STRUCT_TLVLEN |
| 1869 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1870 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1871 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1872 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1873 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1874 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1875 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1876 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1877 | copy_peer_mac_addr_tlv(cmd, param); |
| 1878 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1879 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1880 | cmd->peer_caps = param->peer_caps; |
| 1881 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1882 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1883 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1884 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1885 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1886 | cmd->peer_phymode = param->peer_phymode; |
| 1887 | |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1888 | /* Update 11ax capabilities */ |
| 1889 | cmd->peer_he_cap_info = param->peer_he_cap_macinfo; |
| 1890 | cmd->peer_he_ops = param->peer_he_ops; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1891 | qdf_mem_copy(&cmd->peer_he_cap_phy, ¶m->peer_he_cap_phyinfo, |
| 1892 | sizeof(param->peer_he_cap_phyinfo)); |
| 1893 | qdf_mem_copy(&cmd->peer_ppet, ¶m->peer_ppet, |
| 1894 | sizeof(param->peer_ppet)); |
| 1895 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1896 | /* Update peer legacy rate information */ |
| 1897 | buf_ptr += sizeof(*cmd); |
| 1898 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1899 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1900 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1901 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1902 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1903 | param->peer_legacy_rates.num_rates); |
| 1904 | |
| 1905 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1906 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1907 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1908 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1909 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1910 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1911 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1912 | param->peer_ht_rates.num_rates); |
| 1913 | |
| 1914 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1915 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1916 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 1917 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 1918 | |
| 1919 | cmd->peer_nss = param->peer_nss; |
| 1920 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 1921 | if (param->vht_capable) { |
| 1922 | mcs->rx_max_rate = param->rx_max_rate; |
| 1923 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 1924 | mcs->tx_max_rate = param->tx_max_rate; |
| 1925 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 1926 | } |
| 1927 | |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1928 | /* HE Rates */ |
| 1929 | cmd->peer_he_mcs = param->peer_he_mcs_count; |
| 1930 | buf_ptr += sizeof(wmi_vht_rate_set); |
| 1931 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 1932 | (param->peer_he_mcs_count * sizeof(wmi_he_rate_set))); |
| 1933 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1934 | |
| 1935 | /* Loop through the HE rate set */ |
| 1936 | for (i = 0; i < param->peer_he_mcs_count; i++) { |
| 1937 | he_mcs = (wmi_he_rate_set *) buf_ptr; |
| 1938 | WMITLV_SET_HDR(he_mcs, WMITLV_TAG_STRUC_wmi_he_rate_set, |
| 1939 | WMITLV_GET_STRUCT_TLVLEN(wmi_he_rate_set)); |
| 1940 | |
| 1941 | he_mcs->rx_mcs_set = param->peer_he_rx_mcs_set[i]; |
| 1942 | he_mcs->tx_mcs_set = param->peer_he_tx_mcs_set[i]; |
| 1943 | WMI_LOGD("%s:HE idx %d RxMCSmap %x TxMCSmap %x ", __func__, |
| 1944 | i, he_mcs->rx_mcs_set, he_mcs->tx_mcs_set); |
| 1945 | buf_ptr += sizeof(wmi_he_rate_set); |
| 1946 | } |
| 1947 | |
| 1948 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1949 | 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] | 1950 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 1951 | "nss %d phymode %d peer_mpdu_density %d " |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1952 | "cmd->peer_vht_caps %x " |
| 1953 | "HE cap_info %x ops %x " |
| 1954 | "HE phy %x %x %x ", __func__, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1955 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 1956 | cmd->peer_rate_caps, cmd->peer_caps, |
| 1957 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 1958 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 1959 | cmd->peer_mpdu_density, |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1960 | cmd->peer_vht_caps, cmd->peer_he_cap_info, |
| 1961 | cmd->peer_he_ops, cmd->peer_he_cap_phy[0], |
| 1962 | cmd->peer_he_cap_phy[1], cmd->peer_he_cap_phy[2]); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1963 | |
| 1964 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1965 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1966 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1967 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1968 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1969 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1970 | } |
| 1971 | |
| 1972 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1973 | } |
| 1974 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1975 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 1976 | */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 1977 | static inline void copy_scan_event_cntrl_flags( |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1978 | wmi_start_scan_cmd_fixed_param * cmd, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 1979 | struct scan_req_params *param) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1980 | { |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1981 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 1982 | /* Scan events subscription */ |
| 1983 | if (param->scan_ev_started) |
| 1984 | cmd->notify_scan_events |= WMI_SCAN_EVENT_STARTED; |
| 1985 | if (param->scan_ev_completed) |
| 1986 | cmd->notify_scan_events |= WMI_SCAN_EVENT_COMPLETED; |
| 1987 | if (param->scan_ev_bss_chan) |
| 1988 | cmd->notify_scan_events |= WMI_SCAN_EVENT_BSS_CHANNEL; |
| 1989 | if (param->scan_ev_foreign_chan) |
| 1990 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL; |
| 1991 | if (param->scan_ev_dequeued) |
| 1992 | cmd->notify_scan_events |= WMI_SCAN_EVENT_DEQUEUED; |
| 1993 | if (param->scan_ev_preempted) |
| 1994 | cmd->notify_scan_events |= WMI_SCAN_EVENT_PREEMPTED; |
| 1995 | if (param->scan_ev_start_failed) |
| 1996 | cmd->notify_scan_events |= WMI_SCAN_EVENT_START_FAILED; |
| 1997 | if (param->scan_ev_restarted) |
| 1998 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESTARTED; |
| 1999 | if (param->scan_ev_foreign_chn_exit) |
| 2000 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 2001 | if (param->scan_ev_suspended) |
| 2002 | cmd->notify_scan_events |= WMI_SCAN_EVENT_SUSPENDED; |
| 2003 | if (param->scan_ev_resumed) |
| 2004 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESUMED; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2005 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2006 | /** Set scan control flags */ |
| 2007 | cmd->scan_ctrl_flags = 0; |
| 2008 | if (param->scan_f_passive) |
| 2009 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; |
| 2010 | if (param->scan_f_strict_passive_pch) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2011 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2012 | if (param->scan_f_promisc_mode) |
| 2013 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROMISCOUS; |
| 2014 | if (param->scan_f_capture_phy_err) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2015 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2016 | if (param->scan_f_half_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2017 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2018 | if (param->scan_f_quarter_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2019 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2020 | if (param->scan_f_cck_rates) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2021 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2022 | if (param->scan_f_ofdm_rates) |
| 2023 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 2024 | if (param->scan_f_chan_stat_evnt) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2025 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2026 | if (param->scan_f_filter_prb_req) |
| 2027 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; |
| 2028 | if (param->scan_f_bcast_probe) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2029 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2030 | if (param->scan_f_offchan_mgmt_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2031 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2032 | if (param->scan_f_offchan_data_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2033 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2034 | if (param->scan_f_force_active_dfs_chn) |
| 2035 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_FORCE_ACTIVE_ON_DFS; |
| 2036 | if (param->scan_f_add_tpc_ie_in_probe) |
| 2037 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_TPC_IE_IN_PROBE_REQ; |
| 2038 | if (param->scan_f_add_ds_ie_in_probe) |
| 2039 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
| 2040 | if (param->scan_f_add_spoofed_mac_in_probe) |
| 2041 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; |
| 2042 | if (param->scan_f_add_rand_seq_in_probe) |
| 2043 | cmd->scan_ctrl_flags |= WMI_SCAN_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 2044 | if (param->scan_f_en_ie_whitelist_in_probe) |
| 2045 | cmd->scan_ctrl_flags |= |
| 2046 | WMI_SCAN_ENABLE_IE_WHTELIST_IN_PROBE_REQ; |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2047 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2048 | /* for adaptive scan mode using 3 bits (21 - 23 bits) */ |
| 2049 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 2050 | param->adaptive_dwell_time_mode); |
| 2051 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2052 | |
| 2053 | /* scan_copy_ie_buffer() - Copy scan ie_data */ |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2054 | static inline void scan_copy_ie_buffer(uint8_t *buf_ptr, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2055 | struct scan_req_params *params) |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2056 | { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2057 | qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len); |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2058 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2059 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2060 | /* |
| 2061 | * get_pdev_wmi_handle() - Helper func to derive pdev wmi handle from vdev_id |
| 2062 | * @param wmi_handle : Handle to WMI |
| 2063 | * @param vdev_id : vdev identifier |
| 2064 | * |
| 2065 | * Return : void * |
| 2066 | */ |
| 2067 | static inline void *get_pdev_wmi_handle(wmi_unified_t wmi_handle, uint8_t vdev_id) |
| 2068 | { |
| 2069 | struct wlan_objmgr_vdev *vdev = NULL; |
| 2070 | struct wlan_objmgr_pdev *pdev = NULL; |
| 2071 | uint8_t pdev_id = 0; |
| 2072 | |
| 2073 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc( |
| 2074 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 2075 | vdev_id, WLAN_SCAN_ID); |
| 2076 | if (vdev) { |
| 2077 | wlan_objmgr_vdev_release_ref(vdev, WLAN_SCAN_ID); |
| 2078 | pdev = wlan_vdev_get_pdev(vdev); |
| 2079 | if (pdev) |
| 2080 | pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); |
| 2081 | else { |
| 2082 | qdf_print("%s : Invalid PDEV, forcing pdev_id to 0\n", __func__); |
| 2083 | } |
| 2084 | } else { |
| 2085 | qdf_print("%s : Invalid VDEV, forcing pdev_id to 0\n", __func__); |
| 2086 | } |
| 2087 | |
| 2088 | return wmi_unified_get_pdev_handle(wmi_handle->soc, pdev_id); |
| 2089 | } |
| 2090 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2091 | /** |
| 2092 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 2093 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2094 | * @param param : pointer to hold scan start cmd parameter |
| 2095 | * |
| 2096 | * Return: 0 on success and -ve on failure. |
| 2097 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2098 | 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] | 2099 | struct scan_req_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2100 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2101 | int32_t ret = 0; |
| 2102 | int32_t i; |
| 2103 | wmi_buf_t wmi_buf; |
| 2104 | wmi_start_scan_cmd_fixed_param *cmd; |
| 2105 | uint8_t *buf_ptr; |
| 2106 | uint32_t *tmp_ptr; |
| 2107 | wmi_ssid *ssid = NULL; |
| 2108 | wmi_mac_addr *bssid; |
| 2109 | int len = sizeof(*cmd); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2110 | uint8_t extraie_len_with_pad = 0; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2111 | |
| 2112 | /* Length TLV placeholder for array of uint32_t */ |
| 2113 | len += WMI_TLV_HDR_SIZE; |
| 2114 | /* calculate the length of buffer required */ |
| 2115 | if (params->num_chan) |
| 2116 | len += params->num_chan * sizeof(uint32_t); |
| 2117 | |
| 2118 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 2119 | len += WMI_TLV_HDR_SIZE; |
| 2120 | if (params->num_ssids) |
| 2121 | len += params->num_ssids * sizeof(wmi_ssid); |
| 2122 | |
| 2123 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 2124 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2125 | if (params->num_bssid) |
| 2126 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2127 | |
| 2128 | /* Length TLV placeholder for array of bytes */ |
| 2129 | len += WMI_TLV_HDR_SIZE; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2130 | if (params->extraie.len) |
| 2131 | extraie_len_with_pad = |
| 2132 | roundup(params->extraie.len, sizeof(uint32_t)); |
| 2133 | len += extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2134 | |
| 2135 | /* Allocate the memory */ |
| 2136 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2137 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2138 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2139 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2140 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2141 | } |
| 2142 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2143 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 2144 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2145 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 2146 | WMITLV_GET_STRUCT_TLVLEN |
| 2147 | (wmi_start_scan_cmd_fixed_param)); |
| 2148 | |
| 2149 | cmd->scan_id = params->scan_id; |
| 2150 | cmd->scan_req_id = params->scan_req_id; |
| 2151 | cmd->vdev_id = params->vdev_id; |
| 2152 | cmd->scan_priority = params->scan_priority; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2153 | |
| 2154 | copy_scan_event_cntrl_flags(cmd, params); |
| 2155 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2156 | cmd->dwell_time_active = params->dwell_time_active; |
| 2157 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 2158 | cmd->min_rest_time = params->min_rest_time; |
| 2159 | cmd->max_rest_time = params->max_rest_time; |
| 2160 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 2161 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 2162 | cmd->idle_time = params->idle_time; |
| 2163 | cmd->max_scan_time = params->max_scan_time; |
| 2164 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2165 | cmd->burst_duration = params->burst_duration; |
| 2166 | cmd->num_chan = params->num_chan; |
| 2167 | cmd->num_bssid = params->num_bssid; |
| 2168 | cmd->num_ssids = params->num_ssids; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2169 | cmd->ie_len = params->extraie.len; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2170 | cmd->n_probes = params->n_probes; |
| 2171 | buf_ptr += sizeof(*cmd); |
| 2172 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2173 | for (i = 0; i < params->num_chan; ++i) |
| 2174 | tmp_ptr[i] = params->chan_list[i]; |
| 2175 | |
| 2176 | WMITLV_SET_HDR(buf_ptr, |
| 2177 | WMITLV_TAG_ARRAY_UINT32, |
| 2178 | (params->num_chan * sizeof(uint32_t))); |
| 2179 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2180 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2181 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2182 | goto error; |
| 2183 | } |
| 2184 | |
| 2185 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2186 | (params->num_ssids * sizeof(wmi_ssid))); |
| 2187 | |
| 2188 | if (params->num_ssids) { |
| 2189 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2190 | for (i = 0; i < params->num_ssids; ++i) { |
| 2191 | ssid->ssid_len = params->ssid[i].length; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2192 | qdf_mem_copy(ssid->ssid, params->ssid[i].ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2193 | params->ssid[i].length); |
| 2194 | ssid++; |
| 2195 | } |
| 2196 | } |
| 2197 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 2198 | |
| 2199 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2200 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 2201 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2202 | |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2203 | if (params->num_bssid) { |
| 2204 | for (i = 0; i < params->num_bssid; ++i) { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2205 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 2206 | ¶ms->bssid_list[i].bytes[0], bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2207 | bssid++; |
| 2208 | } |
| 2209 | } |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2210 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2211 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2212 | (params->num_bssid * sizeof(wmi_mac_addr)); |
| 2213 | |
| 2214 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, extraie_len_with_pad); |
| 2215 | if (params->extraie.len) |
| 2216 | scan_copy_ie_buffer(buf_ptr + WMI_TLV_HDR_SIZE, |
| 2217 | params); |
| 2218 | |
| 2219 | buf_ptr += WMI_TLV_HDR_SIZE + extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2220 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2221 | ret = wmi_unified_cmd_send( |
| 2222 | get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2223 | len, WMI_START_SCAN_CMDID); |
| 2224 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2225 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2226 | wmi_buf_free(wmi_buf); |
| 2227 | } |
| 2228 | return ret; |
| 2229 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2230 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2231 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2232 | } |
| 2233 | |
| 2234 | /** |
| 2235 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 2236 | * @param wmi_handle : handle to WMI. |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2237 | * @param param : pointer to hold scan cancel cmd parameter |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2238 | * |
| 2239 | * Return: 0 on success and -ve on failure. |
| 2240 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2241 | 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] | 2242 | struct scan_cancel_param *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2243 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2244 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2245 | int ret; |
| 2246 | int len = sizeof(*cmd); |
| 2247 | wmi_buf_t wmi_buf; |
| 2248 | |
| 2249 | /* Allocate the memory */ |
| 2250 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2251 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2252 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2253 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2254 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2255 | goto error; |
| 2256 | } |
| 2257 | |
| 2258 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2259 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2260 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2261 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2262 | cmd->vdev_id = param->vdev_id; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2263 | cmd->requestor = param->requester; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2264 | cmd->scan_id = param->scan_id; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2265 | cmd->pdev_id = param->pdev_id + 1; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2266 | /* stop the scan with the corresponding scan_id */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2267 | if (param->req_type == WLAN_SCAN_CANCEL_PDEV_ALL) { |
| 2268 | /* Cancelling all scans */ |
| 2269 | cmd->req_type = WMI_SCAN_STOP_ALL; |
| 2270 | } else if (param->req_type == WLAN_SCAN_CANCEL_VDEV_ALL) { |
| 2271 | /* Cancelling VAP scans */ |
| 2272 | cmd->req_type = WMI_SCN_STOP_VAP_ALL; |
| 2273 | } else if (param->req_type == WLAN_SCAN_CANCEL_SINGLE) { |
| 2274 | /* Cancelling specific scan */ |
| 2275 | cmd->req_type = WMI_SCAN_STOP_ONE; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2276 | } else { |
| 2277 | WMI_LOGE("%s: Invalid Command : ", __func__); |
| 2278 | wmi_buf_free(wmi_buf); |
| 2279 | return QDF_STATUS_E_INVAL; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2280 | } |
| 2281 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2282 | 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] | 2283 | len, WMI_STOP_SCAN_CMDID); |
| 2284 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2285 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2286 | wmi_buf_free(wmi_buf); |
| 2287 | } |
| 2288 | |
| 2289 | error: |
| 2290 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2291 | } |
| 2292 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2293 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2294 | /** |
| 2295 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2296 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2297 | * @param param : pointer to hold scan channel list parameter |
| 2298 | * |
| 2299 | * Return: 0 on success and -ve on failure. |
| 2300 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2301 | 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] | 2302 | struct scan_chan_list_params *chan_list) |
| 2303 | { |
| 2304 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2305 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2306 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2307 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2308 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2309 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2310 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2311 | |
| 2312 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2313 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2314 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2315 | WMI_LOGE("Failed to allocate memory"); |
| 2316 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2317 | goto end; |
| 2318 | } |
| 2319 | |
| 2320 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2321 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2322 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2323 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2324 | WMITLV_GET_STRUCT_TLVLEN |
| 2325 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2326 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2327 | 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] | 2328 | |
| 2329 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2330 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2331 | WMITLV_TAG_ARRAY_STRUC, |
| 2332 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2333 | chan_info = (wmi_channel_param *) |
| 2334 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2335 | tchan_info = chan_list->chan_info; |
| 2336 | |
| 2337 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2338 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2339 | WMITLV_TAG_STRUC_wmi_channel, |
| 2340 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2341 | chan_info->mhz = tchan_info->mhz; |
| 2342 | chan_info->band_center_freq1 = |
| 2343 | tchan_info->band_center_freq1; |
| 2344 | chan_info->band_center_freq2 = |
| 2345 | tchan_info->band_center_freq2; |
| 2346 | chan_info->info = tchan_info->info; |
| 2347 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2348 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2349 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2350 | |
| 2351 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2352 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2353 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2354 | tchan_info++; |
| 2355 | chan_info++; |
| 2356 | } |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2357 | cmd->pdev_id = chan_list->pdev_id + 1; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2358 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2359 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 2360 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2361 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2362 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2363 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2364 | wmi_buf_free(buf); |
| 2365 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2366 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2367 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2368 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2369 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2370 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2371 | 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] | 2372 | struct scan_chan_list_params *chan_list) |
| 2373 | { |
| 2374 | wmi_buf_t buf; |
| 2375 | QDF_STATUS qdf_status; |
| 2376 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2377 | int i; |
| 2378 | uint8_t *buf_ptr; |
| 2379 | wmi_channel *chan_info; |
| 2380 | struct channel_param *tchan_info; |
| 2381 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2382 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2383 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2384 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2385 | if (!buf) { |
| 2386 | WMI_LOGE("Failed to allocate memory"); |
| 2387 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2388 | goto end; |
| 2389 | } |
| 2390 | |
| 2391 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2392 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2393 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2394 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2395 | WMITLV_GET_STRUCT_TLVLEN |
| 2396 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2397 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2398 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2399 | |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 2400 | cmd->pdev_id = chan_list->pdev_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2401 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2402 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2403 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2404 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2405 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2406 | tchan_info = &(chan_list->ch_param[0]); |
| 2407 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2408 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2409 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2410 | WMITLV_TAG_STRUC_wmi_channel, |
| 2411 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2412 | chan_info->mhz = tchan_info->mhz; |
| 2413 | chan_info->band_center_freq1 = |
| 2414 | tchan_info->cfreq1; |
| 2415 | chan_info->band_center_freq2 = |
| 2416 | tchan_info->cfreq2; |
| 2417 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2418 | if (tchan_info->is_chan_passive) |
| 2419 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2420 | WMI_CHAN_FLAG_PASSIVE); |
| 2421 | |
| 2422 | if (tchan_info->allow_vht) |
| 2423 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2424 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2425 | else if (tchan_info->allow_ht) |
| 2426 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2427 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2428 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2429 | tchan_info->phy_mode); |
| 2430 | |
| 2431 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2432 | * after FW support |
| 2433 | */ |
| 2434 | |
| 2435 | /* also fill in power information */ |
| 2436 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2437 | tchan_info->minpower); |
| 2438 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2439 | tchan_info->maxpower); |
| 2440 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2441 | tchan_info->maxregpower); |
| 2442 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2443 | tchan_info->antennamax); |
| 2444 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2445 | tchan_info->reg_class_id); |
| 2446 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2447 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2448 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2449 | tchan_info++; |
| 2450 | chan_info++; |
| 2451 | } |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2452 | cmd->pdev_id = chan_list->pdev_id + 1; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2453 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2454 | qdf_status = wmi_unified_cmd_send( |
| 2455 | wmi_handle, |
| 2456 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2457 | |
| 2458 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2459 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2460 | wmi_buf_free(buf); |
| 2461 | } |
| 2462 | |
| 2463 | end: |
| 2464 | return qdf_status; |
| 2465 | } |
| 2466 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2467 | /** |
| 2468 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2469 | * @wmi_handle : handle to WMI. |
| 2470 | * @param : pointer to hold mgmt cmd parameter |
| 2471 | * |
| 2472 | * Return: 0 on success and -ve on failure. |
| 2473 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2474 | static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2475 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2476 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2477 | wmi_buf_t buf; |
| 2478 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2479 | int32_t cmd_len; |
| 2480 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2481 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2482 | uint8_t *bufp; |
| 2483 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2484 | mgmt_tx_dl_frm_len; |
| 2485 | |
| 2486 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 2487 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 2488 | |
| 2489 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2490 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2491 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2492 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2493 | } |
| 2494 | |
| 2495 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2496 | bufp = (uint8_t *) cmd; |
| 2497 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2498 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2499 | WMITLV_GET_STRUCT_TLVLEN |
| 2500 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2501 | |
| 2502 | cmd->vdev_id = param->vdev_id; |
| 2503 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2504 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2505 | cmd->chanfreq = param->chanfreq; |
| 2506 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2507 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2508 | sizeof(uint32_t))); |
| 2509 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2510 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2511 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2512 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2513 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
Orhan K AKYILDIZ | 271641f | 2017-01-29 15:17:12 -0800 | [diff] [blame] | 2514 | #if defined(HTT_PADDR64) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2515 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2516 | #endif |
| 2517 | cmd->frame_len = param->frm_len; |
| 2518 | cmd->buf_len = bufp_len; |
| 2519 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2520 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2521 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2522 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2523 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2524 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2525 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2526 | goto err1; |
| 2527 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2528 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2529 | |
| 2530 | err1: |
| 2531 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2532 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2533 | } |
| 2534 | |
| 2535 | /** |
| 2536 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2537 | * @wmi_handle: wmi handle |
| 2538 | * @param_value: parameter value |
| 2539 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2540 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2541 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2542 | 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] | 2543 | uint32_t param_value) |
| 2544 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2545 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2546 | wmi_modem_power_state_cmd_param *cmd; |
| 2547 | wmi_buf_t buf; |
| 2548 | uint16_t len = sizeof(*cmd); |
| 2549 | |
| 2550 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2551 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2552 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2553 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2554 | } |
| 2555 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2556 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2557 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2558 | WMITLV_GET_STRUCT_TLVLEN |
| 2559 | (wmi_modem_power_state_cmd_param)); |
| 2560 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2561 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2562 | param_value); |
| 2563 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2564 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2565 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2566 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2567 | wmi_buf_free(buf); |
| 2568 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2569 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2570 | return ret; |
| 2571 | } |
| 2572 | |
| 2573 | /** |
| 2574 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2575 | * @wmi_handle: wmi handle |
| 2576 | * @vdev_id: vdev id |
| 2577 | * @val: value |
| 2578 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2579 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2580 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2581 | 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] | 2582 | uint32_t vdev_id, uint8_t val) |
| 2583 | { |
| 2584 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2585 | wmi_buf_t buf; |
| 2586 | int32_t len = sizeof(*cmd); |
| 2587 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2588 | 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] | 2589 | |
| 2590 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2591 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2592 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2593 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2594 | } |
| 2595 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2596 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2597 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2598 | WMITLV_GET_STRUCT_TLVLEN |
| 2599 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2600 | cmd->vdev_id = vdev_id; |
| 2601 | if (val) |
| 2602 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2603 | else |
| 2604 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2605 | |
| 2606 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2607 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2608 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2609 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2610 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2611 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2612 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2613 | return 0; |
| 2614 | } |
| 2615 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2616 | /** |
| 2617 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2618 | * @wmi_handle: wmi handle |
| 2619 | * @vdev_id: vdev id |
| 2620 | * @value: value |
| 2621 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2622 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2623 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2624 | 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] | 2625 | uint8_t vdev_id, int value) |
| 2626 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2627 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2628 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2629 | wmi_buf_t buf; |
| 2630 | uint16_t len = sizeof(*cmd); |
| 2631 | |
| 2632 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2633 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2634 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2635 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2636 | } |
| 2637 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2638 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2639 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2640 | WMITLV_GET_STRUCT_TLVLEN |
| 2641 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2642 | |
| 2643 | cmd->vdev_id = vdev_id; |
| 2644 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2645 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2646 | * to SM power save values defined in the specification. |
| 2647 | * Make sure to send the right mapping. |
| 2648 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2649 | switch (value) { |
| 2650 | case 0: |
| 2651 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 2652 | break; |
| 2653 | case 1: |
| 2654 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 2655 | break; |
| 2656 | case 2: |
| 2657 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 2658 | break; |
| 2659 | case 3: |
| 2660 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 2661 | break; |
| 2662 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2663 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 2664 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2665 | } |
| 2666 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2667 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2668 | |
| 2669 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2670 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2671 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2672 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2673 | wmi_buf_free(buf); |
| 2674 | } |
| 2675 | |
| 2676 | return ret; |
| 2677 | } |
| 2678 | |
| 2679 | /** |
| 2680 | * send_set_smps_params_cmd_tlv() - set smps params |
| 2681 | * @wmi_handle: wmi handle |
| 2682 | * @vdev_id: vdev id |
| 2683 | * @value: value |
| 2684 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2685 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2686 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2687 | 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] | 2688 | int value) |
| 2689 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2690 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2691 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 2692 | wmi_buf_t buf; |
| 2693 | uint16_t len = sizeof(*cmd); |
| 2694 | |
| 2695 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2696 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2697 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2698 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2699 | } |
| 2700 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 2701 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2702 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 2703 | WMITLV_GET_STRUCT_TLVLEN |
| 2704 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 2705 | |
| 2706 | cmd->vdev_id = vdev_id; |
| 2707 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 2708 | cmd->param = |
| 2709 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 2710 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2711 | 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] | 2712 | cmd->param); |
| 2713 | |
| 2714 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2715 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2716 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2717 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2718 | wmi_buf_free(buf); |
| 2719 | } |
| 2720 | |
| 2721 | return ret; |
| 2722 | } |
| 2723 | |
| 2724 | /** |
| 2725 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 2726 | * @wmi_handle: wmi handle |
| 2727 | * @noa: p2p power save parameters |
| 2728 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2729 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2730 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2731 | 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] | 2732 | struct p2p_ps_params *noa) |
| 2733 | { |
| 2734 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 2735 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 2736 | wmi_buf_t buf; |
| 2737 | uint8_t *buf_ptr; |
| 2738 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2739 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2740 | uint32_t duration; |
| 2741 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2742 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2743 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 2744 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2745 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2746 | WMI_LOGE("Failed to allocate memory"); |
| 2747 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2748 | goto end; |
| 2749 | } |
| 2750 | |
| 2751 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2752 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 2753 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2754 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 2755 | WMITLV_GET_STRUCT_TLVLEN |
| 2756 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 2757 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 2758 | cmd->vdev_id = noa->session_id; |
| 2759 | cmd->enable = (duration) ? true : false; |
| 2760 | cmd->num_noa = 1; |
| 2761 | |
| 2762 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 2763 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 2764 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 2765 | sizeof |
| 2766 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 2767 | + WMI_TLV_HDR_SIZE); |
| 2768 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 2769 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 2770 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 2771 | noa_discriptor->type_count = noa->count; |
| 2772 | noa_discriptor->duration = duration; |
| 2773 | noa_discriptor->interval = noa->interval; |
| 2774 | noa_discriptor->start_time = 0; |
| 2775 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2776 | 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] | 2777 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 2778 | noa->interval); |
| 2779 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2780 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2781 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2782 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2783 | wmi_buf_free(buf); |
| 2784 | } |
| 2785 | |
| 2786 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2787 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2788 | return status; |
| 2789 | } |
| 2790 | |
| 2791 | |
| 2792 | /** |
| 2793 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 2794 | * @wmi_handle: wmi handle |
| 2795 | * @noa: p2p opp power save parameters |
| 2796 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2797 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2798 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2799 | 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] | 2800 | struct p2p_ps_params *oppps) |
| 2801 | { |
| 2802 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 2803 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2804 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2805 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2806 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2807 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2808 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2809 | WMI_LOGE("Failed to allocate memory"); |
| 2810 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2811 | goto end; |
| 2812 | } |
| 2813 | |
| 2814 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 2815 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2816 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 2817 | WMITLV_GET_STRUCT_TLVLEN |
| 2818 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 2819 | cmd->vdev_id = oppps->session_id; |
| 2820 | if (oppps->ctwindow) |
| 2821 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 2822 | |
| 2823 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2824 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2825 | cmd->vdev_id, oppps->ctwindow); |
| 2826 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 2827 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2828 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2829 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2830 | wmi_buf_free(buf); |
| 2831 | } |
| 2832 | |
| 2833 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2834 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2835 | return status; |
| 2836 | } |
| 2837 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 2838 | #ifdef CONVERGED_P2P_ENABLE |
| 2839 | /** |
| 2840 | * send_p2p_lo_start_cmd_tlv() - send p2p lo start request to fw |
| 2841 | * @wmi_handle: wmi handle |
| 2842 | * @param: p2p listen offload start parameters |
| 2843 | * |
| 2844 | * Return: QDF status |
| 2845 | */ |
| 2846 | static QDF_STATUS send_p2p_lo_start_cmd_tlv(wmi_unified_t wmi_handle, |
| 2847 | struct p2p_lo_start *param) |
| 2848 | { |
| 2849 | wmi_buf_t buf; |
| 2850 | wmi_p2p_lo_start_cmd_fixed_param *cmd; |
| 2851 | int32_t len = sizeof(*cmd); |
| 2852 | uint8_t *buf_ptr; |
| 2853 | QDF_STATUS status; |
| 2854 | int device_types_len_aligned; |
| 2855 | int probe_resp_len_aligned; |
| 2856 | |
| 2857 | if (!param) { |
| 2858 | WMI_LOGE("lo start param is null"); |
| 2859 | return QDF_STATUS_E_INVAL; |
| 2860 | } |
| 2861 | |
| 2862 | WMI_LOGD("%s: vdev_id:%d", __func__, param->vdev_id); |
| 2863 | |
| 2864 | device_types_len_aligned = |
| 2865 | qdf_roundup(param->dev_types_len, |
| 2866 | sizeof(A_UINT32)); |
| 2867 | probe_resp_len_aligned = |
| 2868 | qdf_roundup(param->probe_resp_len, |
| 2869 | sizeof(A_UINT32)); |
| 2870 | |
| 2871 | len += 2 * WMI_TLV_HDR_SIZE + device_types_len_aligned + |
| 2872 | probe_resp_len_aligned; |
| 2873 | |
| 2874 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2875 | if (!buf) { |
| 2876 | WMI_LOGE("%s: Failed to allocate memory for p2p lo start", |
| 2877 | __func__); |
| 2878 | return QDF_STATUS_E_NOMEM; |
| 2879 | } |
| 2880 | |
| 2881 | cmd = (wmi_p2p_lo_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 2882 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2883 | |
| 2884 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2885 | WMITLV_TAG_STRUC_wmi_p2p_lo_start_cmd_fixed_param, |
| 2886 | WMITLV_GET_STRUCT_TLVLEN( |
| 2887 | wmi_p2p_lo_start_cmd_fixed_param)); |
| 2888 | |
| 2889 | cmd->vdev_id = param->vdev_id; |
| 2890 | cmd->ctl_flags = param->ctl_flags; |
| 2891 | cmd->channel = param->freq; |
| 2892 | cmd->period = param->period; |
| 2893 | cmd->interval = param->interval; |
| 2894 | cmd->count = param->count; |
| 2895 | cmd->device_types_len = param->dev_types_len; |
| 2896 | cmd->prob_resp_len = param->probe_resp_len; |
| 2897 | |
| 2898 | buf_ptr += sizeof(wmi_p2p_lo_start_cmd_fixed_param); |
| 2899 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2900 | device_types_len_aligned); |
| 2901 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2902 | qdf_mem_copy(buf_ptr, param->device_types, |
| 2903 | param->dev_types_len); |
| 2904 | |
| 2905 | buf_ptr += device_types_len_aligned; |
| 2906 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2907 | probe_resp_len_aligned); |
| 2908 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2909 | qdf_mem_copy(buf_ptr, param->probe_resp_tmplt, |
| 2910 | param->probe_resp_len); |
| 2911 | |
| 2912 | WMI_LOGD("%s: Sending WMI_P2P_LO_START command, channel=%d, period=%d, interval=%d, count=%d", __func__, |
| 2913 | cmd->channel, cmd->period, cmd->interval, cmd->count); |
| 2914 | |
| 2915 | status = wmi_unified_cmd_send(wmi_handle, |
| 2916 | buf, len, |
| 2917 | WMI_P2P_LISTEN_OFFLOAD_START_CMDID); |
| 2918 | if (status != QDF_STATUS_SUCCESS) { |
| 2919 | WMI_LOGE("%s: Failed to send p2p lo start: %d", |
| 2920 | __func__, status); |
| 2921 | wmi_buf_free(buf); |
| 2922 | return status; |
| 2923 | } |
| 2924 | |
| 2925 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_START", __func__); |
| 2926 | |
| 2927 | return QDF_STATUS_SUCCESS; |
| 2928 | } |
| 2929 | |
| 2930 | /** |
| 2931 | * send_p2p_lo_stop_cmd_tlv() - send p2p lo stop request to fw |
| 2932 | * @wmi_handle: wmi handle |
| 2933 | * @param: p2p listen offload stop parameters |
| 2934 | * |
| 2935 | * Return: QDF status |
| 2936 | */ |
| 2937 | static QDF_STATUS send_p2p_lo_stop_cmd_tlv(wmi_unified_t wmi_handle, |
| 2938 | uint8_t vdev_id) |
| 2939 | { |
| 2940 | wmi_buf_t buf; |
| 2941 | wmi_p2p_lo_stop_cmd_fixed_param *cmd; |
| 2942 | int32_t len; |
| 2943 | QDF_STATUS status; |
| 2944 | |
| 2945 | WMI_LOGD("%s: vdev_id:%d", __func__, vdev_id); |
| 2946 | |
| 2947 | len = sizeof(*cmd); |
| 2948 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2949 | if (!buf) { |
| 2950 | qdf_print("%s: Failed to allocate memory for p2p lo stop", |
| 2951 | __func__); |
| 2952 | return QDF_STATUS_E_NOMEM; |
| 2953 | } |
| 2954 | cmd = (wmi_p2p_lo_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 2955 | |
| 2956 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2957 | WMITLV_TAG_STRUC_wmi_p2p_lo_stop_cmd_fixed_param, |
| 2958 | WMITLV_GET_STRUCT_TLVLEN( |
| 2959 | wmi_p2p_lo_stop_cmd_fixed_param)); |
| 2960 | |
| 2961 | cmd->vdev_id = vdev_id; |
| 2962 | |
| 2963 | WMI_LOGD("%s: Sending WMI_P2P_LO_STOP command", __func__); |
| 2964 | |
| 2965 | status = wmi_unified_cmd_send(wmi_handle, |
| 2966 | buf, len, |
| 2967 | WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID); |
| 2968 | if (status != QDF_STATUS_SUCCESS) { |
| 2969 | WMI_LOGE("%s: Failed to send p2p lo stop: %d", |
| 2970 | __func__, status); |
| 2971 | wmi_buf_free(buf); |
| 2972 | return status; |
| 2973 | } |
| 2974 | |
| 2975 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_STOP", __func__); |
| 2976 | |
| 2977 | return QDF_STATUS_SUCCESS; |
| 2978 | } |
| 2979 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 2980 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2981 | /** |
| 2982 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 2983 | * @wmi_handle: wmi handle |
| 2984 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2985 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2986 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2987 | 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] | 2988 | { |
| 2989 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 2990 | wmi_buf_t wmi_buf; |
| 2991 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 2992 | uint8_t *buf_ptr; |
| 2993 | |
| 2994 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2995 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 2996 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2997 | } |
| 2998 | |
| 2999 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 3000 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3001 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3002 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3003 | } |
| 3004 | |
| 3005 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3006 | |
| 3007 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 3008 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3009 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 3010 | WMITLV_GET_STRUCT_TLVLEN |
| 3011 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 3012 | |
| 3013 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 3014 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3015 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3016 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3017 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3018 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3019 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3020 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3021 | } |
| 3022 | |
| 3023 | /** |
| 3024 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 3025 | * @wmi_handle: wmi handle |
| 3026 | * @vdevid: vdev id |
| 3027 | * @peer_addr: peer mac address |
| 3028 | * @auto_triggerparam: auto trigger parameters |
| 3029 | * @num_ac: number of access category |
| 3030 | * |
| 3031 | * This function sets the trigger |
| 3032 | * uapsd params such as service interval, delay interval |
| 3033 | * and suspend interval which will be used by the firmware |
| 3034 | * to send trigger frames periodically when there is no |
| 3035 | * traffic on the transmit side. |
| 3036 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3037 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3038 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3039 | 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] | 3040 | struct sta_uapsd_trig_params *param) |
| 3041 | { |
| 3042 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3043 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3044 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 3045 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 3046 | uint32_t i; |
| 3047 | wmi_buf_t buf; |
| 3048 | uint8_t *buf_ptr; |
| 3049 | |
| 3050 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 3051 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3052 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3053 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3054 | } |
| 3055 | |
| 3056 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3057 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 3058 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3059 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 3060 | WMITLV_GET_STRUCT_TLVLEN |
| 3061 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 3062 | cmd->vdev_id = param->vdevid; |
| 3063 | cmd->num_ac = param->num_ac; |
| 3064 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 3065 | |
| 3066 | /* TLV indicating array of structures to follow */ |
| 3067 | buf_ptr += sizeof(*cmd); |
| 3068 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 3069 | |
| 3070 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3071 | qdf_mem_copy(buf_ptr, param->auto_triggerparam, param_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3072 | |
| 3073 | /* |
| 3074 | * Update tag and length for uapsd auto trigger params (this will take |
| 3075 | * care of updating tag and length if it is not pre-filled by caller). |
| 3076 | */ |
| 3077 | for (i = 0; i < param->num_ac; i++) { |
| 3078 | WMITLV_SET_HDR((buf_ptr + |
| 3079 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 3080 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 3081 | WMITLV_GET_STRUCT_TLVLEN |
| 3082 | (wmi_sta_uapsd_auto_trig_param)); |
| 3083 | } |
| 3084 | |
| 3085 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3086 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3087 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3088 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3089 | wmi_buf_free(buf); |
| 3090 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3091 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3092 | return ret; |
| 3093 | } |
| 3094 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3095 | /** |
| 3096 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 3097 | * @wmi_handle: pointer to the wmi handle |
| 3098 | * @utc: pointer to the UTC time struct |
| 3099 | * |
| 3100 | * Return: 0 on succes |
| 3101 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3102 | 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] | 3103 | struct ocb_utc_param *utc) |
| 3104 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3105 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3106 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 3107 | uint8_t *buf_ptr; |
| 3108 | uint32_t len, i; |
| 3109 | wmi_buf_t buf; |
| 3110 | |
| 3111 | len = sizeof(*cmd); |
| 3112 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3113 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3114 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3115 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3116 | } |
| 3117 | |
| 3118 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3119 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 3120 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3121 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 3122 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 3123 | cmd->vdev_id = utc->vdev_id; |
| 3124 | |
| 3125 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 3126 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 3127 | |
| 3128 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 3129 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 3130 | |
| 3131 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3132 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3133 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3134 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3135 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3136 | } |
| 3137 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3138 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3139 | } |
| 3140 | |
| 3141 | /** |
| 3142 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 3143 | * frames on a channel |
| 3144 | * @wmi_handle: pointer to the wmi handle |
| 3145 | * @timing_advert: pointer to the timing advertisement struct |
| 3146 | * |
| 3147 | * Return: 0 on succes |
| 3148 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3149 | 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] | 3150 | struct ocb_timing_advert_param *timing_advert) |
| 3151 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3152 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3153 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 3154 | uint8_t *buf_ptr; |
| 3155 | uint32_t len, len_template; |
| 3156 | wmi_buf_t buf; |
| 3157 | |
| 3158 | len = sizeof(*cmd) + |
| 3159 | WMI_TLV_HDR_SIZE; |
| 3160 | |
| 3161 | len_template = timing_advert->template_length; |
| 3162 | /* Add padding to the template if needed */ |
| 3163 | if (len_template % 4 != 0) |
| 3164 | len_template += 4 - (len_template % 4); |
| 3165 | len += len_template; |
| 3166 | |
| 3167 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3168 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3169 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3170 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3171 | } |
| 3172 | |
| 3173 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3174 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3175 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3176 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 3177 | WMITLV_GET_STRUCT_TLVLEN( |
| 3178 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 3179 | cmd->vdev_id = timing_advert->vdev_id; |
| 3180 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 3181 | cmd->channel_freq = timing_advert->chan_freq; |
| 3182 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 3183 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 3184 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 3185 | buf_ptr += sizeof(*cmd); |
| 3186 | |
| 3187 | /* Add the timing advert template */ |
| 3188 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3189 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3190 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3191 | (uint8_t *)timing_advert->template_value, |
| 3192 | timing_advert->template_length); |
| 3193 | |
| 3194 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3195 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3196 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3197 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3198 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3199 | } |
| 3200 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3201 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3202 | } |
| 3203 | |
| 3204 | /** |
| 3205 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 3206 | * on a channel |
| 3207 | * @wmi_handle: pointer to the wmi handle |
| 3208 | * @timing_advert: pointer to the timing advertisement struct |
| 3209 | * |
| 3210 | * Return: 0 on succes |
| 3211 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3212 | 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] | 3213 | struct ocb_timing_advert_param *timing_advert) |
| 3214 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3215 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3216 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 3217 | uint8_t *buf_ptr; |
| 3218 | uint32_t len; |
| 3219 | wmi_buf_t buf; |
| 3220 | |
| 3221 | len = sizeof(*cmd); |
| 3222 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3223 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3224 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3225 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3226 | } |
| 3227 | |
| 3228 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3229 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3230 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3231 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 3232 | WMITLV_GET_STRUCT_TLVLEN( |
| 3233 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 3234 | cmd->vdev_id = timing_advert->vdev_id; |
| 3235 | cmd->channel_freq = timing_advert->chan_freq; |
| 3236 | |
| 3237 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3238 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3239 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3240 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3241 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3242 | } |
| 3243 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3244 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3245 | } |
| 3246 | |
| 3247 | /** |
| 3248 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 3249 | * @wmi_handle: pointer to the wmi handle |
| 3250 | * @request: pointer to the request |
| 3251 | * |
| 3252 | * Return: 0 on succes |
| 3253 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3254 | 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] | 3255 | uint8_t vdev_id) |
| 3256 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3257 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3258 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 3259 | uint8_t *buf_ptr; |
| 3260 | wmi_buf_t buf; |
| 3261 | int32_t len; |
| 3262 | |
| 3263 | len = sizeof(*cmd); |
| 3264 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3265 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3266 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3267 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3268 | } |
| 3269 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3270 | |
| 3271 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3272 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3273 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3274 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 3275 | WMITLV_GET_STRUCT_TLVLEN( |
| 3276 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 3277 | cmd->vdev_id = vdev_id; |
| 3278 | |
| 3279 | /* Send the WMI command */ |
| 3280 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3281 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 3282 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3283 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3284 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3285 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3286 | } |
| 3287 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3288 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3289 | } |
| 3290 | |
| 3291 | /** |
| 3292 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 3293 | * @wmi_handle: pointer to the wmi handle |
| 3294 | * @get_stats_param: pointer to the dcc stats |
| 3295 | * |
| 3296 | * Return: 0 on succes |
| 3297 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3298 | 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] | 3299 | struct dcc_get_stats_param *get_stats_param) |
| 3300 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3301 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3302 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 3303 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 3304 | wmi_buf_t buf; |
| 3305 | uint8_t *buf_ptr; |
| 3306 | uint32_t len; |
| 3307 | uint32_t i; |
| 3308 | |
| 3309 | /* Validate the input */ |
| 3310 | if (get_stats_param->request_array_len != |
| 3311 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3312 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3313 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3314 | } |
| 3315 | |
| 3316 | /* Allocate memory for the WMI command */ |
| 3317 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 3318 | get_stats_param->request_array_len; |
| 3319 | |
| 3320 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3321 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3322 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3323 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3324 | } |
| 3325 | |
| 3326 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3327 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3328 | |
| 3329 | /* Populate the WMI command */ |
| 3330 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 3331 | buf_ptr += sizeof(*cmd); |
| 3332 | |
| 3333 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3334 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 3335 | WMITLV_GET_STRUCT_TLVLEN( |
| 3336 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 3337 | cmd->vdev_id = get_stats_param->vdev_id; |
| 3338 | cmd->num_channels = get_stats_param->channel_count; |
| 3339 | |
| 3340 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3341 | get_stats_param->request_array_len); |
| 3342 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3343 | |
| 3344 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3345 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3346 | get_stats_param->request_array_len); |
| 3347 | for (i = 0; i < cmd->num_channels; i++) |
| 3348 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 3349 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 3350 | WMITLV_GET_STRUCT_TLVLEN( |
| 3351 | wmi_dcc_channel_stats_request)); |
| 3352 | |
| 3353 | /* Send the WMI command */ |
| 3354 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3355 | WMI_DCC_GET_STATS_CMDID); |
| 3356 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3357 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3358 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3359 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3360 | } |
| 3361 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3362 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3363 | } |
| 3364 | |
| 3365 | /** |
| 3366 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 3367 | * @wmi_handle: pointer to the wmi handle |
| 3368 | * @vdev_id: vdev id |
| 3369 | * @dcc_stats_bitmap: dcc status bitmap |
| 3370 | * |
| 3371 | * Return: 0 on succes |
| 3372 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3373 | 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] | 3374 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 3375 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3376 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3377 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 3378 | wmi_buf_t buf; |
| 3379 | uint8_t *buf_ptr; |
| 3380 | uint32_t len; |
| 3381 | |
| 3382 | /* Allocate memory for the WMI command */ |
| 3383 | len = sizeof(*cmd); |
| 3384 | |
| 3385 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3386 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3387 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3388 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3389 | } |
| 3390 | |
| 3391 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3392 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3393 | |
| 3394 | /* Populate the WMI command */ |
| 3395 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 3396 | |
| 3397 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3398 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 3399 | WMITLV_GET_STRUCT_TLVLEN( |
| 3400 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 3401 | cmd->vdev_id = vdev_id; |
| 3402 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 3403 | |
| 3404 | /* Send the WMI command */ |
| 3405 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3406 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3407 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3408 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3409 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3410 | } |
| 3411 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3412 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3413 | } |
| 3414 | |
| 3415 | /** |
| 3416 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 3417 | * @wmi_handle: pointer to the wmi handle |
| 3418 | * @update_ndl_param: pointer to the request parameters |
| 3419 | * |
| 3420 | * Return: 0 on success |
| 3421 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3422 | 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] | 3423 | struct dcc_update_ndl_param *update_ndl_param) |
| 3424 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3425 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3426 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 3427 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 3428 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 3429 | uint32_t active_state_count; |
| 3430 | wmi_buf_t buf; |
| 3431 | uint8_t *buf_ptr; |
| 3432 | uint32_t len; |
| 3433 | uint32_t i; |
| 3434 | |
| 3435 | /* validate the input */ |
| 3436 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 3437 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3438 | WMI_LOGE(FL("Invalid parameter")); |
| 3439 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3440 | } |
| 3441 | active_state_count = 0; |
| 3442 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 3443 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 3444 | active_state_count += |
| 3445 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 3446 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 3447 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3448 | WMI_LOGE(FL("Invalid parameter")); |
| 3449 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3450 | } |
| 3451 | |
| 3452 | /* Allocate memory for the WMI command */ |
| 3453 | len = sizeof(*cmd) + |
| 3454 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 3455 | WMI_TLV_HDR_SIZE + |
| 3456 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 3457 | |
| 3458 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3459 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3460 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3461 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3462 | } |
| 3463 | |
| 3464 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3465 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3466 | |
| 3467 | /* Populate the WMI command */ |
| 3468 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3469 | buf_ptr += sizeof(*cmd); |
| 3470 | |
| 3471 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3472 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3473 | WMITLV_GET_STRUCT_TLVLEN( |
| 3474 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3475 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3476 | cmd->num_channel = update_ndl_param->channel_count; |
| 3477 | |
| 3478 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3479 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3480 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3481 | |
| 3482 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3483 | 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] | 3484 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3485 | for (i = 0; i < cmd->num_channel; i++) |
| 3486 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3487 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3488 | WMITLV_GET_STRUCT_TLVLEN( |
| 3489 | wmi_dcc_ndl_chan)); |
| 3490 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3491 | |
| 3492 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3493 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3494 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3495 | |
| 3496 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3497 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3498 | update_ndl_param->dcc_ndl_active_state_list, |
| 3499 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3500 | for (i = 0; i < active_state_count; i++) { |
| 3501 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3502 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3503 | WMITLV_GET_STRUCT_TLVLEN( |
| 3504 | wmi_dcc_ndl_active_state_config)); |
| 3505 | } |
| 3506 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3507 | |
| 3508 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3509 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3510 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3511 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3512 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3513 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3514 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3515 | } |
| 3516 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3517 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3518 | } |
| 3519 | |
| 3520 | /** |
| 3521 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3522 | * @wmi_handle: pointer to the wmi handle |
| 3523 | * @config: the OCB configuration |
| 3524 | * |
| 3525 | * Return: 0 on success |
| 3526 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3527 | 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] | 3528 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3529 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3530 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3531 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3532 | wmi_channel *chan; |
| 3533 | wmi_ocb_channel *ocb_chan; |
| 3534 | wmi_qos_parameter *qos_param; |
| 3535 | wmi_dcc_ndl_chan *ndl_chan; |
| 3536 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3537 | wmi_ocb_schedule_element *sched_elem; |
| 3538 | uint8_t *buf_ptr; |
| 3539 | wmi_buf_t buf; |
| 3540 | int32_t len; |
| 3541 | int32_t i, j, active_state_count; |
| 3542 | |
| 3543 | /* |
| 3544 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3545 | * states. Validate dcc_ndl_active_state_list_len. |
| 3546 | */ |
| 3547 | active_state_count = 0; |
| 3548 | if (config->dcc_ndl_chan_list_len) { |
| 3549 | if (!config->dcc_ndl_chan_list || |
| 3550 | config->dcc_ndl_chan_list_len != |
| 3551 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3552 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3553 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3554 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3555 | } |
| 3556 | |
| 3557 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3558 | i < config->channel_count; ++i, ++ndl_chan) |
| 3559 | active_state_count += |
| 3560 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3561 | |
| 3562 | if (active_state_count) { |
| 3563 | if (!config->dcc_ndl_active_state_list || |
| 3564 | config->dcc_ndl_active_state_list_len != |
| 3565 | active_state_count * |
| 3566 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3567 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3568 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3569 | } |
| 3570 | } |
| 3571 | } |
| 3572 | |
| 3573 | len = sizeof(*cmd) + |
| 3574 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3575 | sizeof(wmi_channel) + |
| 3576 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3577 | sizeof(wmi_ocb_channel) + |
| 3578 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3579 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3580 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3581 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3582 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3583 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3584 | sizeof(wmi_ocb_schedule_element); |
| 3585 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3586 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3587 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3588 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3589 | } |
| 3590 | |
| 3591 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3592 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3593 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3594 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3595 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3596 | cmd->vdev_id = config->session_id; |
| 3597 | cmd->channel_count = config->channel_count; |
| 3598 | cmd->schedule_size = config->schedule_size; |
| 3599 | cmd->flags = config->flags; |
| 3600 | buf_ptr += sizeof(*cmd); |
| 3601 | |
| 3602 | /* Add the wmi_channel info */ |
| 3603 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3604 | config->channel_count*sizeof(wmi_channel)); |
| 3605 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3606 | for (i = 0; i < config->channel_count; i++) { |
| 3607 | chan = (wmi_channel *)buf_ptr; |
| 3608 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3609 | WMITLV_TAG_STRUC_wmi_channel, |
| 3610 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3611 | chan->mhz = config->channels[i].chan_freq; |
| 3612 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3613 | chan->band_center_freq2 = 0; |
| 3614 | chan->info = 0; |
| 3615 | |
| 3616 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3617 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3618 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3619 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3620 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3621 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3622 | config->channels[i].antenna_max); |
| 3623 | |
| 3624 | if (config->channels[i].bandwidth < 10) |
| 3625 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3626 | else if (config->channels[i].bandwidth < 20) |
| 3627 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3628 | buf_ptr += sizeof(*chan); |
| 3629 | } |
| 3630 | |
| 3631 | /* Add the wmi_ocb_channel info */ |
| 3632 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3633 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3634 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3635 | for (i = 0; i < config->channel_count; i++) { |
| 3636 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3637 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3638 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 3639 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 3640 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 3641 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 3642 | config->channels[i].mac_address.bytes, |
| 3643 | &ocb_chan->mac_address); |
| 3644 | buf_ptr += sizeof(*ocb_chan); |
| 3645 | } |
| 3646 | |
| 3647 | /* Add the wmi_qos_parameter info */ |
| 3648 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3649 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 3650 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3651 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 3652 | for (i = 0; i < config->channel_count; i++) { |
| 3653 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 3654 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 3655 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 3656 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 3657 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 3658 | qos_param->aifsn = |
| 3659 | config->channels[i].qos_params[j].aifsn; |
| 3660 | qos_param->cwmin = |
| 3661 | config->channels[i].qos_params[j].cwmin; |
| 3662 | qos_param->cwmax = |
| 3663 | config->channels[i].qos_params[j].cwmax; |
| 3664 | buf_ptr += sizeof(*qos_param); |
| 3665 | } |
| 3666 | } |
| 3667 | |
| 3668 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 3669 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3670 | config->dcc_ndl_chan_list_len); |
| 3671 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3672 | if (config->dcc_ndl_chan_list_len) { |
| 3673 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3674 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3675 | config->dcc_ndl_chan_list_len); |
| 3676 | for (i = 0; i < config->channel_count; i++) |
| 3677 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 3678 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3679 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 3680 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 3681 | } |
| 3682 | |
| 3683 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 3684 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 3685 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 3686 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3687 | if (active_state_count) { |
| 3688 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3689 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3690 | config->dcc_ndl_active_state_list, |
| 3691 | active_state_count * sizeof(*ndl_active_config)); |
| 3692 | for (i = 0; i < active_state_count; ++i) |
| 3693 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 3694 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3695 | WMITLV_GET_STRUCT_TLVLEN( |
| 3696 | wmi_dcc_ndl_active_state_config)); |
| 3697 | buf_ptr += active_state_count * |
| 3698 | sizeof(*ndl_active_config); |
| 3699 | } |
| 3700 | |
| 3701 | /* Add the wmi_ocb_schedule_element info */ |
| 3702 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3703 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 3704 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3705 | for (i = 0; i < config->schedule_size; i++) { |
| 3706 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 3707 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 3708 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 3709 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 3710 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 3711 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 3712 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 3713 | buf_ptr += sizeof(*sched_elem); |
| 3714 | } |
| 3715 | |
| 3716 | |
| 3717 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3718 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3719 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3720 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3721 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3722 | } |
| 3723 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3724 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3725 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3726 | |
| 3727 | /** |
| 3728 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 3729 | * @wmi_handle: wmi handle |
| 3730 | * @mcc_adaptive_scheduler: enable/disable |
| 3731 | * |
| 3732 | * This function enable/disable mcc adaptive scheduler in fw. |
| 3733 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3734 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3735 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3736 | static QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3737 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 3738 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3739 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3740 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3741 | wmi_buf_t buf = 0; |
| 3742 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 3743 | uint16_t len = |
| 3744 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 3745 | |
| 3746 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3747 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3748 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 3749 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3750 | } |
| 3751 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 3752 | wmi_buf_data(buf); |
| 3753 | |
| 3754 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3755 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 3756 | WMITLV_GET_STRUCT_TLVLEN |
| 3757 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 3758 | cmd->enable = mcc_adaptive_scheduler; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3759 | cmd->pdev_id = pdev_id; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3760 | |
| 3761 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3762 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3763 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3764 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3765 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3766 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3767 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3768 | |
| 3769 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3770 | } |
| 3771 | |
| 3772 | /** |
| 3773 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 3774 | * @wmi: wmi handle |
| 3775 | * @mcc_channel: mcc channel |
| 3776 | * @mcc_channel_time_latency: MCC channel time latency. |
| 3777 | * |
| 3778 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 3779 | * channel of it and channel number. The info is provided run time using |
| 3780 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 3781 | * |
| 3782 | * Return: CDF status |
| 3783 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3784 | 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] | 3785 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 3786 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3787 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3788 | wmi_buf_t buf = 0; |
| 3789 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 3790 | uint16_t len = 0; |
| 3791 | uint8_t *buf_ptr = NULL; |
| 3792 | wmi_resmgr_chan_latency chan_latency; |
| 3793 | /* Note: we only support MCC time latency for a single channel */ |
| 3794 | uint32_t num_channels = 1; |
| 3795 | uint32_t chan1_freq = mcc_channel_freq; |
| 3796 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 3797 | |
| 3798 | |
| 3799 | /* If 0ms latency is provided, then FW will set to a default. |
| 3800 | * Otherwise, latency must be at least 30ms. |
| 3801 | */ |
| 3802 | if ((latency_chan1 > 0) && |
| 3803 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3804 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3805 | "Minimum is 30ms (or 0 to use default value by " |
| 3806 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3807 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3808 | } |
| 3809 | |
| 3810 | /* Set WMI CMD for channel time latency here */ |
| 3811 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 3812 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 3813 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 3814 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3815 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3816 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3817 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3818 | } |
| 3819 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3820 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 3821 | wmi_buf_data(buf); |
| 3822 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 3823 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 3824 | WMITLV_GET_STRUCT_TLVLEN |
| 3825 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 3826 | cmdTL->num_chans = num_channels; |
| 3827 | /* Update channel time latency information for home channel(s) */ |
| 3828 | buf_ptr += sizeof(*cmdTL); |
| 3829 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3830 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 3831 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3832 | chan_latency.chan_mhz = chan1_freq; |
| 3833 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3834 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3835 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3836 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3837 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3838 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3839 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3840 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3841 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3842 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3843 | |
| 3844 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3845 | } |
| 3846 | |
| 3847 | /** |
| 3848 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 3849 | * @wmi: wmi handle |
| 3850 | * @adapter_1_chan_number: adapter 1 channel number |
| 3851 | * @adapter_1_quota: adapter 1 quota |
| 3852 | * @adapter_2_chan_number: adapter 2 channel number |
| 3853 | * |
| 3854 | * Return: CDF status |
| 3855 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3856 | 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] | 3857 | uint32_t adapter_1_chan_freq, |
| 3858 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 3859 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3860 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3861 | wmi_buf_t buf = 0; |
| 3862 | uint16_t len = 0; |
| 3863 | uint8_t *buf_ptr = NULL; |
| 3864 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 3865 | wmi_resmgr_chan_time_quota chan_quota; |
| 3866 | uint32_t quota_chan1 = adapter_1_quota; |
| 3867 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 3868 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 3869 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 3870 | uint32_t num_channels = 2; |
| 3871 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 3872 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 3873 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3874 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3875 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 3876 | chan1_freq, quota_chan1, chan2_freq, |
| 3877 | quota_chan2); |
| 3878 | |
| 3879 | /* |
| 3880 | * Perform sanity check on time quota values provided. |
| 3881 | */ |
| 3882 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 3883 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3884 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3885 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3886 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3887 | } |
| 3888 | /* Set WMI CMD for channel time quota here */ |
| 3889 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 3890 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 3891 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 3892 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3893 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3894 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3895 | QDF_ASSERT(0); |
| 3896 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3897 | } |
| 3898 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3899 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 3900 | wmi_buf_data(buf); |
| 3901 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 3902 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 3903 | WMITLV_GET_STRUCT_TLVLEN |
| 3904 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 3905 | cmdTQ->num_chans = num_channels; |
| 3906 | |
| 3907 | /* Update channel time quota information for home channel(s) */ |
| 3908 | buf_ptr += sizeof(*cmdTQ); |
| 3909 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3910 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 3911 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3912 | chan_quota.chan_mhz = chan1_freq; |
| 3913 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3914 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3915 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 3916 | buf_ptr += sizeof(chan_quota); |
| 3917 | chan_quota.chan_mhz = chan2_freq; |
| 3918 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3919 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3920 | |
| 3921 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3922 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3923 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3924 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3925 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3926 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3927 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3928 | |
| 3929 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3930 | } |
| 3931 | |
| 3932 | /** |
| 3933 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 3934 | * @wmi_handle: Pointer to wmi handle |
| 3935 | * @thermal_info: Thermal command information |
| 3936 | * |
| 3937 | * This function sends the thermal management command |
| 3938 | * to the firmware |
| 3939 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3940 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3941 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3942 | 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] | 3943 | struct thermal_cmd_params *thermal_info) |
| 3944 | { |
| 3945 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 3946 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3947 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3948 | uint32_t len = 0; |
| 3949 | |
| 3950 | len = sizeof(*cmd); |
| 3951 | |
| 3952 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3953 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3954 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3955 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3956 | } |
| 3957 | |
| 3958 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 3959 | |
| 3960 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3961 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 3962 | WMITLV_GET_STRUCT_TLVLEN |
| 3963 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 3964 | |
| 3965 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 3966 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 3967 | cmd->enable = thermal_info->thermal_enable; |
| 3968 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3969 | 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] | 3970 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 3971 | |
| 3972 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3973 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3974 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3975 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3976 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3977 | } |
| 3978 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3979 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3980 | } |
| 3981 | |
| 3982 | |
| 3983 | /** |
| 3984 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3985 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3986 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 3987 | * |
| 3988 | * This function sends down the LRO configuration parameters to |
| 3989 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 3990 | * seed values for the toeplitz hash generation |
| 3991 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3992 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3993 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3994 | 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] | 3995 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 3996 | { |
| 3997 | wmi_lro_info_cmd_fixed_param *cmd; |
| 3998 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3999 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4000 | |
| 4001 | |
| 4002 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4003 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4004 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4005 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4006 | } |
| 4007 | |
| 4008 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 4009 | |
| 4010 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4011 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 4012 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 4013 | |
| 4014 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 4015 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 4016 | wmi_lro_cmd->tcp_flag); |
| 4017 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 4018 | wmi_lro_cmd->tcp_flag_mask); |
| 4019 | cmd->toeplitz_hash_ipv4_0_3 = |
| 4020 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 4021 | cmd->toeplitz_hash_ipv4_4_7 = |
| 4022 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 4023 | cmd->toeplitz_hash_ipv4_8_11 = |
| 4024 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 4025 | cmd->toeplitz_hash_ipv4_12_15 = |
| 4026 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 4027 | cmd->toeplitz_hash_ipv4_16 = |
| 4028 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 4029 | |
| 4030 | cmd->toeplitz_hash_ipv6_0_3 = |
| 4031 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 4032 | cmd->toeplitz_hash_ipv6_4_7 = |
| 4033 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 4034 | cmd->toeplitz_hash_ipv6_8_11 = |
| 4035 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 4036 | cmd->toeplitz_hash_ipv6_12_15 = |
| 4037 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 4038 | cmd->toeplitz_hash_ipv6_16_19 = |
| 4039 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 4040 | cmd->toeplitz_hash_ipv6_20_23 = |
| 4041 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 4042 | cmd->toeplitz_hash_ipv6_24_27 = |
| 4043 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 4044 | cmd->toeplitz_hash_ipv6_28_31 = |
| 4045 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 4046 | cmd->toeplitz_hash_ipv6_32_35 = |
| 4047 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 4048 | cmd->toeplitz_hash_ipv6_36_39 = |
| 4049 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 4050 | cmd->toeplitz_hash_ipv6_40 = |
| 4051 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 4052 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4053 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4054 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 4055 | |
| 4056 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4057 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4058 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4059 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4060 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4061 | } |
| 4062 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4063 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4064 | } |
| 4065 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4066 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4067 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 4068 | * @wmi_handle: Pointer to wmi handle |
| 4069 | * @rate_report_params: Pointer to peer rate report parameters |
| 4070 | * |
| 4071 | * |
| 4072 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 4073 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4074 | 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] | 4075 | struct wmi_peer_rate_report_params *rate_report_params) |
| 4076 | { |
| 4077 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 4078 | wmi_buf_t buf = NULL; |
| 4079 | QDF_STATUS status = 0; |
| 4080 | uint32_t len = 0; |
| 4081 | uint32_t i, j; |
| 4082 | |
| 4083 | len = sizeof(*cmd); |
| 4084 | |
| 4085 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4086 | if (!buf) { |
| 4087 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 4088 | return QDF_STATUS_E_FAILURE; |
| 4089 | } |
| 4090 | |
| 4091 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 4092 | wmi_buf_data(buf); |
| 4093 | |
| 4094 | WMITLV_SET_HDR( |
| 4095 | &cmd->tlv_header, |
| 4096 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 4097 | WMITLV_GET_STRUCT_TLVLEN( |
| 4098 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 4099 | |
| 4100 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 4101 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 4102 | cmd->report_timer_period = rate_report_params->timer_period; |
| 4103 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 4104 | cmd->cond_per_phy[i].val_cond_flags = |
| 4105 | rate_report_params->report_per_phy[i].cond_flags; |
| 4106 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 4107 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 4108 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 4109 | rate_report_params->report_per_phy[i].delta.percent; |
| 4110 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 4111 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 4112 | rate_report_params->report_per_phy[i]. |
| 4113 | report_rate_threshold[j]; |
| 4114 | } |
| 4115 | } |
| 4116 | |
| 4117 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 4118 | cmd->enable_rate_report, |
| 4119 | cmd->report_backoff_time, cmd->report_timer_period); |
| 4120 | |
| 4121 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4122 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 4123 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4124 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4125 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 4126 | __func__); |
| 4127 | } |
| 4128 | return status; |
| 4129 | } |
| 4130 | |
| 4131 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4132 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 4133 | * @wmi_handle: wmi handle |
| 4134 | * @param: bcn ll cmd parameter |
| 4135 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4136 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4137 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4138 | 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] | 4139 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 4140 | { |
| 4141 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 4142 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4143 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4144 | |
| 4145 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4146 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4147 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4148 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4149 | } |
| 4150 | |
| 4151 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 4152 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4153 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 4154 | WMITLV_GET_STRUCT_TLVLEN |
| 4155 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 4156 | cmd->vdev_id = param->vdev_id; |
| 4157 | cmd->data_len = param->data_len; |
| 4158 | cmd->frame_ctrl = param->frame_ctrl; |
| 4159 | cmd->frag_ptr = param->frag_ptr; |
| 4160 | cmd->dtim_flag = param->dtim_flag; |
| 4161 | |
| 4162 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 4163 | WMI_PDEV_SEND_BCN_CMDID); |
| 4164 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4165 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4166 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4167 | wmi_buf_free(wmi_buf); |
| 4168 | } |
| 4169 | |
| 4170 | return ret; |
| 4171 | } |
| 4172 | |
| 4173 | /** |
| 4174 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 4175 | * @wmi_handle: wmi handle |
| 4176 | * @vdev_id: vdev id |
| 4177 | * @max_retries: max retries |
| 4178 | * @retry_interval: retry interval |
| 4179 | * This function sets sta query related parameters in fw. |
| 4180 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4181 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4182 | */ |
| 4183 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4184 | 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] | 4185 | uint8_t vdev_id, uint32_t max_retries, |
| 4186 | uint32_t retry_interval) |
| 4187 | { |
| 4188 | wmi_buf_t buf; |
| 4189 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 4190 | int len; |
| 4191 | |
| 4192 | len = sizeof(*cmd); |
| 4193 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4194 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4195 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 4196 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4197 | } |
| 4198 | |
| 4199 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 4200 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4201 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 4202 | WMITLV_GET_STRUCT_TLVLEN |
| 4203 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 4204 | |
| 4205 | |
| 4206 | cmd->vdev_id = vdev_id; |
| 4207 | cmd->sa_query_max_retry_count = max_retries; |
| 4208 | cmd->sa_query_retry_interval = retry_interval; |
| 4209 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4210 | 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] | 4211 | vdev_id, retry_interval, max_retries); |
| 4212 | |
| 4213 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4214 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4215 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4216 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4217 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4218 | } |
| 4219 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4220 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4221 | return 0; |
| 4222 | } |
| 4223 | |
| 4224 | /** |
| 4225 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 4226 | * @wmi_handle: wmi handle |
| 4227 | * @params: sta keep alive parameter |
| 4228 | * |
| 4229 | * This function sets keep alive related parameters in fw. |
| 4230 | * |
| 4231 | * Return: CDF status |
| 4232 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4233 | 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] | 4234 | struct sta_params *params) |
| 4235 | { |
| 4236 | wmi_buf_t buf; |
| 4237 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 4238 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 4239 | uint8_t *buf_ptr; |
| 4240 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4241 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4242 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4243 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4244 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4245 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 4246 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4247 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4248 | WMI_LOGE("wmi_buf_alloc failed"); |
| 4249 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4250 | } |
| 4251 | |
| 4252 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 4253 | buf_ptr = (uint8_t *) cmd; |
| 4254 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4255 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 4256 | WMITLV_GET_STRUCT_TLVLEN |
| 4257 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 4258 | cmd->interval = params->timeperiod; |
| 4259 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 4260 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4261 | 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] | 4262 | params->timeperiod, params->method); |
| 4263 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 4264 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 4265 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 4266 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 4267 | |
| 4268 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 4269 | if ((NULL == params->hostv4addr) || |
| 4270 | (NULL == params->destv4addr) || |
| 4271 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4272 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4273 | "destv4addr:%p destmac:%p ", __func__, |
| 4274 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4275 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4276 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4277 | } |
| 4278 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4279 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4280 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4281 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4282 | WMI_IPV4_ADDR_LEN); |
| 4283 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 4284 | } else { |
| 4285 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 4286 | } |
| 4287 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4288 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4289 | WMI_STA_KEEPALIVE_CMDID); |
| 4290 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4291 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4292 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4293 | } |
| 4294 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4295 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4296 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4297 | } |
| 4298 | |
| 4299 | /** |
| 4300 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 4301 | * @wmi_handle: wmi handle |
| 4302 | * @if_id: vdev id |
| 4303 | * @gtx_info: GTX config params |
| 4304 | * |
| 4305 | * This function set GTX related params in firmware. |
| 4306 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4307 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4308 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4309 | 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] | 4310 | struct wmi_gtx_config *gtx_info) |
| 4311 | { |
| 4312 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 4313 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4314 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4315 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4316 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4317 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4318 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4319 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4320 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4321 | } |
| 4322 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 4323 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4324 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 4325 | WMITLV_GET_STRUCT_TLVLEN |
| 4326 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 4327 | cmd->vdev_id = if_id; |
| 4328 | |
| 4329 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 4330 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 4331 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 4332 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 4333 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 4334 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 4335 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 4336 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 4337 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4338 | 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] | 4339 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 4340 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 4341 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 4342 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 4343 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4344 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4345 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4346 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4347 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 4348 | wmi_buf_free(buf); |
| 4349 | } |
| 4350 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4351 | } |
| 4352 | |
| 4353 | /** |
| 4354 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 4355 | * @wmi_handle: wmi handle |
| 4356 | * @edca_params: edca parameters |
| 4357 | * |
| 4358 | * This function updates EDCA parameters to the target |
| 4359 | * |
| 4360 | * Return: CDF Status |
| 4361 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4362 | 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] | 4363 | uint8_t vdev_id, |
| 4364 | wmi_wmm_vparams gwmm_param[WMI_MAX_NUM_AC]) |
| 4365 | { |
| 4366 | uint8_t *buf_ptr; |
| 4367 | wmi_buf_t buf; |
| 4368 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
| 4369 | wmi_wmm_vparams *wmm_param, *twmm_param; |
| 4370 | int len = sizeof(*cmd); |
| 4371 | int ac; |
| 4372 | |
| 4373 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4374 | |
| 4375 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4376 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4377 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4378 | } |
| 4379 | |
| 4380 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4381 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 4382 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4383 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4384 | WMITLV_GET_STRUCT_TLVLEN |
| 4385 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 4386 | cmd->vdev_id = vdev_id; |
| 4387 | |
| 4388 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 4389 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
| 4390 | twmm_param = (wmi_wmm_vparams *) (&gwmm_param[ac]); |
| 4391 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 4392 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4393 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 4394 | wmm_param->cwmin = twmm_param->cwmin; |
| 4395 | wmm_param->cwmax = twmm_param->cwmax; |
| 4396 | wmm_param->aifs = twmm_param->aifs; |
| 4397 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 4398 | wmm_param->acm = twmm_param->acm; |
| 4399 | wmm_param->no_ack = twmm_param->no_ack; |
| 4400 | } |
| 4401 | |
| 4402 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4403 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 4404 | goto fail; |
| 4405 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4406 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4407 | |
| 4408 | fail: |
| 4409 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4410 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 4411 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4412 | } |
| 4413 | |
| 4414 | /** |
| 4415 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 4416 | * @wmi_handle: wmi handle |
| 4417 | * @vdev_id: vdev id |
| 4418 | * @probe_rsp_info: probe response info |
| 4419 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4420 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4421 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4422 | 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] | 4423 | uint8_t vdev_id, |
| 4424 | struct wmi_probe_resp_params *probe_rsp_info, |
| 4425 | uint8_t *frm) |
| 4426 | { |
| 4427 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 4428 | wmi_bcn_prb_info *bcn_prb_info; |
| 4429 | wmi_buf_t wmi_buf; |
| 4430 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 4431 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4432 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4433 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4434 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4435 | |
| 4436 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 4437 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 4438 | |
| 4439 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 4440 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 4441 | tmpl_len_aligned; |
| 4442 | |
| 4443 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4444 | 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] | 4445 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4446 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4447 | } |
| 4448 | |
| 4449 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4450 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4451 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4452 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4453 | } |
| 4454 | |
| 4455 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4456 | |
| 4457 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 4458 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4459 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 4460 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 4461 | cmd->vdev_id = vdev_id; |
| 4462 | cmd->buf_len = tmpl_len; |
| 4463 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 4464 | |
| 4465 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4466 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4467 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4468 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4469 | bcn_prb_info->caps = 0; |
| 4470 | bcn_prb_info->erp = 0; |
| 4471 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4472 | |
| 4473 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4474 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4475 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4476 | |
| 4477 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4478 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4479 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4480 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4481 | wmi_buf_free(wmi_buf); |
| 4482 | } |
| 4483 | |
| 4484 | return ret; |
| 4485 | } |
| 4486 | |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4487 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4488 | #define WPI_IV_LEN 16 |
| 4489 | |
| 4490 | /** |
| 4491 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4492 | * |
| 4493 | * @dest_tx: destination address of tsc key counter |
| 4494 | * @src_tx: source address of tsc key counter |
| 4495 | * @dest_rx: destination address of rsc key counter |
| 4496 | * @src_rx: source address of rsc key counter |
| 4497 | * |
| 4498 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4499 | * |
| 4500 | * Return: None |
| 4501 | * |
| 4502 | */ |
| 4503 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4504 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4505 | { |
| 4506 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4507 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4508 | } |
| 4509 | #else |
| 4510 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4511 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4512 | { |
| 4513 | return; |
| 4514 | } |
| 4515 | #endif |
| 4516 | |
| 4517 | /** |
| 4518 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4519 | * @wmi_handle: wmi handle |
| 4520 | * @key_params: key parameters |
| 4521 | * |
| 4522 | * This function fills structure from information |
| 4523 | * passed in key_params. |
| 4524 | * |
| 4525 | * Return: QDF_STATUS_SUCCESS - success |
| 4526 | * QDF_STATUS_E_FAILURE - failure |
| 4527 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4528 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4529 | 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] | 4530 | struct set_key_params *key_params) |
| 4531 | { |
| 4532 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4533 | wmi_buf_t buf; |
| 4534 | uint8_t *buf_ptr; |
| 4535 | uint32_t len; |
| 4536 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4537 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4538 | |
| 4539 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4540 | WMI_TLV_HDR_SIZE; |
| 4541 | |
| 4542 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4543 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4544 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4545 | return QDF_STATUS_E_NOMEM; |
| 4546 | } |
| 4547 | |
| 4548 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4549 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4550 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4551 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4552 | WMITLV_GET_STRUCT_TLVLEN |
| 4553 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4554 | cmd->vdev_id = key_params->vdev_id; |
| 4555 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4556 | |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4557 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4558 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4559 | cmd->key_flags |= key_params->key_flags; |
| 4560 | cmd->key_cipher = key_params->key_cipher; |
| 4561 | if ((key_params->key_txmic_len) && |
| 4562 | (key_params->key_rxmic_len)) { |
| 4563 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4564 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4565 | } |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4566 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4567 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4568 | key_params->tx_iv, |
| 4569 | cmd->wpi_key_rsc_counter, |
| 4570 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4571 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4572 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4573 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4574 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4575 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4576 | qdf_mem_copy((void *)key_data, |
| 4577 | (const void *)key_params->key_data, key_params->key_len); |
| 4578 | cmd->key_len = key_params->key_len; |
| 4579 | |
| 4580 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4581 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4582 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4583 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4584 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4585 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4586 | } |
| 4587 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4588 | /** |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 4589 | * send_sar_limit_cmd_tlv() - send sar limit cmd to fw |
| 4590 | * @wmi_handle: wmi handle |
| 4591 | * @params: sar limit params |
| 4592 | * |
| 4593 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4594 | */ |
| 4595 | static QDF_STATUS send_sar_limit_cmd_tlv(wmi_unified_t wmi_handle, |
| 4596 | struct sar_limit_cmd_params *sar_limit_params) |
| 4597 | { |
| 4598 | wmi_buf_t buf; |
| 4599 | QDF_STATUS qdf_status; |
| 4600 | wmi_sar_limits_cmd_fixed_param *cmd; |
| 4601 | int i; |
| 4602 | uint8_t *buf_ptr; |
| 4603 | wmi_sar_limit_cmd_row *wmi_sar_rows_list; |
| 4604 | struct sar_limit_cmd_row *sar_rows_list; |
| 4605 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4606 | |
| 4607 | len += sizeof(wmi_sar_limit_cmd_row) * sar_limit_params->num_limit_rows; |
| 4608 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4609 | if (!buf) { |
| 4610 | WMI_LOGE("Failed to allocate memory"); |
| 4611 | qdf_status = QDF_STATUS_E_NOMEM; |
| 4612 | goto end; |
| 4613 | } |
| 4614 | |
| 4615 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4616 | cmd = (wmi_sar_limits_cmd_fixed_param *) buf_ptr; |
| 4617 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4618 | WMITLV_TAG_STRUC_wmi_sar_limits_cmd_fixed_param, |
| 4619 | WMITLV_GET_STRUCT_TLVLEN |
| 4620 | (wmi_sar_limits_cmd_fixed_param)); |
| 4621 | cmd->sar_enable = sar_limit_params->sar_enable; |
| 4622 | cmd->commit_limits = sar_limit_params->commit_limits; |
| 4623 | cmd->num_limit_rows = sar_limit_params->num_limit_rows; |
| 4624 | |
| 4625 | WMI_LOGD("no of sar rows = %d, len = %d", |
| 4626 | sar_limit_params->num_limit_rows, len); |
| 4627 | buf_ptr += sizeof(*cmd); |
| 4628 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4629 | sizeof(wmi_sar_limit_cmd_row) * |
| 4630 | sar_limit_params->num_limit_rows); |
| 4631 | if (cmd->num_limit_rows == 0) |
| 4632 | goto send_sar_limits; |
| 4633 | |
| 4634 | wmi_sar_rows_list = (wmi_sar_limit_cmd_row *) |
| 4635 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4636 | sar_rows_list = sar_limit_params->sar_limit_row_list; |
| 4637 | |
| 4638 | for (i = 0; i < sar_limit_params->num_limit_rows; i++) { |
| 4639 | WMITLV_SET_HDR(&wmi_sar_rows_list->tlv_header, |
| 4640 | WMITLV_TAG_STRUC_wmi_sar_limit_cmd_row, |
| 4641 | WMITLV_GET_STRUCT_TLVLEN(wmi_sar_limit_cmd_row)); |
| 4642 | wmi_sar_rows_list->band_id = sar_rows_list->band_id; |
| 4643 | wmi_sar_rows_list->chain_id = sar_rows_list->chain_id; |
| 4644 | wmi_sar_rows_list->mod_id = sar_rows_list->mod_id; |
| 4645 | wmi_sar_rows_list->limit_value = sar_rows_list->limit_value; |
| 4646 | wmi_sar_rows_list->validity_bitmap = |
| 4647 | sar_rows_list->validity_bitmap; |
| 4648 | WMI_LOGD("row %d, band_id = %d, chain_id = %d, mod_id = %d, limit_value = %d, validity_bitmap = %d", |
| 4649 | i, wmi_sar_rows_list->band_id, |
| 4650 | wmi_sar_rows_list->chain_id, |
| 4651 | wmi_sar_rows_list->mod_id, |
| 4652 | wmi_sar_rows_list->limit_value, |
| 4653 | wmi_sar_rows_list->validity_bitmap); |
| 4654 | sar_rows_list++; |
| 4655 | wmi_sar_rows_list++; |
| 4656 | } |
| 4657 | send_sar_limits: |
| 4658 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4659 | WMI_SAR_LIMITS_CMDID); |
| 4660 | |
| 4661 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 4662 | WMI_LOGE("Failed to send WMI_SAR_LIMITS_CMDID"); |
| 4663 | wmi_buf_free(buf); |
| 4664 | } |
| 4665 | |
| 4666 | end: |
| 4667 | return qdf_status; |
| 4668 | } |
| 4669 | |
| 4670 | /** |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4671 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 4672 | * @wmi_handle: wmi handle |
| 4673 | * @params: encrypt/decrypt params |
| 4674 | * |
| 4675 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4676 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 4677 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4678 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 4679 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 4680 | { |
| 4681 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 4682 | wmi_buf_t wmi_buf; |
| 4683 | uint8_t *buf_ptr; |
| 4684 | QDF_STATUS ret; |
| 4685 | uint32_t len; |
| 4686 | |
| 4687 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 4688 | |
| 4689 | len = sizeof(*cmd) + |
| 4690 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 4691 | WMI_TLV_HDR_SIZE; |
| 4692 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4693 | if (!wmi_buf) { |
| 4694 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 4695 | __func__); |
| 4696 | return QDF_STATUS_E_NOMEM; |
| 4697 | } |
| 4698 | |
| 4699 | buf_ptr = wmi_buf_data(wmi_buf); |
| 4700 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 4701 | |
| 4702 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4703 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 4704 | WMITLV_GET_STRUCT_TLVLEN( |
| 4705 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 4706 | |
| 4707 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 4708 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 4709 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 4710 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 4711 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 4712 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 4713 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 4714 | |
| 4715 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 4716 | encrypt_decrypt_params->key_len); |
| 4717 | |
| 4718 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 4719 | MAX_MAC_HEADER_LEN); |
| 4720 | |
| 4721 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 4722 | |
| 4723 | if (cmd->data_len) { |
| 4724 | buf_ptr += sizeof(*cmd); |
| 4725 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4726 | roundup(encrypt_decrypt_params->data_len, |
| 4727 | sizeof(A_UINT32))); |
| 4728 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4729 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 4730 | encrypt_decrypt_params->data_len); |
| 4731 | } |
| 4732 | |
| 4733 | /* This conversion is to facilitate data to FW in little endian */ |
| 4734 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 4735 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 4736 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 4737 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 4738 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 4739 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 4740 | |
| 4741 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4742 | wmi_buf, len, |
| 4743 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 4744 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4745 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 4746 | wmi_buf_free(wmi_buf); |
| 4747 | } |
| 4748 | |
| 4749 | return ret; |
| 4750 | } |
| 4751 | |
| 4752 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4753 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4754 | /** |
| 4755 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 4756 | * @wmi_handle: wmi handle |
| 4757 | * @vdev_id: vdev id |
| 4758 | * @p2p_ie: p2p IE |
| 4759 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4760 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4761 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4762 | 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] | 4763 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 4764 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4765 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4766 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 4767 | wmi_buf_t wmi_buf; |
| 4768 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 4769 | uint8_t *buf_ptr; |
| 4770 | |
| 4771 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 4772 | |
| 4773 | /* More than one P2P IE may be included in a single frame. |
| 4774 | If multiple P2P IEs are present, the complete P2P attribute |
| 4775 | data consists of the concatenation of the P2P Attribute |
| 4776 | fields of the P2P IEs. The P2P Attributes field of each |
| 4777 | P2P IE may be any length up to the maximum (251 octets). |
| 4778 | In this case host sends one P2P IE to firmware so the length |
| 4779 | should not exceed more than 251 bytes |
| 4780 | */ |
| 4781 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4782 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4783 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4784 | } |
| 4785 | |
| 4786 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 4787 | |
| 4788 | wmi_buf_len = |
| 4789 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 4790 | WMI_TLV_HDR_SIZE; |
| 4791 | |
| 4792 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4793 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4794 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4795 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4796 | } |
| 4797 | |
| 4798 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4799 | |
| 4800 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 4801 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4802 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 4803 | WMITLV_GET_STRUCT_TLVLEN |
| 4804 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 4805 | cmd->vdev_id = vdev_id; |
| 4806 | cmd->ie_buf_len = ie_len; |
| 4807 | |
| 4808 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 4809 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 4810 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4811 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4812 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4813 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4814 | |
| 4815 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4816 | wmi_buf, wmi_buf_len, |
| 4817 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4818 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4819 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4820 | wmi_buf_free(wmi_buf); |
| 4821 | } |
| 4822 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4823 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4824 | return ret; |
| 4825 | } |
| 4826 | |
| 4827 | /** |
| 4828 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 4829 | * @wmi_handle: wmi handle |
| 4830 | * @req: gateway parameter update request structure |
| 4831 | * |
| 4832 | * This function reads the incoming @req and fill in the destination |
| 4833 | * WMI structure and sends down the gateway configs down to the firmware |
| 4834 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4835 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4836 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4837 | 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] | 4838 | struct gateway_update_req_param *req) |
| 4839 | { |
| 4840 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 4841 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4842 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4843 | int len = sizeof(*cmd); |
| 4844 | |
| 4845 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4846 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4847 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4848 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4849 | } |
| 4850 | |
| 4851 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 4852 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4853 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 4854 | WMITLV_GET_STRUCT_TLVLEN( |
| 4855 | wmi_roam_subnet_change_config_fixed_param)); |
| 4856 | |
| 4857 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4858 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 4859 | QDF_IPV4_ADDR_SIZE); |
| 4860 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 4861 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4862 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 4863 | &cmd->inet_gw_mac_addr); |
| 4864 | cmd->max_retries = req->max_retries; |
| 4865 | cmd->timeout = req->timeout; |
| 4866 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 4867 | cmd->flag = 0; |
| 4868 | if (req->ipv4_addr_type) |
| 4869 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 4870 | |
| 4871 | if (req->ipv6_addr_type) |
| 4872 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 4873 | |
| 4874 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4875 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4876 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4877 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4878 | ret); |
| 4879 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4880 | } |
| 4881 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4882 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4883 | } |
| 4884 | |
| 4885 | /** |
| 4886 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 4887 | * @wmi_handle: wmi handle |
| 4888 | * @req: rssi monitoring request structure |
| 4889 | * |
| 4890 | * This function reads the incoming @req and fill in the destination |
| 4891 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 4892 | * |
| 4893 | * Return: 0 on success; error number otherwise |
| 4894 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4895 | 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] | 4896 | struct rssi_monitor_param *req) |
| 4897 | { |
| 4898 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 4899 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4900 | QDF_STATUS ret; |
| 4901 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4902 | |
| 4903 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4904 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4905 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4906 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4907 | } |
| 4908 | |
| 4909 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 4910 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4911 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 4912 | WMITLV_GET_STRUCT_TLVLEN( |
| 4913 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 4914 | |
| 4915 | cmd->vdev_id = req->session_id; |
| 4916 | cmd->request_id = req->request_id; |
| 4917 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 4918 | cmd->hi_rssi_reenable_histeresis = 0; |
| 4919 | cmd->min_report_interval = 0; |
| 4920 | cmd->max_num_report = 1; |
| 4921 | if (req->control) { |
| 4922 | /* enable one threshold for each min/max */ |
| 4923 | cmd->enabled_bitmap = 0x09; |
| 4924 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 4925 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 4926 | } else { |
| 4927 | cmd->enabled_bitmap = 0; |
| 4928 | cmd->low_rssi_breach_threshold[0] = 0; |
| 4929 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 4930 | } |
| 4931 | |
| 4932 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4933 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4934 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4935 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4936 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4937 | } |
| 4938 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4939 | WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4940 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4941 | } |
| 4942 | |
| 4943 | /** |
| 4944 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 4945 | * @wmi_handle: wmi handle |
| 4946 | * @psetoui: OUI parameters |
| 4947 | * |
| 4948 | * set scan probe OUI parameters in firmware |
| 4949 | * |
| 4950 | * Return: CDF status |
| 4951 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4952 | 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] | 4953 | struct scan_mac_oui *psetoui) |
| 4954 | { |
| 4955 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 4956 | wmi_buf_t wmi_buf; |
| 4957 | uint32_t len; |
| 4958 | uint8_t *buf_ptr; |
| 4959 | uint32_t *oui_buf; |
| 4960 | |
| 4961 | len = sizeof(*cmd); |
| 4962 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4963 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4964 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4965 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4966 | } |
| 4967 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4968 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 4969 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4970 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 4971 | WMITLV_GET_STRUCT_TLVLEN |
| 4972 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 4973 | |
| 4974 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4975 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4976 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 4977 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4978 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4979 | cmd->prob_req_oui); |
| 4980 | |
| 4981 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4982 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4983 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4984 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4985 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4986 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4987 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4988 | } |
| 4989 | |
| 4990 | /** |
| 4991 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 4992 | * @wmi_handle: wmi handle |
| 4993 | * @req: passpoint network request structure |
| 4994 | * |
| 4995 | * This function sends down WMI command with network id set to wildcard id. |
| 4996 | * firmware shall clear all the config entries |
| 4997 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4998 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4999 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5000 | 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] | 5001 | struct wifi_passpoint_req_param *req) |
| 5002 | { |
| 5003 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5004 | wmi_buf_t buf; |
| 5005 | uint32_t len; |
| 5006 | int ret; |
| 5007 | |
| 5008 | len = sizeof(*cmd); |
| 5009 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5010 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5011 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5012 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5013 | } |
| 5014 | |
| 5015 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5016 | |
| 5017 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5018 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5019 | WMITLV_GET_STRUCT_TLVLEN( |
| 5020 | wmi_passpoint_config_cmd_fixed_param)); |
| 5021 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 5022 | |
| 5023 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5024 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5025 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5026 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5027 | __func__); |
| 5028 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5029 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5030 | } |
| 5031 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5032 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5033 | } |
| 5034 | |
| 5035 | /** |
| 5036 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 5037 | * @wmi_handle: wmi handle |
| 5038 | * @req: passpoint network request structure |
| 5039 | * |
| 5040 | * This function reads the incoming @req and fill in the destination |
| 5041 | * WMI structure and send down the passpoint configs down to the firmware |
| 5042 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5043 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5044 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5045 | 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] | 5046 | struct wifi_passpoint_req_param *req) |
| 5047 | { |
| 5048 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5049 | u_int8_t i, j, *bytes; |
| 5050 | wmi_buf_t buf; |
| 5051 | uint32_t len; |
| 5052 | int ret; |
| 5053 | |
| 5054 | len = sizeof(*cmd); |
| 5055 | for (i = 0; i < req->num_networks; i++) { |
| 5056 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5057 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5058 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5059 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5060 | } |
| 5061 | |
| 5062 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 5063 | wmi_buf_data(buf); |
| 5064 | |
| 5065 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5066 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5067 | WMITLV_GET_STRUCT_TLVLEN( |
| 5068 | wmi_passpoint_config_cmd_fixed_param)); |
| 5069 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5070 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 5071 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5072 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5073 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5074 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 5075 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5076 | 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] | 5077 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 5078 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 5079 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5080 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5081 | &req->networks[i].roaming_consortium_ids[j], |
| 5082 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 5083 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5084 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5085 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5086 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5087 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 5088 | |
| 5089 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5090 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5091 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5092 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5093 | __func__); |
| 5094 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5095 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5096 | } |
| 5097 | } |
| 5098 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5099 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5100 | } |
| 5101 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5102 | /** |
| 5103 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 5104 | * @wmi_handle: wmi handle |
| 5105 | * @scan_cmd_fp: start scan command ptr |
| 5106 | * @roam_req: roam request param |
| 5107 | * |
| 5108 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 5109 | * of WMI_ROAM_SCAN_MODE. |
| 5110 | * |
| 5111 | * Return: QDF status |
| 5112 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5113 | 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] | 5114 | wmi_start_scan_cmd_fixed_param * |
| 5115 | scan_cmd_fp, |
| 5116 | struct roam_offload_scan_params *roam_req) |
| 5117 | { |
| 5118 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5119 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5120 | int len; |
| 5121 | uint8_t *buf_ptr; |
| 5122 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5123 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5124 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5125 | int auth_mode = roam_req->auth_mode; |
| 5126 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 5127 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 5128 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 5129 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5130 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5131 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5132 | /* Need to create a buf with roam_scan command at |
| 5133 | * front and piggyback with scan command */ |
| 5134 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 5135 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5136 | (2 * WMI_TLV_HDR_SIZE) + |
| 5137 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5138 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 5139 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5140 | if (roam_req->is_roam_req_valid && |
| 5141 | roam_req->roam_offload_enabled) { |
| 5142 | len += sizeof(wmi_roam_offload_tlv_param); |
| 5143 | len += WMI_TLV_HDR_SIZE; |
| 5144 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5145 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5146 | (auth_mode == WMI_AUTH_OPEN && |
| 5147 | roam_req->mdid.mdie_present) || |
| 5148 | roam_req->is_ese_assoc)) { |
| 5149 | len += WMI_TLV_HDR_SIZE; |
| 5150 | if (roam_req->is_ese_assoc) |
| 5151 | len += |
| 5152 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5153 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 5154 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 5155 | (auth_mode == WMI_AUTH_OPEN && |
| 5156 | roam_req->mdid.mdie_present)) |
| 5157 | len += |
| 5158 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5159 | else |
| 5160 | len += |
| 5161 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5162 | } else { |
| 5163 | len += WMI_TLV_HDR_SIZE; |
| 5164 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5165 | |
| 5166 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 5167 | + roundup(roam_req->assoc_ie_length, |
| 5168 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5169 | } else { |
| 5170 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5171 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5172 | __func__, roam_req->roam_offload_enabled); |
| 5173 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5174 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5175 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5176 | } |
| 5177 | if (roam_req->is_roam_req_valid && |
| 5178 | roam_req->roam_offload_enabled) { |
| 5179 | roam_req->mode = roam_req->mode | |
| 5180 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 5181 | } |
| 5182 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5183 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5184 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 5185 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 5186 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 5187 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5188 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5189 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5190 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5191 | return QDF_STATUS_E_NOMEM; |
| 5192 | } |
| 5193 | |
| 5194 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5195 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5196 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 5197 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 5198 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 5199 | WMITLV_GET_STRUCT_TLVLEN |
| 5200 | (wmi_roam_scan_mode_fixed_param)); |
| 5201 | |
| 5202 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 5203 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5204 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 5205 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 5206 | goto send_roam_scan_mode_cmd; |
| 5207 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5208 | /* Fill in scan parameters suitable for roaming scan */ |
| 5209 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5210 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5211 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 5212 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 5213 | /* Ensure there is no additional IEs */ |
| 5214 | scan_cmd_fp->ie_len = 0; |
| 5215 | WMITLV_SET_HDR(buf_ptr, |
| 5216 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 5217 | WMITLV_GET_STRUCT_TLVLEN |
| 5218 | (wmi_start_scan_cmd_fixed_param)); |
| 5219 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5220 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 5221 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 5222 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5223 | sizeof(wmi_roam_offload_tlv_param)); |
| 5224 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5225 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 5226 | WMITLV_SET_HDR(buf_ptr, |
| 5227 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 5228 | WMITLV_GET_STRUCT_TLVLEN |
| 5229 | (wmi_roam_offload_tlv_param)); |
| 5230 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 5231 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 5232 | roam_offload_params->select_5g_margin = |
| 5233 | roam_req->select_5ghz_margin; |
| 5234 | roam_offload_params->reassoc_failure_timeout = |
| 5235 | roam_req->reassoc_failure_timeout; |
| 5236 | |
| 5237 | /* Fill the capabilities */ |
| 5238 | roam_offload_params->capability = |
| 5239 | roam_req->roam_offload_params.capability; |
| 5240 | roam_offload_params->ht_caps_info = |
| 5241 | roam_req->roam_offload_params.ht_caps_info; |
| 5242 | roam_offload_params->ampdu_param = |
| 5243 | roam_req->roam_offload_params.ampdu_param; |
| 5244 | roam_offload_params->ht_ext_cap = |
| 5245 | roam_req->roam_offload_params.ht_ext_cap; |
| 5246 | roam_offload_params->ht_txbf = |
| 5247 | roam_req->roam_offload_params.ht_txbf; |
| 5248 | roam_offload_params->asel_cap = |
| 5249 | roam_req->roam_offload_params.asel_cap; |
| 5250 | roam_offload_params->qos_caps = |
| 5251 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 5252 | roam_offload_params->qos_enabled = |
| 5253 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5254 | roam_offload_params->wmm_caps = |
| 5255 | roam_req->roam_offload_params.wmm_caps; |
| 5256 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 5257 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 5258 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 5259 | |
| 5260 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 5261 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 5262 | * they are filled in the same order.Depending on the |
| 5263 | * authentication type, the other mode TLV's are nullified |
| 5264 | * and only headers are filled.*/ |
| 5265 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5266 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5267 | (auth_mode == WMI_AUTH_OPEN |
| 5268 | && roam_req->mdid.mdie_present) || |
| 5269 | roam_req->is_ese_assoc)) { |
| 5270 | if (roam_req->is_ese_assoc) { |
| 5271 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5272 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5273 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5274 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5275 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5276 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5277 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5278 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 5279 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5280 | roam_offload_ese = |
| 5281 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 5282 | qdf_mem_copy(roam_offload_ese->krk, |
| 5283 | roam_req->krk, |
| 5284 | sizeof(roam_req->krk)); |
| 5285 | qdf_mem_copy(roam_offload_ese->btk, |
| 5286 | roam_req->btk, |
| 5287 | sizeof(roam_req->btk)); |
| 5288 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 5289 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 5290 | WMITLV_GET_STRUCT_TLVLEN |
| 5291 | (wmi_roam_ese_offload_tlv_param)); |
| 5292 | buf_ptr += |
| 5293 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5294 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 5295 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 5296 | || (auth_mode == WMI_AUTH_OPEN |
| 5297 | && roam_req->mdid.mdie_present)) { |
| 5298 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5299 | 0); |
| 5300 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5301 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5302 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 5303 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5304 | roam_offload_11r = |
| 5305 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 5306 | roam_offload_11r->r0kh_id_len = |
| 5307 | roam_req->rokh_id_length; |
| 5308 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 5309 | roam_req->rokh_id, |
| 5310 | roam_offload_11r->r0kh_id_len); |
| 5311 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 5312 | roam_req->psk_pmk, |
| 5313 | sizeof(roam_req->psk_pmk)); |
| 5314 | roam_offload_11r->psk_msk_len = |
| 5315 | roam_req->pmk_len; |
| 5316 | roam_offload_11r->mdie_present = |
| 5317 | roam_req->mdid.mdie_present; |
| 5318 | roam_offload_11r->mdid = |
| 5319 | roam_req->mdid.mobility_domain; |
| 5320 | if (auth_mode == WMI_AUTH_OPEN) { |
| 5321 | /* If FT-Open ensure pmk length |
| 5322 | and r0khid len are zero */ |
| 5323 | roam_offload_11r->r0kh_id_len = 0; |
| 5324 | roam_offload_11r->psk_msk_len = 0; |
| 5325 | } |
| 5326 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 5327 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 5328 | WMITLV_GET_STRUCT_TLVLEN |
| 5329 | (wmi_roam_11r_offload_tlv_param)); |
| 5330 | buf_ptr += |
| 5331 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5332 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5333 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5334 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5335 | } else { |
| 5336 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5337 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 5338 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5339 | roam_offload_11i = |
| 5340 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 5341 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 5342 | roam_req->okc_enabled) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5343 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 5344 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5345 | WMI_LOGE("LFR3:OKC Enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5346 | } else { |
| 5347 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 5348 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5349 | WMI_LOGE("LFR3:OKC Disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5350 | } |
| 5351 | |
| 5352 | qdf_mem_copy(roam_offload_11i->pmk, |
| 5353 | roam_req->psk_pmk, |
| 5354 | sizeof(roam_req->psk_pmk)); |
| 5355 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 5356 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 5357 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 5358 | WMITLV_GET_STRUCT_TLVLEN |
| 5359 | (wmi_roam_11i_offload_tlv_param)); |
| 5360 | buf_ptr += |
| 5361 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5362 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5363 | 0); |
| 5364 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5365 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5366 | 0); |
| 5367 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5368 | } |
| 5369 | } else { |
| 5370 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5371 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5372 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5373 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5374 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5375 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5376 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5377 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5378 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5379 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5380 | |
| 5381 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5382 | sizeof(*assoc_ies)); |
| 5383 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5384 | |
| 5385 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 5386 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 5387 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 5388 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 5389 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 5390 | |
| 5391 | buf_ptr += sizeof(*assoc_ies); |
| 5392 | |
| 5393 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5394 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 5395 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5396 | |
| 5397 | if (assoc_ies->buf_len != 0) { |
| 5398 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 5399 | assoc_ies->buf_len); |
| 5400 | } |
| 5401 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5402 | } else { |
| 5403 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5404 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5405 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5406 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5407 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5408 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5409 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5410 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5411 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5412 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5413 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5414 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5415 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5416 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5417 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5418 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5419 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5420 | } |
| 5421 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5422 | |
| 5423 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5424 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5425 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5426 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5427 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5428 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 5429 | status); |
| 5430 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5431 | } |
| 5432 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5433 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5434 | } |
| 5435 | |
| 5436 | |
| 5437 | /** |
| 5438 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 5439 | * rssi threashold |
| 5440 | * @wmi_handle: wmi handle |
| 5441 | * @roam_req: Roaming request buffer |
| 5442 | * |
| 5443 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 5444 | * |
| 5445 | * Return: QDF status |
| 5446 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5447 | 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] | 5448 | struct roam_offload_scan_rssi_params *roam_req) |
| 5449 | { |
| 5450 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5451 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5452 | int len; |
| 5453 | uint8_t *buf_ptr; |
| 5454 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 5455 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 5456 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5457 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5458 | |
| 5459 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5460 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5461 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5462 | len += WMI_TLV_HDR_SIZE; |
| 5463 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5464 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 5465 | len += sizeof(wmi_roam_dense_thres_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5466 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5467 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5468 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5469 | return QDF_STATUS_E_NOMEM; |
| 5470 | } |
| 5471 | |
| 5472 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5473 | rssi_threshold_fp = |
| 5474 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 5475 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 5476 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 5477 | WMITLV_GET_STRUCT_TLVLEN |
| 5478 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 5479 | /* fill in threshold values */ |
| 5480 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 5481 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 5482 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 5483 | rssi_threshold_fp->hirssi_scan_max_count = |
| 5484 | roam_req->hi_rssi_scan_max_count; |
| 5485 | rssi_threshold_fp->hirssi_scan_delta = |
| 5486 | roam_req->hi_rssi_scan_rssi_delta; |
| 5487 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
| 5488 | |
| 5489 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5490 | WMITLV_SET_HDR(buf_ptr, |
| 5491 | WMITLV_TAG_ARRAY_STRUC, |
| 5492 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 5493 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5494 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 5495 | |
| 5496 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 5497 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 5498 | ext_thresholds->boost_threshold_5g = |
| 5499 | roam_req->boost_threshold_5g; |
| 5500 | |
| 5501 | ext_thresholds->boost_algorithm_5g = |
| 5502 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5503 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 5504 | ext_thresholds->penalty_algorithm_5g = |
| 5505 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5506 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 5507 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 5508 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 5509 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 5510 | |
| 5511 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 5512 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 5513 | WMITLV_GET_STRUCT_TLVLEN |
| 5514 | (wmi_roam_scan_extended_threshold_param)); |
| 5515 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5516 | WMITLV_SET_HDR(buf_ptr, |
| 5517 | WMITLV_TAG_ARRAY_STRUC, |
| 5518 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 5519 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5520 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 5521 | early_stop_thresholds->roam_earlystop_thres_min = |
| 5522 | roam_req->roam_earlystop_thres_min; |
| 5523 | early_stop_thresholds->roam_earlystop_thres_max = |
| 5524 | roam_req->roam_earlystop_thres_max; |
| 5525 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 5526 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 5527 | WMITLV_GET_STRUCT_TLVLEN |
| 5528 | (wmi_roam_earlystop_rssi_thres_param)); |
| 5529 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5530 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 5531 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5532 | sizeof(wmi_roam_dense_thres_param)); |
| 5533 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5534 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 5535 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 5536 | roam_req->dense_rssi_thresh_offset; |
| 5537 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 5538 | dense_thresholds->roam_dense_traffic_thres = |
| 5539 | roam_req->traffic_threshold; |
| 5540 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 5541 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 5542 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 5543 | WMITLV_GET_STRUCT_TLVLEN |
| 5544 | (wmi_roam_dense_thres_param)); |
| 5545 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5546 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5547 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5548 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5549 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5550 | status); |
| 5551 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5552 | } |
| 5553 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5554 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5555 | } |
| 5556 | |
| 5557 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5558 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 5559 | * configuration params |
| 5560 | * @wma_handle: wma handler |
| 5561 | * @dwelltime_params: pointer to dwelltime_params |
| 5562 | * |
| 5563 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 5564 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5565 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5566 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5567 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 5568 | { |
| 5569 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 5570 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 5571 | wmi_buf_t buf; |
| 5572 | uint8_t *buf_ptr; |
| 5573 | int32_t err; |
| 5574 | int len; |
| 5575 | |
| 5576 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5577 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5578 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 5579 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5580 | if (!buf) { |
| 5581 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 5582 | __func__); |
| 5583 | return QDF_STATUS_E_NOMEM; |
| 5584 | } |
| 5585 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5586 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 5587 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 5588 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 5589 | WMITLV_GET_STRUCT_TLVLEN |
| 5590 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 5591 | |
| 5592 | dwell_param->enable = dwelltime_params->is_enabled; |
| 5593 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5594 | WMITLV_SET_HDR(buf_ptr, |
| 5595 | WMITLV_TAG_ARRAY_STRUC, |
| 5596 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5597 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5598 | |
| 5599 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 5600 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5601 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 5602 | WMITLV_GET_STRUCT_TLVLEN( |
| 5603 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5604 | |
| 5605 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 5606 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 5607 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 5608 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 5609 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 5610 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 5611 | if (err) { |
| 5612 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 5613 | wmi_buf_free(buf); |
| 5614 | return QDF_STATUS_E_FAILURE; |
| 5615 | } |
| 5616 | |
| 5617 | return QDF_STATUS_SUCCESS; |
| 5618 | } |
| 5619 | |
| 5620 | |
| 5621 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5622 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 5623 | * @wmi_handle: wmi handle |
| 5624 | * @roam_req: Request which contains the filters |
| 5625 | * |
| 5626 | * There are filters such as whitelist, blacklist and preferred |
| 5627 | * list that need to be applied to the scan results to form the |
| 5628 | * probable candidates for roaming. |
| 5629 | * |
| 5630 | * Return: Return success upon succesfully passing the |
| 5631 | * parameters to the firmware, otherwise failure. |
| 5632 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5633 | 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] | 5634 | struct roam_scan_filter_params *roam_req) |
| 5635 | { |
| 5636 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5637 | QDF_STATUS status; |
| 5638 | uint32_t i; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5639 | uint32_t len; |
| 5640 | uint8_t *buf_ptr; |
| 5641 | wmi_roam_filter_fixed_param *roam_filter; |
| 5642 | uint8_t *bssid_src_ptr = NULL; |
| 5643 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 5644 | wmi_ssid *ssid_ptr = NULL; |
| 5645 | uint32_t *bssid_preferred_factor_ptr = NULL; |
| 5646 | |
| 5647 | len = sizeof(wmi_roam_filter_fixed_param); |
| 5648 | len += WMI_TLV_HDR_SIZE; |
| 5649 | len += roam_req->len; |
| 5650 | |
| 5651 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5652 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5653 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5654 | return QDF_STATUS_E_NOMEM; |
| 5655 | } |
| 5656 | |
| 5657 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 5658 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 5659 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 5660 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 5661 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 5662 | /* fill in fixed values */ |
| 5663 | roam_filter->vdev_id = roam_req->session_id; |
| 5664 | roam_filter->flags = 0; |
| 5665 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 5666 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 5667 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 5668 | roam_filter->num_bssid_preferred_list = |
| 5669 | roam_req->num_bssid_preferred_list; |
| 5670 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 5671 | |
| 5672 | WMITLV_SET_HDR((buf_ptr), |
| 5673 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5674 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 5675 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 5676 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5677 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 5678 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 5679 | bssid_src_ptr += ATH_MAC_LEN; |
| 5680 | bssid_dst_ptr++; |
| 5681 | } |
| 5682 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5683 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 5684 | WMITLV_SET_HDR((buf_ptr), |
| 5685 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5686 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 5687 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5688 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 5689 | qdf_mem_copy(&ssid_ptr->ssid, |
| 5690 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 5691 | roam_req->ssid_allowed_list[i].length); |
| 5692 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 5693 | ssid_ptr++; |
| 5694 | } |
| 5695 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 5696 | sizeof(wmi_ssid)); |
| 5697 | WMITLV_SET_HDR((buf_ptr), |
| 5698 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5699 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 5700 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 5701 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5702 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5703 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 5704 | (wmi_mac_addr *)bssid_dst_ptr); |
| 5705 | bssid_src_ptr += ATH_MAC_LEN; |
| 5706 | bssid_dst_ptr++; |
| 5707 | } |
| 5708 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5709 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 5710 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 5711 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 5712 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5713 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5714 | *bssid_preferred_factor_ptr = |
| 5715 | roam_req->bssid_favored_factor[i]; |
| 5716 | bssid_preferred_factor_ptr++; |
| 5717 | } |
| 5718 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5719 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 5720 | |
| 5721 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5722 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5723 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5724 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5725 | status); |
| 5726 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5727 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5728 | |
| 5729 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5730 | } |
| 5731 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5732 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 5733 | * @wmi_handle: wmi handle |
| 5734 | * @req: epno config params request structure |
| 5735 | * |
| 5736 | * This function reads the incoming epno config request structure |
| 5737 | * and constructs the WMI message to the firmware. |
| 5738 | * |
| 5739 | * Returns: 0 on success, error number otherwise |
| 5740 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5741 | 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] | 5742 | struct wifi_enhanched_pno_params *req) |
| 5743 | { |
| 5744 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 5745 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5746 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5747 | u_int8_t i, *buf_ptr; |
| 5748 | wmi_buf_t buf; |
| 5749 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5750 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5751 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5752 | /* Fixed Params */ |
| 5753 | len = sizeof(*cmd); |
| 5754 | if (req->num_networks) { |
| 5755 | /* TLV place holder for array of structures |
| 5756 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 5757 | */ |
| 5758 | len += WMI_TLV_HDR_SIZE; |
| 5759 | len += (sizeof(nlo_configured_parameters) |
| 5760 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 5761 | /* TLV for array of uint32 channel_list */ |
| 5762 | len += WMI_TLV_HDR_SIZE; |
| 5763 | /* TLV for nlo_channel_prediction_cfg */ |
| 5764 | len += WMI_TLV_HDR_SIZE; |
| 5765 | /* TLV for candidate score params */ |
| 5766 | len += sizeof(enlo_candidate_score_params); |
| 5767 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5768 | |
| 5769 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5770 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5771 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5772 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5773 | } |
| 5774 | |
| 5775 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5776 | |
| 5777 | buf_ptr = (u_int8_t *) cmd; |
| 5778 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5779 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5780 | WMITLV_GET_STRUCT_TLVLEN( |
| 5781 | wmi_nlo_config_cmd_fixed_param)); |
| 5782 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5783 | |
| 5784 | /* set flag to reset if num of networks are 0 */ |
| 5785 | cmd->flags = (req->num_networks == 0 ? |
| 5786 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5787 | |
| 5788 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 5789 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5790 | 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] | 5791 | WMI_LOGD("SSID count: %d flags: %d", |
| 5792 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5793 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5794 | /* Fill nlo_config only when num_networks are non zero */ |
| 5795 | if (cmd->no_of_ssids) { |
| 5796 | /* Fill networks */ |
| 5797 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5798 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 5799 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5800 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5801 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 5802 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 5803 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 5804 | WMITLV_TAG_ARRAY_BYTE, |
| 5805 | WMITLV_GET_STRUCT_TLVLEN( |
| 5806 | nlo_configured_parameters)); |
| 5807 | /* Copy ssid and it's length */ |
| 5808 | nlo_list[i].ssid.valid = true; |
| 5809 | nlo_list[i].ssid.ssid.ssid_len = |
| 5810 | req->networks[i].ssid.length; |
| 5811 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 5812 | req->networks[i].ssid.mac_ssid, |
| 5813 | nlo_list[i].ssid.ssid.ssid_len); |
| 5814 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 5815 | nlo_list[i].ssid.ssid.ssid_len, |
| 5816 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 5817 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5818 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5819 | /* Copy pno flags */ |
| 5820 | nlo_list[i].bcast_nw_type.valid = true; |
| 5821 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 5822 | req->networks[i].flags; |
| 5823 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5824 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 5825 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5826 | /* Copy auth bit field */ |
| 5827 | nlo_list[i].auth_type.valid = true; |
| 5828 | nlo_list[i].auth_type.auth_type = |
| 5829 | req->networks[i].auth_bit_field; |
| 5830 | WMI_LOGD("Auth bit field (%u)", |
| 5831 | nlo_list[i].auth_type.auth_type); |
| 5832 | } |
| 5833 | |
| 5834 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 5835 | /* Fill the channel list */ |
| 5836 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 5837 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5838 | |
| 5839 | /* Fill prediction_param */ |
| 5840 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5841 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5842 | |
| 5843 | /* Fill epno candidate score params */ |
| 5844 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 5845 | WMITLV_SET_HDR(buf_ptr, |
| 5846 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 5847 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 5848 | cand_score_params->min5GHz_rssi = |
| 5849 | req->min_5ghz_rssi; |
| 5850 | cand_score_params->min24GHz_rssi = |
| 5851 | req->min_24ghz_rssi; |
| 5852 | cand_score_params->initial_score_max = |
| 5853 | req->initial_score_max; |
| 5854 | cand_score_params->current_connection_bonus = |
| 5855 | req->current_connection_bonus; |
| 5856 | cand_score_params->same_network_bonus = |
| 5857 | req->same_network_bonus; |
| 5858 | cand_score_params->secure_bonus = |
| 5859 | req->secure_bonus; |
| 5860 | cand_score_params->band5GHz_bonus = |
| 5861 | req->band_5ghz_bonus; |
| 5862 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5863 | } |
| 5864 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5865 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5866 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5867 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5868 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5869 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5870 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5871 | } |
| 5872 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5873 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5874 | req->session_id); |
| 5875 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5876 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5877 | } |
| 5878 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5879 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5880 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 5881 | * @wmi_handle: wmi handle |
| 5882 | * @ipa_offload: ipa offload control parameter |
| 5883 | * |
| 5884 | * Returns: 0 on success, error number otherwise |
| 5885 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5886 | 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] | 5887 | struct ipa_offload_control_params *ipa_offload) |
| 5888 | { |
| 5889 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 5890 | wmi_buf_t wmi_buf; |
| 5891 | uint32_t len; |
| 5892 | u_int8_t *buf_ptr; |
| 5893 | |
| 5894 | len = sizeof(*cmd); |
| 5895 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5896 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5897 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 5898 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5899 | } |
| 5900 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5901 | WMI_LOGE("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5902 | ipa_offload->offload_type, ipa_offload->enable); |
| 5903 | |
| 5904 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 5905 | |
| 5906 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 5907 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5908 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 5909 | WMITLV_GET_STRUCT_TLVLEN( |
| 5910 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 5911 | |
| 5912 | cmd->offload_type = ipa_offload->offload_type; |
| 5913 | cmd->vdev_id = ipa_offload->vdev_id; |
| 5914 | cmd->enable = ipa_offload->enable; |
| 5915 | |
| 5916 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5917 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5918 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5919 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5920 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5921 | } |
| 5922 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5923 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5924 | } |
| 5925 | |
| 5926 | /** |
| 5927 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 5928 | * @wmi_handle: wmi handle |
| 5929 | * @pgetcapab: get capabilities params |
| 5930 | * |
| 5931 | * This function send request to fw to get extscan capabilities. |
| 5932 | * |
| 5933 | * Return: CDF status |
| 5934 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5935 | 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] | 5936 | struct extscan_capabilities_params *pgetcapab) |
| 5937 | { |
| 5938 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 5939 | wmi_buf_t wmi_buf; |
| 5940 | uint32_t len; |
| 5941 | uint8_t *buf_ptr; |
| 5942 | |
| 5943 | len = sizeof(*cmd); |
| 5944 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5945 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5946 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5947 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5948 | } |
| 5949 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5950 | |
| 5951 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 5952 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5953 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 5954 | WMITLV_GET_STRUCT_TLVLEN |
| 5955 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 5956 | |
| 5957 | cmd->request_id = pgetcapab->request_id; |
| 5958 | |
| 5959 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5960 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5961 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5962 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5963 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5964 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5965 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5966 | } |
| 5967 | |
| 5968 | /** |
| 5969 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 5970 | * @wmi_handle: wmi handle |
| 5971 | * @pcached_results: cached results parameters |
| 5972 | * |
| 5973 | * This function send request to fw to get cached results. |
| 5974 | * |
| 5975 | * Return: CDF status |
| 5976 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5977 | 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] | 5978 | struct extscan_cached_result_params *pcached_results) |
| 5979 | { |
| 5980 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 5981 | wmi_buf_t wmi_buf; |
| 5982 | uint32_t len; |
| 5983 | uint8_t *buf_ptr; |
| 5984 | |
| 5985 | len = sizeof(*cmd); |
| 5986 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5987 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5988 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5989 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5990 | } |
| 5991 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5992 | |
| 5993 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 5994 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5995 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 5996 | WMITLV_GET_STRUCT_TLVLEN |
| 5997 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 5998 | |
| 5999 | cmd->request_id = pcached_results->request_id; |
| 6000 | cmd->vdev_id = pcached_results->session_id; |
| 6001 | cmd->control_flags = pcached_results->flush; |
| 6002 | |
| 6003 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6004 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6005 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6006 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6007 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6008 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6009 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6010 | } |
| 6011 | |
| 6012 | /** |
| 6013 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 6014 | * @wmi_handle: wmi handle |
| 6015 | * @reset_req: Reset change request params |
| 6016 | * |
| 6017 | * This function sends stop change monitor request to fw. |
| 6018 | * |
| 6019 | * Return: CDF status |
| 6020 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6021 | 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] | 6022 | struct extscan_capabilities_reset_params *reset_req) |
| 6023 | { |
| 6024 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6025 | wmi_buf_t wmi_buf; |
| 6026 | uint32_t len; |
| 6027 | uint8_t *buf_ptr; |
| 6028 | int change_list = 0; |
| 6029 | |
| 6030 | len = sizeof(*cmd); |
| 6031 | |
| 6032 | /* reset significant change tlv is set to 0 */ |
| 6033 | len += WMI_TLV_HDR_SIZE; |
| 6034 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6035 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6036 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6037 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6038 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6039 | } |
| 6040 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6041 | |
| 6042 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6043 | buf_ptr; |
| 6044 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6045 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6046 | WMITLV_GET_STRUCT_TLVLEN |
| 6047 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6048 | |
| 6049 | cmd->request_id = reset_req->request_id; |
| 6050 | cmd->vdev_id = reset_req->session_id; |
| 6051 | cmd->mode = 0; |
| 6052 | |
| 6053 | buf_ptr += sizeof(*cmd); |
| 6054 | WMITLV_SET_HDR(buf_ptr, |
| 6055 | WMITLV_TAG_ARRAY_STRUC, |
| 6056 | change_list * |
| 6057 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6058 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 6059 | sizeof |
| 6060 | (wmi_extscan_wlan_change_bssid_param)); |
| 6061 | |
| 6062 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6063 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6064 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6065 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6066 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6067 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6068 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6069 | } |
| 6070 | |
| 6071 | /** |
| 6072 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 6073 | * @wmi_handle: wmi handle |
| 6074 | * @psigchange: change monitor request params |
| 6075 | * @buf: wmi buffer |
| 6076 | * @buf_len: buffer length |
| 6077 | * |
| 6078 | * This function fills elements of change monitor request buffer. |
| 6079 | * |
| 6080 | * Return: CDF status |
| 6081 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6082 | 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] | 6083 | struct extscan_set_sig_changereq_params |
| 6084 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 6085 | { |
| 6086 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6087 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 6088 | uint8_t *buf_ptr; |
| 6089 | int j; |
| 6090 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6091 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6092 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 6093 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6094 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6095 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 6096 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6097 | } |
| 6098 | len += WMI_TLV_HDR_SIZE; |
| 6099 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6100 | |
| 6101 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6102 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6103 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6104 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6105 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6106 | } |
| 6107 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6108 | cmd = |
| 6109 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6110 | buf_ptr; |
| 6111 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6112 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6113 | WMITLV_GET_STRUCT_TLVLEN |
| 6114 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6115 | |
| 6116 | cmd->request_id = psigchange->request_id; |
| 6117 | cmd->vdev_id = psigchange->session_id; |
| 6118 | cmd->total_entries = numap; |
| 6119 | cmd->mode = 1; |
| 6120 | cmd->num_entries_in_page = numap; |
| 6121 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 6122 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 6123 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 6124 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 6125 | |
| 6126 | buf_ptr += sizeof(*cmd); |
| 6127 | WMITLV_SET_HDR(buf_ptr, |
| 6128 | WMITLV_TAG_ARRAY_STRUC, |
| 6129 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6130 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 6131 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6132 | |
| 6133 | for (j = 0; j < numap; j++) { |
| 6134 | WMITLV_SET_HDR(dest_chglist, |
| 6135 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6136 | WMITLV_GET_STRUCT_TLVLEN |
| 6137 | (wmi_extscan_wlan_change_bssid_param)); |
| 6138 | |
| 6139 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 6140 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 6141 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 6142 | &dest_chglist->bssid); |
| 6143 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6144 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6145 | dest_chglist->lower_rssi_limit); |
| 6146 | dest_chglist++; |
| 6147 | src_ap++; |
| 6148 | } |
| 6149 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6150 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6151 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6152 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6153 | } |
| 6154 | |
| 6155 | /** |
| 6156 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 6157 | * @wmi_handle: wmi handle |
| 6158 | * @psigchange: change monitor request params |
| 6159 | * |
| 6160 | * This function sends start change monitor request to fw. |
| 6161 | * |
| 6162 | * Return: CDF status |
| 6163 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6164 | 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] | 6165 | struct extscan_set_sig_changereq_params * |
| 6166 | psigchange) |
| 6167 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6168 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6169 | wmi_buf_t buf; |
| 6170 | int len; |
| 6171 | |
| 6172 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6173 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6174 | psigchange, &buf, |
| 6175 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6176 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6177 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6178 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6179 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6180 | } |
| 6181 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6182 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 6183 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6184 | } |
| 6185 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6186 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6187 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6188 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6189 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6190 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6191 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6192 | } |
| 6193 | |
| 6194 | /** |
| 6195 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 6196 | * @wmi_handle: wmi handle |
| 6197 | * @photlist_reset: hotlist reset params |
| 6198 | * |
| 6199 | * This function configures hotlist monitor to stop in fw. |
| 6200 | * |
| 6201 | * Return: CDF status |
| 6202 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6203 | 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] | 6204 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 6205 | { |
| 6206 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 6207 | wmi_buf_t wmi_buf; |
| 6208 | uint32_t len; |
| 6209 | uint8_t *buf_ptr; |
| 6210 | int hotlist_entries = 0; |
| 6211 | |
| 6212 | len = sizeof(*cmd); |
| 6213 | |
| 6214 | /* reset bssid hotlist with tlv set to 0 */ |
| 6215 | len += WMI_TLV_HDR_SIZE; |
| 6216 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 6217 | |
| 6218 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6219 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6220 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6221 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6222 | } |
| 6223 | |
| 6224 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6225 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 6226 | buf_ptr; |
| 6227 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6228 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 6229 | WMITLV_GET_STRUCT_TLVLEN |
| 6230 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 6231 | |
| 6232 | cmd->request_id = photlist_reset->request_id; |
| 6233 | cmd->vdev_id = photlist_reset->session_id; |
| 6234 | cmd->mode = 0; |
| 6235 | |
| 6236 | buf_ptr += sizeof(*cmd); |
| 6237 | WMITLV_SET_HDR(buf_ptr, |
| 6238 | WMITLV_TAG_ARRAY_STRUC, |
| 6239 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6240 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6241 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6242 | |
| 6243 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6244 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6245 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6246 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6247 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6248 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6249 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6250 | } |
| 6251 | |
| 6252 | /** |
| 6253 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 6254 | * @wmi_handle: wmi handle |
| 6255 | * @pstopcmd: stop scan command request params |
| 6256 | * |
| 6257 | * This function sends stop extscan request to fw. |
| 6258 | * |
| 6259 | * Return: CDF Status. |
| 6260 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6261 | 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] | 6262 | struct extscan_stop_req_params *pstopcmd) |
| 6263 | { |
| 6264 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 6265 | wmi_buf_t wmi_buf; |
| 6266 | uint32_t len; |
| 6267 | uint8_t *buf_ptr; |
| 6268 | |
| 6269 | len = sizeof(*cmd); |
| 6270 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6271 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6272 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6273 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6274 | } |
| 6275 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6276 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 6277 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6278 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 6279 | WMITLV_GET_STRUCT_TLVLEN |
| 6280 | (wmi_extscan_stop_cmd_fixed_param)); |
| 6281 | |
| 6282 | cmd->request_id = pstopcmd->request_id; |
| 6283 | cmd->vdev_id = pstopcmd->session_id; |
| 6284 | |
| 6285 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6286 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6287 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6288 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6289 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6290 | } |
| 6291 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6292 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6293 | } |
| 6294 | |
| 6295 | /** |
| 6296 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 6297 | * @wmi_handle: wmi handle |
| 6298 | * @pstart: scan command request params |
| 6299 | * @buf: event buffer |
| 6300 | * @buf_len: length of buffer |
| 6301 | * |
| 6302 | * This function fills individual elements of extscan request and |
| 6303 | * TLV for buckets, channel list. |
| 6304 | * |
| 6305 | * Return: CDF Status. |
| 6306 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6307 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6308 | 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] | 6309 | struct wifi_scan_cmd_req_params *pstart, |
| 6310 | wmi_buf_t *buf, int *buf_len) |
| 6311 | { |
| 6312 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 6313 | wmi_extscan_bucket *dest_blist; |
| 6314 | wmi_extscan_bucket_channel *dest_clist; |
| 6315 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 6316 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 6317 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 6318 | |
| 6319 | uint8_t *buf_ptr; |
| 6320 | int i, k, count = 0; |
| 6321 | int len = sizeof(*cmd); |
| 6322 | int nbuckets = pstart->numBuckets; |
| 6323 | int nchannels = 0; |
| 6324 | |
| 6325 | /* These TLV's are are NULL by default */ |
| 6326 | uint32_t ie_len_with_pad = 0; |
| 6327 | int num_ssid = 0; |
| 6328 | int num_bssid = 0; |
| 6329 | int ie_len = 0; |
| 6330 | |
| 6331 | uint32_t base_period = pstart->basePeriod; |
| 6332 | |
| 6333 | /* TLV placeholder for ssid_list (NULL) */ |
| 6334 | len += WMI_TLV_HDR_SIZE; |
| 6335 | len += num_ssid * sizeof(wmi_ssid); |
| 6336 | |
| 6337 | /* TLV placeholder for bssid_list (NULL) */ |
| 6338 | len += WMI_TLV_HDR_SIZE; |
| 6339 | len += num_bssid * sizeof(wmi_mac_addr); |
| 6340 | |
| 6341 | /* TLV placeholder for ie_data (NULL) */ |
| 6342 | len += WMI_TLV_HDR_SIZE; |
| 6343 | len += ie_len * sizeof(uint32_t); |
| 6344 | |
| 6345 | /* TLV placeholder for bucket */ |
| 6346 | len += WMI_TLV_HDR_SIZE; |
| 6347 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 6348 | |
| 6349 | /* TLV channel placeholder */ |
| 6350 | len += WMI_TLV_HDR_SIZE; |
| 6351 | for (i = 0; i < nbuckets; i++) { |
| 6352 | nchannels += src_bucket->numChannels; |
| 6353 | src_bucket++; |
| 6354 | } |
| 6355 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6356 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6357 | __func__, nbuckets, nchannels); |
| 6358 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 6359 | /* Allocate the memory */ |
| 6360 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6361 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6362 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6363 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6364 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6365 | } |
| 6366 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6367 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 6368 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6369 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 6370 | WMITLV_GET_STRUCT_TLVLEN |
| 6371 | (wmi_extscan_start_cmd_fixed_param)); |
| 6372 | |
| 6373 | cmd->request_id = pstart->requestId; |
| 6374 | cmd->vdev_id = pstart->sessionId; |
| 6375 | cmd->base_period = pstart->basePeriod; |
| 6376 | cmd->num_buckets = nbuckets; |
| 6377 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 6378 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6379 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6380 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6381 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6382 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6383 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 6384 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6385 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 6386 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 6387 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6388 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 6389 | |
| 6390 | /* The max dwell time is retrieved from the first channel |
| 6391 | * of the first bucket and kept common for all channels. |
| 6392 | */ |
| 6393 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 6394 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 6395 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 6396 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 6397 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 6398 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 6399 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 6400 | |
| 6401 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6402 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6403 | cmd->probe_delay = 0; |
| 6404 | cmd->probe_spacing_time = 0; |
| 6405 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6406 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 6407 | WMI_SCAN_ADD_CCK_RATES | |
| 6408 | WMI_SCAN_ADD_OFDM_RATES | |
| 6409 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 6410 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6411 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 6412 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 6413 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6414 | cmd->num_ssids = 0; |
| 6415 | cmd->num_bssid = 0; |
| 6416 | cmd->ie_len = 0; |
| 6417 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 6418 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 6419 | |
| 6420 | buf_ptr += sizeof(*cmd); |
| 6421 | WMITLV_SET_HDR(buf_ptr, |
| 6422 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6423 | num_ssid * sizeof(wmi_ssid)); |
| 6424 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 6425 | |
| 6426 | WMITLV_SET_HDR(buf_ptr, |
| 6427 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6428 | num_bssid * sizeof(wmi_mac_addr)); |
| 6429 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 6430 | |
| 6431 | ie_len_with_pad = 0; |
| 6432 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 6433 | ie_len_with_pad); |
| 6434 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 6435 | |
| 6436 | WMITLV_SET_HDR(buf_ptr, |
| 6437 | WMITLV_TAG_ARRAY_STRUC, |
| 6438 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 6439 | dest_blist = (wmi_extscan_bucket *) |
| 6440 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6441 | src_bucket = pstart->buckets; |
| 6442 | |
| 6443 | /* Retrieve scanning information from each bucket and |
| 6444 | * channels and send it to the target |
| 6445 | */ |
| 6446 | for (i = 0; i < nbuckets; i++) { |
| 6447 | WMITLV_SET_HDR(dest_blist, |
| 6448 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6449 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 6450 | |
| 6451 | dest_blist->bucket_id = src_bucket->bucket; |
| 6452 | dest_blist->base_period_multiplier = |
| 6453 | src_bucket->period / base_period; |
| 6454 | dest_blist->min_period = src_bucket->period; |
| 6455 | dest_blist->max_period = src_bucket->max_period; |
| 6456 | dest_blist->exp_backoff = src_bucket->exponent; |
| 6457 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 6458 | dest_blist->channel_band = src_bucket->band; |
| 6459 | dest_blist->num_channels = src_bucket->numChannels; |
| 6460 | dest_blist->notify_extscan_events = 0; |
| 6461 | |
| 6462 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 6463 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 6464 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 6465 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6466 | |
| 6467 | if (src_bucket->reportEvents & |
| 6468 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 6469 | dest_blist->forwarding_flags = |
| 6470 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 6471 | dest_blist->notify_extscan_events |= |
| 6472 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 6473 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 6474 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 6475 | } else { |
| 6476 | dest_blist->forwarding_flags = |
| 6477 | WMI_EXTSCAN_NO_FORWARDING; |
| 6478 | } |
| 6479 | |
| 6480 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 6481 | dest_blist->configuration_flags = 0; |
| 6482 | else |
| 6483 | dest_blist->configuration_flags = |
| 6484 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 6485 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6486 | 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] | 6487 | __func__, dest_blist->notify_extscan_events, |
| 6488 | dest_blist->configuration_flags, |
| 6489 | dest_blist->forwarding_flags); |
| 6490 | |
| 6491 | dest_blist->min_dwell_time_active = |
| 6492 | src_bucket->min_dwell_time_active; |
| 6493 | dest_blist->max_dwell_time_active = |
| 6494 | src_bucket->max_dwell_time_active; |
| 6495 | dest_blist->min_dwell_time_passive = |
| 6496 | src_bucket->min_dwell_time_passive; |
| 6497 | dest_blist->max_dwell_time_passive = |
| 6498 | src_bucket->max_dwell_time_passive; |
| 6499 | src_channel = src_bucket->channels; |
| 6500 | |
| 6501 | /* save the channel info to later populate |
| 6502 | * the channel TLV |
| 6503 | */ |
| 6504 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 6505 | save_channel[count++].channel = src_channel->channel; |
| 6506 | src_channel++; |
| 6507 | } |
| 6508 | dest_blist++; |
| 6509 | src_bucket++; |
| 6510 | } |
| 6511 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 6512 | WMITLV_SET_HDR(buf_ptr, |
| 6513 | WMITLV_TAG_ARRAY_STRUC, |
| 6514 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6515 | dest_clist = (wmi_extscan_bucket_channel *) |
| 6516 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6517 | |
| 6518 | /* Active or passive scan is based on the bucket dwell time |
| 6519 | * and channel specific active,passive scans are not |
| 6520 | * supported yet |
| 6521 | */ |
| 6522 | for (i = 0; i < nchannels; i++) { |
| 6523 | WMITLV_SET_HDR(dest_clist, |
| 6524 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 6525 | WMITLV_GET_STRUCT_TLVLEN |
| 6526 | (wmi_extscan_bucket_channel)); |
| 6527 | dest_clist->channel = save_channel[i].channel; |
| 6528 | dest_clist++; |
| 6529 | } |
| 6530 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6531 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6532 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6533 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6534 | } |
| 6535 | |
| 6536 | /** |
| 6537 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 6538 | * @wmi_handle: wmi handle |
| 6539 | * @pstart: scan command request params |
| 6540 | * |
| 6541 | * This function sends start extscan request to fw. |
| 6542 | * |
| 6543 | * Return: CDF Status. |
| 6544 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6545 | 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] | 6546 | struct wifi_scan_cmd_req_params *pstart) |
| 6547 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6548 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6549 | wmi_buf_t buf; |
| 6550 | int len; |
| 6551 | |
| 6552 | /* Fill individual elements of extscan request and |
| 6553 | * TLV for buckets, channel list. |
| 6554 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6555 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6556 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6557 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6558 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 6559 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6560 | } |
| 6561 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6562 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6563 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6564 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6565 | } |
| 6566 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 6567 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6568 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6569 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6570 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6571 | } |
| 6572 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6573 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6574 | } |
| 6575 | |
| 6576 | /** |
| 6577 | * send_plm_stop_cmd_tlv() - plm stop request |
| 6578 | * @wmi_handle: wmi handle |
| 6579 | * @plm: plm request parameters |
| 6580 | * |
| 6581 | * This function request FW to stop PLM. |
| 6582 | * |
| 6583 | * Return: CDF status |
| 6584 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6585 | 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] | 6586 | const struct plm_req_params *plm) |
| 6587 | { |
| 6588 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 6589 | int32_t len; |
| 6590 | wmi_buf_t buf; |
| 6591 | uint8_t *buf_ptr; |
| 6592 | int ret; |
| 6593 | |
| 6594 | len = sizeof(*cmd); |
| 6595 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6596 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6597 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6598 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6599 | } |
| 6600 | |
| 6601 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 6602 | |
| 6603 | buf_ptr = (uint8_t *) cmd; |
| 6604 | |
| 6605 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6606 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 6607 | WMITLV_GET_STRUCT_TLVLEN |
| 6608 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 6609 | |
| 6610 | cmd->vdev_id = plm->session_id; |
| 6611 | |
| 6612 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6613 | 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] | 6614 | |
| 6615 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6616 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 6617 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6618 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6619 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6620 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6621 | } |
| 6622 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6623 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6624 | } |
| 6625 | |
| 6626 | /** |
| 6627 | * send_plm_start_cmd_tlv() - plm start request |
| 6628 | * @wmi_handle: wmi handle |
| 6629 | * @plm: plm request parameters |
| 6630 | * |
| 6631 | * This function request FW to start PLM. |
| 6632 | * |
| 6633 | * Return: CDF status |
| 6634 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6635 | 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] | 6636 | const struct plm_req_params *plm, |
| 6637 | uint32_t *gchannel_list) |
| 6638 | { |
| 6639 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 6640 | uint32_t *channel_list; |
| 6641 | int32_t len; |
| 6642 | wmi_buf_t buf; |
| 6643 | uint8_t *buf_ptr; |
| 6644 | uint8_t count; |
| 6645 | int ret; |
| 6646 | |
| 6647 | /* TLV place holder for channel_list */ |
| 6648 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 6649 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 6650 | |
| 6651 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6652 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6653 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6654 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6655 | } |
| 6656 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 6657 | |
| 6658 | buf_ptr = (uint8_t *) cmd; |
| 6659 | |
| 6660 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6661 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 6662 | WMITLV_GET_STRUCT_TLVLEN |
| 6663 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 6664 | |
| 6665 | cmd->vdev_id = plm->session_id; |
| 6666 | |
| 6667 | cmd->meas_token = plm->meas_token; |
| 6668 | cmd->dialog_token = plm->diag_token; |
| 6669 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6670 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6671 | cmd->off_duration = plm->meas_duration; |
| 6672 | cmd->burst_cycle = plm->burst_len; |
| 6673 | cmd->tx_power = plm->desired_tx_pwr; |
| 6674 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 6675 | cmd->num_chans = plm->plm_num_ch; |
| 6676 | |
| 6677 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 6678 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6679 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 6680 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 6681 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 6682 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 6683 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 6684 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 6685 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 6686 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6687 | |
| 6688 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6689 | (cmd->num_chans * sizeof(uint32_t))); |
| 6690 | |
| 6691 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6692 | if (cmd->num_chans) { |
| 6693 | channel_list = (uint32_t *) buf_ptr; |
| 6694 | for (count = 0; count < cmd->num_chans; count++) { |
| 6695 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6696 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6697 | channel_list[count] = |
| 6698 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6699 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6700 | } |
| 6701 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 6702 | } |
| 6703 | |
| 6704 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6705 | WMI_VDEV_PLMREQ_START_CMDID); |
| 6706 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6707 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6708 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6709 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6710 | } |
| 6711 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6712 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6713 | } |
| 6714 | |
| 6715 | /** |
| 6716 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 6717 | * @wmi_handle: wmi handle |
| 6718 | * @vdev_id: vdev id |
| 6719 | * |
| 6720 | * This function request FW to stop ongoing PNO operation. |
| 6721 | * |
| 6722 | * Return: CDF status |
| 6723 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6724 | 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] | 6725 | { |
| 6726 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6727 | int32_t len = sizeof(*cmd); |
| 6728 | wmi_buf_t buf; |
| 6729 | uint8_t *buf_ptr; |
| 6730 | int ret; |
| 6731 | |
| 6732 | /* |
| 6733 | * TLV place holder for array of structures nlo_configured_parameters |
| 6734 | * TLV place holder for array of uint32_t channel_list |
| 6735 | * TLV place holder for chnl prediction cfg |
| 6736 | */ |
| 6737 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6738 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6739 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6740 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6741 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6742 | } |
| 6743 | |
| 6744 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6745 | buf_ptr = (uint8_t *) cmd; |
| 6746 | |
| 6747 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6748 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6749 | WMITLV_GET_STRUCT_TLVLEN |
| 6750 | (wmi_nlo_config_cmd_fixed_param)); |
| 6751 | |
| 6752 | cmd->vdev_id = vdev_id; |
| 6753 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 6754 | buf_ptr += sizeof(*cmd); |
| 6755 | |
| 6756 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6757 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6758 | |
| 6759 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6760 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6761 | |
| 6762 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6763 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6764 | |
| 6765 | |
| 6766 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6767 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6768 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6769 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6770 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6771 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6772 | } |
| 6773 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6774 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6775 | } |
| 6776 | |
| 6777 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6778 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 6779 | * @buf_ptr: Buffer passed by upper layers |
| 6780 | * @pno: Buffer to be sent to the firmware |
| 6781 | * |
| 6782 | * Copy the PNO Channel prediction configuration parameters |
| 6783 | * passed by the upper layers to a WMI format TLV and send it |
| 6784 | * down to the firmware. |
| 6785 | * |
| 6786 | * Return: None |
| 6787 | */ |
| 6788 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 6789 | struct pno_scan_req_params *pno) |
| 6790 | { |
| 6791 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 6792 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 6793 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 6794 | WMITLV_TAG_ARRAY_BYTE, |
| 6795 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6796 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6797 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 6798 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 6799 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 6800 | channel_prediction_cfg->full_scan_period_ms = |
| 6801 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6802 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6803 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 6804 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 6805 | channel_prediction_cfg->enable, |
| 6806 | channel_prediction_cfg->top_k_num, |
| 6807 | channel_prediction_cfg->stationary_threshold, |
| 6808 | channel_prediction_cfg->full_scan_period_ms); |
| 6809 | } |
| 6810 | |
| 6811 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6812 | * send_pno_start_cmd_tlv() - PNO start request |
| 6813 | * @wmi_handle: wmi handle |
| 6814 | * @pno: PNO request |
| 6815 | * |
| 6816 | * This function request FW to start PNO request. |
| 6817 | * Request: CDF status |
| 6818 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6819 | static QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6820 | struct pno_scan_req_params *pno, |
| 6821 | uint32_t *gchannel_freq_list) |
| 6822 | { |
| 6823 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6824 | nlo_configured_parameters *nlo_list; |
| 6825 | uint32_t *channel_list; |
| 6826 | int32_t len; |
| 6827 | wmi_buf_t buf; |
| 6828 | uint8_t *buf_ptr; |
| 6829 | uint8_t i; |
| 6830 | int ret; |
| 6831 | |
| 6832 | /* |
| 6833 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 6834 | * TLV place holder for array of uint32_t channel_list |
| 6835 | * TLV place holder for chnnl prediction cfg |
| 6836 | */ |
| 6837 | len = sizeof(*cmd) + |
| 6838 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6839 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6840 | len += sizeof(uint32_t) * QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6841 | WMI_NLO_MAX_CHAN); |
| 6842 | len += sizeof(nlo_configured_parameters) * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6843 | QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6844 | len += sizeof(nlo_channel_prediction_cfg); |
| 6845 | |
| 6846 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6847 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6848 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6849 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6850 | } |
| 6851 | |
| 6852 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6853 | |
| 6854 | buf_ptr = (uint8_t *) cmd; |
| 6855 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6856 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6857 | WMITLV_GET_STRUCT_TLVLEN |
| 6858 | (wmi_nlo_config_cmd_fixed_param)); |
| 6859 | cmd->vdev_id = pno->sessionId; |
| 6860 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 6861 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6862 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6863 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
| 6864 | pno->pnoscan_adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6865 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6866 | /* Current FW does not support min-max range for dwell time */ |
| 6867 | cmd->active_dwell_time = pno->active_max_time; |
| 6868 | cmd->passive_dwell_time = pno->passive_max_time; |
| 6869 | |
| 6870 | /* Copy scan interval */ |
| 6871 | cmd->fast_scan_period = pno->fast_scan_period; |
| 6872 | cmd->slow_scan_period = pno->slow_scan_period; |
Arif Hussain | 17ff203 | 2017-03-02 11:56:04 -0800 | [diff] [blame] | 6873 | cmd->delay_start_time = WMI_SEC_TO_MSEC(pno->delay_start_time); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6874 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6875 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6876 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6877 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6878 | |
| 6879 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6880 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6881 | cmd->no_of_ssids = QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
| 6882 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6883 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6884 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6885 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6886 | |
| 6887 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6888 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6889 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6890 | WMITLV_TAG_ARRAY_BYTE, |
| 6891 | WMITLV_GET_STRUCT_TLVLEN |
| 6892 | (nlo_configured_parameters)); |
| 6893 | /* Copy ssid and it's length */ |
| 6894 | nlo_list[i].ssid.valid = true; |
| 6895 | nlo_list[i].ssid.ssid.ssid_len = pno->aNetworks[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6896 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6897 | pno->aNetworks[i].ssid.mac_ssid, |
| 6898 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6899 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6900 | nlo_list[i].ssid.ssid.ssid_len, |
| 6901 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 6902 | nlo_list[i].ssid.ssid.ssid_len); |
| 6903 | |
| 6904 | /* Copy rssi threshold */ |
| 6905 | if (pno->aNetworks[i].rssiThreshold && |
| 6906 | pno->aNetworks[i].rssiThreshold > WMI_RSSI_THOLD_DEFAULT) { |
| 6907 | nlo_list[i].rssi_cond.valid = true; |
| 6908 | nlo_list[i].rssi_cond.rssi = |
| 6909 | pno->aNetworks[i].rssiThreshold; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6910 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6911 | nlo_list[i].rssi_cond.rssi); |
| 6912 | } |
| 6913 | nlo_list[i].bcast_nw_type.valid = true; |
| 6914 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6915 | pno->aNetworks[i].bcastNetwType; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6916 | WMI_LOGI("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6917 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6918 | } |
| 6919 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6920 | |
| 6921 | /* Copy channel info */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6922 | cmd->num_of_channels = QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6923 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6924 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6925 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6926 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 6927 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6928 | |
| 6929 | channel_list = (uint32_t *) buf_ptr; |
| 6930 | for (i = 0; i < cmd->num_of_channels; i++) { |
| 6931 | channel_list[i] = pno->aNetworks[0].aChannels[i]; |
| 6932 | |
| 6933 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
| 6934 | channel_list[i] = gchannel_freq_list[i]; |
| 6935 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6936 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6937 | } |
| 6938 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 6939 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6940 | sizeof(nlo_channel_prediction_cfg)); |
| 6941 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6942 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6943 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6944 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 6945 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 6946 | */ |
| 6947 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6948 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6949 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6950 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6951 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6952 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6953 | } |
| 6954 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6955 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6956 | } |
| 6957 | |
| 6958 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 6959 | * @wmi_handle: wmi handle |
| 6960 | * @msg: message |
| 6961 | * @is_add_ts: is addts required |
| 6962 | * |
| 6963 | * This function sets ric request element for 11r roaming. |
| 6964 | * |
| 6965 | * Return: CDF status |
| 6966 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6967 | 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] | 6968 | void *msg, uint8_t is_add_ts) |
| 6969 | { |
| 6970 | wmi_ric_request_fixed_param *cmd; |
| 6971 | wmi_ric_tspec *tspec_param; |
| 6972 | wmi_buf_t buf; |
| 6973 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6974 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6975 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 6976 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 6977 | |
| 6978 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6979 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6980 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6981 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6982 | } |
| 6983 | |
| 6984 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6985 | |
| 6986 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 6987 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6988 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 6989 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 6990 | if (is_add_ts) |
| 6991 | cmd->vdev_id = ((struct add_ts_param *) msg)->sessionId; |
| 6992 | else |
| 6993 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 6994 | cmd->num_ric_request = 1; |
| 6995 | cmd->is_add_ric = is_add_ts; |
| 6996 | |
| 6997 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 6998 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 6999 | |
| 7000 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7001 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 7002 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 7003 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 7004 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 7005 | |
| 7006 | if (is_add_ts) |
| 7007 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7008 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7009 | else |
| 7010 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7011 | #endif |
| 7012 | if (ptspecIE) { |
| 7013 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7014 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7015 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 7016 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7017 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7018 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 7019 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7020 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 7021 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7022 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 7023 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 7024 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 7025 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 7026 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 7027 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 7028 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 7029 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 7030 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 7031 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 7032 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 7033 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 7034 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 7035 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 7036 | tspec_param->medium_time = 0; |
| 7037 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7038 | 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] | 7039 | |
| 7040 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7041 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7042 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7043 | __func__); |
| 7044 | if (is_add_ts) |
| 7045 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7046 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7047 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7048 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7049 | } |
| 7050 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7051 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7052 | } |
| 7053 | |
| 7054 | /** |
| 7055 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 7056 | * @wmi_handle: wmi handle |
| 7057 | * @clear_req: ll stats clear request command params |
| 7058 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7059 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7060 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7061 | 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] | 7062 | const struct ll_stats_clear_params *clear_req, |
| 7063 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7064 | { |
| 7065 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 7066 | int32_t len; |
| 7067 | wmi_buf_t buf; |
| 7068 | uint8_t *buf_ptr; |
| 7069 | int ret; |
| 7070 | |
| 7071 | len = sizeof(*cmd); |
| 7072 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7073 | |
| 7074 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7075 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7076 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7077 | } |
| 7078 | |
| 7079 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7080 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7081 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 7082 | |
| 7083 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7084 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 7085 | WMITLV_GET_STRUCT_TLVLEN |
| 7086 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 7087 | |
| 7088 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 7089 | cmd->vdev_id = clear_req->sta_id; |
| 7090 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 7091 | |
| 7092 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7093 | &cmd->peer_macaddr); |
| 7094 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7095 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 7096 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 7097 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 7098 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 7099 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7100 | cmd->peer_macaddr); */ |
| 7101 | |
| 7102 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7103 | WMI_CLEAR_LINK_STATS_CMDID); |
| 7104 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7105 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7106 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7107 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7108 | } |
| 7109 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7110 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 7111 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7112 | } |
| 7113 | |
| 7114 | /** |
| 7115 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 7116 | * @wmi_handle: wmi handle |
| 7117 | * @setReq: ll stats set request command params |
| 7118 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7119 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7120 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7121 | 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] | 7122 | const struct ll_stats_set_params *set_req) |
| 7123 | { |
| 7124 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 7125 | int32_t len; |
| 7126 | wmi_buf_t buf; |
| 7127 | uint8_t *buf_ptr; |
| 7128 | int ret; |
| 7129 | |
| 7130 | len = sizeof(*cmd); |
| 7131 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7132 | |
| 7133 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7134 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7135 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7136 | } |
| 7137 | |
| 7138 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7139 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7140 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 7141 | |
| 7142 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7143 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 7144 | WMITLV_GET_STRUCT_TLVLEN |
| 7145 | (wmi_start_link_stats_cmd_fixed_param)); |
| 7146 | |
| 7147 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 7148 | cmd->aggressive_statistics_gathering = |
| 7149 | set_req->aggressive_statistics_gathering; |
| 7150 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7151 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 7152 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 7153 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7154 | |
| 7155 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7156 | WMI_START_LINK_STATS_CMDID); |
| 7157 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7158 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7159 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7160 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7161 | } |
| 7162 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7163 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7164 | } |
| 7165 | |
| 7166 | /** |
| 7167 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 7168 | * @wmi_handle:wmi handle |
| 7169 | * @get_req:ll stats get request command params |
| 7170 | * @addr: mac address |
| 7171 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7172 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7173 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7174 | 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] | 7175 | const struct ll_stats_get_params *get_req, |
| 7176 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7177 | { |
| 7178 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 7179 | int32_t len; |
| 7180 | wmi_buf_t buf; |
| 7181 | uint8_t *buf_ptr; |
| 7182 | int ret; |
| 7183 | |
| 7184 | len = sizeof(*cmd); |
| 7185 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7186 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 7187 | if (!buf) { |
| 7188 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 7189 | return QDF_STATUS_E_NOMEM; |
| 7190 | } |
| 7191 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7192 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7193 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7194 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 7195 | |
| 7196 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7197 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 7198 | WMITLV_GET_STRUCT_TLVLEN |
| 7199 | (wmi_request_link_stats_cmd_fixed_param)); |
| 7200 | |
| 7201 | cmd->request_id = get_req->req_id; |
| 7202 | cmd->stats_type = get_req->param_id_mask; |
| 7203 | cmd->vdev_id = get_req->sta_id; |
| 7204 | |
| 7205 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7206 | &cmd->peer_macaddr); |
| 7207 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7208 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
| 7209 | WMI_LOGD("Request ID : %d", cmd->request_id); |
| 7210 | WMI_LOGD("Stats Type : %d", cmd->stats_type); |
| 7211 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 7212 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7213 | |
| 7214 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7215 | WMI_REQUEST_LINK_STATS_CMDID); |
| 7216 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7217 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7218 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7219 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7220 | } |
| 7221 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7222 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7223 | } |
| 7224 | |
| 7225 | /** |
| 7226 | * send_get_stats_cmd_tlv() - get stats request |
| 7227 | * @wmi_handle: wmi handle |
| 7228 | * @get_stats_param: stats params |
| 7229 | * @addr: mac address |
| 7230 | * |
| 7231 | * Return: CDF status |
| 7232 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7233 | 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] | 7234 | struct pe_stats_req *get_stats_param, |
| 7235 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7236 | { |
| 7237 | wmi_buf_t buf; |
| 7238 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7239 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7240 | |
| 7241 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7242 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7243 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 7244 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7245 | } |
| 7246 | |
| 7247 | |
| 7248 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7249 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7250 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7251 | WMITLV_GET_STRUCT_TLVLEN |
| 7252 | (wmi_request_stats_cmd_fixed_param)); |
| 7253 | cmd->stats_id = |
| 7254 | WMI_REQUEST_PEER_STAT | WMI_REQUEST_PDEV_STAT | |
Himanshu Agarwal | c9fc2a3 | 2016-07-21 14:46:58 +0530 | [diff] [blame] | 7255 | WMI_REQUEST_VDEV_STAT | WMI_REQUEST_RSSI_PER_CHAIN_STAT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7256 | cmd->vdev_id = get_stats_param->session_id; |
| 7257 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7258 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7259 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7260 | WMI_REQUEST_STATS_CMDID)) { |
| 7261 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7262 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7263 | __func__); |
| 7264 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7265 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7266 | } |
| 7267 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7268 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7269 | |
| 7270 | } |
| 7271 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7272 | /** |
| 7273 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 7274 | * @wmi_handle: wmi handle |
| 7275 | * @rssi_req: get RSSI request |
| 7276 | * |
| 7277 | * Return: CDF status |
| 7278 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7279 | 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] | 7280 | { |
| 7281 | wmi_buf_t buf; |
| 7282 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7283 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7284 | |
| 7285 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7286 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7287 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7288 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7289 | } |
| 7290 | |
| 7291 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7292 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7293 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7294 | WMITLV_GET_STRUCT_TLVLEN |
| 7295 | (wmi_request_stats_cmd_fixed_param)); |
| 7296 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 7297 | if (wmi_unified_cmd_send |
| 7298 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7299 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7300 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7301 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7302 | } |
| 7303 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7304 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7305 | } |
| 7306 | |
| 7307 | /** |
| 7308 | * send_snr_cmd_tlv() - get RSSI from fw |
| 7309 | * @wmi_handle: wmi handle |
| 7310 | * @vdev_id: vdev id |
| 7311 | * |
| 7312 | * Return: CDF status |
| 7313 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7314 | 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] | 7315 | { |
| 7316 | wmi_buf_t buf; |
| 7317 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7318 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7319 | |
| 7320 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7321 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7322 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7323 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7324 | } |
| 7325 | |
| 7326 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7327 | cmd->vdev_id = vdev_id; |
| 7328 | |
| 7329 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7330 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7331 | WMITLV_GET_STRUCT_TLVLEN |
| 7332 | (wmi_request_stats_cmd_fixed_param)); |
| 7333 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 7334 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7335 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7336 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7337 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7338 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7339 | } |
| 7340 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7341 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7342 | } |
| 7343 | |
| 7344 | /** |
| 7345 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 7346 | * @wmi_handle: wmi handle |
| 7347 | * @link_status: get link params |
| 7348 | * |
| 7349 | * Return: CDF status |
| 7350 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7351 | 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] | 7352 | struct link_status_params *link_status) |
| 7353 | { |
| 7354 | wmi_buf_t buf; |
| 7355 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7356 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7357 | |
| 7358 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7359 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7360 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7361 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7362 | } |
| 7363 | |
| 7364 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7365 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7366 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7367 | WMITLV_GET_STRUCT_TLVLEN |
| 7368 | (wmi_request_stats_cmd_fixed_param)); |
| 7369 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 7370 | cmd->vdev_id = link_status->session_id; |
| 7371 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7372 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7373 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7374 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7375 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7376 | } |
| 7377 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7378 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7379 | } |
| 7380 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7381 | /** |
| 7382 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 7383 | * @wmi_handle: wmi handle |
| 7384 | * @ta_dhcp_ind: DHCP indication parameter |
| 7385 | * |
| 7386 | * Return: CDF Status |
| 7387 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7388 | 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] | 7389 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 7390 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7391 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7392 | wmi_buf_t buf = NULL; |
| 7393 | uint8_t *buf_ptr; |
| 7394 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 7395 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 7396 | |
| 7397 | |
| 7398 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7399 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7400 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7401 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7402 | } |
| 7403 | |
| 7404 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7405 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 7406 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 7407 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 7408 | WMITLV_GET_STRUCT_TLVLEN |
| 7409 | (wmi_peer_set_param_cmd_fixed_param)); |
| 7410 | |
| 7411 | /* fill in values */ |
| 7412 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 7413 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 7414 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7415 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7416 | &ta_dhcp_ind->peer_macaddr, |
| 7417 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 7418 | |
| 7419 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7420 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7421 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7422 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7423 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7424 | wmi_buf_free(buf); |
| 7425 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7426 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7427 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7428 | } |
| 7429 | |
| 7430 | /** |
| 7431 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 7432 | * @wmi_handle: wmi handle |
| 7433 | * @pLinkSpeed: link speed info |
| 7434 | * |
| 7435 | * Return: CDF status |
| 7436 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7437 | 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] | 7438 | wmi_mac_addr peer_macaddr) |
| 7439 | { |
| 7440 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 7441 | wmi_buf_t wmi_buf; |
| 7442 | uint32_t len; |
| 7443 | uint8_t *buf_ptr; |
| 7444 | |
| 7445 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 7446 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7447 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7448 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7449 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7450 | } |
| 7451 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7452 | |
| 7453 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 7454 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7455 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 7456 | WMITLV_GET_STRUCT_TLVLEN |
| 7457 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 7458 | |
| 7459 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7460 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7461 | &peer_macaddr, |
| 7462 | sizeof(peer_macaddr)); |
| 7463 | |
| 7464 | |
| 7465 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7466 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7467 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7468 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7469 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7470 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7471 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7472 | } |
| 7473 | |
| 7474 | /** |
| 7475 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 7476 | * @wmi_handle: wmi handler |
| 7477 | * @egap_params: pointer to egap_params |
| 7478 | * |
| 7479 | * Return: 0 for success, otherwise appropriate error code |
| 7480 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7481 | 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] | 7482 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 7483 | { |
| 7484 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 7485 | wmi_buf_t buf; |
| 7486 | int32_t err; |
| 7487 | |
| 7488 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7489 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7490 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 7491 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7492 | } |
| 7493 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 7494 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7495 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 7496 | WMITLV_GET_STRUCT_TLVLEN( |
| 7497 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 7498 | |
| 7499 | cmd->enable = egap_params->enable; |
| 7500 | cmd->inactivity_time = egap_params->inactivity_time; |
| 7501 | cmd->wait_time = egap_params->wait_time; |
| 7502 | cmd->flags = egap_params->flags; |
| 7503 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7504 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 7505 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7506 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7507 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7508 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7509 | } |
| 7510 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7511 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7512 | } |
| 7513 | |
| 7514 | /** |
| 7515 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 7516 | * @wmi_handl: wmi handle |
| 7517 | * @cmd: Profiling command index |
| 7518 | * @value1: parameter1 value |
| 7519 | * @value2: parameter2 value |
| 7520 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7521 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7522 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7523 | 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] | 7524 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 7525 | { |
| 7526 | wmi_buf_t buf; |
| 7527 | int32_t len = 0; |
| 7528 | int ret; |
| 7529 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 7530 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 7531 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 7532 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 7533 | |
| 7534 | switch (cmd) { |
| 7535 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 7536 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 7537 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7538 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7539 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7540 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7541 | } |
| 7542 | prof_trig_cmd = |
| 7543 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 7544 | wmi_buf_data(buf); |
| 7545 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 7546 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 7547 | WMITLV_GET_STRUCT_TLVLEN |
| 7548 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 7549 | prof_trig_cmd->enable = value1; |
| 7550 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7551 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 7552 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7553 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7554 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7555 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7556 | return ret; |
| 7557 | } |
| 7558 | break; |
| 7559 | |
| 7560 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 7561 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 7562 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7563 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7564 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7565 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7566 | } |
| 7567 | profile_getdata_cmd = |
| 7568 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 7569 | wmi_buf_data(buf); |
| 7570 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 7571 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 7572 | WMITLV_GET_STRUCT_TLVLEN |
| 7573 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 7574 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7575 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 7576 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7577 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7578 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7579 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7580 | return ret; |
| 7581 | } |
| 7582 | break; |
| 7583 | |
| 7584 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 7585 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 7586 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7587 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7588 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7589 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7590 | } |
| 7591 | hist_intvl_cmd = |
| 7592 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 7593 | wmi_buf_data(buf); |
| 7594 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 7595 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 7596 | WMITLV_GET_STRUCT_TLVLEN |
| 7597 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 7598 | hist_intvl_cmd->profile_id = value1; |
| 7599 | hist_intvl_cmd->value = value2; |
| 7600 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7601 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 7602 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7603 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7604 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7605 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7606 | return ret; |
| 7607 | } |
| 7608 | break; |
| 7609 | |
| 7610 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 7611 | len = |
| 7612 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 7613 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7614 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7615 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7616 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7617 | } |
| 7618 | profile_enable_cmd = |
| 7619 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 7620 | wmi_buf_data(buf); |
| 7621 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 7622 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 7623 | WMITLV_GET_STRUCT_TLVLEN |
| 7624 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 7625 | profile_enable_cmd->profile_id = value1; |
| 7626 | profile_enable_cmd->enable = value2; |
| 7627 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7628 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 7629 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7630 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7631 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7632 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7633 | return ret; |
| 7634 | } |
| 7635 | break; |
| 7636 | |
| 7637 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7638 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7639 | break; |
| 7640 | } |
| 7641 | |
| 7642 | return 0; |
| 7643 | } |
| 7644 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7645 | /** |
| 7646 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 7647 | * @wmi_handle: wmi handle |
| 7648 | * @vdev_id: vdev id |
| 7649 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7650 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7651 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7652 | 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] | 7653 | { |
| 7654 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 7655 | wmi_buf_t buf; |
| 7656 | int32_t len = sizeof(*cmd); |
| 7657 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7658 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7659 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7660 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7661 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7662 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7663 | } |
| 7664 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 7665 | wmi_buf_data(buf); |
| 7666 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7667 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 7668 | WMITLV_GET_STRUCT_TLVLEN |
| 7669 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 7670 | cmd->vdev_id = vdev_id; |
| 7671 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 7672 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7673 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7674 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7675 | __func__); |
| 7676 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7677 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7678 | } |
| 7679 | |
| 7680 | return 0; |
| 7681 | } |
| 7682 | |
| 7683 | /** |
| 7684 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 7685 | * @wmi_handle: wmi handle |
| 7686 | * @vdev_id: vdev id |
| 7687 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7688 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7689 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7690 | 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] | 7691 | uint8_t vdev_id) |
| 7692 | { |
| 7693 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 7694 | wmi_buf_t buf; |
| 7695 | int32_t len = sizeof(*cmd); |
| 7696 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7697 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7698 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7699 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7700 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7701 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7702 | } |
| 7703 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 7704 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7705 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 7706 | WMITLV_GET_STRUCT_TLVLEN |
| 7707 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 7708 | cmd->vdev_id = vdev_id; |
| 7709 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 7710 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7711 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7712 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7713 | __func__); |
| 7714 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7715 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7716 | } |
| 7717 | |
| 7718 | return 0; |
| 7719 | } |
| 7720 | |
| 7721 | /** |
| 7722 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 7723 | * @wmi_handle: wmi handle |
| 7724 | * @startOemDataReq: start request params |
| 7725 | * |
| 7726 | * Return: CDF status |
| 7727 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7728 | 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] | 7729 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7730 | uint8_t *data) |
| 7731 | { |
| 7732 | wmi_buf_t buf; |
| 7733 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7734 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7735 | |
| 7736 | buf = wmi_buf_alloc(wmi_handle, |
| 7737 | (data_len + WMI_TLV_HDR_SIZE)); |
| 7738 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7739 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 7740 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7741 | } |
| 7742 | |
| 7743 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 7744 | |
| 7745 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 7746 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7747 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7748 | data_len); |
| 7749 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7750 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7751 | data_len); |
| 7752 | |
| 7753 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 7754 | (data_len + |
| 7755 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 7756 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7757 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7758 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7759 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7760 | } |
| 7761 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7762 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7763 | } |
| 7764 | |
| 7765 | /** |
| 7766 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 7767 | * @wmi_handle: wmi handle |
| 7768 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 7769 | * |
| 7770 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 7771 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 7772 | * to firmware based on phyerr filtering |
| 7773 | * offload status. |
| 7774 | * |
| 7775 | * Return: 1 success, 0 failure |
| 7776 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7777 | static QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7778 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 7779 | bool dfs_phyerr_filter_offload) |
| 7780 | { |
| 7781 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 7782 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 7783 | wmi_buf_t buf; |
| 7784 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7785 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7786 | |
| 7787 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 7788 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7789 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7790 | __func__); |
| 7791 | len = sizeof(*disable_phyerr_offload_cmd); |
| 7792 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7793 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7794 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7795 | return 0; |
| 7796 | } |
| 7797 | disable_phyerr_offload_cmd = |
| 7798 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 7799 | wmi_buf_data(buf); |
| 7800 | |
| 7801 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 7802 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 7803 | WMITLV_GET_STRUCT_TLVLEN |
| 7804 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 7805 | |
| 7806 | /* |
| 7807 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 7808 | * to the firmware to disable the phyerror |
| 7809 | * filtering offload. |
| 7810 | */ |
| 7811 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7812 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7813 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7814 | 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] | 7815 | __func__, ret); |
| 7816 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7817 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7818 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7819 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7820 | __func__); |
| 7821 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7822 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7823 | __func__); |
| 7824 | |
| 7825 | len = sizeof(*enable_phyerr_offload_cmd); |
| 7826 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7827 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7828 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7829 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7830 | } |
| 7831 | |
| 7832 | enable_phyerr_offload_cmd = |
| 7833 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 7834 | wmi_buf_data(buf); |
| 7835 | |
| 7836 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 7837 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 7838 | WMITLV_GET_STRUCT_TLVLEN |
| 7839 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 7840 | |
| 7841 | /* |
| 7842 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 7843 | * to the firmware to enable the phyerror |
| 7844 | * filtering offload. |
| 7845 | */ |
| 7846 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7847 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 7848 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7849 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7850 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7851 | __func__, ret); |
| 7852 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7853 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7854 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7855 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7856 | __func__); |
| 7857 | } |
| 7858 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7859 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7860 | } |
| 7861 | |
| 7862 | #if !defined(REMOVE_PKT_LOG) |
| 7863 | /** |
| 7864 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 7865 | * @wmi_handle: wmi handle |
| 7866 | * @pktlog_event: pktlog event |
| 7867 | * @cmd_id: pktlog cmd id |
| 7868 | * |
| 7869 | * Return: CDF status |
| 7870 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7871 | 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] | 7872 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7873 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7874 | { |
| 7875 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 7876 | WMI_CMD_ID CMD_ID; |
| 7877 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 7878 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 7879 | int len = 0; |
| 7880 | wmi_buf_t buf; |
| 7881 | |
| 7882 | PKTLOG_EVENT = pktlog_event; |
| 7883 | CMD_ID = cmd_id; |
| 7884 | |
| 7885 | switch (CMD_ID) { |
| 7886 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 7887 | len = sizeof(*cmd); |
| 7888 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7889 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7890 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7891 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7892 | } |
| 7893 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 7894 | wmi_buf_data(buf); |
| 7895 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7896 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 7897 | WMITLV_GET_STRUCT_TLVLEN |
| 7898 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 7899 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7900 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 7901 | : WMI_PKTLOG_ENABLE_AUTO; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7902 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7903 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7904 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7905 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7906 | goto wmi_send_failed; |
| 7907 | } |
| 7908 | break; |
| 7909 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 7910 | len = sizeof(*disable_cmd); |
| 7911 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7912 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7913 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7914 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7915 | } |
| 7916 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 7917 | wmi_buf_data(buf); |
| 7918 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 7919 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 7920 | WMITLV_GET_STRUCT_TLVLEN |
| 7921 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7922 | disable_cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7923 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7924 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7925 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7926 | goto wmi_send_failed; |
| 7927 | } |
| 7928 | break; |
| 7929 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7930 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7931 | break; |
| 7932 | } |
| 7933 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7934 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7935 | |
| 7936 | wmi_send_failed: |
| 7937 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7938 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7939 | } |
| 7940 | #endif /* REMOVE_PKT_LOG */ |
| 7941 | |
| 7942 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7943 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 7944 | * @wmi_handle: wmi handle |
| 7945 | * @ptrn_id: pattern id |
| 7946 | * @vdev_id: vdev id |
| 7947 | * |
| 7948 | * Return: CDF status |
| 7949 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 7950 | static QDF_STATUS send_wow_delete_pattern_cmd_tlv(wmi_unified_t wmi_handle, |
| 7951 | uint8_t ptrn_id, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7952 | { |
| 7953 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 7954 | wmi_buf_t buf; |
| 7955 | int32_t len; |
| 7956 | int ret; |
| 7957 | |
| 7958 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 7959 | |
| 7960 | |
| 7961 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7962 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7963 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7964 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7965 | } |
| 7966 | |
| 7967 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7968 | |
| 7969 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7970 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 7971 | WMITLV_GET_STRUCT_TLVLEN( |
| 7972 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 7973 | cmd->vdev_id = vdev_id; |
| 7974 | cmd->pattern_id = ptrn_id; |
| 7975 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 7976 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7977 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7978 | cmd->pattern_id, vdev_id); |
| 7979 | |
| 7980 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7981 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 7982 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7983 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7984 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7985 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7986 | } |
| 7987 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7988 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7989 | } |
| 7990 | |
| 7991 | /** |
| 7992 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 7993 | * @wmi_handle: wmi handle |
| 7994 | * |
| 7995 | * Sends host wakeup indication to FW. On receiving this indication, |
| 7996 | * FW will come out of WOW. |
| 7997 | * |
| 7998 | * Return: CDF status |
| 7999 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8000 | 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] | 8001 | { |
| 8002 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 8003 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8004 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8005 | int32_t len; |
| 8006 | int ret; |
| 8007 | |
| 8008 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 8009 | |
| 8010 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8011 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8012 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8013 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8014 | } |
| 8015 | |
| 8016 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 8017 | wmi_buf_data(buf); |
| 8018 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8019 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 8020 | WMITLV_GET_STRUCT_TLVLEN |
| 8021 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 8022 | |
| 8023 | |
| 8024 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8025 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 8026 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8027 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8028 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8029 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8030 | } |
| 8031 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8032 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8033 | } |
| 8034 | |
| 8035 | /** |
| 8036 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8037 | * @wmi_handle: wmi handle |
| 8038 | * @msg: delts params |
| 8039 | * |
| 8040 | * Return: CDF status |
| 8041 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8042 | 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] | 8043 | uint8_t ac) |
| 8044 | { |
| 8045 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8046 | wmi_buf_t buf; |
| 8047 | int32_t len = sizeof(*cmd); |
| 8048 | |
| 8049 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8050 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8051 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8052 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8053 | } |
| 8054 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8055 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8056 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8057 | WMITLV_GET_STRUCT_TLVLEN |
| 8058 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8059 | cmd->vdev_id = vdev_id; |
| 8060 | cmd->ac = ac; |
| 8061 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8062 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8063 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8064 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8065 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8066 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +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_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8076 | * @wmi_handle: handle to wmi |
| 8077 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8078 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8079 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8080 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8081 | * active flow. |
| 8082 | * |
| 8083 | * Return: CDF status |
| 8084 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8085 | 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] | 8086 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8087 | { |
| 8088 | int i = 0; |
| 8089 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8090 | wmi_buf_t buf; |
| 8091 | int32_t len = sizeof(*cmd); |
| 8092 | |
| 8093 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 8094 | /* if flow in this AC is active */ |
| 8095 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 8096 | /* |
| 8097 | * as per implementation of wma_add_ts_req() we |
| 8098 | * are not waiting any response from firmware so |
| 8099 | * apart from sending ADDTS to firmware just send |
| 8100 | * success to upper layers |
| 8101 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8102 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8103 | |
| 8104 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8105 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8106 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8107 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8108 | } |
| 8109 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 8110 | wmi_buf_data(buf); |
| 8111 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8112 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8113 | WMITLV_GET_STRUCT_TLVLEN |
| 8114 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8115 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 8116 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 8117 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8118 | traffic.userPrio); |
| 8119 | cmd->medium_time_us = |
| 8120 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 8121 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8122 | 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] | 8123 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 8124 | cmd->medium_time_us, cmd->downgrade_type); |
| 8125 | if (wmi_unified_cmd_send |
| 8126 | (wmi_handle, buf, len, |
| 8127 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8128 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8129 | __func__); |
| 8130 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8131 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8132 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8133 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8134 | } |
| 8135 | } |
| 8136 | } |
| 8137 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8138 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8139 | } |
| 8140 | |
| 8141 | /** |
| 8142 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 8143 | * @wmi_handle: wmi handle |
| 8144 | * @msg: ADDTS params |
| 8145 | * |
| 8146 | * Return: CDF status |
| 8147 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8148 | 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] | 8149 | struct add_ts_param *msg) |
| 8150 | { |
| 8151 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8152 | wmi_buf_t buf; |
| 8153 | int32_t len = sizeof(*cmd); |
| 8154 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8155 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8156 | |
| 8157 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8158 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8159 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8160 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8161 | } |
| 8162 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8163 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8164 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8165 | WMITLV_GET_STRUCT_TLVLEN |
| 8166 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8167 | cmd->vdev_id = msg->sme_session_id; |
| 8168 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 8169 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 8170 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8171 | 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] | 8172 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 8173 | cmd->downgrade_type, __func__, __LINE__); |
| 8174 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8175 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8176 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 8177 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8178 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8179 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8180 | } |
| 8181 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8182 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8183 | } |
| 8184 | |
| 8185 | /** |
| 8186 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter in target |
| 8187 | * @wmi_handle: wmi handle |
| 8188 | * @vdev_id: vdev id |
| 8189 | * @enable: Flag to enable/disable packet filter |
| 8190 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8191 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8192 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8193 | static QDF_STATUS send_enable_disable_packet_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8194 | uint8_t vdev_id, bool enable) |
| 8195 | { |
| 8196 | int32_t len; |
| 8197 | int ret = 0; |
| 8198 | wmi_buf_t buf; |
| 8199 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 8200 | |
| 8201 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 8202 | |
| 8203 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8204 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8205 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8206 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8207 | } |
| 8208 | |
| 8209 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 8210 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8211 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 8212 | WMITLV_GET_STRUCT_TLVLEN( |
| 8213 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 8214 | |
| 8215 | cmd->vdev_id = vdev_id; |
| 8216 | if (enable) |
| 8217 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 8218 | else |
| 8219 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 8220 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8221 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8222 | __func__, cmd->enable, vdev_id); |
| 8223 | |
| 8224 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8225 | WMI_PACKET_FILTER_ENABLE_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8226 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8227 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8228 | wmi_buf_free(buf); |
| 8229 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8230 | |
| 8231 | return ret; |
| 8232 | } |
| 8233 | |
| 8234 | /** |
| 8235 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 8236 | * @wmi_handle: wmi handle |
| 8237 | * @vdev_id: vdev id |
| 8238 | * @rcv_filter_param: Packet filter parameters |
| 8239 | * @filter_id: Filter id |
| 8240 | * @enable: Flag to add/delete packet filter configuration |
| 8241 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8242 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8243 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8244 | static QDF_STATUS send_config_packet_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8245 | uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param, |
| 8246 | uint8_t filter_id, bool enable) |
| 8247 | { |
| 8248 | int len, i; |
| 8249 | int err = 0; |
| 8250 | wmi_buf_t buf; |
| 8251 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 8252 | |
| 8253 | |
| 8254 | /* allocate the memory */ |
| 8255 | len = sizeof(*cmd); |
| 8256 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8257 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8258 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8259 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8260 | } |
| 8261 | |
| 8262 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 8263 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8264 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 8265 | WMITLV_GET_STRUCT_TLVLEN |
| 8266 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 8267 | |
| 8268 | cmd->vdev_id = vdev_id; |
| 8269 | cmd->filter_id = filter_id; |
| 8270 | if (enable) |
| 8271 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 8272 | else |
| 8273 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 8274 | |
| 8275 | if (enable) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8276 | cmd->num_params = QDF_MIN( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8277 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 8278 | rcv_filter_param->numFieldParams); |
| 8279 | cmd->filter_type = rcv_filter_param->filterType; |
| 8280 | cmd->coalesce_time = rcv_filter_param->coalesceTime; |
| 8281 | |
| 8282 | for (i = 0; i < cmd->num_params; i++) { |
| 8283 | cmd->paramsData[i].proto_type = |
| 8284 | rcv_filter_param->paramsData[i].protocolLayer; |
| 8285 | cmd->paramsData[i].cmp_type = |
| 8286 | rcv_filter_param->paramsData[i].cmpFlag; |
| 8287 | cmd->paramsData[i].data_length = |
| 8288 | rcv_filter_param->paramsData[i].dataLength; |
| 8289 | cmd->paramsData[i].data_offset = |
| 8290 | rcv_filter_param->paramsData[i].dataOffset; |
| 8291 | memcpy(&cmd->paramsData[i].compareData, |
| 8292 | rcv_filter_param->paramsData[i].compareData, |
| 8293 | sizeof(cmd->paramsData[i].compareData)); |
| 8294 | memcpy(&cmd->paramsData[i].dataMask, |
| 8295 | rcv_filter_param->paramsData[i].dataMask, |
| 8296 | sizeof(cmd->paramsData[i].dataMask)); |
| 8297 | } |
| 8298 | } |
| 8299 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8300 | WMI_LOGE("Packet filter action %d filter with id: %d, num_params=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8301 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 8302 | /* send the command along with data */ |
| 8303 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8304 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 8305 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8306 | WMI_LOGE("Failed to send pkt_filter cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8307 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8308 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8309 | } |
| 8310 | |
| 8311 | |
| 8312 | return 0; |
| 8313 | } |
| 8314 | |
| 8315 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8316 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 8317 | * @wmi_handle: wmi handle |
| 8318 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 8319 | * |
| 8320 | * Retrun: CDF status |
| 8321 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8322 | 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] | 8323 | struct periodic_tx_pattern * |
| 8324 | pAddPeriodicTxPtrnParams, |
| 8325 | uint8_t vdev_id) |
| 8326 | { |
| 8327 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8328 | wmi_buf_t wmi_buf; |
| 8329 | uint32_t len; |
| 8330 | uint8_t *buf_ptr; |
| 8331 | uint32_t ptrn_len, ptrn_len_aligned; |
| 8332 | int j; |
| 8333 | |
| 8334 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8335 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 8336 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 8337 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 8338 | |
| 8339 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8340 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8341 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8342 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8343 | } |
| 8344 | |
| 8345 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8346 | |
| 8347 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 8348 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8349 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8350 | WMITLV_GET_STRUCT_TLVLEN |
| 8351 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8352 | |
| 8353 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8354 | cmd->vdev_id = vdev_id; |
| 8355 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 8356 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 8357 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8358 | |
| 8359 | /* Pattern info */ |
| 8360 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8361 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 8362 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8363 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8364 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8365 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8366 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8367 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8368 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8369 | |
| 8370 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8371 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8372 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8373 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8374 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8375 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8376 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8377 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8378 | } |
| 8379 | |
| 8380 | /** |
| 8381 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 8382 | * @wmi_handle: wmi handle |
| 8383 | * @vdev_id: vdev id |
| 8384 | * @pattern_id: pattern id |
| 8385 | * |
| 8386 | * Retrun: CDF status |
| 8387 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8388 | 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] | 8389 | uint8_t vdev_id, |
| 8390 | uint8_t pattern_id) |
| 8391 | { |
| 8392 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8393 | wmi_buf_t wmi_buf; |
| 8394 | uint32_t len = |
| 8395 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8396 | |
| 8397 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8398 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8399 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8400 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8401 | } |
| 8402 | |
| 8403 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 8404 | wmi_buf_data(wmi_buf); |
| 8405 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8406 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8407 | WMITLV_GET_STRUCT_TLVLEN |
| 8408 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8409 | |
| 8410 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8411 | cmd->vdev_id = vdev_id; |
| 8412 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8413 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8414 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8415 | |
| 8416 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8417 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8418 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8419 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8420 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8421 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8422 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8423 | } |
| 8424 | |
| 8425 | /** |
| 8426 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 8427 | * @wmi_handle: wmi handle |
| 8428 | * @preq: stats ext params |
| 8429 | * |
| 8430 | * Return: CDF status |
| 8431 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8432 | 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] | 8433 | struct stats_ext_params *preq) |
| 8434 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8435 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8436 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 8437 | wmi_buf_t buf; |
| 8438 | uint16_t len; |
| 8439 | uint8_t *buf_ptr; |
| 8440 | |
| 8441 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 8442 | |
| 8443 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8444 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8445 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8446 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8447 | } |
| 8448 | |
| 8449 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8450 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 8451 | |
| 8452 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8453 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 8454 | WMITLV_GET_STRUCT_TLVLEN |
| 8455 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 8456 | cmd->vdev_id = preq->vdev_id; |
| 8457 | cmd->data_len = preq->request_data_len; |
| 8458 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8459 | 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] | 8460 | __func__, preq->request_data_len, preq->vdev_id); |
| 8461 | |
| 8462 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 8463 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 8464 | |
| 8465 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8466 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8467 | |
| 8468 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8469 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8470 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8471 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8472 | ret); |
| 8473 | wmi_buf_free(buf); |
| 8474 | } |
| 8475 | |
| 8476 | return ret; |
| 8477 | } |
| 8478 | |
| 8479 | /** |
| 8480 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 8481 | * @wmi_handle: wmi handle |
| 8482 | * @params: ext wow params |
| 8483 | * |
| 8484 | * Return:0 for success or error code |
| 8485 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8486 | 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] | 8487 | struct ext_wow_params *params) |
| 8488 | { |
| 8489 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 8490 | wmi_buf_t buf; |
| 8491 | int32_t len; |
| 8492 | int ret; |
| 8493 | |
| 8494 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 8495 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8496 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8497 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8498 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8499 | } |
| 8500 | |
| 8501 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8502 | |
| 8503 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8504 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 8505 | WMITLV_GET_STRUCT_TLVLEN |
| 8506 | (wmi_extwow_enable_cmd_fixed_param)); |
| 8507 | |
| 8508 | cmd->vdev_id = params->vdev_id; |
| 8509 | cmd->type = params->type; |
| 8510 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 8511 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8512 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8513 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 8514 | |
| 8515 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8516 | WMI_EXTWOW_ENABLE_CMDID); |
| 8517 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8518 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8519 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8520 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8521 | } |
| 8522 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8523 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8524 | |
| 8525 | } |
| 8526 | |
| 8527 | /** |
| 8528 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 8529 | * @wmi_handle: wmi handle |
| 8530 | * @app_type1_params: app type1 params |
| 8531 | * |
| 8532 | * Return: CDF status |
| 8533 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8534 | 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] | 8535 | struct app_type1_params *app_type1_params) |
| 8536 | { |
| 8537 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 8538 | wmi_buf_t buf; |
| 8539 | int32_t len; |
| 8540 | int ret; |
| 8541 | |
| 8542 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 8543 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8544 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8545 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8546 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8547 | } |
| 8548 | |
| 8549 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 8550 | wmi_buf_data(buf); |
| 8551 | |
| 8552 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8553 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 8554 | WMITLV_GET_STRUCT_TLVLEN |
| 8555 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 8556 | |
| 8557 | cmd->vdev_id = app_type1_params->vdev_id; |
| 8558 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 8559 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8560 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8561 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8562 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8563 | cmd->passwd_len = app_type1_params->pass_length; |
| 8564 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8565 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8566 | "identification_id %.8s id_length %u " |
| 8567 | "password %.16s pass_length %u", |
| 8568 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 8569 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 8570 | |
| 8571 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8572 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 8573 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8574 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8575 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8576 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8577 | } |
| 8578 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8579 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8580 | } |
| 8581 | |
| 8582 | /** |
| 8583 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 8584 | * @wmi_handle: wmi handle |
| 8585 | * @appType2Params: app type2 params |
| 8586 | * |
| 8587 | * Return: CDF status |
| 8588 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8589 | 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] | 8590 | struct app_type2_params *appType2Params) |
| 8591 | { |
| 8592 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 8593 | wmi_buf_t buf; |
| 8594 | int32_t len; |
| 8595 | int ret; |
| 8596 | |
| 8597 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 8598 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8599 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8600 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8601 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8602 | } |
| 8603 | |
| 8604 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 8605 | wmi_buf_data(buf); |
| 8606 | |
| 8607 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8608 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 8609 | WMITLV_GET_STRUCT_TLVLEN |
| 8610 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 8611 | |
| 8612 | cmd->vdev_id = appType2Params->vdev_id; |
| 8613 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8614 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8615 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 8616 | |
| 8617 | cmd->ip_id = appType2Params->ip_id; |
| 8618 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 8619 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 8620 | |
| 8621 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 8622 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 8623 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 8624 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 8625 | |
| 8626 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 8627 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 8628 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 8629 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 8630 | |
| 8631 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 8632 | &cmd->gateway_mac); |
| 8633 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 8634 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 8635 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8636 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8637 | "rc4_key %.16s rc4_key_len %u " |
| 8638 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 8639 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 8640 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 8641 | "keepalive_max %u keepalive_inc %u " |
| 8642 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 8643 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 8644 | cmd->rc4_key, cmd->rc4_key_len, |
| 8645 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 8646 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 8647 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 8648 | cmd->keepalive_max, cmd->keepalive_inc, |
| 8649 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 8650 | |
| 8651 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8652 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 8653 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8654 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8655 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8656 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8657 | } |
| 8658 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8659 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8660 | |
| 8661 | } |
| 8662 | |
| 8663 | /** |
| 8664 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 8665 | * @wmi_handle: wmi handle |
| 8666 | * @timer_val: auto shutdown timer value |
| 8667 | * |
| 8668 | * Return: CDF status |
| 8669 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8670 | 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] | 8671 | uint32_t timer_val) |
| 8672 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8673 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8674 | wmi_buf_t buf = NULL; |
| 8675 | uint8_t *buf_ptr; |
| 8676 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 8677 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 8678 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8679 | 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] | 8680 | __func__, timer_val); |
| 8681 | |
| 8682 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8683 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8684 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8685 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8686 | } |
| 8687 | |
| 8688 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8689 | wmi_auto_sh_cmd = |
| 8690 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 8691 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 8692 | |
| 8693 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 8694 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 8695 | WMITLV_GET_STRUCT_TLVLEN |
| 8696 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 8697 | |
| 8698 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8699 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8700 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8701 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8702 | __func__, status); |
| 8703 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8704 | } |
| 8705 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8706 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8707 | } |
| 8708 | |
| 8709 | /** |
| 8710 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 8711 | * @wmi_handle: wmi handle |
| 8712 | * @nan_req: request data which will be non-null |
| 8713 | * |
| 8714 | * Return: CDF status |
| 8715 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8716 | 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] | 8717 | struct nan_req_params *nan_req) |
| 8718 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8719 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8720 | wmi_nan_cmd_param *cmd; |
| 8721 | wmi_buf_t buf; |
| 8722 | uint16_t len = sizeof(*cmd); |
| 8723 | uint16_t nan_data_len, nan_data_len_aligned; |
| 8724 | uint8_t *buf_ptr; |
| 8725 | |
| 8726 | /* |
| 8727 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 8728 | * +------------+----------+-----------------------+--------------+ |
| 8729 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 8730 | * +------------+----------+-----------------------+--------------+ |
| 8731 | */ |
| 8732 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8733 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 8734 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8735 | } |
| 8736 | nan_data_len = nan_req->request_data_len; |
| 8737 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 8738 | sizeof(uint32_t)); |
| 8739 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 8740 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8741 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8742 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8743 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8744 | } |
| 8745 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8746 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 8747 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8748 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 8749 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 8750 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8751 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8752 | __func__, nan_req->request_data_len); |
| 8753 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 8754 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 8755 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8756 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8757 | |
| 8758 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8759 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8760 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8761 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8762 | __func__, ret); |
| 8763 | wmi_buf_free(buf); |
| 8764 | } |
| 8765 | |
| 8766 | return ret; |
| 8767 | } |
| 8768 | |
| 8769 | /** |
| 8770 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 8771 | * @wmi_handle: wmi handle |
| 8772 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 8773 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8774 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8775 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8776 | 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] | 8777 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 8778 | { |
| 8779 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 8780 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8781 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8782 | |
| 8783 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8784 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8785 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8786 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8787 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8788 | } |
| 8789 | |
| 8790 | 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] | 8791 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8792 | |
| 8793 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8794 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 8795 | WMITLV_GET_STRUCT_TLVLEN |
| 8796 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 8797 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 8798 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 8799 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 8800 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 8801 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8802 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8803 | sizeof(*cmd), |
| 8804 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8805 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8806 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8807 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8808 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8809 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8810 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8811 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8812 | |
| 8813 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8814 | } |
| 8815 | |
| 8816 | /** |
| 8817 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 8818 | * @wmi_handle: wmi handle |
| 8819 | * @flashing: flashing request |
| 8820 | * |
| 8821 | * Return: CDF status |
| 8822 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8823 | 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] | 8824 | struct flashing_req_params *flashing) |
| 8825 | { |
| 8826 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8827 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8828 | wmi_buf_t buf; |
| 8829 | uint8_t *buf_ptr; |
| 8830 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 8831 | |
| 8832 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8833 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8834 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8835 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8836 | } |
| 8837 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8838 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 8839 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8840 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 8841 | WMITLV_GET_STRUCT_TLVLEN |
| 8842 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 8843 | cmd->pattern_id = flashing->pattern_id; |
| 8844 | cmd->led_x0 = flashing->led_x0; |
| 8845 | cmd->led_x1 = flashing->led_x1; |
| 8846 | |
| 8847 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8848 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8849 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8850 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8851 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8852 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8853 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8854 | |
| 8855 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8856 | } |
| 8857 | |
| 8858 | /** |
| 8859 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 8860 | * @wmi_handle: wmi handle |
| 8861 | * @ch_avoid_update_req: channel avoid update params |
| 8862 | * |
| 8863 | * Return: CDF status |
| 8864 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8865 | 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] | 8866 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8867 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8868 | wmi_buf_t buf = NULL; |
| 8869 | uint8_t *buf_ptr; |
| 8870 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 8871 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 8872 | |
| 8873 | |
| 8874 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8875 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8876 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8877 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8878 | } |
| 8879 | |
| 8880 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8881 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 8882 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 8883 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 8884 | WMITLV_GET_STRUCT_TLVLEN |
| 8885 | (wmi_chan_avoid_update_cmd_param)); |
| 8886 | |
| 8887 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8888 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8889 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8890 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8891 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 8892 | " returned Error %d", status); |
| 8893 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8894 | } |
| 8895 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8896 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8897 | } |
| 8898 | |
| 8899 | /** |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 8900 | * send_pdev_set_regdomain_cmd_tlv() - send set regdomain command to fw |
| 8901 | * @wmi_handle: wmi handle |
| 8902 | * @param: pointer to pdev regdomain params |
| 8903 | * |
| 8904 | * Return: 0 for success or error code |
| 8905 | */ |
| 8906 | static QDF_STATUS |
| 8907 | send_pdev_set_regdomain_cmd_tlv(wmi_unified_t wmi_handle, |
| 8908 | struct pdev_set_regdomain_params *param) |
| 8909 | { |
| 8910 | wmi_buf_t buf; |
| 8911 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 8912 | int32_t len = sizeof(*cmd); |
| 8913 | |
| 8914 | |
| 8915 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8916 | if (!buf) { |
| 8917 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8918 | return QDF_STATUS_E_NOMEM; |
| 8919 | } |
| 8920 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 8921 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8922 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 8923 | WMITLV_GET_STRUCT_TLVLEN |
| 8924 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 8925 | |
| 8926 | cmd->reg_domain = param->currentRDinuse; |
| 8927 | cmd->reg_domain_2G = param->currentRD2G; |
| 8928 | cmd->reg_domain_5G = param->currentRD5G; |
| 8929 | cmd->conformance_test_limit_2G = param->ctl_2G; |
| 8930 | cmd->conformance_test_limit_5G = param->ctl_5G; |
| 8931 | cmd->dfs_domain = param->dfsDomain; |
| 8932 | cmd->pdev_id = param->pdev_id; |
| 8933 | |
| 8934 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8935 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
| 8936 | WMI_LOGE("%s: Failed to send pdev set regdomain command", |
| 8937 | __func__); |
| 8938 | wmi_buf_free(buf); |
| 8939 | return QDF_STATUS_E_FAILURE; |
| 8940 | } |
| 8941 | |
| 8942 | return QDF_STATUS_SUCCESS; |
| 8943 | } |
| 8944 | |
| 8945 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8946 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 8947 | * @wmi_handle: wmi handle |
| 8948 | * @reg_dmn: reg domain |
| 8949 | * @regdmn2G: 2G reg domain |
| 8950 | * @regdmn5G: 5G reg domain |
| 8951 | * @ctl2G: 2G test limit |
| 8952 | * @ctl5G: 5G test limit |
| 8953 | * |
| 8954 | * Return: none |
| 8955 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8956 | 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] | 8957 | uint32_t reg_dmn, uint16_t regdmn2G, |
| 8958 | uint16_t regdmn5G, int8_t ctl2G, |
| 8959 | int8_t ctl5G) |
| 8960 | { |
| 8961 | wmi_buf_t buf; |
| 8962 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 8963 | int32_t len = sizeof(*cmd); |
| 8964 | |
| 8965 | |
| 8966 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8967 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8968 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8969 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8970 | } |
| 8971 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 8972 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8973 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 8974 | WMITLV_GET_STRUCT_TLVLEN |
| 8975 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 8976 | cmd->reg_domain = reg_dmn; |
| 8977 | cmd->reg_domain_2G = regdmn2G; |
| 8978 | cmd->reg_domain_5G = regdmn5G; |
| 8979 | cmd->conformance_test_limit_2G = ctl2G; |
| 8980 | cmd->conformance_test_limit_5G = ctl5G; |
| 8981 | |
| 8982 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8983 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8984 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8985 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8986 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8987 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8988 | } |
| 8989 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8990 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8991 | } |
| 8992 | |
| 8993 | |
| 8994 | /** |
| 8995 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 8996 | * @wmi_handle: wmi handle |
| 8997 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 8998 | * |
| 8999 | * This function sets tdls off channel mode |
| 9000 | * |
| 9001 | * Return: 0 on success; Negative errno otherwise |
| 9002 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9003 | 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] | 9004 | struct tdls_channel_switch_params *chan_switch_params) |
| 9005 | { |
| 9006 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9007 | wmi_buf_t wmi_buf; |
| 9008 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9009 | |
| 9010 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9011 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9012 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9013 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9014 | } |
| 9015 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9016 | wmi_buf_data(wmi_buf); |
| 9017 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9018 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9019 | WMITLV_GET_STRUCT_TLVLEN( |
| 9020 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9021 | |
| 9022 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9023 | &cmd->peer_macaddr); |
| 9024 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9025 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9026 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9027 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9028 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9029 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9030 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9031 | 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] | 9032 | cmd->peer_macaddr.mac_addr31to0, |
| 9033 | cmd->peer_macaddr.mac_addr47to32); |
| 9034 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9035 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9036 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9037 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9038 | ), |
| 9039 | cmd->vdev_id, |
| 9040 | cmd->offchan_mode, |
| 9041 | cmd->offchan_num, |
| 9042 | cmd->offchan_bw_bitmap, |
| 9043 | cmd->is_peer_responder, |
| 9044 | cmd->offchan_oper_class); |
| 9045 | |
| 9046 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9047 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9048 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9049 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9050 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9051 | } |
| 9052 | |
| 9053 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9054 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9055 | } |
| 9056 | |
| 9057 | /** |
| 9058 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9059 | * @wmi_handle: wmi handle |
| 9060 | * @pwmaTdlsparams: TDLS params |
| 9061 | * |
| 9062 | * Return: 0 for sucess or error code |
| 9063 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9064 | 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] | 9065 | void *tdls_param, uint8_t tdls_state) |
| 9066 | { |
| 9067 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9068 | wmi_buf_t wmi_buf; |
| 9069 | |
| 9070 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9071 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9072 | |
| 9073 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9074 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9075 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9076 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9077 | } |
| 9078 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9079 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9080 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9081 | WMITLV_GET_STRUCT_TLVLEN |
| 9082 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9083 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9084 | cmd->state = tdls_state; |
| 9085 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9086 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9087 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9088 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9089 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9090 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9091 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9092 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9093 | wmi_tdls->peer_traffic_response_timeout; |
| 9094 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9095 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9096 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9097 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9098 | cmd->teardown_notification_ms = |
| 9099 | wmi_tdls->teardown_notification_ms; |
| 9100 | cmd->tdls_peer_kickout_threshold = |
| 9101 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9102 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9103 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9104 | "notification_interval_ms: %d, " |
| 9105 | "tx_discovery_threshold: %d, " |
| 9106 | "tx_teardown_threshold: %d, " |
| 9107 | "rssi_teardown_threshold: %d, " |
| 9108 | "rssi_delta: %d, " |
| 9109 | "tdls_options: 0x%x, " |
| 9110 | "tdls_peer_traffic_ind_window: %d, " |
| 9111 | "tdls_peer_traffic_response_timeout: %d, " |
| 9112 | "tdls_puapsd_mask: 0x%x, " |
| 9113 | "tdls_puapsd_inactivity_time: %d, " |
| 9114 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9115 | "teardown_notification_ms: %d, " |
| 9116 | "tdls_peer_kickout_threshold: %d", |
| 9117 | __func__, tdls_state, cmd->state, |
| 9118 | cmd->notification_interval_ms, |
| 9119 | cmd->tx_discovery_threshold, |
| 9120 | cmd->tx_teardown_threshold, |
| 9121 | cmd->rssi_teardown_threshold, |
| 9122 | cmd->rssi_delta, |
| 9123 | cmd->tdls_options, |
| 9124 | cmd->tdls_peer_traffic_ind_window, |
| 9125 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9126 | cmd->tdls_puapsd_mask, |
| 9127 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9128 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9129 | cmd->teardown_notification_ms, |
| 9130 | cmd->tdls_peer_kickout_threshold); |
| 9131 | |
| 9132 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9133 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9134 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9135 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9136 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9137 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9138 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9139 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9140 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9141 | } |
| 9142 | |
| 9143 | /** |
| 9144 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9145 | * @wmi_handle: wmi handle |
| 9146 | * @peerStateParams: TDLS peer state params |
| 9147 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9148 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9149 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9150 | 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] | 9151 | struct tdls_peer_state_params *peerStateParams, |
| 9152 | uint32_t *ch_mhz) |
| 9153 | { |
| 9154 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9155 | wmi_tdls_peer_capabilities *peer_cap; |
| 9156 | wmi_channel *chan_info; |
| 9157 | wmi_buf_t wmi_buf; |
| 9158 | uint8_t *buf_ptr; |
| 9159 | uint32_t i; |
| 9160 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9161 | sizeof(wmi_tdls_peer_capabilities); |
| 9162 | |
| 9163 | |
| 9164 | len += WMI_TLV_HDR_SIZE + |
| 9165 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9166 | |
| 9167 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9168 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9169 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9170 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9171 | } |
| 9172 | |
| 9173 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9174 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9175 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9176 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9177 | WMITLV_GET_STRUCT_TLVLEN |
| 9178 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9179 | |
| 9180 | cmd->vdev_id = peerStateParams->vdevId; |
| 9181 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9182 | &cmd->peer_macaddr); |
| 9183 | |
| 9184 | |
| 9185 | cmd->peer_state = peerStateParams->peerState; |
| 9186 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9187 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9188 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9189 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9190 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9191 | cmd->peer_macaddr.mac_addr31to0, |
| 9192 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9193 | |
| 9194 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9195 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9196 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9197 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9198 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9199 | |
| 9200 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9201 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9202 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9203 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9204 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9205 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9206 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9207 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9208 | |
| 9209 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9210 | * but fill SP |
| 9211 | */ |
| 9212 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9213 | peerStateParams->peerCap.peerMaxSp); |
| 9214 | |
| 9215 | peer_cap->buff_sta_support = |
| 9216 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9217 | peer_cap->off_chan_support = |
| 9218 | peerStateParams->peerCap.peerOffChanSupport; |
| 9219 | peer_cap->peer_curr_operclass = |
| 9220 | peerStateParams->peerCap.peerCurrOperClass; |
| 9221 | /* self curr operclass is not being used and so pass op class for |
| 9222 | * preferred off chan in it. |
| 9223 | */ |
| 9224 | peer_cap->self_curr_operclass = |
| 9225 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 9226 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 9227 | peer_cap->peer_operclass_len = |
| 9228 | peerStateParams->peerCap.peerOperClassLen; |
| 9229 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9230 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9231 | __func__, peer_cap->peer_operclass_len); |
| 9232 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 9233 | peer_cap->peer_operclass[i] = |
| 9234 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9235 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9236 | __func__, i, peer_cap->peer_operclass[i]); |
| 9237 | } |
| 9238 | |
| 9239 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 9240 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 9241 | peer_cap->pref_offchan_bw = |
| 9242 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 9243 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9244 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9245 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 9246 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 9247 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 9248 | " %d, pref_offchan_bw: %d", |
| 9249 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 9250 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 9251 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 9252 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 9253 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 9254 | |
| 9255 | /* next fill variable size array of peer chan info */ |
| 9256 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 9257 | WMITLV_SET_HDR(buf_ptr, |
| 9258 | WMITLV_TAG_ARRAY_STRUC, |
| 9259 | sizeof(wmi_channel) * |
| 9260 | peerStateParams->peerCap.peerChanLen); |
| 9261 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9262 | |
| 9263 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 9264 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 9265 | WMITLV_TAG_STRUC_wmi_channel, |
| 9266 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 9267 | chan_info->mhz = ch_mhz[i]; |
| 9268 | chan_info->band_center_freq1 = chan_info->mhz; |
| 9269 | chan_info->band_center_freq2 = 0; |
| 9270 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9271 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9272 | |
| 9273 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 9274 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9275 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9276 | peerStateParams->peerCap.peerChan[i].chanId, |
| 9277 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 9278 | } |
| 9279 | |
| 9280 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 9281 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 9282 | else |
| 9283 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 9284 | |
| 9285 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 9286 | peerStateParams->peerCap. |
| 9287 | peerChan[i].pwr); |
| 9288 | |
| 9289 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 9290 | peerStateParams->peerCap.peerChan[i]. |
| 9291 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9292 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9293 | peerStateParams->peerCap.peerChan[i].pwr); |
| 9294 | |
| 9295 | chan_info++; |
| 9296 | } |
| 9297 | |
| 9298 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9299 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9300 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9301 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9302 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9303 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9304 | } |
| 9305 | |
| 9306 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9307 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9308 | } |
| 9309 | |
| 9310 | /* |
| 9311 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 9312 | * firmware |
| 9313 | * @wmi_handle: Pointer to wmi handle |
| 9314 | * @mem_dump_req: Pointer for mem_dump_req |
| 9315 | * |
| 9316 | * This function sends memory dump request to firmware |
| 9317 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9318 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9319 | * |
| 9320 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9321 | 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] | 9322 | struct fw_dump_req_param *mem_dump_req) |
| 9323 | { |
| 9324 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 9325 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9326 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9327 | int32_t len; |
| 9328 | wmi_buf_t buf; |
| 9329 | u_int8_t *buf_ptr; |
| 9330 | int ret, loop; |
| 9331 | |
| 9332 | /* |
| 9333 | * len = sizeof(fixed param) that includes tlv header + |
| 9334 | * tlv header for array of struc + |
| 9335 | * sizeof (each struct) |
| 9336 | */ |
| 9337 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9338 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 9339 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9340 | |
| 9341 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9342 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 9343 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9344 | } |
| 9345 | |
| 9346 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9347 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9348 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 9349 | |
| 9350 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9351 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 9352 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 9353 | |
| 9354 | cmd->request_id = mem_dump_req->request_id; |
| 9355 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 9356 | |
| 9357 | /* TLV indicating array of structures to follow */ |
| 9358 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 9359 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9360 | sizeof(wmi_fw_mem_dump) * |
| 9361 | cmd->num_fw_mem_dump_segs); |
| 9362 | |
| 9363 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9364 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 9365 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9366 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9367 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 9368 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9369 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9370 | ((uint8_t *)(mem_dump_req->segment) + |
| 9371 | loop * sizeof(*seg_req)); |
| 9372 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 9373 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 9374 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 9375 | dump_params->seg_id = seg_req->seg_id; |
| 9376 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 9377 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 9378 | dump_params->seg_length = seg_req->seg_length; |
| 9379 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 9380 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9381 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 9382 | 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] | 9383 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 9384 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9385 | 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] | 9386 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 9387 | dump_params->dest_addr_hi); |
| 9388 | dump_params++; |
| 9389 | } |
| 9390 | |
| 9391 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9392 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 9393 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9394 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9395 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9396 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9397 | } |
| 9398 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9399 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 9400 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9401 | } |
| 9402 | |
| 9403 | /* |
| 9404 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 9405 | * @wmi_handle: Pointer to WMi handle |
| 9406 | * @ie_data: Pointer for ie data |
| 9407 | * |
| 9408 | * This function sends IE information to firmware |
| 9409 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9410 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9411 | * |
| 9412 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9413 | 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] | 9414 | struct vdev_ie_info_param *ie_info) |
| 9415 | { |
| 9416 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 9417 | wmi_buf_t buf; |
| 9418 | uint8_t *buf_ptr; |
| 9419 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9420 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9421 | |
| 9422 | |
| 9423 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 9424 | /* Allocate memory for the WMI command */ |
| 9425 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 9426 | |
| 9427 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9428 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9429 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9430 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9431 | } |
| 9432 | |
| 9433 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9434 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9435 | |
| 9436 | /* Populate the WMI command */ |
| 9437 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 9438 | |
| 9439 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9440 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 9441 | WMITLV_GET_STRUCT_TLVLEN( |
| 9442 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 9443 | cmd->vdev_id = ie_info->vdev_id; |
| 9444 | cmd->ie_id = ie_info->ie_id; |
| 9445 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 9446 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9447 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9448 | 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] | 9449 | ie_info->length, ie_info->vdev_id); |
| 9450 | |
| 9451 | buf_ptr += sizeof(*cmd); |
| 9452 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 9453 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9454 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9455 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9456 | |
| 9457 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9458 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9459 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9460 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9461 | wmi_buf_free(buf); |
| 9462 | } |
| 9463 | |
| 9464 | return ret; |
| 9465 | } |
| 9466 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9467 | /** |
| 9468 | * send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function |
| 9469 | * |
| 9470 | * @param wmi_handle : handle to WMI. |
| 9471 | * @param param : pointer to antenna param |
| 9472 | * |
| 9473 | * This function sends smart antenna enable command to FW |
| 9474 | * |
| 9475 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9476 | */ |
| 9477 | static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 9478 | struct smart_ant_enable_params *param) |
| 9479 | { |
| 9480 | /* Send WMI COMMAND to Enable */ |
| 9481 | wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd; |
| 9482 | wmi_pdev_smart_ant_gpio_handle *gpio_param; |
| 9483 | wmi_buf_t buf; |
| 9484 | uint8_t *buf_ptr; |
| 9485 | int len = 0; |
| 9486 | QDF_STATUS ret; |
| 9487 | int loop = 0; |
| 9488 | |
| 9489 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9490 | len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle); |
| 9491 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9492 | |
| 9493 | if (!buf) { |
| 9494 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9495 | return QDF_STATUS_E_NOMEM; |
| 9496 | } |
| 9497 | |
| 9498 | buf_ptr = wmi_buf_data(buf); |
| 9499 | qdf_mem_zero(buf_ptr, len); |
| 9500 | cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr; |
| 9501 | |
| 9502 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9503 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param, |
| 9504 | WMITLV_GET_STRUCT_TLVLEN( |
| 9505 | wmi_pdev_smart_ant_enable_cmd_fixed_param)); |
| 9506 | |
| 9507 | cmd->pdev_id = param->pdev_id; |
| 9508 | cmd->enable = param->enable; |
| 9509 | cmd->mode = param->mode; |
| 9510 | cmd->rx_antenna = param->rx_antenna; |
| 9511 | cmd->tx_default_antenna = param->rx_antenna; |
| 9512 | |
| 9513 | /* TLV indicating array of structures to follow */ |
| 9514 | buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param); |
| 9515 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9516 | WMI_HAL_MAX_SANTENNA * |
| 9517 | sizeof(wmi_pdev_smart_ant_gpio_handle)); |
| 9518 | |
| 9519 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9520 | gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr; |
| 9521 | |
| 9522 | for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) { |
| 9523 | WMITLV_SET_HDR(&gpio_param->tlv_header, |
| 9524 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle, |
| 9525 | WMITLV_GET_STRUCT_TLVLEN( |
| 9526 | wmi_pdev_smart_ant_gpio_handle)); |
| 9527 | if (param->mode == SMART_ANT_MODE_SERIAL) { |
| 9528 | if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) { |
| 9529 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 9530 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 9531 | } else { |
| 9532 | gpio_param->gpio_pin = 0; |
| 9533 | gpio_param->gpio_func = 0; |
| 9534 | } |
| 9535 | } else if (param->mode == SMART_ANT_MODE_PARALLEL) { |
| 9536 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 9537 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 9538 | } |
| 9539 | /* Setting it to 0 for now */ |
| 9540 | gpio_param->pdev_id = param->pdev_id; |
| 9541 | gpio_param++; |
| 9542 | } |
| 9543 | |
| 9544 | ret = wmi_unified_cmd_send(wmi_handle, |
| 9545 | buf, |
| 9546 | len, |
| 9547 | WMI_PDEV_SMART_ANT_ENABLE_CMDID); |
| 9548 | |
| 9549 | if (ret != 0) { |
| 9550 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 9551 | WMI_LOGE("enable:%d mode:%d rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n", |
| 9552 | cmd->enable, |
| 9553 | cmd->mode, |
| 9554 | cmd->rx_antenna, |
| 9555 | param->gpio_pin[0], param->gpio_pin[1], |
| 9556 | param->gpio_pin[2], param->gpio_pin[3], |
| 9557 | param->gpio_func[0], param->gpio_func[1], |
| 9558 | param->gpio_func[2], param->gpio_func[3], |
| 9559 | ret); |
| 9560 | wmi_buf_free(buf); |
| 9561 | } |
| 9562 | |
| 9563 | return ret; |
| 9564 | } |
| 9565 | |
| 9566 | /** |
| 9567 | * send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function |
| 9568 | * |
| 9569 | * @param wmi_handle : handle to WMI. |
| 9570 | * @param param : pointer to rx antenna param |
| 9571 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9572 | */ |
| 9573 | static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 9574 | struct smart_ant_rx_ant_params *param) |
| 9575 | { |
| 9576 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd; |
| 9577 | wmi_buf_t buf; |
| 9578 | uint8_t *buf_ptr; |
| 9579 | uint32_t len; |
| 9580 | QDF_STATUS ret; |
| 9581 | |
| 9582 | len = sizeof(*cmd); |
| 9583 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9584 | WMI_LOGD("%s:\n", __func__); |
| 9585 | if (!buf) { |
| 9586 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9587 | return QDF_STATUS_E_NOMEM; |
| 9588 | } |
| 9589 | |
| 9590 | buf_ptr = wmi_buf_data(buf); |
| 9591 | cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr; |
| 9592 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9593 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param, |
| 9594 | WMITLV_GET_STRUCT_TLVLEN( |
| 9595 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param)); |
| 9596 | cmd->rx_antenna = param->antenna; |
| 9597 | cmd->pdev_id = param->pdev_id; |
| 9598 | |
| 9599 | ret = wmi_unified_cmd_send(wmi_handle, |
| 9600 | buf, |
| 9601 | len, |
| 9602 | WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID); |
| 9603 | |
| 9604 | if (ret != 0) { |
| 9605 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 9606 | WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n", |
| 9607 | __func__, |
| 9608 | cmd->rx_antenna, |
| 9609 | ret); |
| 9610 | wmi_buf_free(buf); |
| 9611 | } |
| 9612 | |
| 9613 | return ret; |
| 9614 | } |
| 9615 | |
| 9616 | /** |
| 9617 | * send_set_ctl_table_cmd_tlv() - send ctl table cmd to fw |
| 9618 | * @wmi_handle: wmi handle |
| 9619 | * @param: pointer to hold ctl table param |
| 9620 | * |
| 9621 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9622 | */ |
| 9623 | static QDF_STATUS |
| 9624 | send_set_ctl_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 9625 | struct ctl_table_params *param) |
| 9626 | { |
| 9627 | uint16_t len, ctl_tlv_len; |
| 9628 | uint8_t *buf_ptr; |
| 9629 | wmi_buf_t buf; |
| 9630 | wmi_pdev_set_ctl_table_cmd_fixed_param *cmd; |
| 9631 | uint32_t *ctl_array; |
| 9632 | |
| 9633 | if (!param->ctl_array) |
| 9634 | return QDF_STATUS_E_FAILURE; |
| 9635 | |
| 9636 | if (param->ctl_cmd_len != |
| 9637 | WMI_HOST_NUM_CTLS_2G * WMI_HOST_NUM_BAND_EDGES_2G * 2 + |
| 9638 | WMI_HOST_NUM_CTLS_5G * WMI_HOST_NUM_BAND_EDGES_5G * 2) { |
| 9639 | qdf_print("CTL array len not correct\n"); |
| 9640 | return QDF_STATUS_E_FAILURE; |
| 9641 | } |
| 9642 | |
| 9643 | ctl_tlv_len = WMI_TLV_HDR_SIZE + |
| 9644 | roundup(param->ctl_cmd_len, sizeof(A_UINT32)); |
| 9645 | len = sizeof(*cmd) + ctl_tlv_len; |
| 9646 | |
| 9647 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9648 | if (!buf) { |
| 9649 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9650 | return QDF_STATUS_E_FAILURE; |
| 9651 | } |
| 9652 | |
| 9653 | buf_ptr = wmi_buf_data(buf); |
| 9654 | qdf_mem_zero(buf_ptr, len); |
| 9655 | |
| 9656 | cmd = (wmi_pdev_set_ctl_table_cmd_fixed_param *)buf_ptr; |
| 9657 | |
| 9658 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9659 | WMITLV_TAG_STRUC_wmi_pdev_set_ctl_table_cmd_fixed_param, |
| 9660 | WMITLV_GET_STRUCT_TLVLEN( |
| 9661 | wmi_pdev_set_ctl_table_cmd_fixed_param)); |
| 9662 | cmd->ctl_len = param->ctl_cmd_len; |
| 9663 | cmd->pdev_id = param->pdev_id; |
| 9664 | |
| 9665 | buf_ptr += sizeof(*cmd); |
| 9666 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9667 | (cmd->ctl_len)); |
| 9668 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9669 | ctl_array = (uint32_t *)buf_ptr; |
| 9670 | |
| 9671 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[0], ¶m->ctl_band, |
| 9672 | sizeof(param->ctl_band)); |
| 9673 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[1], param->ctl_array, |
| 9674 | param->ctl_cmd_len - |
| 9675 | sizeof(param->ctl_band)); |
| 9676 | |
| 9677 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9678 | WMI_PDEV_SET_CTL_TABLE_CMDID)) { |
| 9679 | WMI_LOGE("%s:Failed to send command\n", __func__); |
| 9680 | wmi_buf_free(buf); |
| 9681 | return QDF_STATUS_E_FAILURE; |
| 9682 | } |
| 9683 | |
| 9684 | return QDF_STATUS_SUCCESS; |
| 9685 | } |
| 9686 | |
| 9687 | /** |
| 9688 | * send_set_mimogain_table_cmd_tlv() - send mimogain table cmd to fw |
| 9689 | * @wmi_handle: wmi handle |
| 9690 | * @param: pointer to hold mimogain table param |
| 9691 | * |
| 9692 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9693 | */ |
| 9694 | static QDF_STATUS |
| 9695 | send_set_mimogain_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 9696 | struct mimogain_table_params *param) |
| 9697 | { |
| 9698 | uint16_t len, table_tlv_len; |
| 9699 | wmi_buf_t buf; |
| 9700 | uint8_t *buf_ptr; |
| 9701 | wmi_pdev_set_mimogain_table_cmd_fixed_param *cmd; |
| 9702 | uint32_t *gain_table; |
| 9703 | |
| 9704 | if (!param->array_gain) |
| 9705 | return QDF_STATUS_E_FAILURE; |
| 9706 | |
| 9707 | /* len must be multiple of a single array gain table */ |
| 9708 | if (param->tbl_len % |
| 9709 | ((WMI_HOST_TX_NUM_CHAIN-1) * WMI_HOST_TPC_REGINDEX_MAX * |
| 9710 | WMI_HOST_ARRAY_GAIN_NUM_STREAMS) != 0) { |
| 9711 | WMI_LOGE("Array gain table len not correct\n"); |
| 9712 | return QDF_STATUS_E_FAILURE; |
| 9713 | } |
| 9714 | |
| 9715 | table_tlv_len = WMI_TLV_HDR_SIZE + |
| 9716 | roundup(param->tbl_len, sizeof(uint32_t)); |
| 9717 | len = sizeof(*cmd) + table_tlv_len; |
| 9718 | |
| 9719 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9720 | if (!buf) { |
| 9721 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9722 | return QDF_STATUS_E_FAILURE; |
| 9723 | } |
| 9724 | |
| 9725 | buf_ptr = wmi_buf_data(buf); |
| 9726 | qdf_mem_zero(buf_ptr, len); |
| 9727 | |
| 9728 | cmd = (wmi_pdev_set_mimogain_table_cmd_fixed_param *)buf_ptr; |
| 9729 | |
| 9730 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9731 | WMITLV_TAG_STRUC_wmi_pdev_set_mimogain_table_cmd_fixed_param, |
| 9732 | WMITLV_GET_STRUCT_TLVLEN( |
| 9733 | wmi_pdev_set_mimogain_table_cmd_fixed_param)); |
| 9734 | |
| 9735 | cmd->pdev_id = param->pdev_id; |
| 9736 | WMI_MIMOGAIN_ARRAY_GAIN_LEN_SET(cmd->mimogain_info, param->tbl_len); |
| 9737 | WMI_MIMOGAIN_MULTI_CHAIN_BYPASS_SET(cmd->mimogain_info, |
| 9738 | param->multichain_gain_bypass); |
| 9739 | |
| 9740 | buf_ptr += sizeof(*cmd); |
| 9741 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9742 | (param->tbl_len)); |
| 9743 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9744 | gain_table = (uint32_t *)buf_ptr; |
| 9745 | |
| 9746 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(gain_table, |
| 9747 | param->array_gain, |
| 9748 | param->tbl_len); |
| 9749 | |
| 9750 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9751 | WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID)) { |
| 9752 | return QDF_STATUS_E_FAILURE; |
| 9753 | } |
| 9754 | |
| 9755 | return QDF_STATUS_SUCCESS; |
| 9756 | } |
| 9757 | |
| 9758 | /** |
| 9759 | * send_packet_power_info_get_cmd_tlv() - send request to get packet power |
| 9760 | * info to fw |
| 9761 | * @wmi_handle: wmi handle |
| 9762 | * @param: pointer to hold packet power info param |
| 9763 | * |
| 9764 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9765 | */ |
| 9766 | static QDF_STATUS |
| 9767 | send_packet_power_info_get_cmd_tlv(wmi_unified_t wmi_handle, |
| 9768 | struct packet_power_info_params *param) |
| 9769 | { |
| 9770 | wmi_pdev_get_tpc_cmd_fixed_param *cmd; |
| 9771 | wmi_buf_t wmibuf; |
| 9772 | uint8_t *buf_ptr; |
| 9773 | u_int32_t len = sizeof(wmi_pdev_get_tpc_cmd_fixed_param); |
| 9774 | |
| 9775 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 9776 | if (wmibuf == NULL) |
| 9777 | return QDF_STATUS_E_NOMEM; |
| 9778 | |
| 9779 | buf_ptr = (uint8_t *)wmi_buf_data(wmibuf); |
| 9780 | |
| 9781 | cmd = (wmi_pdev_get_tpc_cmd_fixed_param *)buf_ptr; |
| 9782 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9783 | WMITLV_TAG_STRUC_wmi_pdev_get_tpc_cmd_fixed_param, |
| 9784 | WMITLV_GET_STRUCT_TLVLEN( |
| 9785 | wmi_pdev_get_tpc_cmd_fixed_param)); |
| 9786 | cmd->pdev_id = param->pdev_id; |
| 9787 | cmd->rate_flags = param->rate_flags; |
| 9788 | cmd->nss = param->nss; |
| 9789 | cmd->preamble = param->preamble; |
| 9790 | cmd->hw_rate = param->hw_rate; |
| 9791 | WMI_LOGI("%s[%d] commandID %d, wmi_pdev_get_tpc_cmd=0x%x\n", |
| 9792 | __func__, |
| 9793 | __LINE__, |
| 9794 | WMI_PDEV_GET_TPC_CMDID, |
| 9795 | *((u_int32_t *)cmd)); |
| 9796 | if (wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 9797 | WMI_PDEV_GET_TPC_CMDID)) { |
| 9798 | WMI_LOGE(FL("Failed to get tpc command\n")); |
| 9799 | wmi_buf_free(wmibuf); |
| 9800 | return QDF_STATUS_E_FAILURE; |
| 9801 | } |
| 9802 | |
| 9803 | return QDF_STATUS_SUCCESS; |
| 9804 | } |
| 9805 | |
| 9806 | /** |
| 9807 | * send_vdev_config_ratemask_cmd_tlv() - config ratemask param in fw |
| 9808 | * @wmi_handle: wmi handle |
| 9809 | * @param: pointer to hold config ratemask params |
| 9810 | * |
| 9811 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9812 | */ |
| 9813 | static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle, |
| 9814 | struct config_ratemask_params *param) |
| 9815 | { |
| 9816 | wmi_vdev_config_ratemask_cmd_fixed_param *cmd; |
| 9817 | wmi_buf_t buf; |
| 9818 | int32_t len = sizeof(*cmd); |
| 9819 | |
| 9820 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9821 | if (!buf) { |
| 9822 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9823 | return QDF_STATUS_E_FAILURE; |
| 9824 | } |
| 9825 | cmd = (wmi_vdev_config_ratemask_cmd_fixed_param *)wmi_buf_data(buf); |
| 9826 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9827 | WMITLV_TAG_STRUC_wmi_vdev_config_ratemask_fixed_param, |
| 9828 | WMITLV_GET_STRUCT_TLVLEN( |
| 9829 | wmi_vdev_config_ratemask_cmd_fixed_param)); |
| 9830 | cmd->vdev_id = param->vdev_id; |
| 9831 | cmd->type = param->type; |
| 9832 | cmd->mask_lower32 = param->lower32; |
| 9833 | cmd->mask_higher32 = param->higher32; |
| 9834 | WMI_LOGI("Setting vdev ratemask vdev id = 0x%X, type = 0x%X, mask_l32 = 0x%X mask_h32 = 0x%X\n", |
| 9835 | param->vdev_id, param->type, param->lower32, param->higher32); |
| 9836 | |
| 9837 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9838 | WMI_VDEV_RATEMASK_CMDID)) { |
| 9839 | WMI_LOGE("Seting vdev ratemask failed\n"); |
| 9840 | wmi_buf_free(buf); |
| 9841 | return QDF_STATUS_E_FAILURE; |
| 9842 | } |
| 9843 | |
| 9844 | return QDF_STATUS_SUCCESS; |
| 9845 | } |
| 9846 | |
| 9847 | /** |
| 9848 | * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw |
| 9849 | * @wmi_handle: wmi handle |
| 9850 | * @param: pointer to hold vap dscp tid map param |
| 9851 | * |
| 9852 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9853 | */ |
| 9854 | static QDF_STATUS |
| 9855 | send_set_vap_dscp_tid_map_cmd_tlv(wmi_unified_t wmi_handle, |
| 9856 | struct vap_dscp_tid_map_params *param) |
| 9857 | { |
| 9858 | wmi_buf_t buf; |
| 9859 | wmi_vdev_set_dscp_tid_map_cmd_fixed_param *cmd; |
| 9860 | int32_t len = sizeof(*cmd); |
| 9861 | |
| 9862 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9863 | if (!buf) { |
| 9864 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9865 | return QDF_STATUS_E_FAILURE; |
| 9866 | } |
| 9867 | |
| 9868 | cmd = (wmi_vdev_set_dscp_tid_map_cmd_fixed_param *)wmi_buf_data(buf); |
| 9869 | qdf_mem_copy(cmd->dscp_to_tid_map, param->dscp_to_tid_map, |
| 9870 | sizeof(A_UINT32) * WMI_DSCP_MAP_MAX); |
| 9871 | |
| 9872 | cmd->vdev_id = param->vdev_id; |
| 9873 | cmd->enable_override = 0; |
| 9874 | |
| 9875 | WMI_LOGI("Setting dscp for vap id: %d\n", cmd->vdev_id); |
| 9876 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9877 | WMI_VDEV_SET_DSCP_TID_MAP_CMDID)) { |
| 9878 | WMI_LOGE("Failed to set dscp cmd\n"); |
| 9879 | wmi_buf_free(buf); |
| 9880 | return QDF_STATUS_E_FAILURE; |
| 9881 | } |
| 9882 | |
| 9883 | return QDF_STATUS_SUCCESS; |
| 9884 | } |
| 9885 | |
| 9886 | /** |
| 9887 | * send_vdev_set_neighbour_rx_cmd_tlv() - set neighbour rx param in fw |
| 9888 | * @wmi_handle: wmi handle |
| 9889 | * @macaddr: vdev mac address |
| 9890 | * @param: pointer to hold neigbour rx param |
| 9891 | * |
| 9892 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9893 | */ |
| 9894 | static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(wmi_unified_t wmi_handle, |
| 9895 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 9896 | struct set_neighbour_rx_params *param) |
| 9897 | { |
| 9898 | wmi_vdev_filter_nrp_config_cmd_fixed_param *cmd; |
| 9899 | wmi_buf_t buf; |
| 9900 | int32_t len = sizeof(*cmd); |
| 9901 | |
| 9902 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9903 | if (!buf) { |
| 9904 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9905 | return QDF_STATUS_E_FAILURE; |
| 9906 | } |
| 9907 | cmd = (wmi_vdev_filter_nrp_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 9908 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9909 | WMITLV_TAG_STRUC_wmi_vdev_filter_nrp_config_cmd_fixed_param, |
| 9910 | WMITLV_GET_STRUCT_TLVLEN( |
| 9911 | wmi_vdev_filter_nrp_config_cmd_fixed_param)); |
| 9912 | cmd->vdev_id = param->vdev_id; |
| 9913 | cmd->bssid_idx = param->idx; |
| 9914 | cmd->action = param->action; |
| 9915 | cmd->type = param->type; |
| 9916 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr); |
| 9917 | cmd->flag = 0; |
| 9918 | |
| 9919 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9920 | WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID)) { |
| 9921 | WMI_LOGE("Failed to set neighbour rx param\n"); |
| 9922 | wmi_buf_free(buf); |
| 9923 | return QDF_STATUS_E_FAILURE; |
| 9924 | } |
| 9925 | |
| 9926 | return QDF_STATUS_SUCCESS; |
| 9927 | } |
| 9928 | |
| 9929 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 9930 | * 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] | 9931 | * @param wmi_handle : handle to WMI. |
| 9932 | * @param macaddr : vdev mac address |
| 9933 | * @param param : pointer to tx antenna param |
| 9934 | * |
| 9935 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9936 | */ |
| 9937 | static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 9938 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 9939 | struct smart_ant_tx_ant_params *param) |
| 9940 | { |
| 9941 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd; |
| 9942 | wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series; |
| 9943 | wmi_buf_t buf; |
| 9944 | int32_t len = 0; |
| 9945 | int i; |
| 9946 | uint8_t *buf_ptr; |
| 9947 | QDF_STATUS ret; |
| 9948 | |
| 9949 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9950 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 9951 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series); |
| 9952 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9953 | |
| 9954 | if (!buf) { |
| 9955 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9956 | return QDF_STATUS_E_NOMEM; |
| 9957 | } |
| 9958 | |
| 9959 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 9960 | qdf_mem_zero(buf_ptr, len); |
| 9961 | cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr; |
| 9962 | |
| 9963 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9964 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param, |
| 9965 | WMITLV_GET_STRUCT_TLVLEN( |
| 9966 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param)); |
| 9967 | |
| 9968 | cmd->vdev_id = param->vdev_id; |
| 9969 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 9970 | |
| 9971 | buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param); |
| 9972 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9973 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series)); |
| 9974 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9975 | ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr; |
| 9976 | |
| 9977 | for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) { |
| 9978 | WMITLV_SET_HDR(&ant_tx_series->tlv_header, |
| 9979 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series, |
| 9980 | WMITLV_GET_STRUCT_TLVLEN( |
| 9981 | wmi_peer_smart_ant_set_tx_antenna_series)); |
| 9982 | ant_tx_series->antenna_series = param->antenna_array[i]; |
| 9983 | ant_tx_series++; |
| 9984 | } |
| 9985 | |
| 9986 | ret = wmi_unified_cmd_send(wmi_handle, |
| 9987 | buf, |
| 9988 | len, |
| 9989 | WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID); |
| 9990 | |
| 9991 | if (ret != 0) { |
| 9992 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 9993 | wmi_buf_free(buf); |
| 9994 | } |
| 9995 | |
| 9996 | return ret; |
| 9997 | } |
| 9998 | |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 9999 | /** |
| 10000 | * send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw |
| 10001 | * @wmi_handle: wmi handle |
| 10002 | * @param: pointer to hold ant switch tbl param |
| 10003 | * |
| 10004 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10005 | */ |
| 10006 | static QDF_STATUS |
| 10007 | send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10008 | struct ant_switch_tbl_params *param) |
| 10009 | { |
| 10010 | uint8_t len; |
| 10011 | wmi_buf_t buf; |
| 10012 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd; |
| 10013 | wmi_pdev_set_ant_ctrl_chain *ctrl_chain; |
| 10014 | uint8_t *buf_ptr; |
| 10015 | |
| 10016 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10017 | len += sizeof(wmi_pdev_set_ant_ctrl_chain); |
| 10018 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10019 | |
| 10020 | if (!buf) { |
| 10021 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10022 | return QDF_STATUS_E_NOMEM; |
| 10023 | } |
| 10024 | |
| 10025 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10026 | qdf_mem_zero(buf_ptr, len); |
| 10027 | cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr; |
| 10028 | |
| 10029 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10030 | WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param, |
| 10031 | WMITLV_GET_STRUCT_TLVLEN( |
| 10032 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param)); |
| 10033 | |
| 10034 | cmd->antCtrlCommon1 = param->ant_ctrl_common1; |
| 10035 | cmd->antCtrlCommon2 = param->ant_ctrl_common2; |
| 10036 | cmd->mac_id = param->pdev_id; /* Setting it to 0 for now */ |
| 10037 | |
| 10038 | /* TLV indicating array of structures to follow */ |
| 10039 | buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param); |
| 10040 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10041 | sizeof(wmi_pdev_set_ant_ctrl_chain)); |
| 10042 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10043 | ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr; |
| 10044 | |
| 10045 | ctrl_chain->pdev_id = param->pdev_id; |
| 10046 | ctrl_chain->antCtrlChain = param->antCtrlChain; |
| 10047 | |
| 10048 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10049 | WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) { |
| 10050 | wmi_buf_free(buf); |
| 10051 | return QDF_STATUS_E_FAILURE; |
| 10052 | } |
| 10053 | |
| 10054 | return QDF_STATUS_SUCCESS; |
| 10055 | } |
| 10056 | |
| 10057 | /** |
| 10058 | * send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna |
| 10059 | * training information function |
| 10060 | * @param wmi_handle : handle to WMI. |
| 10061 | * @macaddr : vdev mac address |
| 10062 | * @param param : pointer to tx antenna param |
| 10063 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10064 | */ |
| 10065 | static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv( |
| 10066 | wmi_unified_t wmi_handle, |
| 10067 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10068 | struct smart_ant_training_info_params *param) |
| 10069 | { |
| 10070 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd; |
| 10071 | wmi_peer_smart_ant_set_train_antenna_param *train_param; |
| 10072 | wmi_buf_t buf; |
| 10073 | uint8_t *buf_ptr; |
| 10074 | int32_t len = 0; |
| 10075 | QDF_STATUS ret; |
| 10076 | int loop; |
| 10077 | |
| 10078 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10079 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10080 | sizeof(wmi_peer_smart_ant_set_train_antenna_param); |
| 10081 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10082 | |
| 10083 | if (!buf) { |
| 10084 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10085 | return QDF_STATUS_E_NOMEM; |
| 10086 | } |
| 10087 | |
| 10088 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10089 | qdf_mem_zero(buf_ptr, len); |
| 10090 | cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr; |
| 10091 | |
| 10092 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10093 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param, |
| 10094 | WMITLV_GET_STRUCT_TLVLEN( |
| 10095 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param)); |
| 10096 | |
| 10097 | cmd->vdev_id = param->vdev_id; |
| 10098 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10099 | cmd->num_pkts = param->numpkts; |
| 10100 | |
| 10101 | buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param); |
| 10102 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10103 | sizeof(wmi_peer_smart_ant_set_train_antenna_param) * |
| 10104 | WMI_SMART_ANT_MAX_RATE_SERIES); |
| 10105 | |
| 10106 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10107 | train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr; |
| 10108 | |
| 10109 | for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) { |
| 10110 | WMITLV_SET_HDR(&train_param->tlv_header, |
| 10111 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param, |
| 10112 | WMITLV_GET_STRUCT_TLVLEN( |
| 10113 | wmi_peer_smart_ant_set_train_antenna_param)); |
| 10114 | train_param->train_rate_series = param->rate_array[loop]; |
| 10115 | train_param->train_antenna_series = param->antenna_array[loop]; |
| 10116 | train_param->rc_flags = 0; |
| 10117 | WMI_LOGI(FL("Series number:%d\n"), loop); |
| 10118 | WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"), |
| 10119 | train_param->train_rate_series, |
| 10120 | train_param->train_antenna_series); |
| 10121 | train_param++; |
| 10122 | } |
| 10123 | |
| 10124 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10125 | buf, |
| 10126 | len, |
| 10127 | WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID); |
| 10128 | |
| 10129 | if (ret != 0) { |
| 10130 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10131 | wmi_buf_free(buf); |
| 10132 | return QDF_STATUS_E_FAILURE; |
| 10133 | } |
| 10134 | |
| 10135 | return ret; |
| 10136 | } |
| 10137 | |
| 10138 | /** |
| 10139 | * send_smart_ant_set_node_config_cmd_tlv() - WMI set node |
| 10140 | * configuration function |
| 10141 | * @param wmi_handle : handle to WMI. |
| 10142 | * @macaddr : vdev mad address |
| 10143 | * @param param : pointer to tx antenna param |
| 10144 | * |
| 10145 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10146 | */ |
| 10147 | static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv( |
| 10148 | wmi_unified_t wmi_handle, |
| 10149 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10150 | struct smart_ant_node_config_params *param) |
| 10151 | { |
| 10152 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd; |
| 10153 | wmi_buf_t buf; |
| 10154 | uint8_t *buf_ptr; |
| 10155 | int32_t len = 0, args_tlv_len; |
| 10156 | int ret; |
| 10157 | int i = 0; |
| 10158 | A_UINT32 *node_config_args; |
| 10159 | |
| 10160 | args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(A_UINT32); |
| 10161 | len = sizeof(*cmd) + args_tlv_len; |
| 10162 | |
| 10163 | if ((param->args_count == 0)) { |
| 10164 | WMI_LOGE("%s: Can't send a command with %d arguments\n", |
| 10165 | __func__, param->args_count); |
| 10166 | return QDF_STATUS_E_FAILURE; |
| 10167 | } |
| 10168 | |
| 10169 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10170 | if (!buf) { |
| 10171 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10172 | return QDF_STATUS_E_NOMEM; |
| 10173 | } |
| 10174 | |
| 10175 | cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *) |
| 10176 | wmi_buf_data(buf); |
| 10177 | buf_ptr = (uint8_t *)cmd; |
| 10178 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10179 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param, |
| 10180 | WMITLV_GET_STRUCT_TLVLEN( |
| 10181 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param)); |
| 10182 | cmd->vdev_id = param->vdev_id; |
| 10183 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10184 | cmd->cmd_id = param->cmd_id; |
| 10185 | cmd->args_count = param->args_count; |
| 10186 | buf_ptr += sizeof( |
| 10187 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param); |
| 10188 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10189 | (cmd->args_count * sizeof(A_UINT32))); |
| 10190 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10191 | node_config_args = (A_UINT32 *)buf_ptr; |
| 10192 | |
| 10193 | for (i = 0; i < param->args_count; i++) { |
| 10194 | node_config_args[i] = param->args_arr[i]; |
| 10195 | WMI_LOGI("%d", param->args_arr[i]); |
| 10196 | } |
| 10197 | |
| 10198 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10199 | buf, |
| 10200 | len, |
| 10201 | WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID); |
| 10202 | |
| 10203 | if (ret != 0) { |
| 10204 | WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n", |
| 10205 | __func__, param->cmd_id, macaddr[0], |
| 10206 | macaddr[1], macaddr[2], macaddr[3], |
| 10207 | macaddr[4], macaddr[5], ret); |
| 10208 | wmi_buf_free(buf); |
| 10209 | } |
| 10210 | |
| 10211 | return ret; |
| 10212 | } |
| 10213 | |
| 10214 | /** |
| 10215 | * send_set_atf_cmd_tlv() - send set atf command to fw |
| 10216 | * @wmi_handle: wmi handle |
| 10217 | * @param: pointer to set atf param |
| 10218 | * |
| 10219 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10220 | */ |
| 10221 | static QDF_STATUS |
| 10222 | send_set_atf_cmd_tlv(wmi_unified_t wmi_handle, |
| 10223 | struct set_atf_params *param) |
| 10224 | { |
| 10225 | wmi_atf_peer_info *peer_info; |
| 10226 | wmi_peer_atf_request_fixed_param *cmd; |
| 10227 | wmi_buf_t buf; |
| 10228 | uint8_t *buf_ptr; |
| 10229 | int i; |
| 10230 | int32_t len = 0; |
| 10231 | QDF_STATUS retval; |
| 10232 | |
| 10233 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10234 | len += param->num_peers * sizeof(wmi_atf_peer_info); |
| 10235 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10236 | if (!buf) { |
| 10237 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10238 | return QDF_STATUS_E_FAILURE; |
| 10239 | } |
| 10240 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10241 | cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr; |
| 10242 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10243 | WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param, |
| 10244 | WMITLV_GET_STRUCT_TLVLEN( |
| 10245 | wmi_peer_atf_request_fixed_param)); |
| 10246 | cmd->num_peers = param->num_peers; |
| 10247 | |
| 10248 | buf_ptr += sizeof(*cmd); |
| 10249 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10250 | sizeof(wmi_atf_peer_info) * |
| 10251 | cmd->num_peers); |
| 10252 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10253 | peer_info = (wmi_atf_peer_info *)buf_ptr; |
| 10254 | |
| 10255 | for (i = 0; i < cmd->num_peers; i++) { |
| 10256 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 10257 | WMITLV_TAG_STRUC_wmi_atf_peer_info, |
| 10258 | WMITLV_GET_STRUCT_TLVLEN( |
| 10259 | wmi_atf_peer_info)); |
| 10260 | peer_info->atf_units = param->peer_info[i].percentage_peer; |
| 10261 | /* |
| 10262 | * TLV definition for peer atf request fixed param combines |
| 10263 | * extension stats. Legacy FW for WIN (Non-TLV) has peer atf |
| 10264 | * stats and atf extension stats as two different |
| 10265 | * implementations. |
| 10266 | * Need to discuss with FW on this. |
| 10267 | * |
| 10268 | * peer_info->atf_groupid = param->peer_ext_info[i].group_index; |
| 10269 | * peer_info->atf_units_reserved = |
| 10270 | * param->peer_ext_info[i].atf_index_reserved; |
| 10271 | */ |
| 10272 | peer_info++; |
| 10273 | } |
| 10274 | |
| 10275 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10276 | WMI_PEER_ATF_REQUEST_CMDID); |
| 10277 | |
| 10278 | if (retval != QDF_STATUS_SUCCESS) { |
| 10279 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 10280 | wmi_buf_free(buf); |
| 10281 | } |
| 10282 | |
| 10283 | return retval; |
| 10284 | } |
| 10285 | |
| 10286 | /** |
| 10287 | * send_vdev_set_fwtest_param_cmd_tlv() - send fwtest param in fw |
| 10288 | * @wmi_handle: wmi handle |
| 10289 | * @param: pointer to hold fwtest param |
| 10290 | * |
| 10291 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10292 | */ |
| 10293 | static QDF_STATUS send_vdev_set_fwtest_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 10294 | struct set_fwtest_params *param) |
| 10295 | { |
| 10296 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 10297 | wmi_buf_t buf; |
| 10298 | int32_t len = sizeof(*cmd); |
| 10299 | |
| 10300 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10301 | |
| 10302 | if (!buf) { |
| 10303 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10304 | return QDF_STATUS_E_FAILURE; |
| 10305 | } |
| 10306 | |
| 10307 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 10308 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10309 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 10310 | WMITLV_GET_STRUCT_TLVLEN( |
| 10311 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 10312 | cmd->param_id = param->arg; |
| 10313 | cmd->param_value = param->value; |
| 10314 | |
| 10315 | if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FWTEST_CMDID)) { |
| 10316 | WMI_LOGE("Setting FW test param failed\n"); |
| 10317 | wmi_buf_free(buf); |
| 10318 | return QDF_STATUS_E_FAILURE; |
| 10319 | } |
| 10320 | |
| 10321 | return QDF_STATUS_SUCCESS; |
| 10322 | } |
| 10323 | |
| 10324 | /** |
| 10325 | * send_set_qboost_param_cmd_tlv() - send set qboost command to fw |
| 10326 | * @wmi_handle: wmi handle |
| 10327 | * @param: pointer to qboost params |
| 10328 | * @macaddr: vdev mac address |
| 10329 | * |
| 10330 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10331 | */ |
| 10332 | static QDF_STATUS |
| 10333 | send_set_qboost_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 10334 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10335 | struct set_qboost_params *param) |
| 10336 | { |
| 10337 | WMI_QBOOST_CFG_CMD_fixed_param *cmd; |
| 10338 | wmi_buf_t buf; |
| 10339 | int32_t len; |
| 10340 | QDF_STATUS ret; |
| 10341 | |
| 10342 | len = sizeof(*cmd); |
| 10343 | |
| 10344 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10345 | if (!buf) { |
| 10346 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10347 | return QDF_STATUS_E_FAILURE; |
| 10348 | } |
| 10349 | |
| 10350 | cmd = (WMI_QBOOST_CFG_CMD_fixed_param *)wmi_buf_data(buf); |
| 10351 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10352 | WMITLV_TAG_STRUC_WMI_QBOOST_CFG_CMD_fixed_param, |
| 10353 | WMITLV_GET_STRUCT_TLVLEN( |
| 10354 | WMI_QBOOST_CFG_CMD_fixed_param)); |
| 10355 | cmd->vdev_id = param->vdev_id; |
| 10356 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10357 | cmd->qb_enable = param->value; |
| 10358 | |
| 10359 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10360 | WMI_QBOOST_CFG_CMDID); |
| 10361 | |
| 10362 | if (ret != 0) { |
| 10363 | WMI_LOGE("Setting qboost cmd failed\n"); |
| 10364 | wmi_buf_free(buf); |
| 10365 | } |
| 10366 | |
| 10367 | return ret; |
| 10368 | } |
| 10369 | |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 10370 | /** |
| 10371 | * send_gpio_config_cmd_tlv() - send gpio config to fw |
| 10372 | * @wmi_handle: wmi handle |
| 10373 | * @param: pointer to hold gpio config param |
| 10374 | * |
| 10375 | * Return: 0 for success or error code |
| 10376 | */ |
| 10377 | static QDF_STATUS |
| 10378 | send_gpio_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 10379 | struct gpio_config_params *param) |
| 10380 | { |
| 10381 | wmi_gpio_config_cmd_fixed_param *cmd; |
| 10382 | wmi_buf_t buf; |
| 10383 | int32_t len; |
| 10384 | QDF_STATUS ret; |
| 10385 | |
| 10386 | len = sizeof(*cmd); |
| 10387 | |
| 10388 | /* Sanity Checks */ |
| 10389 | if (param->pull_type > WMI_GPIO_PULL_DOWN || |
| 10390 | param->intr_mode > WMI_GPIO_INTTYPE_LEVEL_HIGH) { |
| 10391 | return QDF_STATUS_E_FAILURE; |
| 10392 | } |
| 10393 | |
| 10394 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10395 | if (!buf) { |
| 10396 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10397 | return QDF_STATUS_E_FAILURE; |
| 10398 | } |
| 10399 | |
| 10400 | cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 10401 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10402 | WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param, |
| 10403 | WMITLV_GET_STRUCT_TLVLEN( |
| 10404 | wmi_gpio_config_cmd_fixed_param)); |
| 10405 | cmd->gpio_num = param->gpio_num; |
| 10406 | cmd->input = param->input; |
| 10407 | cmd->pull_type = param->pull_type; |
| 10408 | cmd->intr_mode = param->intr_mode; |
| 10409 | |
| 10410 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10411 | WMI_GPIO_CONFIG_CMDID); |
| 10412 | |
| 10413 | if (ret != 0) { |
| 10414 | WMI_LOGE("Sending GPIO config cmd failed\n"); |
| 10415 | wmi_buf_free(buf); |
| 10416 | } |
| 10417 | |
| 10418 | return ret; |
| 10419 | } |
| 10420 | |
| 10421 | /** |
| 10422 | * send_gpio_output_cmd_tlv() - send gpio output to fw |
| 10423 | * @wmi_handle: wmi handle |
| 10424 | * @param: pointer to hold gpio output param |
| 10425 | * |
| 10426 | * Return: 0 for success or error code |
| 10427 | */ |
| 10428 | static QDF_STATUS |
| 10429 | send_gpio_output_cmd_tlv(wmi_unified_t wmi_handle, |
| 10430 | struct gpio_output_params *param) |
| 10431 | { |
| 10432 | wmi_gpio_output_cmd_fixed_param *cmd; |
| 10433 | wmi_buf_t buf; |
| 10434 | int32_t len; |
| 10435 | QDF_STATUS ret; |
| 10436 | |
| 10437 | len = sizeof(*cmd); |
| 10438 | |
| 10439 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10440 | if (!buf) { |
| 10441 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10442 | return QDF_STATUS_E_FAILURE; |
| 10443 | } |
| 10444 | |
| 10445 | cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf); |
| 10446 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10447 | WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param, |
| 10448 | WMITLV_GET_STRUCT_TLVLEN( |
| 10449 | wmi_gpio_output_cmd_fixed_param)); |
| 10450 | cmd->gpio_num = param->gpio_num; |
| 10451 | cmd->set = param->set; |
| 10452 | |
| 10453 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10454 | WMI_GPIO_OUTPUT_CMDID); |
| 10455 | |
| 10456 | if (ret != 0) { |
| 10457 | WMI_LOGE("Sending GPIO output cmd failed\n"); |
| 10458 | wmi_buf_free(buf); |
| 10459 | } |
| 10460 | |
| 10461 | return ret; |
| 10462 | |
| 10463 | } |
| 10464 | |
| 10465 | /** |
| 10466 | * send_phyerr_disable_cmd_tlv() - WMI phyerr disable function |
| 10467 | * |
| 10468 | * @param wmi_handle : handle to WMI. |
| 10469 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10470 | */ |
| 10471 | static QDF_STATUS send_phyerr_disable_cmd_tlv(wmi_unified_t wmi_handle) |
| 10472 | { |
| 10473 | wmi_pdev_dfs_disable_cmd_fixed_param *cmd; |
| 10474 | wmi_buf_t buf; |
| 10475 | QDF_STATUS ret; |
| 10476 | int32_t len; |
| 10477 | |
| 10478 | len = sizeof(*cmd); |
| 10479 | |
| 10480 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10481 | if (!buf) { |
| 10482 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10483 | return QDF_STATUS_E_FAILURE; |
| 10484 | } |
| 10485 | |
| 10486 | cmd = (wmi_pdev_dfs_disable_cmd_fixed_param *)wmi_buf_data(buf); |
| 10487 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10488 | WMITLV_TAG_STRUC_wmi_pdev_dfs_disable_cmd_fixed_param, |
| 10489 | WMITLV_GET_STRUCT_TLVLEN( |
| 10490 | wmi_pdev_dfs_disable_cmd_fixed_param)); |
| 10491 | /* Filling it with WMI_PDEV_ID_SOC for now */ |
| 10492 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 10493 | |
| 10494 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10495 | WMI_PDEV_DFS_DISABLE_CMDID); |
| 10496 | |
| 10497 | if (ret != 0) { |
| 10498 | WMI_LOGE("Sending PDEV DFS disable cmd failed\n"); |
| 10499 | wmi_buf_free(buf); |
| 10500 | } |
| 10501 | |
| 10502 | return ret; |
| 10503 | } |
| 10504 | |
| 10505 | /** |
| 10506 | * send_phyerr_enable_cmd_tlv() - WMI phyerr disable function |
| 10507 | * |
| 10508 | * @param wmi_handle : handle to WMI. |
| 10509 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10510 | */ |
| 10511 | static QDF_STATUS send_phyerr_enable_cmd_tlv(wmi_unified_t wmi_handle) |
| 10512 | { |
| 10513 | wmi_pdev_dfs_enable_cmd_fixed_param *cmd; |
| 10514 | wmi_buf_t buf; |
| 10515 | QDF_STATUS ret; |
| 10516 | int32_t len; |
| 10517 | |
| 10518 | len = sizeof(*cmd); |
| 10519 | |
| 10520 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10521 | if (!buf) { |
| 10522 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10523 | return QDF_STATUS_E_FAILURE; |
| 10524 | } |
| 10525 | |
| 10526 | cmd = (wmi_pdev_dfs_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 10527 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10528 | WMITLV_TAG_STRUC_wmi_pdev_dfs_enable_cmd_fixed_param, |
| 10529 | WMITLV_GET_STRUCT_TLVLEN( |
| 10530 | wmi_pdev_dfs_enable_cmd_fixed_param)); |
| 10531 | /* Reserved for future use */ |
| 10532 | cmd->reserved0 = 0; |
| 10533 | |
| 10534 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10535 | WMI_PDEV_DFS_ENABLE_CMDID); |
| 10536 | |
| 10537 | if (ret != 0) { |
| 10538 | WMI_LOGE("Sending PDEV DFS enable cmd failed\n"); |
| 10539 | wmi_buf_free(buf); |
| 10540 | } |
| 10541 | |
| 10542 | return ret; |
| 10543 | } |
| 10544 | |
| 10545 | /** |
| 10546 | * send_nf_dbr_dbm_info_get_cmd_tlv() - send request to get nf to fw |
| 10547 | * @wmi_handle: wmi handle |
| 10548 | * |
| 10549 | * Return: 0 for success or error code |
| 10550 | */ |
| 10551 | static QDF_STATUS |
| 10552 | send_nf_dbr_dbm_info_get_cmd_tlv(wmi_unified_t wmi_handle) |
| 10553 | { |
| 10554 | wmi_buf_t buf; |
| 10555 | QDF_STATUS ret; |
| 10556 | |
| 10557 | buf = wmi_buf_alloc(wmi_handle, 0); |
| 10558 | if (buf == NULL) |
| 10559 | return QDF_STATUS_E_NOMEM; |
| 10560 | |
| 10561 | ret = wmi_unified_cmd_send(wmi_handle, buf, 0, |
| 10562 | WMI_PDEV_GET_NFCAL_POWER_CMDID); |
| 10563 | if (ret != 0) { |
| 10564 | WMI_LOGE("Sending get nfcal power cmd failed\n"); |
| 10565 | wmi_buf_free(buf); |
| 10566 | } |
| 10567 | |
| 10568 | return ret; |
| 10569 | } |
| 10570 | |
| 10571 | /** |
| 10572 | * send_set_ht_ie_cmd_tlv() - send ht ie command to fw |
| 10573 | * @wmi_handle: wmi handle |
| 10574 | * @param: pointer to ht ie param |
| 10575 | * |
| 10576 | * Return: 0 for success or error code |
| 10577 | */ |
| 10578 | static QDF_STATUS |
| 10579 | send_set_ht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 10580 | struct ht_ie_params *param) |
| 10581 | { |
| 10582 | wmi_pdev_set_ht_ie_cmd_fixed_param *cmd; |
| 10583 | wmi_buf_t buf; |
| 10584 | QDF_STATUS ret; |
| 10585 | int32_t len; |
| 10586 | uint8_t *buf_ptr; |
| 10587 | |
| 10588 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10589 | roundup(param->ie_len, sizeof(uint32_t)); |
| 10590 | |
| 10591 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10592 | if (!buf) { |
| 10593 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10594 | return QDF_STATUS_E_FAILURE; |
| 10595 | } |
| 10596 | |
| 10597 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10598 | cmd = (wmi_pdev_set_ht_ie_cmd_fixed_param *)buf_ptr; |
| 10599 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10600 | WMITLV_TAG_STRUC_wmi_pdev_set_ht_ie_cmd_fixed_param, |
| 10601 | WMITLV_GET_STRUCT_TLVLEN( |
| 10602 | wmi_pdev_set_ht_ie_cmd_fixed_param)); |
| 10603 | cmd->reserved0 = 0; |
| 10604 | cmd->ie_len = param->ie_len; |
| 10605 | cmd->tx_streams = param->tx_streams; |
| 10606 | cmd->rx_streams = param->rx_streams; |
| 10607 | |
| 10608 | buf_ptr += sizeof(*cmd); |
| 10609 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 10610 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10611 | if (param->ie_len) |
| 10612 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 10613 | cmd->ie_len); |
| 10614 | |
| 10615 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10616 | WMI_PDEV_SET_HT_CAP_IE_CMDID); |
| 10617 | |
| 10618 | if (ret != 0) { |
| 10619 | WMI_LOGE("Sending set ht ie cmd failed\n"); |
| 10620 | wmi_buf_free(buf); |
| 10621 | } |
| 10622 | |
| 10623 | return ret; |
| 10624 | } |
| 10625 | |
| 10626 | /** |
| 10627 | * send_set_vht_ie_cmd_tlv() - send vht ie command to fw |
| 10628 | * @wmi_handle: wmi handle |
| 10629 | * @param: pointer to vht ie param |
| 10630 | * |
| 10631 | * Return: 0 for success or error code |
| 10632 | */ |
| 10633 | static QDF_STATUS |
| 10634 | send_set_vht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 10635 | struct vht_ie_params *param) |
| 10636 | { |
| 10637 | wmi_pdev_set_vht_ie_cmd_fixed_param *cmd; |
| 10638 | wmi_buf_t buf; |
| 10639 | QDF_STATUS ret; |
| 10640 | int32_t len; |
| 10641 | uint8_t *buf_ptr; |
| 10642 | |
| 10643 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10644 | roundup(param->ie_len, sizeof(uint32_t)); |
| 10645 | |
| 10646 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10647 | if (!buf) { |
| 10648 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10649 | return QDF_STATUS_E_FAILURE; |
| 10650 | } |
| 10651 | |
| 10652 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10653 | cmd = (wmi_pdev_set_vht_ie_cmd_fixed_param *)buf_ptr; |
| 10654 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10655 | WMITLV_TAG_STRUC_wmi_pdev_set_vht_ie_cmd_fixed_param, |
| 10656 | WMITLV_GET_STRUCT_TLVLEN( |
| 10657 | wmi_pdev_set_vht_ie_cmd_fixed_param)); |
| 10658 | cmd->reserved0 = 0; |
| 10659 | cmd->ie_len = param->ie_len; |
| 10660 | cmd->tx_streams = param->tx_streams; |
| 10661 | cmd->rx_streams = param->rx_streams; |
| 10662 | |
| 10663 | buf_ptr += sizeof(*cmd); |
| 10664 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 10665 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10666 | if (param->ie_len) |
| 10667 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 10668 | cmd->ie_len); |
| 10669 | |
| 10670 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10671 | WMI_PDEV_SET_VHT_CAP_IE_CMDID); |
| 10672 | |
| 10673 | if (ret != 0) { |
| 10674 | WMI_LOGE("Sending set vht ie cmd failed\n"); |
| 10675 | wmi_buf_free(buf); |
| 10676 | } |
| 10677 | |
| 10678 | return ret; |
| 10679 | } |
| 10680 | |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 10681 | /** |
| 10682 | * send_set_quiet_mode_cmd_tlv() - send set quiet mode command to fw |
| 10683 | * @wmi_handle: wmi handle |
| 10684 | * @param: pointer to quiet mode params |
| 10685 | * |
| 10686 | * Return: 0 for success or error code |
| 10687 | */ |
| 10688 | static QDF_STATUS |
| 10689 | send_set_quiet_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 10690 | struct set_quiet_mode_params *param) |
| 10691 | { |
| 10692 | wmi_pdev_set_quiet_cmd_fixed_param *quiet_cmd; |
| 10693 | wmi_buf_t buf; |
| 10694 | QDF_STATUS ret; |
| 10695 | int32_t len; |
| 10696 | |
| 10697 | len = sizeof(*quiet_cmd); |
| 10698 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10699 | if (!buf) { |
| 10700 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10701 | return QDF_STATUS_E_FAILURE; |
| 10702 | } |
| 10703 | |
| 10704 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 10705 | WMITLV_SET_HDR(&quiet_cmd->tlv_header, |
| 10706 | WMITLV_TAG_STRUC_wmi_pdev_set_quiet_cmd_fixed_param, |
| 10707 | WMITLV_GET_STRUCT_TLVLEN( |
| 10708 | wmi_pdev_set_quiet_cmd_fixed_param)); |
| 10709 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 10710 | quiet_cmd->enabled = param->enabled; |
| 10711 | quiet_cmd->period = (param->period)*(param->intval); |
| 10712 | quiet_cmd->duration = param->duration; |
| 10713 | quiet_cmd->next_start = param->offset; |
| 10714 | quiet_cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 10715 | |
| 10716 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10717 | WMI_PDEV_SET_QUIET_MODE_CMDID); |
| 10718 | |
| 10719 | if (ret != 0) { |
| 10720 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 10721 | wmi_buf_free(buf); |
| 10722 | } |
| 10723 | |
| 10724 | return ret; |
| 10725 | } |
| 10726 | |
| 10727 | /** |
| 10728 | * send_set_bwf_cmd_tlv() - send set bwf command to fw |
| 10729 | * @wmi_handle: wmi handle |
| 10730 | * @param: pointer to set bwf param |
| 10731 | * |
| 10732 | * Return: 0 for success or error code |
| 10733 | */ |
| 10734 | static QDF_STATUS |
| 10735 | send_set_bwf_cmd_tlv(wmi_unified_t wmi_handle, |
| 10736 | struct set_bwf_params *param) |
| 10737 | { |
| 10738 | wmi_bwf_peer_info *peer_info; |
| 10739 | wmi_peer_bwf_request_fixed_param *cmd; |
| 10740 | wmi_buf_t buf; |
| 10741 | QDF_STATUS retval; |
| 10742 | int32_t len; |
| 10743 | uint8_t *buf_ptr; |
| 10744 | int i; |
| 10745 | |
| 10746 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10747 | len += param->num_peers * sizeof(wmi_bwf_peer_info); |
| 10748 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10749 | if (!buf) { |
| 10750 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10751 | return QDF_STATUS_E_FAILURE; |
| 10752 | } |
| 10753 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10754 | cmd = (wmi_peer_bwf_request_fixed_param *)buf_ptr; |
| 10755 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10756 | WMITLV_TAG_STRUC_wmi_peer_bwf_request_fixed_param, |
| 10757 | WMITLV_GET_STRUCT_TLVLEN( |
| 10758 | wmi_peer_bwf_request_fixed_param)); |
| 10759 | cmd->num_peers = param->num_peers; |
| 10760 | |
| 10761 | buf_ptr += sizeof(*cmd); |
| 10762 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10763 | sizeof(wmi_bwf_peer_info) * |
| 10764 | cmd->num_peers); |
| 10765 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10766 | peer_info = (wmi_bwf_peer_info *)buf_ptr; |
| 10767 | |
| 10768 | for (i = 0; i < cmd->num_peers; i++) { |
| 10769 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 10770 | WMITLV_TAG_STRUC_wmi_bwf_peer_info, |
| 10771 | WMITLV_GET_STRUCT_TLVLEN(wmi_bwf_peer_info)); |
| 10772 | peer_info->bwf_guaranteed_bandwidth = |
| 10773 | param->peer_info[i].throughput; |
| 10774 | peer_info->bwf_max_airtime = |
| 10775 | param->peer_info[i].max_airtime; |
| 10776 | peer_info->bwf_peer_priority = |
| 10777 | param->peer_info[i].priority; |
| 10778 | qdf_mem_copy(&peer_info->peer_macaddr, |
| 10779 | ¶m->peer_info[i].peer_macaddr, |
| 10780 | sizeof(param->peer_info[i].peer_macaddr)); |
| 10781 | peer_info++; |
| 10782 | } |
| 10783 | |
| 10784 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10785 | WMI_PEER_BWF_REQUEST_CMDID); |
| 10786 | |
| 10787 | if (retval != QDF_STATUS_SUCCESS) { |
| 10788 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 10789 | wmi_buf_free(buf); |
| 10790 | } |
| 10791 | |
| 10792 | return retval; |
| 10793 | } |
| 10794 | |
| 10795 | /** |
| 10796 | * send_mcast_group_update_cmd_tlv() - send mcast group update cmd to fw |
| 10797 | * @wmi_handle: wmi handle |
| 10798 | * @param: pointer to hold mcast update param |
| 10799 | * |
| 10800 | * Return: 0 for success or error code |
| 10801 | */ |
| 10802 | static QDF_STATUS |
| 10803 | send_mcast_group_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 10804 | struct mcast_group_update_params *param) |
| 10805 | { |
| 10806 | wmi_peer_mcast_group_cmd_fixed_param *cmd; |
| 10807 | wmi_buf_t buf; |
| 10808 | QDF_STATUS ret; |
| 10809 | int32_t len; |
| 10810 | int offset = 0; |
| 10811 | static char dummymask[4] = { 0xFF, 0xFF, 0xFF, 0xFF}; |
| 10812 | |
| 10813 | len = sizeof(*cmd); |
| 10814 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10815 | if (!buf) { |
| 10816 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10817 | return QDF_STATUS_E_FAILURE; |
| 10818 | } |
| 10819 | cmd = (wmi_peer_mcast_group_cmd_fixed_param *)wmi_buf_data(buf); |
| 10820 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10821 | WMITLV_TAG_STRUC_wmi_peer_mcast_group_cmd_fixed_param, |
| 10822 | WMITLV_GET_STRUCT_TLVLEN( |
| 10823 | wmi_peer_mcast_group_cmd_fixed_param)); |
| 10824 | /* confirm the buffer is 4-byte aligned */ |
| 10825 | QDF_ASSERT((((size_t) cmd) & 0x3) == 0); |
| 10826 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 10827 | |
| 10828 | cmd->vdev_id = param->vap_id; |
| 10829 | /* construct the message assuming our endianness matches the target */ |
| 10830 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_ACTION_M & |
| 10831 | (param->action << WMI_PEER_MCAST_GROUP_FLAG_ACTION_S); |
| 10832 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_M & |
| 10833 | (param->wildcard << WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_S); |
| 10834 | if (param->is_action_delete) |
| 10835 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_DELETEALL_M; |
| 10836 | |
| 10837 | if (param->is_mcast_addr_len) |
| 10838 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_IPV6_M; |
| 10839 | |
| 10840 | if (param->is_filter_mode_snoop) |
| 10841 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_SRC_FILTER_EXCLUDE_M; |
| 10842 | |
| 10843 | /* unicast address spec only applies for non-wildcard cases */ |
| 10844 | if (!param->wildcard && param->ucast_mac_addr) { |
| 10845 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->ucast_mac_addr, |
| 10846 | &cmd->ucast_mac_addr); |
| 10847 | } |
| 10848 | if (param->mcast_ip_addr) { |
| 10849 | QDF_ASSERT(param->mcast_ip_addr_bytes <= |
| 10850 | sizeof(cmd->mcast_ip_addr)); |
| 10851 | offset = sizeof(cmd->mcast_ip_addr) - |
| 10852 | param->mcast_ip_addr_bytes; |
| 10853 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_addr) + offset, |
| 10854 | param->mcast_ip_addr, |
| 10855 | param->mcast_ip_addr_bytes); |
| 10856 | } |
| 10857 | if (!param->mask) |
| 10858 | param->mask = &dummymask[0]; |
| 10859 | |
| 10860 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_mask) + offset, |
| 10861 | param->mask, |
| 10862 | param->mcast_ip_addr_bytes); |
| 10863 | |
| 10864 | if (param->srcs && param->nsrcs) { |
| 10865 | cmd->num_filter_addr = param->nsrcs; |
| 10866 | QDF_ASSERT((param->nsrcs * param->mcast_ip_addr_bytes) <= |
| 10867 | sizeof(cmd->filter_addr)); |
| 10868 | |
| 10869 | qdf_mem_copy(((uint8_t *) &cmd->filter_addr), param->srcs, |
| 10870 | param->nsrcs * param->mcast_ip_addr_bytes); |
| 10871 | } |
| 10872 | |
| 10873 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10874 | WMI_PEER_MCAST_GROUP_CMDID); |
| 10875 | |
| 10876 | if (ret != QDF_STATUS_SUCCESS) { |
| 10877 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 10878 | wmi_buf_free(buf); |
| 10879 | } |
| 10880 | |
| 10881 | return ret; |
| 10882 | } |
| 10883 | |
| 10884 | /** |
| 10885 | * send_vdev_spectral_configure_cmd_tlv() - send VDEV spectral configure |
| 10886 | * command to fw |
| 10887 | * @wmi_handle: wmi handle |
| 10888 | * @param: pointer to hold spectral config parameter |
| 10889 | * |
| 10890 | * Return: 0 for success or error code |
| 10891 | */ |
| 10892 | static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle, |
| 10893 | struct vdev_spectral_configure_params *param) |
| 10894 | { |
| 10895 | wmi_vdev_spectral_configure_cmd_fixed_param *cmd; |
| 10896 | wmi_buf_t buf; |
| 10897 | QDF_STATUS ret; |
| 10898 | int32_t len; |
| 10899 | |
| 10900 | len = sizeof(*cmd); |
| 10901 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10902 | if (!buf) { |
| 10903 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10904 | return QDF_STATUS_E_FAILURE; |
| 10905 | } |
| 10906 | |
| 10907 | cmd = (wmi_vdev_spectral_configure_cmd_fixed_param *)wmi_buf_data(buf); |
| 10908 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10909 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param, |
| 10910 | WMITLV_GET_STRUCT_TLVLEN( |
| 10911 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param)); |
| 10912 | |
| 10913 | cmd->vdev_id = param->vdev_id; |
| 10914 | cmd->spectral_scan_count = param->count; |
| 10915 | cmd->spectral_scan_period = param->period; |
| 10916 | cmd->spectral_scan_priority = param->spectral_pri; |
| 10917 | cmd->spectral_scan_fft_size = param->fft_size; |
| 10918 | cmd->spectral_scan_gc_ena = param->gc_enable; |
| 10919 | cmd->spectral_scan_restart_ena = param->restart_enable; |
| 10920 | cmd->spectral_scan_noise_floor_ref = param->noise_floor_ref; |
| 10921 | cmd->spectral_scan_init_delay = param->init_delay; |
| 10922 | cmd->spectral_scan_nb_tone_thr = param->nb_tone_thr; |
| 10923 | cmd->spectral_scan_str_bin_thr = param->str_bin_thr; |
| 10924 | cmd->spectral_scan_wb_rpt_mode = param->wb_rpt_mode; |
| 10925 | cmd->spectral_scan_rssi_rpt_mode = param->rssi_rpt_mode; |
| 10926 | cmd->spectral_scan_rssi_thr = param->rssi_thr; |
| 10927 | cmd->spectral_scan_pwr_format = param->pwr_format; |
| 10928 | cmd->spectral_scan_rpt_mode = param->rpt_mode; |
| 10929 | cmd->spectral_scan_bin_scale = param->bin_scale; |
| 10930 | cmd->spectral_scan_dBm_adj = param->dBm_adj; |
| 10931 | cmd->spectral_scan_chn_mask = param->chn_mask; |
| 10932 | |
| 10933 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10934 | WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID); |
| 10935 | |
| 10936 | if (ret != 0) { |
| 10937 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 10938 | wmi_buf_free(buf); |
| 10939 | } |
| 10940 | |
| 10941 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID\n", |
| 10942 | __func__); |
| 10943 | |
| 10944 | WMI_LOGI("vdev_id = %u\n" |
| 10945 | "spectral_scan_count = %u\n" |
| 10946 | "spectral_scan_period = %u\n" |
| 10947 | "spectral_scan_priority = %u\n" |
| 10948 | "spectral_scan_fft_size = %u\n" |
| 10949 | "spectral_scan_gc_ena = %u\n" |
| 10950 | "spectral_scan_restart_ena = %u\n" |
| 10951 | "spectral_scan_noise_floor_ref = %u\n" |
| 10952 | "spectral_scan_init_delay = %u\n" |
| 10953 | "spectral_scan_nb_tone_thr = %u\n" |
| 10954 | "spectral_scan_str_bin_thr = %u\n" |
| 10955 | "spectral_scan_wb_rpt_mode = %u\n" |
| 10956 | "spectral_scan_rssi_rpt_mode = %u\n" |
| 10957 | "spectral_scan_rssi_thr = %u\n" |
| 10958 | "spectral_scan_pwr_format = %u\n" |
| 10959 | "spectral_scan_rpt_mode = %u\n" |
| 10960 | "spectral_scan_bin_scale = %u\n" |
| 10961 | "spectral_scan_dBm_adj = %u\n" |
| 10962 | "spectral_scan_chn_mask = %u\n", |
| 10963 | param->vdev_id, |
| 10964 | param->count, |
| 10965 | param->period, |
| 10966 | param->spectral_pri, |
| 10967 | param->fft_size, |
| 10968 | param->gc_enable, |
| 10969 | param->restart_enable, |
| 10970 | param->noise_floor_ref, |
| 10971 | param->init_delay, |
| 10972 | param->nb_tone_thr, |
| 10973 | param->str_bin_thr, |
| 10974 | param->wb_rpt_mode, |
| 10975 | param->rssi_rpt_mode, |
| 10976 | param->rssi_thr, |
| 10977 | param->pwr_format, |
| 10978 | param->rpt_mode, |
| 10979 | param->bin_scale, |
| 10980 | param->dBm_adj, |
| 10981 | param->chn_mask); |
| 10982 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 10983 | |
| 10984 | return ret; |
| 10985 | } |
| 10986 | |
| 10987 | /** |
| 10988 | * send_vdev_spectral_enable_cmd_tlv() - send VDEV spectral configure |
| 10989 | * command to fw |
| 10990 | * @wmi_handle: wmi handle |
| 10991 | * @param: pointer to hold spectral enable parameter |
| 10992 | * |
| 10993 | * Return: 0 for success or error code |
| 10994 | */ |
| 10995 | static QDF_STATUS send_vdev_spectral_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 10996 | struct vdev_spectral_enable_params *param) |
| 10997 | { |
| 10998 | wmi_vdev_spectral_enable_cmd_fixed_param *cmd; |
| 10999 | wmi_buf_t buf; |
| 11000 | QDF_STATUS ret; |
| 11001 | int32_t len; |
| 11002 | |
| 11003 | len = sizeof(*cmd); |
| 11004 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11005 | if (!buf) { |
| 11006 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11007 | return QDF_STATUS_E_FAILURE; |
| 11008 | } |
| 11009 | |
| 11010 | cmd = (wmi_vdev_spectral_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11011 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11012 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param, |
| 11013 | WMITLV_GET_STRUCT_TLVLEN( |
| 11014 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param)); |
| 11015 | |
| 11016 | cmd->vdev_id = param->vdev_id; |
| 11017 | |
| 11018 | if (param->active_valid) { |
| 11019 | cmd->trigger_cmd = param->active ? 1 : 2; |
| 11020 | /* 1: Trigger, 2: Clear Trigger */ |
| 11021 | } else { |
| 11022 | cmd->trigger_cmd = 0; /* 0: Ignore */ |
| 11023 | } |
| 11024 | |
| 11025 | if (param->enabled_valid) { |
| 11026 | cmd->enable_cmd = param->enabled ? 1 : 2; |
| 11027 | /* 1: Enable 2: Disable */ |
| 11028 | } else { |
| 11029 | cmd->enable_cmd = 0; /* 0: Ignore */ |
| 11030 | } |
| 11031 | |
| 11032 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11033 | WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID); |
| 11034 | |
| 11035 | if (ret != 0) { |
| 11036 | WMI_LOGE("Sending scan enable CMD failed\n"); |
| 11037 | wmi_buf_free(buf); |
| 11038 | } |
| 11039 | |
| 11040 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID\n", __func__); |
| 11041 | |
| 11042 | WMI_LOGI("vdev_id = %u\n" |
| 11043 | "trigger_cmd = %u\n" |
| 11044 | "enable_cmd = %u\n", |
| 11045 | cmd->vdev_id, |
| 11046 | cmd->trigger_cmd, |
| 11047 | cmd->enable_cmd); |
| 11048 | |
| 11049 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 11050 | |
| 11051 | return ret; |
| 11052 | } |
| 11053 | |
| 11054 | /** |
| 11055 | * send_pdev_qvit_cmd_tlv() - send qvit command to fw |
| 11056 | * @wmi_handle: wmi handle |
| 11057 | * @param: pointer to pdev_qvit_params |
| 11058 | * |
| 11059 | * Return: 0 for success or error code |
| 11060 | */ |
| 11061 | static QDF_STATUS |
| 11062 | send_pdev_qvit_cmd_tlv(wmi_unified_t wmi_handle, |
| 11063 | struct pdev_qvit_params *param) |
| 11064 | { |
| 11065 | wmi_buf_t buf; |
| 11066 | QDF_STATUS ret; |
| 11067 | uint8_t *cmd; |
| 11068 | static uint8_t msgref = 1; |
| 11069 | uint8_t segnumber = 0, seginfo, numsegments; |
| 11070 | uint16_t chunk_len, total_bytes; |
| 11071 | uint8_t *bufpos; |
| 11072 | QVIT_SEG_HDR_INFO_STRUCT seghdrinfo; |
| 11073 | |
| 11074 | bufpos = param->utf_payload; |
| 11075 | total_bytes = param->len; |
| 11076 | ASSERT(total_bytes / MAX_WMI_QVIT_LEN == |
| 11077 | (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN)); |
| 11078 | numsegments = (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN); |
| 11079 | |
| 11080 | if (param->len - (numsegments * MAX_WMI_QVIT_LEN)) |
| 11081 | numsegments++; |
| 11082 | |
| 11083 | while (param->len) { |
| 11084 | if (param->len > MAX_WMI_QVIT_LEN) |
| 11085 | chunk_len = MAX_WMI_QVIT_LEN; /* MAX messsage */ |
| 11086 | else |
| 11087 | chunk_len = param->len; |
| 11088 | |
| 11089 | buf = wmi_buf_alloc(wmi_handle, |
| 11090 | (chunk_len + sizeof(seghdrinfo) + |
| 11091 | WMI_TLV_HDR_SIZE)); |
| 11092 | if (!buf) { |
| 11093 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 11094 | return QDF_STATUS_E_NOMEM; |
| 11095 | } |
| 11096 | |
| 11097 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 11098 | |
| 11099 | seghdrinfo.len = total_bytes; |
| 11100 | seghdrinfo.msgref = msgref; |
| 11101 | seginfo = ((numsegments << 4) & 0xF0) | (segnumber & 0xF); |
| 11102 | seghdrinfo.segmentInfo = seginfo; |
| 11103 | |
| 11104 | segnumber++; |
| 11105 | |
| 11106 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 11107 | (chunk_len + sizeof(seghdrinfo))); |
| 11108 | cmd += WMI_TLV_HDR_SIZE; |
| 11109 | qdf_mem_copy(cmd, &seghdrinfo, sizeof(seghdrinfo)); |
| 11110 | qdf_mem_copy(&cmd[sizeof(seghdrinfo)], bufpos, chunk_len); |
| 11111 | |
| 11112 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 11113 | (chunk_len + sizeof(seghdrinfo) + |
| 11114 | WMI_TLV_HDR_SIZE), |
| 11115 | WMI_PDEV_QVIT_CMDID); |
| 11116 | |
| 11117 | if (ret != 0) { |
| 11118 | WMI_LOGE("Failed to send WMI_PDEV_QVIT_CMDID command"); |
| 11119 | wmi_buf_free(buf); |
| 11120 | break; |
| 11121 | } |
| 11122 | |
| 11123 | param->len -= chunk_len; |
| 11124 | bufpos += chunk_len; |
| 11125 | } |
| 11126 | msgref++; |
| 11127 | |
| 11128 | return ret; |
| 11129 | } |
| 11130 | |
| 11131 | /** |
| 11132 | * send_wmm_update_cmd_tlv() - send wmm update command to fw |
| 11133 | * @wmi_handle: wmi handle |
| 11134 | * @param: pointer to wmm update param |
| 11135 | * |
| 11136 | * Return: 0 for success or error code |
| 11137 | */ |
| 11138 | static QDF_STATUS |
| 11139 | send_wmm_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 11140 | struct wmm_update_params *param) |
| 11141 | { |
| 11142 | wmi_pdev_set_wmm_params_cmd_fixed_param *cmd; |
| 11143 | wmi_wmm_params *wmm_param; |
| 11144 | wmi_buf_t buf; |
| 11145 | QDF_STATUS ret; |
| 11146 | int32_t len; |
| 11147 | int ac = 0; |
| 11148 | struct wmi_host_wmeParams *wmep; |
| 11149 | uint8_t *buf_ptr; |
| 11150 | |
| 11151 | len = sizeof(*cmd) + (WME_NUM_AC * sizeof(*wmm_param)); |
| 11152 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11153 | if (!buf) { |
| 11154 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11155 | return QDF_STATUS_E_FAILURE; |
| 11156 | } |
| 11157 | |
| 11158 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11159 | cmd = (wmi_pdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 11160 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11161 | WMITLV_TAG_STRUC_wmi_pdev_set_wmm_params_cmd_fixed_param, |
| 11162 | WMITLV_GET_STRUCT_TLVLEN |
| 11163 | (wmi_pdev_set_wmm_params_cmd_fixed_param)); |
| 11164 | |
| 11165 | cmd->reserved0 = WMI_PDEV_ID_SOC; |
| 11166 | |
| 11167 | buf_ptr += sizeof(wmi_pdev_set_wmm_params_cmd_fixed_param); |
| 11168 | |
| 11169 | for (ac = 0; ac < WME_NUM_AC; ac++) { |
| 11170 | wmep = ¶m->wmep_array[ac]; |
| 11171 | wmm_param = (wmi_wmm_params *)buf_ptr; |
| 11172 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 11173 | WMITLV_TAG_STRUC_wmi_wmm_params, |
| 11174 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_params)); |
| 11175 | wmm_param->aifs = wmep->wmep_aifsn; |
| 11176 | wmm_param->cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin); |
| 11177 | wmm_param->cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax); |
| 11178 | wmm_param->txoplimit = ATH_TXOP_TO_US(wmep->wmep_txopLimit); |
| 11179 | wmm_param->acm = wmep->wmep_acm; |
| 11180 | wmm_param->no_ack = wmep->wmep_noackPolicy; |
| 11181 | buf_ptr += sizeof(wmi_wmm_params); |
| 11182 | } |
| 11183 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11184 | WMI_PDEV_SET_WMM_PARAMS_CMDID); |
| 11185 | |
| 11186 | if (ret != 0) { |
| 11187 | WMI_LOGE("Sending WMM update CMD failed\n"); |
| 11188 | wmi_buf_free(buf); |
| 11189 | } |
| 11190 | |
| 11191 | return ret; |
| 11192 | } |
| 11193 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11194 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11195 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11196 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11197 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11198 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11199 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 11200 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 11201 | resource_cfg->num_offload_reorder_buffs = |
| 11202 | tgt_res_cfg->num_offload_reorder_buffs; |
| 11203 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 11204 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 11205 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 11206 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 11207 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 11208 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 11209 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 11210 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 11211 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 11212 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 11213 | resource_cfg->scan_max_pending_req = |
| 11214 | tgt_res_cfg->scan_max_pending_req; |
| 11215 | resource_cfg->bmiss_offload_max_vdev = |
| 11216 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 11217 | resource_cfg->roam_offload_max_vdev = |
| 11218 | tgt_res_cfg->roam_offload_max_vdev; |
| 11219 | resource_cfg->roam_offload_max_ap_profiles = |
| 11220 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 11221 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 11222 | resource_cfg->num_mcast_table_elems = |
| 11223 | tgt_res_cfg->num_mcast_table_elems; |
| 11224 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 11225 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 11226 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 11227 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 11228 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 11229 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 11230 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 11231 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 11232 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 11233 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 11234 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 11235 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 11236 | resource_cfg->num_tdls_conn_table_entries = |
| 11237 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 11238 | resource_cfg->beacon_tx_offload_max_vdev = |
| 11239 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 11240 | resource_cfg->num_multicast_filter_entries = |
| 11241 | tgt_res_cfg->num_multicast_filter_entries; |
| 11242 | resource_cfg->num_wow_filters = |
| 11243 | tgt_res_cfg->num_wow_filters; |
| 11244 | resource_cfg->num_keep_alive_pattern = |
| 11245 | tgt_res_cfg->num_keep_alive_pattern; |
| 11246 | resource_cfg->keep_alive_pattern_size = |
| 11247 | tgt_res_cfg->keep_alive_pattern_size; |
| 11248 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 11249 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 11250 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 11251 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 11252 | resource_cfg->wmi_send_separate = |
| 11253 | tgt_res_cfg->wmi_send_separate; |
| 11254 | resource_cfg->num_ocb_vdevs = |
| 11255 | tgt_res_cfg->num_ocb_vdevs; |
| 11256 | resource_cfg->num_ocb_channels = |
| 11257 | tgt_res_cfg->num_ocb_channels; |
| 11258 | resource_cfg->num_ocb_schedules = |
| 11259 | tgt_res_cfg->num_ocb_schedules; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 11260 | resource_cfg->bpf_instruction_size = tgt_res_cfg->bpf_instruction_size; |
| 11261 | resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters; |
| 11262 | resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11263 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 11264 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11265 | /** |
| 11266 | * send_init_cmd_tlv() - wmi init command |
| 11267 | * @wmi_handle: pointer to wmi handle |
| 11268 | * @res_cfg: resource config |
| 11269 | * @num_mem_chunks: no of mem chunck |
| 11270 | * @mem_chunk: pointer to mem chunck structure |
| 11271 | * |
| 11272 | * This function sends IE information to firmware |
| 11273 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11274 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11275 | * |
| 11276 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11277 | static QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11278 | wmi_resource_config *tgt_res_cfg, |
| 11279 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 11280 | bool action) |
| 11281 | { |
| 11282 | wmi_buf_t buf; |
| 11283 | wmi_init_cmd_fixed_param *cmd; |
| 11284 | wmi_abi_version my_vers; |
| 11285 | int num_whitelist; |
| 11286 | uint8_t *buf_ptr; |
| 11287 | wmi_resource_config *resource_cfg; |
| 11288 | wlan_host_memory_chunk *host_mem_chunks; |
| 11289 | uint32_t mem_chunk_len = 0; |
| 11290 | uint16_t idx; |
| 11291 | int len; |
| 11292 | int ret; |
| 11293 | |
| 11294 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 11295 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 11296 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 11297 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11298 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 11299 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11300 | } |
| 11301 | |
| 11302 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11303 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 11304 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 11305 | |
| 11306 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 11307 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 11308 | + WMI_TLV_HDR_SIZE); |
| 11309 | |
| 11310 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11311 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 11312 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 11313 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11314 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11315 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 11316 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 11317 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 11318 | |
| 11319 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 11320 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 11321 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 11322 | WMITLV_GET_STRUCT_TLVLEN |
| 11323 | (wlan_host_memory_chunk)); |
| 11324 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 11325 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 11326 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11327 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11328 | idx, host_mem_chunks[idx].size, |
| 11329 | host_mem_chunks[idx].ptr); |
| 11330 | } |
| 11331 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 11332 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 11333 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 11334 | WMITLV_TAG_ARRAY_STRUC, |
| 11335 | (sizeof(wlan_host_memory_chunk) * |
| 11336 | num_mem_chunks)); |
| 11337 | |
| 11338 | num_whitelist = sizeof(version_whitelist) / |
| 11339 | sizeof(wmi_whitelist_version_info); |
| 11340 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 11341 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 11342 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 11343 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 11344 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 11345 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11346 | #ifdef CONFIG_MCL |
| 11347 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 11348 | * 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] | 11349 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 11350 | &my_vers, |
| 11351 | &wmi_handle->fw_abi_version, |
| 11352 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11353 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11354 | 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] | 11355 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 11356 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 11357 | cmd->host_abi_vers.abi_version_ns_0, |
| 11358 | cmd->host_abi_vers.abi_version_ns_1, |
| 11359 | cmd->host_abi_vers.abi_version_ns_2, |
| 11360 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11361 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11362 | /* Save version sent from host - |
| 11363 | * Will be used to check ready event |
| 11364 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11365 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11366 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11367 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11368 | if (action) { |
| 11369 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11370 | WMI_INIT_CMDID); |
| 11371 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11372 | 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] | 11373 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11374 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11375 | } |
| 11376 | } else { |
| 11377 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 11378 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 11379 | } |
| 11380 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11381 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11382 | |
| 11383 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 11384 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11385 | /** |
| 11386 | * send_saved_init_cmd_tlv() - wmi init command |
| 11387 | * @wmi_handle: pointer to wmi handle |
| 11388 | * |
| 11389 | * This function sends IE information to firmware |
| 11390 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11391 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11392 | * |
| 11393 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11394 | 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] | 11395 | { |
| 11396 | int status; |
| 11397 | |
| 11398 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 11399 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11400 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 11401 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11402 | } |
| 11403 | status = wmi_unified_cmd_send(wmi_handle, |
| 11404 | wmi_handle->saved_wmi_init_cmd.buf, |
| 11405 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 11406 | WMI_INIT_CMDID); |
| 11407 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11408 | 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] | 11409 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11410 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11411 | } |
| 11412 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 11413 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 11414 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11415 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11416 | } |
| 11417 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11418 | 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] | 11419 | { |
| 11420 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11421 | wmi_service_ready_event_fixed_param *ev; |
| 11422 | |
| 11423 | |
| 11424 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11425 | |
| 11426 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11427 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11428 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11429 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11430 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11431 | /*Save fw version from service ready message */ |
| 11432 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11433 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11434 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11435 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11436 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11437 | } |
| 11438 | |
| 11439 | /** |
| 11440 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 11441 | * @wmi_handle: pointer to wmi handle |
| 11442 | * @res_cfg: resource config |
| 11443 | * @num_mem_chunks: no of mem chunck |
| 11444 | * @mem_chunk: pointer to mem chunck structure |
| 11445 | * |
| 11446 | * This function sends IE information to firmware |
| 11447 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11448 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11449 | * |
| 11450 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11451 | 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] | 11452 | void *evt_buf) |
| 11453 | { |
| 11454 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 11455 | wmi_ready_event_fixed_param *ev = NULL; |
| 11456 | |
| 11457 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 11458 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11459 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11460 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 11461 | &ev->fw_abi_vers)) { |
| 11462 | /* |
| 11463 | * Error: Our host version and the given firmware version |
| 11464 | * are incompatible. |
| 11465 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11466 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11467 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 11468 | __func__, |
| 11469 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 11470 | abi_version_0), |
| 11471 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 11472 | abi_version_0), |
| 11473 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 11474 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 11475 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 11476 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 11477 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 11478 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 11479 | ev->fw_abi_vers.abi_version_ns_0, |
| 11480 | ev->fw_abi_vers.abi_version_ns_1, |
| 11481 | ev->fw_abi_vers.abi_version_ns_2, |
| 11482 | ev->fw_abi_vers.abi_version_ns_3); |
| 11483 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11484 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11485 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11486 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11487 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11488 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11489 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11490 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11491 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11492 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11493 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11494 | |
| 11495 | /** |
| 11496 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 11497 | * @wmi_handle: wmi handle |
| 11498 | * @custom_addr: base mac address |
| 11499 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11500 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11501 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11502 | 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] | 11503 | uint8_t *custom_addr) |
| 11504 | { |
| 11505 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 11506 | wmi_buf_t buf; |
| 11507 | int err; |
| 11508 | |
| 11509 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 11510 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11511 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11512 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11513 | } |
| 11514 | |
| 11515 | 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] | 11516 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11517 | |
| 11518 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11519 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 11520 | WMITLV_GET_STRUCT_TLVLEN |
| 11521 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 11522 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 11523 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11524 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 11525 | sizeof(*cmd), |
| 11526 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 11527 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11528 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11529 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11530 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11531 | } |
| 11532 | |
| 11533 | return 0; |
| 11534 | } |
| 11535 | |
| 11536 | /** |
| 11537 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 11538 | * @handle: wmi handle |
| 11539 | * @event: Event received from FW |
| 11540 | * @len: Length of the event |
| 11541 | * |
| 11542 | * Enables the low frequency events and disables the high frequency |
| 11543 | * events. Bit 17 indicates if the event if low/high frequency. |
| 11544 | * 1 - high frequency, 0 - low frequency |
| 11545 | * |
| 11546 | * Return: 0 on successfully enabling/disabling the events |
| 11547 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11548 | 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] | 11549 | uint8_t *event, |
| 11550 | uint32_t len) |
| 11551 | { |
| 11552 | uint32_t num_of_diag_events_logs; |
| 11553 | wmi_diag_event_log_config_fixed_param *cmd; |
| 11554 | wmi_buf_t buf; |
| 11555 | uint8_t *buf_ptr; |
| 11556 | uint32_t *cmd_args, *evt_args; |
| 11557 | uint32_t buf_len, i; |
| 11558 | |
| 11559 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 11560 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 11561 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11562 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11563 | |
| 11564 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 11565 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11566 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11567 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11568 | } |
| 11569 | wmi_event = param_buf->fixed_param; |
| 11570 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 11571 | evt_args = param_buf->diag_events_logs_list; |
| 11572 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11573 | 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] | 11574 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11575 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11576 | } |
| 11577 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11578 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11579 | __func__, num_of_diag_events_logs); |
| 11580 | |
| 11581 | /* Free any previous allocation */ |
| 11582 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11583 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11584 | |
| 11585 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11586 | 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] | 11587 | sizeof(uint32_t)); |
| 11588 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11589 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11590 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11591 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11592 | } |
| 11593 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 11594 | |
| 11595 | /* Prepare the send buffer */ |
| 11596 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11597 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 11598 | |
| 11599 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 11600 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11601 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11602 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11603 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11604 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11605 | } |
| 11606 | |
| 11607 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 11608 | buf_ptr = (uint8_t *) cmd; |
| 11609 | |
| 11610 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11611 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 11612 | WMITLV_GET_STRUCT_TLVLEN( |
| 11613 | wmi_diag_event_log_config_fixed_param)); |
| 11614 | |
| 11615 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 11616 | |
| 11617 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 11618 | |
| 11619 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11620 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 11621 | |
| 11622 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11623 | |
| 11624 | /* Populate the events */ |
| 11625 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 11626 | /* Low freq (0) - Enable (1) the event |
| 11627 | * High freq (1) - Disable (0) the event |
| 11628 | */ |
| 11629 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 11630 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 11631 | /* Set the event ID */ |
| 11632 | WMI_DIAG_ID_SET(cmd_args[i], |
| 11633 | WMI_DIAG_ID_GET(evt_args[i])); |
| 11634 | /* Set the type */ |
| 11635 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 11636 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11637 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11638 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 11639 | } |
| 11640 | |
| 11641 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 11642 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11643 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11644 | __func__); |
| 11645 | wmi_buf_free(buf); |
| 11646 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 11647 | * Host can still have this list |
| 11648 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11649 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11650 | } |
| 11651 | |
| 11652 | return 0; |
| 11653 | } |
| 11654 | |
| 11655 | /** |
| 11656 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 11657 | * @wmi_handle: wmi handle |
| 11658 | * @start_log: Start logging related parameters |
| 11659 | * |
| 11660 | * Send the command to the FW based on which specific logging of diag |
| 11661 | * event/log id can be started/stopped |
| 11662 | * |
| 11663 | * Return: None |
| 11664 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11665 | 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] | 11666 | struct wmi_wifi_start_log *start_log) |
| 11667 | { |
| 11668 | wmi_diag_event_log_config_fixed_param *cmd; |
| 11669 | wmi_buf_t buf; |
| 11670 | uint8_t *buf_ptr; |
| 11671 | uint32_t len, count, log_level, i; |
| 11672 | uint32_t *cmd_args; |
| 11673 | uint32_t total_len; |
| 11674 | count = 0; |
| 11675 | |
| 11676 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11677 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11678 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11679 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11680 | } |
| 11681 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 11682 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 11683 | */ |
| 11684 | total_len = 0; |
| 11685 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 11686 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 11687 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 11688 | total_len++; |
| 11689 | } |
| 11690 | |
| 11691 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11692 | (total_len * sizeof(uint32_t)); |
| 11693 | |
| 11694 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11695 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11696 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11697 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11698 | } |
| 11699 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 11700 | buf_ptr = (uint8_t *) cmd; |
| 11701 | |
| 11702 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11703 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 11704 | WMITLV_GET_STRUCT_TLVLEN( |
| 11705 | wmi_diag_event_log_config_fixed_param)); |
| 11706 | |
| 11707 | cmd->num_of_diag_events_logs = total_len; |
| 11708 | |
| 11709 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 11710 | |
| 11711 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11712 | (total_len * sizeof(uint32_t))); |
| 11713 | |
| 11714 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11715 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 11716 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11717 | log_level = 1; |
| 11718 | else |
| 11719 | log_level = 0; |
| 11720 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11721 | 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] | 11722 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 11723 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 11724 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 11725 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 11726 | |
| 11727 | WMI_DIAG_ID_SET(cmd_args[count], |
| 11728 | WMI_DIAG_ID_GET(val)); |
| 11729 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 11730 | WMI_DIAG_TYPE_GET(val)); |
| 11731 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 11732 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11733 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11734 | count++; |
| 11735 | } |
| 11736 | } |
| 11737 | |
| 11738 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11739 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11740 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11741 | __func__); |
| 11742 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11743 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11744 | } |
| 11745 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11746 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11747 | } |
| 11748 | |
| 11749 | /** |
| 11750 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 11751 | * @wmi_handle: WMI handle |
| 11752 | * |
| 11753 | * This function is used to send the flush command to the FW, |
| 11754 | * that will flush the fw logs that are residue in the FW |
| 11755 | * |
| 11756 | * Return: None |
| 11757 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11758 | 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] | 11759 | { |
| 11760 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 11761 | wmi_buf_t buf; |
| 11762 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11763 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11764 | |
| 11765 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11766 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11767 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11768 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11769 | } |
| 11770 | |
| 11771 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 11772 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11773 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 11774 | WMITLV_GET_STRUCT_TLVLEN( |
| 11775 | wmi_debug_mesg_flush_fixed_param)); |
| 11776 | cmd->reserved0 = 0; |
| 11777 | |
| 11778 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11779 | buf, |
| 11780 | len, |
| 11781 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11782 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11783 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11784 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11785 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11786 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11787 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11788 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11789 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11790 | } |
| 11791 | |
| 11792 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11793 | * 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] | 11794 | * @wmi_handle: wmi handle |
| 11795 | * @msg: PCL structure containing the PCL and the number of channels |
| 11796 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11797 | * 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] | 11798 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 11799 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 11800 | * to migrate to a new channel without host driver involvement. An example of |
| 11801 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 11802 | * manage the channel selection without firmware involvement. |
| 11803 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11804 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 11805 | * channel list. The weights corresponds to the channels sent in |
| 11806 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 11807 | * weightage compared to the non PCL channels. |
| 11808 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11809 | * Return: Success if the cmd is sent successfully to the firmware |
| 11810 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11811 | 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] | 11812 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11813 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11814 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11815 | wmi_buf_t buf; |
| 11816 | uint8_t *buf_ptr; |
| 11817 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11818 | uint32_t chan_len; |
| 11819 | |
| 11820 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11821 | |
| 11822 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11823 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11824 | |
| 11825 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11826 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11827 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11828 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11829 | } |
| 11830 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11831 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11832 | buf_ptr = (uint8_t *) cmd; |
| 11833 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11834 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 11835 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11836 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11837 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 11838 | cmd->num_chan = chan_len; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11839 | WMI_LOGI("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11840 | |
| 11841 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11842 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11843 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11844 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11845 | for (i = 0; i < chan_len ; i++) { |
| 11846 | cmd_args[i] = msg->weighed_valid_list[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11847 | WMI_LOGI("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11848 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11849 | } |
| 11850 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11851 | WMI_PDEV_SET_PCL_CMDID)) { |
| 11852 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11853 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11854 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11855 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11856 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11857 | } |
| 11858 | |
| 11859 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11860 | * 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] | 11861 | * @wmi_handle: wmi handle |
| 11862 | * @msg: Structure containing the following parameters |
| 11863 | * |
| 11864 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 11865 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 11866 | * |
| 11867 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 11868 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 11869 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 11870 | * |
| 11871 | * Return: Success if the cmd is sent successfully to the firmware |
| 11872 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11873 | 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] | 11874 | uint32_t hw_mode_index) |
| 11875 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11876 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11877 | wmi_buf_t buf; |
| 11878 | uint32_t len; |
| 11879 | |
| 11880 | len = sizeof(*cmd); |
| 11881 | |
| 11882 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11883 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11884 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11885 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11886 | } |
| 11887 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11888 | 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] | 11889 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11890 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 11891 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 11892 | |
| 11893 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11894 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11895 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11896 | |
| 11897 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11898 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 11899 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11900 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11901 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11902 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11903 | } |
| 11904 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11905 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11906 | } |
| 11907 | |
| 11908 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11909 | * 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] | 11910 | * @wmi_handle: wmi handle |
| 11911 | * @msg: Dual MAC config parameters |
| 11912 | * |
| 11913 | * Configures WLAN firmware with the dual MAC features |
| 11914 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11915 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11916 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11917 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11918 | 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] | 11919 | struct wmi_dual_mac_config *msg) |
| 11920 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11921 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11922 | wmi_buf_t buf; |
| 11923 | uint32_t len; |
| 11924 | |
| 11925 | len = sizeof(*cmd); |
| 11926 | |
| 11927 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11928 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11929 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11930 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11931 | } |
| 11932 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11933 | 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] | 11934 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11935 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11936 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11937 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 11938 | |
| 11939 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11940 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 11941 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11942 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11943 | __func__, msg->scan_config, msg->fw_mode_config); |
| 11944 | |
| 11945 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11946 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 11947 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11948 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11949 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11950 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11951 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11952 | } |
| 11953 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 11954 | #ifdef BIG_ENDIAN_HOST |
| 11955 | /** |
| 11956 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 11957 | * @param data_len - data length |
| 11958 | * @param data - pointer to data |
| 11959 | * |
| 11960 | * Return: QDF_STATUS - success or error status |
| 11961 | */ |
| 11962 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 11963 | struct fips_params *param) |
| 11964 | { |
| 11965 | unsigned char *key_unaligned, *data_unaligned; |
| 11966 | int c; |
| 11967 | u_int8_t *key_aligned = NULL; |
| 11968 | u_int8_t *data_aligned = NULL; |
| 11969 | |
| 11970 | /* Assigning unaligned space to copy the key */ |
| 11971 | key_unaligned = qdf_mem_malloc( |
| 11972 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 11973 | data_unaligned = qdf_mem_malloc( |
| 11974 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 11975 | |
| 11976 | /* Checking if kmalloc is succesful to allocate space */ |
| 11977 | if (key_unaligned == NULL) |
| 11978 | return QDF_STATUS_SUCCESS; |
| 11979 | /* Checking if space is aligned */ |
| 11980 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 11981 | /* align to 4 */ |
| 11982 | key_aligned = |
| 11983 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 11984 | FIPS_ALIGN); |
| 11985 | } else { |
| 11986 | key_aligned = (u_int8_t *)key_unaligned; |
| 11987 | } |
| 11988 | |
| 11989 | /* memset and copy content from key to key aligned */ |
| 11990 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 11991 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 11992 | |
| 11993 | /* print a hexdump for host debug */ |
| 11994 | print_hex_dump(KERN_DEBUG, |
| 11995 | "\t Aligned and Copied Key:@@@@ ", |
| 11996 | DUMP_PREFIX_NONE, |
| 11997 | 16, 1, key_aligned, param->key_len, true); |
| 11998 | |
| 11999 | /* Checking if kmalloc is succesful to allocate space */ |
| 12000 | if (data_unaligned == NULL) |
| 12001 | return QDF_STATUS_SUCCESS; |
| 12002 | /* Checking of space is aligned */ |
| 12003 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 12004 | /* align to 4 */ |
| 12005 | data_aligned = |
| 12006 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 12007 | FIPS_ALIGN); |
| 12008 | } else { |
| 12009 | data_aligned = (u_int8_t *)data_unaligned; |
| 12010 | } |
| 12011 | |
| 12012 | /* memset and copy content from data to data aligned */ |
| 12013 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 12014 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 12015 | |
| 12016 | /* print a hexdump for host debug */ |
| 12017 | print_hex_dump(KERN_DEBUG, |
| 12018 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 12019 | DUMP_PREFIX_NONE, |
| 12020 | 16, 1, data_aligned, param->data_len, true); |
| 12021 | |
| 12022 | /* converting to little Endian both key_aligned and |
| 12023 | * data_aligned*/ |
| 12024 | for (c = 0; c < param->key_len/4; c++) { |
| 12025 | *((u_int32_t *)key_aligned+c) = |
| 12026 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 12027 | } |
| 12028 | for (c = 0; c < param->data_len/4; c++) { |
| 12029 | *((u_int32_t *)data_aligned+c) = |
| 12030 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 12031 | } |
| 12032 | |
| 12033 | /* update endian data to key and data vectors */ |
| 12034 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 12035 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 12036 | |
| 12037 | /* clean up allocated spaces */ |
| 12038 | qdf_mem_free(key_unaligned); |
| 12039 | key_unaligned = NULL; |
| 12040 | key_aligned = NULL; |
| 12041 | |
| 12042 | qdf_mem_free(data_unaligned); |
| 12043 | data_unaligned = NULL; |
| 12044 | data_aligned = NULL; |
| 12045 | |
| 12046 | return QDF_STATUS_SUCCESS; |
| 12047 | } |
| 12048 | #else |
| 12049 | /** |
| 12050 | * fips_align_data_be() - DUMMY for LE platform |
| 12051 | * |
| 12052 | * Return: QDF_STATUS - success |
| 12053 | */ |
| 12054 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 12055 | struct fips_params *param) |
| 12056 | { |
| 12057 | return QDF_STATUS_SUCCESS; |
| 12058 | } |
| 12059 | #endif |
| 12060 | |
| 12061 | |
| 12062 | /** |
| 12063 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 12064 | * @wmi_handle: wmi handle |
| 12065 | * @param: pointer to hold pdev fips param |
| 12066 | * |
| 12067 | * Return: 0 for success or error code |
| 12068 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12069 | static QDF_STATUS |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 12070 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 12071 | struct fips_params *param) |
| 12072 | { |
| 12073 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 12074 | wmi_buf_t buf; |
| 12075 | uint8_t *buf_ptr; |
| 12076 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 12077 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 12078 | |
| 12079 | /* Length TLV placeholder for array of bytes */ |
| 12080 | len += WMI_TLV_HDR_SIZE; |
| 12081 | if (param->data_len) |
| 12082 | len += (param->data_len*sizeof(uint8_t)); |
| 12083 | |
| 12084 | /* |
| 12085 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 12086 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 12087 | * wmi_pdev_fips_cmd structure |
| 12088 | */ |
| 12089 | |
| 12090 | /* do sanity on the input */ |
| 12091 | if (!(((param->data_len & 0xF) == 0) && |
| 12092 | ((param->data_len > 0) && |
| 12093 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 12094 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 12095 | return QDF_STATUS_E_INVAL; |
| 12096 | } |
| 12097 | |
| 12098 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12099 | if (!buf) { |
| 12100 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 12101 | return QDF_STATUS_E_FAILURE; |
| 12102 | } |
| 12103 | |
| 12104 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12105 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 12106 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12107 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 12108 | WMITLV_GET_STRUCT_TLVLEN |
| 12109 | (wmi_pdev_fips_cmd_fixed_param)); |
| 12110 | |
| 12111 | cmd->pdev_id = param->pdev_id; |
| 12112 | if (param->key != NULL && param->data != NULL) { |
| 12113 | cmd->key_len = param->key_len; |
| 12114 | cmd->data_len = param->data_len; |
| 12115 | cmd->fips_cmd = !!(param->op); |
| 12116 | |
| 12117 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 12118 | return QDF_STATUS_E_FAILURE; |
| 12119 | |
| 12120 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 12121 | |
| 12122 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 12123 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 12124 | cmd->mode = param->mode; |
| 12125 | } else { |
| 12126 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 12127 | } |
| 12128 | qdf_print(KERN_ERR "Key len = %d, Data len = %d\n", |
| 12129 | cmd->key_len, cmd->data_len); |
| 12130 | |
| 12131 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 12132 | cmd->key, cmd->key_len, true); |
| 12133 | buf_ptr += sizeof(*cmd); |
| 12134 | |
| 12135 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 12136 | |
| 12137 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12138 | if (param->data_len) |
| 12139 | qdf_mem_copy(buf_ptr, |
| 12140 | (uint8_t *) param->data, param->data_len); |
| 12141 | |
| 12142 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 12143 | 16, 1, buf_ptr, cmd->data_len, true); |
| 12144 | |
| 12145 | buf_ptr += param->data_len; |
| 12146 | |
| 12147 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12148 | WMI_PDEV_FIPS_CMDID); |
| 12149 | qdf_print("%s return value %d\n", __func__, retval); |
| 12150 | } else { |
| 12151 | qdf_print("\n%s:%d Key or Data is NULL\n", __func__, __LINE__); |
| 12152 | wmi_buf_free(buf); |
| 12153 | retval = -QDF_STATUS_E_BADMSG; |
| 12154 | } |
| 12155 | |
| 12156 | return retval; |
| 12157 | } |
| 12158 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12159 | #ifdef WLAN_PMO_ENABLE |
| 12160 | /** |
| 12161 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 12162 | * @wmi_handle: wmi handle |
| 12163 | * @vdev_id: vdev id |
| 12164 | * @bitmap: Event bitmap |
| 12165 | * @enable: enable/disable |
| 12166 | * |
| 12167 | * Return: CDF status |
| 12168 | */ |
| 12169 | static QDF_STATUS send_add_wow_wakeup_event_cmd_tlv(wmi_unified_t wmi_handle, |
| 12170 | uint32_t vdev_id, |
| 12171 | uint32_t bitmap, |
| 12172 | bool enable) |
| 12173 | { |
| 12174 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 12175 | uint16_t len; |
| 12176 | wmi_buf_t buf; |
| 12177 | int ret; |
| 12178 | |
| 12179 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 12180 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12181 | if (!buf) { |
| 12182 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 12183 | return QDF_STATUS_E_NOMEM; |
| 12184 | } |
| 12185 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 12186 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12187 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 12188 | WMITLV_GET_STRUCT_TLVLEN |
| 12189 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 12190 | cmd->vdev_id = vdev_id; |
| 12191 | cmd->is_add = enable; |
| 12192 | cmd->event_bitmap = bitmap; |
| 12193 | |
| 12194 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12195 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 12196 | if (ret) { |
| 12197 | WMI_LOGE("Failed to config wow wakeup event"); |
| 12198 | wmi_buf_free(buf); |
| 12199 | return QDF_STATUS_E_FAILURE; |
| 12200 | } |
| 12201 | |
| 12202 | WMI_LOGD("Wakeup pattern 0x%x %s in fw", bitmap, |
| 12203 | enable ? "enabled" : "disabled"); |
| 12204 | |
| 12205 | return QDF_STATUS_SUCCESS; |
| 12206 | } |
| 12207 | |
| 12208 | /** |
| 12209 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 12210 | * @wmi_handle: wmi handle |
| 12211 | * @vdev_id: vdev id |
| 12212 | * @ptrn_id: pattern id |
| 12213 | * @ptrn: pattern |
| 12214 | * @ptrn_len: pattern length |
| 12215 | * @ptrn_offset: pattern offset |
| 12216 | * @mask: mask |
| 12217 | * @mask_len: mask length |
| 12218 | * @user: true for user configured pattern and false for default pattern |
| 12219 | * @default_patterns: default patterns |
| 12220 | * |
| 12221 | * Return: CDF status |
| 12222 | */ |
| 12223 | static QDF_STATUS send_wow_patterns_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
| 12224 | uint8_t vdev_id, uint8_t ptrn_id, |
| 12225 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 12226 | uint8_t ptrn_offset, const uint8_t *mask, |
| 12227 | uint8_t mask_len, bool user, |
| 12228 | uint8_t default_patterns) |
| 12229 | { |
| 12230 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 12231 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 12232 | wmi_buf_t buf; |
| 12233 | uint8_t *buf_ptr; |
| 12234 | int32_t len; |
| 12235 | int ret; |
| 12236 | |
| 12237 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 12238 | WMI_TLV_HDR_SIZE + |
| 12239 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 12240 | WMI_TLV_HDR_SIZE + |
| 12241 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 12242 | WMI_TLV_HDR_SIZE + |
| 12243 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 12244 | WMI_TLV_HDR_SIZE + |
| 12245 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 12246 | WMI_TLV_HDR_SIZE + |
| 12247 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 12248 | |
| 12249 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12250 | if (!buf) { |
| 12251 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 12252 | return QDF_STATUS_E_NOMEM; |
| 12253 | } |
| 12254 | |
| 12255 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 12256 | buf_ptr = (uint8_t *) cmd; |
| 12257 | |
| 12258 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12259 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 12260 | WMITLV_GET_STRUCT_TLVLEN |
| 12261 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 12262 | cmd->vdev_id = vdev_id; |
| 12263 | cmd->pattern_id = ptrn_id; |
| 12264 | |
| 12265 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 12266 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 12267 | |
| 12268 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12269 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 12270 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12271 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 12272 | |
| 12273 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 12274 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 12275 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 12276 | |
| 12277 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 12278 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
| 12279 | |
| 12280 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 12281 | bitmap_pattern->pattern_len = ptrn_len; |
| 12282 | |
| 12283 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 12284 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 12285 | |
| 12286 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 12287 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 12288 | |
| 12289 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 12290 | bitmap_pattern->pattern_id = ptrn_id; |
| 12291 | |
| 12292 | WMI_LOGI("vdev: %d, ptrn id: %d, ptrn len: %d, ptrn offset: %d user %d", |
| 12293 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 12294 | bitmap_pattern->pattern_offset, user); |
| 12295 | WMI_LOGI("Pattern : "); |
| 12296 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 12297 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 12298 | |
| 12299 | WMI_LOGI("Mask : "); |
| 12300 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 12301 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
| 12302 | |
| 12303 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 12304 | |
| 12305 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 12306 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12307 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12308 | |
| 12309 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 12310 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12311 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12312 | |
| 12313 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 12314 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12315 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12316 | |
| 12317 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 12318 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 12319 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12320 | |
| 12321 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 12322 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 12323 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12324 | *(A_UINT32 *) buf_ptr = 0; |
| 12325 | |
| 12326 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12327 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 12328 | if (ret) { |
| 12329 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
| 12330 | wmi_buf_free(buf); |
| 12331 | return QDF_STATUS_E_FAILURE; |
| 12332 | } |
| 12333 | |
| 12334 | return QDF_STATUS_SUCCESS; |
| 12335 | } |
| 12336 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12337 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12338 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 12339 | * @wmi_handle: wmi handle |
| 12340 | * @offload_req: offload request |
| 12341 | * @buf_ptr: buffer pointer |
| 12342 | * |
| 12343 | * To fill ARP offload data to firmware |
| 12344 | * when target goes to wow mode. |
| 12345 | * |
| 12346 | * Return: None |
| 12347 | */ |
| 12348 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12349 | struct pmo_arp_offload_params *offload_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12350 | { |
| 12351 | |
| 12352 | int i; |
| 12353 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12354 | bool enable_or_disable = offload_req->enable; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12355 | |
| 12356 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12357 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 12358 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 12359 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 12360 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 12361 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 12362 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 12363 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 12364 | |
| 12365 | /* Fill data for ARP and NS in the first tupple for LA */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12366 | if ((enable_or_disable & PMO_OFFLOAD_ENABLE) && (i == 0)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12367 | /* Copy the target ip addr and flags */ |
| 12368 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 12369 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12370 | offload_req->host_ipv4_addr, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12371 | WMI_IPV4_ADDR_LEN); |
| 12372 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12373 | offload_req->host_ipv4_addr); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12374 | } |
| 12375 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 12376 | } |
| 12377 | } |
| 12378 | |
| 12379 | #ifdef WLAN_NS_OFFLOAD |
| 12380 | /** |
| 12381 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 12382 | * @wmi|_handle: wmi handle |
| 12383 | * @offload_req: offload request |
| 12384 | * @buf_ptr: buffer pointer |
| 12385 | * |
| 12386 | * To fill NS offload data to firmware |
| 12387 | * when target goes to wow mode. |
| 12388 | * |
| 12389 | * Return: None |
| 12390 | */ |
| 12391 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12392 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12393 | { |
| 12394 | |
| 12395 | int i; |
| 12396 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12397 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12398 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12399 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 12400 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 12401 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 12402 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 12403 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 12404 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 12405 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 12406 | |
| 12407 | /* |
| 12408 | * Fill data only for NS offload in the first ARP tuple for LA |
| 12409 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12410 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12411 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 12412 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12413 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12414 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12415 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12416 | sizeof(WMI_IPV6_ADDR)); |
| 12417 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12418 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12419 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12420 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12421 | ns_tuple->flags |= |
| 12422 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 12423 | } |
| 12424 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12425 | i, &ns_req->self_ipv6_addr[i], |
| 12426 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12427 | |
| 12428 | /* target MAC is optional, check if it is valid, |
| 12429 | * if this is not valid, the target will use the known |
| 12430 | * local MAC address rather than the tuple |
| 12431 | */ |
| 12432 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12433 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12434 | &ns_tuple->target_mac); |
| 12435 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 12436 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 12437 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 12438 | } |
| 12439 | } |
| 12440 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 12441 | } |
| 12442 | } |
| 12443 | |
| 12444 | |
| 12445 | /** |
| 12446 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 12447 | * @wmi: wmi handle |
| 12448 | * @offload_req: offload request |
| 12449 | * @buf_ptr: buffer pointer |
| 12450 | * |
| 12451 | * To fill extended NS offload extended data to firmware |
| 12452 | * when target goes to wow mode. |
| 12453 | * |
| 12454 | * Return: None |
| 12455 | */ |
| 12456 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12457 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12458 | { |
| 12459 | int i; |
| 12460 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 12461 | uint32_t count, num_ns_ext_tuples; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12462 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12463 | count = ns_req->num_ns_offload_count; |
| 12464 | num_ns_ext_tuples = ns_req->num_ns_offload_count - |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12465 | WMI_MAX_NS_OFFLOADS; |
| 12466 | |
| 12467 | /* Populate extended NS offload tuples */ |
| 12468 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12469 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 12470 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 12471 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 12472 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 12473 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 12474 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 12475 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 12476 | |
| 12477 | /* |
| 12478 | * Fill data only for NS offload in the first ARP tuple for LA |
| 12479 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12480 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12481 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 12482 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12483 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12484 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12485 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12486 | sizeof(WMI_IPV6_ADDR)); |
| 12487 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12488 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12489 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12490 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12491 | ns_tuple->flags |= |
| 12492 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 12493 | } |
| 12494 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12495 | i, &ns_req->self_ipv6_addr[i], |
| 12496 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12497 | |
| 12498 | /* target MAC is optional, check if it is valid, |
| 12499 | * if this is not valid, the target will use the |
| 12500 | * known local MAC address rather than the tuple |
| 12501 | */ |
| 12502 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12503 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12504 | &ns_tuple->target_mac); |
| 12505 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 12506 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 12507 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 12508 | } |
| 12509 | } |
| 12510 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 12511 | } |
| 12512 | } |
| 12513 | #else |
| 12514 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12515 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12516 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12517 | } |
| 12518 | |
| 12519 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12520 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12521 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12522 | } |
| 12523 | #endif |
| 12524 | |
| 12525 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12526 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 12527 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12528 | * @arp_offload_req: arp offload request |
| 12529 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12530 | * @arp_only: flag |
| 12531 | * |
| 12532 | * To configure ARP NS off load data to firmware |
| 12533 | * when target goes to wow mode. |
| 12534 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12535 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12536 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12537 | 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] | 12538 | struct pmo_arp_offload_params *arp_offload_req, |
| 12539 | struct pmo_ns_offload_params *ns_offload_req, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12540 | uint8_t vdev_id) |
| 12541 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12542 | int32_t res; |
| 12543 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12544 | A_UINT8 *buf_ptr; |
| 12545 | wmi_buf_t buf; |
| 12546 | int32_t len; |
| 12547 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 12548 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12549 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12550 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12551 | /* |
| 12552 | * TLV place holder size for array of NS tuples |
| 12553 | * TLV place holder size for array of ARP tuples |
| 12554 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12555 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 12556 | WMI_TLV_HDR_SIZE + |
| 12557 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 12558 | WMI_TLV_HDR_SIZE + |
| 12559 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12560 | |
| 12561 | /* |
| 12562 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 12563 | * extra length for extended NS offload tuples which follows ARP offload |
| 12564 | * tuples. Host needs to fill this structure in following format: |
| 12565 | * 2 NS ofload tuples |
| 12566 | * 2 ARP offload tuples |
| 12567 | * N numbers of extended NS offload tuples if HDD has given more than |
| 12568 | * 2 NS offload addresses |
| 12569 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12570 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12571 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12572 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 12573 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12574 | } |
| 12575 | |
| 12576 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12577 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12578 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12579 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12580 | } |
| 12581 | |
| 12582 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 12583 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 12584 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12585 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 12586 | WMITLV_GET_STRUCT_TLVLEN |
| 12587 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 12588 | cmd->flags = 0; |
| 12589 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12590 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12591 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12592 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12593 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12594 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12595 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 12596 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 12597 | if (num_ns_ext_tuples) |
| 12598 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12599 | |
| 12600 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12601 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 12602 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12603 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12604 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12605 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12606 | } |
| 12607 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12608 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12609 | } |
| 12610 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12611 | /** |
| 12612 | * send_enable_enhance_multicast_offload_tlv() - send enhance multicast offload |
| 12613 | * @wmi_handle: wmi handle |
| 12614 | * @vdev_id: vdev id |
| 12615 | * @action: true for enable else false |
| 12616 | * |
| 12617 | * To enable enhance multicast offload to firmware |
| 12618 | * when target goes to wow mode. |
| 12619 | * |
| 12620 | * Return: QDF Status |
| 12621 | */ |
| 12622 | |
| 12623 | static |
| 12624 | QDF_STATUS send_enable_enhance_multicast_offload_tlv( |
| 12625 | wmi_unified_t wmi_handle, |
| 12626 | uint8_t vdev_id, bool action) |
| 12627 | { |
| 12628 | QDF_STATUS status; |
| 12629 | wmi_buf_t buf; |
| 12630 | wmi_config_enhanced_mcast_filter_cmd_fixed_param *cmd; |
| 12631 | |
| 12632 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12633 | if (!buf) { |
| 12634 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 12635 | return QDF_STATUS_E_NOMEM; |
| 12636 | } |
| 12637 | |
| 12638 | cmd = (wmi_config_enhanced_mcast_filter_cmd_fixed_param *) |
| 12639 | wmi_buf_data(buf); |
| 12640 | |
| 12641 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12642 | WMITLV_TAG_STRUC_wmi_config_enhanced_mcast_filter_fixed_param, |
| 12643 | WMITLV_GET_STRUCT_TLVLEN( |
| 12644 | wmi_config_enhanced_mcast_filter_cmd_fixed_param)); |
| 12645 | |
| 12646 | cmd->vdev_id = vdev_id; |
| 12647 | cmd->enable = ((action == 0) ? ENHANCED_MCAST_FILTER_DISABLED : |
| 12648 | ENHANCED_MCAST_FILTER_ENABLED); |
| 12649 | WMI_LOGD("%s: config enhance multicast offload action %d for vdev %d", |
| 12650 | __func__, action, vdev_id); |
| 12651 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 12652 | sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID); |
| 12653 | if (status != QDF_STATUS_SUCCESS) { |
| 12654 | qdf_nbuf_free(buf); |
| 12655 | WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID", |
| 12656 | __func__); |
| 12657 | } |
| 12658 | |
| 12659 | return status; |
| 12660 | } |
| 12661 | |
| 12662 | /** |
| 12663 | * extract_gtk_rsp_event_tlv() - extract gtk rsp params from event |
| 12664 | * @wmi_handle: wmi handle |
| 12665 | * @param evt_buf: pointer to event buffer |
| 12666 | * @param hdr: Pointer to hold header |
| 12667 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 12668 | * |
| 12669 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12670 | */ |
| 12671 | static QDF_STATUS extract_gtk_rsp_event_tlv(wmi_unified_t wmi_handle, |
| 12672 | void *evt_buf, struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len) |
| 12673 | { |
| 12674 | WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *fixed_param; |
| 12675 | WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *param_buf; |
| 12676 | |
| 12677 | param_buf = (WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *)evt_buf; |
| 12678 | if (!param_buf) { |
| 12679 | WMI_LOGE("gtk param_buf is NULL"); |
| 12680 | return QDF_STATUS_E_INVAL; |
| 12681 | } |
| 12682 | |
| 12683 | if (len < sizeof(WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param)) { |
| 12684 | WMI_LOGE("Invalid length for GTK status"); |
| 12685 | return QDF_STATUS_E_INVAL; |
| 12686 | } |
| 12687 | |
| 12688 | fixed_param = (WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *) |
| 12689 | param_buf->fixed_param; |
| 12690 | gtk_rsp_param->vdev_id = fixed_param->vdev_id; |
| 12691 | gtk_rsp_param->status_flag = QDF_STATUS_SUCCESS; |
| 12692 | gtk_rsp_param->refresh_cnt = fixed_param->refresh_cnt; |
| 12693 | qdf_mem_copy(>k_rsp_param->replay_counter, |
| 12694 | &fixed_param->replay_counter, |
| 12695 | GTK_REPLAY_COUNTER_BYTES); |
| 12696 | |
| 12697 | return QDF_STATUS_SUCCESS; |
| 12698 | |
| 12699 | } |
| 12700 | |
| 12701 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 12702 | /** |
| 12703 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 12704 | * @wmi_handle: wmi handle |
| 12705 | * @vdev_id: vdev id |
| 12706 | * |
| 12707 | * Return: CDF status |
| 12708 | */ |
| 12709 | static QDF_STATUS send_wow_sta_ra_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 12710 | uint8_t vdev_id, uint8_t default_pattern, |
| 12711 | uint16_t rate_limit_interval) |
| 12712 | { |
| 12713 | |
| 12714 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 12715 | wmi_buf_t buf; |
| 12716 | uint8_t *buf_ptr; |
| 12717 | int32_t len; |
| 12718 | int ret; |
| 12719 | |
| 12720 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 12721 | WMI_TLV_HDR_SIZE + |
| 12722 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 12723 | WMI_TLV_HDR_SIZE + |
| 12724 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 12725 | WMI_TLV_HDR_SIZE + |
| 12726 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 12727 | WMI_TLV_HDR_SIZE + |
| 12728 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 12729 | WMI_TLV_HDR_SIZE + |
| 12730 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 12731 | |
| 12732 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12733 | if (!buf) { |
| 12734 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 12735 | return QDF_STATUS_E_NOMEM; |
| 12736 | } |
| 12737 | |
| 12738 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 12739 | buf_ptr = (uint8_t *) cmd; |
| 12740 | |
| 12741 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12742 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 12743 | WMITLV_GET_STRUCT_TLVLEN |
| 12744 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 12745 | cmd->vdev_id = vdev_id; |
| 12746 | cmd->pattern_id = default_pattern, |
| 12747 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 12748 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 12749 | |
| 12750 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 12751 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12752 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12753 | |
| 12754 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 12755 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12756 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12757 | |
| 12758 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 12759 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12760 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12761 | |
| 12762 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 12763 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12764 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12765 | |
| 12766 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 12767 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 12768 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12769 | |
| 12770 | /* Fill TLV for ra_ratelimit_interval. */ |
| 12771 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 12772 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12773 | |
| 12774 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 12775 | |
| 12776 | WMI_LOGD("%s: send RA rate limit [%d] to fw vdev = %d", __func__, |
| 12777 | rate_limit_interval, vdev_id); |
| 12778 | |
| 12779 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12780 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 12781 | if (ret) { |
| 12782 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
| 12783 | wmi_buf_free(buf); |
| 12784 | return QDF_STATUS_E_FAILURE; |
| 12785 | } |
| 12786 | |
| 12787 | return QDF_STATUS_SUCCESS; |
| 12788 | |
| 12789 | } |
| 12790 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 12791 | |
| 12792 | /** |
| 12793 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 12794 | * @wmi_handle: wmi handle |
| 12795 | * @vdev_id: vdev id |
| 12796 | * @multicastAddr: mcast address |
| 12797 | * @clearList: clear list flag |
| 12798 | * |
| 12799 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12800 | */ |
| 12801 | static QDF_STATUS send_add_clear_mcbc_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 12802 | uint8_t vdev_id, |
| 12803 | struct qdf_mac_addr multicast_addr, |
| 12804 | bool clearList) |
| 12805 | { |
| 12806 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 12807 | wmi_buf_t buf; |
| 12808 | int err; |
| 12809 | |
| 12810 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12811 | if (!buf) { |
| 12812 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 12813 | return QDF_STATUS_E_NOMEM; |
| 12814 | } |
| 12815 | |
| 12816 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
| 12817 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 12818 | |
| 12819 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12820 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 12821 | WMITLV_GET_STRUCT_TLVLEN |
| 12822 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 12823 | cmd->action = |
| 12824 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 12825 | cmd->vdev_id = vdev_id; |
| 12826 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
| 12827 | |
| 12828 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 12829 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 12830 | |
| 12831 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 12832 | sizeof(*cmd), |
| 12833 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 12834 | if (err) { |
| 12835 | WMI_LOGE("Failed to send set_param cmd"); |
| 12836 | wmi_buf_free(buf); |
| 12837 | return QDF_STATUS_E_FAILURE; |
| 12838 | } |
| 12839 | |
| 12840 | return QDF_STATUS_SUCCESS; |
| 12841 | } |
| 12842 | |
| 12843 | /** |
| 12844 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 12845 | * @wmi_handle: wmi handle |
| 12846 | * @vdev_id: vdev id |
| 12847 | * @params: GTK offload parameters |
| 12848 | * |
| 12849 | * Return: CDF status |
| 12850 | */ |
| 12851 | static |
| 12852 | QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
| 12853 | struct pmo_gtk_req *params, |
| 12854 | bool enable_offload, |
| 12855 | uint32_t gtk_offload_opcode) |
| 12856 | { |
| 12857 | int len; |
| 12858 | wmi_buf_t buf; |
| 12859 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 12860 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12861 | |
| 12862 | WMI_LOGD("%s Enter", __func__); |
| 12863 | |
| 12864 | len = sizeof(*cmd); |
| 12865 | |
| 12866 | /* alloc wmi buffer */ |
| 12867 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12868 | if (!buf) { |
| 12869 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 12870 | status = QDF_STATUS_E_NOMEM; |
| 12871 | goto out; |
| 12872 | } |
| 12873 | |
| 12874 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 12875 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12876 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 12877 | WMITLV_GET_STRUCT_TLVLEN |
| 12878 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 12879 | |
| 12880 | cmd->vdev_id = vdev_id; |
| 12881 | |
| 12882 | /* Request target to enable GTK offload */ |
| 12883 | if (enable_offload == PMO_GTK_OFFLOAD_ENABLE) { |
| 12884 | cmd->flags = gtk_offload_opcode; |
| 12885 | |
| 12886 | /* Copy the keys and replay counter */ |
| 12887 | qdf_mem_copy(cmd->KCK, params->kck, PMO_KCK_LEN); |
| 12888 | qdf_mem_copy(cmd->KEK, params->kek, PMO_KEK_LEN); |
| 12889 | qdf_mem_copy(cmd->replay_counter, ¶ms->replay_counter, |
| 12890 | GTK_REPLAY_COUNTER_BYTES); |
| 12891 | } else { |
| 12892 | cmd->flags = gtk_offload_opcode; |
| 12893 | } |
| 12894 | |
| 12895 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 12896 | |
| 12897 | /* send the wmi command */ |
| 12898 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12899 | WMI_GTK_OFFLOAD_CMDID)) { |
| 12900 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
| 12901 | wmi_buf_free(buf); |
| 12902 | status = QDF_STATUS_E_FAILURE; |
| 12903 | } |
| 12904 | |
| 12905 | out: |
| 12906 | WMI_LOGD("%s Exit", __func__); |
| 12907 | return status; |
| 12908 | } |
| 12909 | |
| 12910 | /** |
| 12911 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 12912 | * @wmi_handle: wmi handle |
| 12913 | * @params: GTK offload params |
| 12914 | * |
| 12915 | * Return: CDF status |
| 12916 | */ |
| 12917 | static QDF_STATUS send_process_gtk_offload_getinfo_cmd_tlv( |
| 12918 | wmi_unified_t wmi_handle, |
| 12919 | uint8_t vdev_id, |
| 12920 | uint64_t offload_req_opcode) |
| 12921 | { |
| 12922 | int len; |
| 12923 | wmi_buf_t buf; |
| 12924 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 12925 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12926 | |
| 12927 | len = sizeof(*cmd); |
| 12928 | |
| 12929 | /* alloc wmi buffer */ |
| 12930 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12931 | if (!buf) { |
| 12932 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 12933 | status = QDF_STATUS_E_NOMEM; |
| 12934 | goto out; |
| 12935 | } |
| 12936 | |
| 12937 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 12938 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12939 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 12940 | WMITLV_GET_STRUCT_TLVLEN |
| 12941 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 12942 | |
| 12943 | /* Request for GTK offload status */ |
| 12944 | cmd->flags = offload_req_opcode; |
| 12945 | cmd->vdev_id = vdev_id; |
| 12946 | |
| 12947 | /* send the wmi command */ |
| 12948 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12949 | WMI_GTK_OFFLOAD_CMDID)) { |
| 12950 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
| 12951 | wmi_buf_free(buf); |
| 12952 | status = QDF_STATUS_E_FAILURE; |
| 12953 | } |
| 12954 | |
| 12955 | out: |
| 12956 | return status; |
| 12957 | } |
| 12958 | |
| 12959 | /** |
| 12960 | * send_action_frame_patterns_cmd_tlv() - send wmi cmd of action filter params |
| 12961 | * @wmi_handle: wmi handler |
| 12962 | * @action_params: pointer to action_params |
| 12963 | * |
| 12964 | * Return: 0 for success, otherwise appropriate error code |
| 12965 | */ |
| 12966 | static QDF_STATUS send_action_frame_patterns_cmd_tlv(wmi_unified_t wmi_handle, |
| 12967 | struct pmo_action_wakeup_set_params *action_params) |
| 12968 | { |
| 12969 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *cmd; |
| 12970 | wmi_buf_t buf; |
| 12971 | int i; |
| 12972 | int32_t err; |
| 12973 | |
| 12974 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12975 | if (!buf) { |
| 12976 | WMI_LOGE("Failed to allocate buffer to send action filter cmd"); |
| 12977 | return QDF_STATUS_E_NOMEM; |
| 12978 | } |
| 12979 | cmd = (WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *) wmi_buf_data(buf); |
| 12980 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12981 | WMITLV_TAG_STRUC_wmi_wow_set_action_wake_up_cmd_fixed_param, |
| 12982 | WMITLV_GET_STRUCT_TLVLEN( |
| 12983 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param)); |
| 12984 | |
| 12985 | cmd->vdev_id = action_params->vdev_id; |
| 12986 | cmd->operation = action_params->operation; |
| 12987 | |
| 12988 | for (i = 0; i < MAX_SUPPORTED_ACTION_CATEGORY_ELE_LIST; i++) |
| 12989 | cmd->action_category_map[i] = |
| 12990 | action_params->action_category_map[i]; |
| 12991 | |
| 12992 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 12993 | sizeof(*cmd), WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
| 12994 | if (err) { |
| 12995 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
| 12996 | wmi_buf_free(buf); |
| 12997 | return QDF_STATUS_E_FAILURE; |
| 12998 | } |
| 12999 | |
| 13000 | return QDF_STATUS_SUCCESS; |
| 13001 | } |
| 13002 | |
| 13003 | #ifdef FEATURE_WLAN_LPHB |
| 13004 | |
| 13005 | /** |
| 13006 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 13007 | * @wmi_handle: wmi handle |
| 13008 | * @lphb_conf_req: configuration info |
| 13009 | * |
| 13010 | * Return: CDF status |
| 13011 | */ |
| 13012 | static QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle, |
| 13013 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 13014 | { |
| 13015 | QDF_STATUS status; |
| 13016 | wmi_buf_t buf = NULL; |
| 13017 | uint8_t *buf_ptr; |
| 13018 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 13019 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 13020 | |
| 13021 | |
| 13022 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13023 | if (!buf) { |
| 13024 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13025 | return QDF_STATUS_E_NOMEM; |
| 13026 | } |
| 13027 | |
| 13028 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13029 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 13030 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 13031 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 13032 | WMITLV_GET_STRUCT_TLVLEN |
| 13033 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 13034 | |
| 13035 | /* fill in values */ |
| 13036 | hb_enable_fp->vdev_id = params->session; |
| 13037 | hb_enable_fp->enable = params->enable; |
| 13038 | hb_enable_fp->item = params->item; |
| 13039 | hb_enable_fp->session = params->session; |
| 13040 | |
| 13041 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13042 | len, WMI_HB_SET_ENABLE_CMDID); |
| 13043 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13044 | WMI_LOGE("cmd_send WMI_HB_SET_ENABLE returned Error %d", |
| 13045 | status); |
| 13046 | wmi_buf_free(buf); |
| 13047 | } |
| 13048 | |
| 13049 | return status; |
| 13050 | } |
| 13051 | |
| 13052 | /** |
| 13053 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 13054 | * @wmi_handle: wmi handle |
| 13055 | * @lphb_conf_req: lphb config request |
| 13056 | * |
| 13057 | * Return: CDF status |
| 13058 | */ |
| 13059 | static QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 13060 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 13061 | { |
| 13062 | QDF_STATUS status; |
| 13063 | wmi_buf_t buf = NULL; |
| 13064 | uint8_t *buf_ptr; |
| 13065 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 13066 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 13067 | |
| 13068 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13069 | if (!buf) { |
| 13070 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13071 | return QDF_STATUS_E_NOMEM; |
| 13072 | } |
| 13073 | |
| 13074 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13075 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 13076 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 13077 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 13078 | WMITLV_GET_STRUCT_TLVLEN |
| 13079 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 13080 | |
| 13081 | /* fill in values */ |
| 13082 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 13083 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 13084 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 13085 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 13086 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 13087 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 13088 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 13089 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 13090 | hb_tcp_params_fp->session = lphb_conf_req->session; |
| 13091 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
| 13092 | &lphb_conf_req->gateway_mac, |
| 13093 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 13094 | |
| 13095 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13096 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
| 13097 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13098 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", |
| 13099 | status); |
| 13100 | wmi_buf_free(buf); |
| 13101 | } |
| 13102 | |
| 13103 | return status; |
| 13104 | } |
| 13105 | |
| 13106 | /** |
| 13107 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 13108 | * @wmi_handle: wmi handle |
| 13109 | * @lphb_conf_req: lphb config request |
| 13110 | * |
| 13111 | * Return: CDF status |
| 13112 | */ |
| 13113 | static |
| 13114 | QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13115 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 13116 | { |
| 13117 | QDF_STATUS status; |
| 13118 | wmi_buf_t buf = NULL; |
| 13119 | uint8_t *buf_ptr; |
| 13120 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 13121 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 13122 | |
| 13123 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13124 | if (!buf) { |
| 13125 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13126 | return QDF_STATUS_E_NOMEM; |
| 13127 | } |
| 13128 | |
| 13129 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13130 | hb_tcp_filter_fp = |
| 13131 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 13132 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 13133 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 13134 | WMITLV_GET_STRUCT_TLVLEN |
| 13135 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 13136 | |
| 13137 | /* fill in values */ |
| 13138 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 13139 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 13140 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 13141 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 13142 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 13143 | (void *)&g_hb_tcp_filter_fp->filter, |
| 13144 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 13145 | |
| 13146 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13147 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 13148 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13149 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", |
| 13150 | status); |
| 13151 | wmi_buf_free(buf); |
| 13152 | } |
| 13153 | |
| 13154 | return status; |
| 13155 | } |
| 13156 | |
| 13157 | /** |
| 13158 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 13159 | * @wmi_handle: wmi handle |
| 13160 | * @lphb_conf_req: lphb config request |
| 13161 | * |
| 13162 | * Return: CDF status |
| 13163 | */ |
| 13164 | static QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 13165 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 13166 | { |
| 13167 | QDF_STATUS status; |
| 13168 | wmi_buf_t buf = NULL; |
| 13169 | uint8_t *buf_ptr; |
| 13170 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 13171 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 13172 | |
| 13173 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13174 | if (!buf) { |
| 13175 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13176 | return QDF_STATUS_E_NOMEM; |
| 13177 | } |
| 13178 | |
| 13179 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13180 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 13181 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 13182 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 13183 | WMITLV_GET_STRUCT_TLVLEN |
| 13184 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 13185 | |
| 13186 | /* fill in values */ |
| 13187 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 13188 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 13189 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 13190 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 13191 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 13192 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 13193 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 13194 | hb_udp_params_fp->session = lphb_conf_req->session; |
| 13195 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
| 13196 | &lphb_conf_req->gateway_mac, |
| 13197 | sizeof(lphb_conf_req->gateway_mac)); |
| 13198 | |
| 13199 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13200 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
| 13201 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13202 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", |
| 13203 | status); |
| 13204 | wmi_buf_free(buf); |
| 13205 | } |
| 13206 | |
| 13207 | return status; |
| 13208 | } |
| 13209 | |
| 13210 | /** |
| 13211 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 13212 | * @wmi_handle: wmi handle |
| 13213 | * @lphb_conf_req: lphb config request |
| 13214 | * |
| 13215 | * Return: CDF status |
| 13216 | */ |
| 13217 | static |
| 13218 | QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13219 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 13220 | { |
| 13221 | QDF_STATUS status; |
| 13222 | wmi_buf_t buf = NULL; |
| 13223 | uint8_t *buf_ptr; |
| 13224 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 13225 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 13226 | |
| 13227 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13228 | if (!buf) { |
| 13229 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13230 | return QDF_STATUS_E_NOMEM; |
| 13231 | } |
| 13232 | |
| 13233 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13234 | hb_udp_filter_fp = |
| 13235 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 13236 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 13237 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 13238 | WMITLV_GET_STRUCT_TLVLEN |
| 13239 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 13240 | |
| 13241 | /* fill in values */ |
| 13242 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 13243 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 13244 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 13245 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 13246 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 13247 | (void *)&lphb_conf_req->filter, |
| 13248 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 13249 | |
| 13250 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13251 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 13252 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13253 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", |
| 13254 | status); |
| 13255 | wmi_buf_free(buf); |
| 13256 | } |
| 13257 | |
| 13258 | return status; |
| 13259 | } |
| 13260 | #endif /* FEATURE_WLAN_LPHB */ |
| 13261 | #endif /* End of WLAN_PMO_ENABLE */ |
| 13262 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13263 | static QDF_STATUS send_enable_broadcast_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 13264 | uint8_t vdev_id, bool enable) |
| 13265 | { |
| 13266 | int32_t res; |
| 13267 | wmi_hw_data_filter_cmd_fixed_param *cmd; |
| 13268 | A_UINT8 *buf_ptr; |
| 13269 | wmi_buf_t buf; |
| 13270 | int32_t len; |
| 13271 | |
| 13272 | /* |
| 13273 | * TLV place holder size for array of ARP tuples |
| 13274 | */ |
| 13275 | len = sizeof(wmi_hw_data_filter_cmd_fixed_param); |
| 13276 | |
| 13277 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13278 | if (!buf) { |
| 13279 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13280 | return QDF_STATUS_E_NOMEM; |
| 13281 | } |
| 13282 | |
| 13283 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 13284 | cmd = (wmi_hw_data_filter_cmd_fixed_param *) buf_ptr; |
| 13285 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13286 | WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param, |
| 13287 | WMITLV_GET_STRUCT_TLVLEN |
| 13288 | (wmi_hw_data_filter_cmd_fixed_param)); |
| 13289 | cmd->vdev_id = vdev_id; |
| 13290 | cmd->enable = enable; |
| 13291 | cmd->hw_filter_bitmap = WMI_HW_DATA_FILTER_DROP_NON_ARP_BC; |
| 13292 | |
| 13293 | WMI_LOGD("HW Broadcast Filter vdev_id: %d", cmd->vdev_id); |
| 13294 | |
| 13295 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13296 | WMI_HW_DATA_FILTER_CMDID); |
| 13297 | if (res) { |
| 13298 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
| 13299 | wmi_buf_free(buf); |
| 13300 | return QDF_STATUS_E_FAILURE; |
| 13301 | } |
| 13302 | |
| 13303 | return QDF_STATUS_SUCCESS; |
| 13304 | } |
| 13305 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13306 | /** |
| 13307 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 13308 | * @wmi_handle: wmi handle |
| 13309 | * @request: SSID hotlist set request |
| 13310 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13311 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13312 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13313 | static QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13314 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 13315 | struct ssid_hotlist_request_params *request) |
| 13316 | { |
| 13317 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 13318 | wmi_buf_t wmi_buf; |
| 13319 | uint32_t len; |
| 13320 | uint32_t array_size; |
| 13321 | uint8_t *buf_ptr; |
| 13322 | |
| 13323 | /* length of fixed portion */ |
| 13324 | len = sizeof(*cmd); |
| 13325 | |
| 13326 | /* length of variable portion */ |
| 13327 | array_size = |
| 13328 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 13329 | len += WMI_TLV_HDR_SIZE + array_size; |
| 13330 | |
| 13331 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13332 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13333 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13334 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13335 | } |
| 13336 | |
| 13337 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 13338 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 13339 | buf_ptr; |
| 13340 | WMITLV_SET_HDR |
| 13341 | (&cmd->tlv_header, |
| 13342 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 13343 | WMITLV_GET_STRUCT_TLVLEN |
| 13344 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 13345 | |
| 13346 | cmd->request_id = request->request_id; |
| 13347 | cmd->requestor_id = 0; |
| 13348 | cmd->vdev_id = request->session_id; |
| 13349 | cmd->table_id = 0; |
| 13350 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 13351 | cmd->total_entries = request->ssid_count; |
| 13352 | cmd->num_entries_in_page = request->ssid_count; |
| 13353 | cmd->first_entry_index = 0; |
| 13354 | |
| 13355 | buf_ptr += sizeof(*cmd); |
| 13356 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 13357 | |
| 13358 | if (request->ssid_count) { |
| 13359 | wmi_extscan_hotlist_ssid_entry *entry; |
| 13360 | int i; |
| 13361 | |
| 13362 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13363 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 13364 | for (i = 0; i < request->ssid_count; i++) { |
| 13365 | WMITLV_SET_HDR |
| 13366 | (entry, |
| 13367 | WMITLV_TAG_ARRAY_STRUC, |
| 13368 | WMITLV_GET_STRUCT_TLVLEN |
| 13369 | (wmi_extscan_hotlist_ssid_entry)); |
| 13370 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13371 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13372 | request->ssids[i].ssid.mac_ssid, |
| 13373 | request->ssids[i].ssid.length); |
| 13374 | entry->band = request->ssids[i].band; |
| 13375 | entry->min_rssi = request->ssids[i].rssi_low; |
| 13376 | entry->max_rssi = request->ssids[i].rssi_high; |
| 13377 | entry++; |
| 13378 | } |
| 13379 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 13380 | } else { |
| 13381 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 13382 | } |
| 13383 | |
| 13384 | if (wmi_unified_cmd_send |
| 13385 | (wmi_handle, wmi_buf, len, |
| 13386 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13387 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13388 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13389 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13390 | } |
| 13391 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13392 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13393 | } |
| 13394 | |
| 13395 | /** |
| 13396 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 13397 | * @wmi_handle: wmi handle |
| 13398 | * @vdev_id: vdev id |
| 13399 | * |
| 13400 | * This function sends roam synch complete event to fw. |
| 13401 | * |
| 13402 | * Return: CDF STATUS |
| 13403 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13404 | 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] | 13405 | uint8_t vdev_id) |
| 13406 | { |
| 13407 | wmi_roam_synch_complete_fixed_param *cmd; |
| 13408 | wmi_buf_t wmi_buf; |
| 13409 | uint8_t *buf_ptr; |
| 13410 | uint16_t len; |
| 13411 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 13412 | |
| 13413 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13414 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13415 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13416 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13417 | } |
| 13418 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 13419 | buf_ptr = (uint8_t *) cmd; |
| 13420 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13421 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 13422 | WMITLV_GET_STRUCT_TLVLEN |
| 13423 | (wmi_roam_synch_complete_fixed_param)); |
| 13424 | cmd->vdev_id = vdev_id; |
| 13425 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13426 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13427 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13428 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13429 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13430 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13431 | } |
| 13432 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13433 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13434 | } |
| 13435 | |
| 13436 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 13437 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 13438 | * @wmi_handle: wmi handle |
| 13439 | * @wmi_fwtest: fw test command |
| 13440 | * |
| 13441 | * This function sends fw test command to fw. |
| 13442 | * |
| 13443 | * Return: CDF STATUS |
| 13444 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 13445 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 13446 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 13447 | struct set_fwtest_params *wmi_fwtest) |
| 13448 | { |
| 13449 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 13450 | wmi_buf_t wmi_buf; |
| 13451 | uint16_t len; |
| 13452 | |
| 13453 | len = sizeof(*cmd); |
| 13454 | |
| 13455 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13456 | if (!wmi_buf) { |
| 13457 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 13458 | return QDF_STATUS_E_NOMEM; |
| 13459 | } |
| 13460 | |
| 13461 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 13462 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13463 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 13464 | WMITLV_GET_STRUCT_TLVLEN( |
| 13465 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 13466 | cmd->param_id = wmi_fwtest->arg; |
| 13467 | cmd->param_value = wmi_fwtest->value; |
| 13468 | |
| 13469 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13470 | WMI_FWTEST_CMDID)) { |
| 13471 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 13472 | qdf_nbuf_free(wmi_buf); |
| 13473 | return QDF_STATUS_E_FAILURE; |
| 13474 | } |
| 13475 | |
| 13476 | return QDF_STATUS_SUCCESS; |
| 13477 | } |
| 13478 | |
| 13479 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13480 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 13481 | * @wmi_handle: wmi handle |
| 13482 | * @wmi_utest: unit test command |
| 13483 | * |
| 13484 | * This function send unit test command to fw. |
| 13485 | * |
| 13486 | * Return: CDF STATUS |
| 13487 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13488 | 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] | 13489 | struct wmi_unit_test_cmd *wmi_utest) |
| 13490 | { |
| 13491 | wmi_unit_test_cmd_fixed_param *cmd; |
| 13492 | wmi_buf_t wmi_buf; |
| 13493 | uint8_t *buf_ptr; |
| 13494 | int i; |
| 13495 | uint16_t len, args_tlv_len; |
| 13496 | A_UINT32 *unit_test_cmd_args; |
| 13497 | |
| 13498 | args_tlv_len = |
| 13499 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 13500 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 13501 | |
| 13502 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13503 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13504 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 13505 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13506 | } |
| 13507 | |
| 13508 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 13509 | buf_ptr = (uint8_t *) cmd; |
| 13510 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13511 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 13512 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 13513 | cmd->vdev_id = wmi_utest->vdev_id; |
| 13514 | cmd->module_id = wmi_utest->module_id; |
| 13515 | cmd->num_args = wmi_utest->num_args; |
| 13516 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 13517 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13518 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 13519 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13520 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13521 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 13522 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13523 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13524 | } |
| 13525 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13526 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13527 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13528 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13529 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13530 | } |
| 13531 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13532 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13533 | } |
| 13534 | |
| 13535 | /** |
| 13536 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 13537 | * @wmi_handle: wma handle |
| 13538 | * @roaminvoke: roam invoke command |
| 13539 | * |
| 13540 | * Send roam invoke command to fw for fastreassoc. |
| 13541 | * |
| 13542 | * Return: CDF STATUS |
| 13543 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13544 | 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] | 13545 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 13546 | uint32_t ch_hz) |
| 13547 | { |
| 13548 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 13549 | wmi_buf_t wmi_buf; |
| 13550 | u_int8_t *buf_ptr; |
| 13551 | u_int16_t len, args_tlv_len; |
| 13552 | A_UINT32 *channel_list; |
| 13553 | wmi_mac_addr *bssid_list; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13554 | wmi_tlv_buf_len_param *buf_len_tlv; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13555 | |
| 13556 | /* Host sends only one channel and one bssid */ |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13557 | args_tlv_len = (4 * WMI_TLV_HDR_SIZE) + sizeof(A_UINT32) + |
| 13558 | sizeof(wmi_mac_addr) + sizeof(wmi_tlv_buf_len_param) + |
| 13559 | roundup(roaminvoke->frame_len, sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13560 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 13561 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13562 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13563 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 13564 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13565 | } |
| 13566 | |
| 13567 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 13568 | buf_ptr = (u_int8_t *) cmd; |
| 13569 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13570 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 13571 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 13572 | cmd->vdev_id = roaminvoke->vdev_id; |
| 13573 | cmd->flags = 0; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13574 | |
| 13575 | if (roaminvoke->frame_len) |
| 13576 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_SKIP; |
| 13577 | else |
| 13578 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_FIXED_CH; |
| 13579 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13580 | cmd->roam_ap_sel_mode = 0; |
| 13581 | cmd->roam_delay = 0; |
| 13582 | cmd->num_chan = 1; |
| 13583 | cmd->num_bssid = 1; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13584 | /* packing 1 beacon/probe_rsp frame with WMI cmd */ |
| 13585 | cmd->num_buf = 1; |
| 13586 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13587 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 13588 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13589 | (sizeof(u_int32_t))); |
| 13590 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13591 | *channel_list = ch_hz; |
| 13592 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 13593 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 13594 | (sizeof(wmi_mac_addr))); |
| 13595 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13596 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13597 | |
| 13598 | /* move to next tlv i.e. bcn_prb_buf_list */ |
| 13599 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_mac_addr); |
| 13600 | |
| 13601 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 13602 | sizeof(wmi_tlv_buf_len_param)); |
| 13603 | |
| 13604 | buf_len_tlv = (wmi_tlv_buf_len_param *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13605 | buf_len_tlv->buf_len = roaminvoke->frame_len; |
| 13606 | |
| 13607 | /* move to next tlv i.e. bcn_prb_frm */ |
| 13608 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_tlv_buf_len_param); |
| 13609 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 13610 | roundup(roaminvoke->frame_len, sizeof(uint32_t))); |
| 13611 | |
| 13612 | /* copy frame after the header */ |
| 13613 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
| 13614 | roaminvoke->frame_buf, |
| 13615 | roaminvoke->frame_len); |
| 13616 | |
| 13617 | WMI_LOGD(FL("bcn/prb_rsp frame, length: %d"), roaminvoke->frame_len); |
| 13618 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 13619 | buf_ptr + WMI_TLV_HDR_SIZE, |
| 13620 | roaminvoke->frame_len); |
| 13621 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13622 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13623 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13624 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13625 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13626 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13627 | } |
| 13628 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13629 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13630 | } |
| 13631 | |
| 13632 | /** |
| 13633 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 13634 | * @wmi_handle: wmi handle |
| 13635 | * @command: command |
| 13636 | * @vdev_id: vdev id |
| 13637 | * |
| 13638 | * This function set roam offload command to fw. |
| 13639 | * |
| 13640 | * Return: CDF status |
| 13641 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13642 | 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] | 13643 | uint32_t command, uint32_t vdev_id) |
| 13644 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13645 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13646 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 13647 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13648 | int len; |
| 13649 | uint8_t *buf_ptr; |
| 13650 | |
| 13651 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 13652 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13653 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13654 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13655 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13656 | } |
| 13657 | |
| 13658 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13659 | |
| 13660 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 13661 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 13662 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 13663 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 13664 | cmd_fp->vdev_id = vdev_id; |
| 13665 | cmd_fp->command_arg = command; |
| 13666 | |
| 13667 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13668 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13669 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13670 | 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] | 13671 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13672 | goto error; |
| 13673 | } |
| 13674 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13675 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 13676 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13677 | |
| 13678 | error: |
| 13679 | wmi_buf_free(buf); |
| 13680 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13681 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13682 | } |
| 13683 | |
| 13684 | /** |
| 13685 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 13686 | * @wmi_handle: wmi handle |
| 13687 | * @ap_profile_p: ap profile |
| 13688 | * @vdev_id: vdev id |
| 13689 | * |
| 13690 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 13691 | * |
| 13692 | * Return: CDF status |
| 13693 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13694 | 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] | 13695 | wmi_ap_profile *ap_profile_p, |
| 13696 | uint32_t vdev_id) |
| 13697 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13698 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13699 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13700 | int len; |
| 13701 | uint8_t *buf_ptr; |
| 13702 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 13703 | |
| 13704 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 13705 | |
| 13706 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13707 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13708 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13709 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13710 | } |
| 13711 | |
| 13712 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13713 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 13714 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 13715 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 13716 | WMITLV_GET_STRUCT_TLVLEN |
| 13717 | (wmi_roam_ap_profile_fixed_param)); |
| 13718 | /* fill in threshold values */ |
| 13719 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 13720 | roam_ap_profile_fp->id = 0; |
| 13721 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 13722 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13723 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13724 | WMITLV_SET_HDR(buf_ptr, |
| 13725 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 13726 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 13727 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13728 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13729 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13730 | 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] | 13731 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13732 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13733 | } |
| 13734 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13735 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13736 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13737 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13738 | } |
| 13739 | |
| 13740 | /** |
| 13741 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 13742 | * @wmi_handle: wmi handle |
| 13743 | * @scan_period: scan period |
| 13744 | * @scan_age: scan age |
| 13745 | * @vdev_id: vdev id |
| 13746 | * |
| 13747 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 13748 | * |
| 13749 | * Return: CDF status |
| 13750 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13751 | 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] | 13752 | uint32_t scan_period, |
| 13753 | uint32_t scan_age, |
| 13754 | uint32_t vdev_id) |
| 13755 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13756 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13757 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13758 | int len; |
| 13759 | uint8_t *buf_ptr; |
| 13760 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 13761 | |
| 13762 | /* Send scan period values */ |
| 13763 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 13764 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13765 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13766 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13767 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13768 | } |
| 13769 | |
| 13770 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13771 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 13772 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 13773 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 13774 | WMITLV_GET_STRUCT_TLVLEN |
| 13775 | (wmi_roam_scan_period_fixed_param)); |
| 13776 | /* fill in scan period values */ |
| 13777 | scan_period_fp->vdev_id = vdev_id; |
| 13778 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 13779 | scan_period_fp->roam_scan_age = scan_age; |
| 13780 | |
| 13781 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13782 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13783 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13784 | 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] | 13785 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13786 | goto error; |
| 13787 | } |
| 13788 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13789 | 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] | 13790 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13791 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13792 | error: |
| 13793 | wmi_buf_free(buf); |
| 13794 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13795 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13796 | } |
| 13797 | |
| 13798 | /** |
| 13799 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 13800 | * @wmi_handle: wmi handle |
| 13801 | * @chan_count: channel count |
| 13802 | * @chan_list: channel list |
| 13803 | * @list_type: list type |
| 13804 | * @vdev_id: vdev id |
| 13805 | * |
| 13806 | * Set roam offload channel list. |
| 13807 | * |
| 13808 | * Return: CDF status |
| 13809 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13810 | 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] | 13811 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 13812 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13813 | uint8_t list_type, uint32_t vdev_id) |
| 13814 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13815 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13816 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13817 | int len, list_tlv_len; |
| 13818 | int i; |
| 13819 | uint8_t *buf_ptr; |
| 13820 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 13821 | A_UINT32 *roam_chan_list_array; |
| 13822 | |
| 13823 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13824 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13825 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13826 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13827 | } |
| 13828 | /* Channel list is a table of 2 TLV's */ |
| 13829 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 13830 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 13831 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13832 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13833 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13834 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13835 | } |
| 13836 | |
| 13837 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13838 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 13839 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 13840 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 13841 | WMITLV_GET_STRUCT_TLVLEN |
| 13842 | (wmi_roam_chan_list_fixed_param)); |
| 13843 | chan_list_fp->vdev_id = vdev_id; |
| 13844 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 13845 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13846 | /* external app is controlling channel list */ |
| 13847 | chan_list_fp->chan_list_type = |
| 13848 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 13849 | } else { |
| 13850 | /* umac supplied occupied channel list in LFR */ |
| 13851 | chan_list_fp->chan_list_type = |
| 13852 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 13853 | } |
| 13854 | |
| 13855 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 13856 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13857 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 13858 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13859 | WMI_LOGI("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13860 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 13861 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 13862 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13863 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13864 | } |
| 13865 | |
| 13866 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13867 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13868 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13869 | 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] | 13870 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13871 | goto error; |
| 13872 | } |
| 13873 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13874 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
| 13875 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13876 | error: |
| 13877 | wmi_buf_free(buf); |
| 13878 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13879 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13880 | } |
| 13881 | |
| 13882 | /** |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 13883 | * send_per_roam_config_cmd_tlv() - set per roaming config to FW |
| 13884 | * @wmi_handle: wmi handle |
| 13885 | * @req_buf: per roam config buffer |
| 13886 | * |
| 13887 | * Return: QDF status |
| 13888 | */ |
| 13889 | static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 13890 | struct wmi_per_roam_config_req *req_buf) |
| 13891 | { |
| 13892 | wmi_buf_t buf = NULL; |
| 13893 | QDF_STATUS status; |
| 13894 | int len; |
| 13895 | uint8_t *buf_ptr; |
| 13896 | wmi_roam_per_config_fixed_param *wmi_per_config; |
| 13897 | |
| 13898 | len = sizeof(wmi_roam_per_config_fixed_param); |
| 13899 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13900 | if (!buf) { |
| 13901 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13902 | return QDF_STATUS_E_NOMEM; |
| 13903 | } |
| 13904 | |
| 13905 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13906 | wmi_per_config = |
| 13907 | (wmi_roam_per_config_fixed_param *) buf_ptr; |
| 13908 | WMITLV_SET_HDR(&wmi_per_config->tlv_header, |
| 13909 | WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param, |
| 13910 | WMITLV_GET_STRUCT_TLVLEN |
| 13911 | (wmi_roam_per_config_fixed_param)); |
| 13912 | |
| 13913 | /* fill in per roam config values */ |
| 13914 | wmi_per_config->vdev_id = req_buf->vdev_id; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 13915 | |
| 13916 | wmi_per_config->enable = req_buf->per_config.enable; |
| 13917 | wmi_per_config->high_rate_thresh = |
| 13918 | (req_buf->per_config.tx_high_rate_thresh << 16) | |
| 13919 | (req_buf->per_config.rx_high_rate_thresh & 0x0000ffff); |
| 13920 | wmi_per_config->low_rate_thresh = |
| 13921 | (req_buf->per_config.tx_low_rate_thresh << 16) | |
| 13922 | (req_buf->per_config.rx_low_rate_thresh & 0x0000ffff); |
| 13923 | wmi_per_config->pkt_err_rate_thresh_pct = |
| 13924 | (req_buf->per_config.tx_rate_thresh_percnt << 16) | |
| 13925 | (req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff); |
| 13926 | 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] | 13927 | wmi_per_config->pkt_err_rate_mon_time = |
| 13928 | (req_buf->per_config.tx_per_mon_time << 16) | |
| 13929 | (req_buf->per_config.rx_per_mon_time & 0x0000ffff); |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 13930 | |
| 13931 | /* Send per roam config parameters */ |
| 13932 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13933 | len, WMI_ROAM_PER_CONFIG_CMDID); |
| 13934 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13935 | WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d", |
| 13936 | status); |
| 13937 | wmi_buf_free(buf); |
| 13938 | return status; |
| 13939 | } |
| 13940 | |
| 13941 | WMI_LOGI(FL("per roam enable=%d, vdev=%d"), |
| 13942 | req_buf->per_config.enable, req_buf->vdev_id); |
| 13943 | return QDF_STATUS_SUCCESS; |
| 13944 | } |
| 13945 | |
| 13946 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13947 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 13948 | * @wmi_handle: wmi handle |
| 13949 | * @rssi_change_thresh: RSSI Change threshold |
| 13950 | * @bcn_rssi_weight: beacon RSSI weight |
| 13951 | * @vdev_id: vdev id |
| 13952 | * |
| 13953 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 13954 | * |
| 13955 | * Return: CDF status |
| 13956 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13957 | 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] | 13958 | uint32_t vdev_id, |
| 13959 | int32_t rssi_change_thresh, |
| 13960 | uint32_t bcn_rssi_weight, |
| 13961 | uint32_t hirssi_delay_btw_scans) |
| 13962 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13963 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13964 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13965 | int len; |
| 13966 | uint8_t *buf_ptr; |
| 13967 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 13968 | |
| 13969 | /* Send rssi change parameters */ |
| 13970 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 13971 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13972 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13973 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13974 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13975 | } |
| 13976 | |
| 13977 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13978 | rssi_change_fp = |
| 13979 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 13980 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 13981 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 13982 | WMITLV_GET_STRUCT_TLVLEN |
| 13983 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 13984 | /* fill in rssi change threshold (hysteresis) values */ |
| 13985 | rssi_change_fp->vdev_id = vdev_id; |
| 13986 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 13987 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 13988 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 13989 | |
| 13990 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13991 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13992 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13993 | 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] | 13994 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13995 | goto error; |
| 13996 | } |
| 13997 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13998 | 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] | 13999 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14000 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 14001 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14002 | error: |
| 14003 | wmi_buf_free(buf); |
| 14004 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14005 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14006 | } |
| 14007 | |
| 14008 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 14009 | * @wmi_handle: wmi handle. |
| 14010 | * @cmd: size of command structure. |
| 14011 | * @per_entry_size: per entry size. |
| 14012 | * |
| 14013 | * This utility function calculates how many hotlist entries can |
| 14014 | * fit in one page. |
| 14015 | * |
| 14016 | * Return: number of entries |
| 14017 | */ |
| 14018 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 14019 | size_t cmd_size, |
| 14020 | size_t per_entry_size) |
| 14021 | { |
| 14022 | uint32_t avail_space = 0; |
| 14023 | int num_entries = 0; |
| 14024 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 14025 | |
| 14026 | /* Calculate number of hotlist entries that can |
| 14027 | * be passed in wma message request. |
| 14028 | */ |
| 14029 | avail_space = max_msg_len - cmd_size; |
| 14030 | num_entries = avail_space / per_entry_size; |
| 14031 | return num_entries; |
| 14032 | } |
| 14033 | |
| 14034 | /** |
| 14035 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 14036 | * @wmi_handle: wmi handle |
| 14037 | * @photlist: hotlist command params |
| 14038 | * @buf_len: buffer length |
| 14039 | * |
| 14040 | * This function fills individual elements for hotlist request and |
| 14041 | * TLV for bssid entries |
| 14042 | * |
| 14043 | * Return: CDF Status. |
| 14044 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14045 | 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] | 14046 | struct ext_scan_setbssi_hotlist_params * |
| 14047 | photlist, int *buf_len) |
| 14048 | { |
| 14049 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 14050 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 14051 | struct ap_threshold_params *src_ap = photlist->ap; |
| 14052 | wmi_buf_t buf; |
| 14053 | uint8_t *buf_ptr; |
| 14054 | |
| 14055 | int j, index = 0; |
| 14056 | int cmd_len = 0; |
| 14057 | int num_entries; |
| 14058 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 14059 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14060 | int len = sizeof(*cmd); |
| 14061 | |
| 14062 | len += WMI_TLV_HDR_SIZE; |
| 14063 | cmd_len = len; |
| 14064 | |
| 14065 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 14066 | cmd_len, |
| 14067 | sizeof(*dest_hotlist)); |
| 14068 | /* setbssid hotlist expects the bssid list |
| 14069 | * to be non zero value |
| 14070 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 14071 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 14072 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14073 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14074 | } |
| 14075 | |
| 14076 | /* Split the hot list entry pages and send multiple command |
| 14077 | * requests if the buffer reaches the maximum request size |
| 14078 | */ |
| 14079 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14080 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14081 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 14082 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14083 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14084 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 14085 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14086 | } |
| 14087 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14088 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 14089 | buf_ptr; |
| 14090 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14091 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 14092 | WMITLV_GET_STRUCT_TLVLEN |
| 14093 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 14094 | |
| 14095 | /* Multiple requests are sent until the num_entries_in_page |
| 14096 | * matches the total_entries |
| 14097 | */ |
| 14098 | cmd->request_id = photlist->requestId; |
| 14099 | cmd->vdev_id = photlist->sessionId; |
| 14100 | cmd->total_entries = numap; |
| 14101 | cmd->mode = 1; |
| 14102 | cmd->num_entries_in_page = min_entries; |
| 14103 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 14104 | cmd->first_entry_index = index; |
| 14105 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14106 | 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] | 14107 | __func__, cmd->vdev_id, cmd->total_entries, |
| 14108 | cmd->num_entries_in_page, |
| 14109 | cmd->lost_ap_scan_count); |
| 14110 | |
| 14111 | buf_ptr += sizeof(*cmd); |
| 14112 | WMITLV_SET_HDR(buf_ptr, |
| 14113 | WMITLV_TAG_ARRAY_STRUC, |
| 14114 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 14115 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 14116 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 14117 | |
| 14118 | /* Populate bssid, channel info and rssi |
| 14119 | * for the bssid's that are sent as hotlists. |
| 14120 | */ |
| 14121 | for (j = 0; j < min_entries; j++) { |
| 14122 | WMITLV_SET_HDR(dest_hotlist, |
| 14123 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 14124 | WMITLV_GET_STRUCT_TLVLEN |
| 14125 | (wmi_extscan_hotlist_entry)); |
| 14126 | |
| 14127 | dest_hotlist->min_rssi = src_ap->low; |
| 14128 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 14129 | &dest_hotlist->bssid); |
| 14130 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14131 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14132 | __func__, dest_hotlist->channel, |
| 14133 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14134 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14135 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 14136 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 14137 | dest_hotlist->bssid.mac_addr47to32); |
| 14138 | dest_hotlist++; |
| 14139 | src_ap++; |
| 14140 | } |
| 14141 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 14142 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 14143 | |
| 14144 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14145 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14146 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14147 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14148 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14149 | } |
| 14150 | index = index + min_entries; |
| 14151 | num_entries = numap - min_entries; |
| 14152 | len = cmd_len; |
| 14153 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14154 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14155 | } |
| 14156 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 14157 | /** |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 14158 | * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW |
| 14159 | * @wmi_handle: the WMI handle |
| 14160 | * @vdev_id: the Id of the vdev to apply the configuration to |
| 14161 | * @ucast_mode: the active BPF mode to configure for unicast packets |
| 14162 | * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast |
| 14163 | * packets |
| 14164 | * |
| 14165 | * Return: QDF status |
| 14166 | */ |
| 14167 | static QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 14168 | uint8_t vdev_id, |
| 14169 | enum wmi_host_active_bpf_mode ucast_mode, |
| 14170 | enum wmi_host_active_bpf_mode mcast_bcast_mode) |
| 14171 | { |
| 14172 | const WMITLV_TAG_ID tag_id = |
| 14173 | WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; |
| 14174 | const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( |
| 14175 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param); |
| 14176 | QDF_STATUS status; |
| 14177 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; |
| 14178 | wmi_buf_t buf; |
| 14179 | |
| 14180 | WMI_LOGI("Sending WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)", |
| 14181 | vdev_id, ucast_mode, mcast_bcast_mode); |
| 14182 | |
| 14183 | /* allocate command buffer */ |
| 14184 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 14185 | if (!buf) { |
| 14186 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 14187 | return QDF_STATUS_E_NOMEM; |
| 14188 | } |
| 14189 | |
| 14190 | /* set TLV header */ |
| 14191 | cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); |
| 14192 | WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); |
| 14193 | |
| 14194 | /* populate data */ |
| 14195 | cmd->vdev_id = vdev_id; |
| 14196 | cmd->uc_mode = ucast_mode; |
| 14197 | cmd->mcbc_mode = mcast_bcast_mode; |
| 14198 | |
| 14199 | /* send to FW */ |
| 14200 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 14201 | WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); |
| 14202 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14203 | WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", |
| 14204 | status); |
| 14205 | wmi_buf_free(buf); |
| 14206 | return status; |
| 14207 | } |
| 14208 | |
| 14209 | WMI_LOGI("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); |
| 14210 | |
| 14211 | return QDF_STATUS_SUCCESS; |
| 14212 | } |
| 14213 | |
| 14214 | /** |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 14215 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 14216 | * @wmi_handle: wmi handle |
| 14217 | * @param: wmi power debug parameter |
| 14218 | * |
| 14219 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 14220 | * |
| 14221 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 14222 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14223 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 14224 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 14225 | { |
| 14226 | wmi_buf_t buf = NULL; |
| 14227 | QDF_STATUS status; |
| 14228 | int len, args_tlv_len; |
| 14229 | uint8_t *buf_ptr; |
| 14230 | uint8_t i; |
| 14231 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 14232 | uint32_t *cmd_args; |
| 14233 | |
| 14234 | /* Prepare and send power debug cmd parameters */ |
| 14235 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 14236 | len = sizeof(*cmd) + args_tlv_len; |
| 14237 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14238 | if (!buf) { |
| 14239 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14240 | return QDF_STATUS_E_NOMEM; |
| 14241 | } |
| 14242 | |
| 14243 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14244 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 14245 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14246 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 14247 | WMITLV_GET_STRUCT_TLVLEN |
| 14248 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 14249 | |
| 14250 | cmd->pdev_id = param->pdev_id; |
| 14251 | cmd->module_id = param->module_id; |
| 14252 | cmd->num_args = param->num_args; |
| 14253 | buf_ptr += sizeof(*cmd); |
| 14254 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14255 | (param->num_args * sizeof(uint32_t))); |
| 14256 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 14257 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 14258 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 14259 | cmd_args[i] = param->args[i]; |
| 14260 | WMI_LOGI("%d,", param->args[i]); |
| 14261 | } |
| 14262 | |
| 14263 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14264 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 14265 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14266 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 14267 | status); |
| 14268 | goto error; |
| 14269 | } |
| 14270 | |
| 14271 | return QDF_STATUS_SUCCESS; |
| 14272 | error: |
| 14273 | wmi_buf_free(buf); |
| 14274 | |
| 14275 | return status; |
| 14276 | } |
| 14277 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14278 | /* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd |
| 14279 | * @buf_ptr: pointer to current position in init command buffer |
| 14280 | * @len: pointer to length. This will be updated with current lenght of cmd |
| 14281 | * @param: point host parameters for init command |
| 14282 | * |
| 14283 | * Return: Updated pointer of buf_ptr. |
| 14284 | */ |
| 14285 | static inline uint8_t *copy_hw_mode_in_init_cmd(uint8_t *buf_ptr, |
| 14286 | int *len, struct wmi_init_cmd_param *param) |
| 14287 | { |
| 14288 | uint16_t idx; |
| 14289 | |
| 14290 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { |
| 14291 | wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode; |
| 14292 | wmi_pdev_band_to_mac *band_to_mac; |
| 14293 | |
| 14294 | hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *) |
| 14295 | (buf_ptr + sizeof(wmi_init_cmd_fixed_param) + |
| 14296 | sizeof(wmi_resource_config) + |
| 14297 | WMI_TLV_HDR_SIZE + (param->num_mem_chunks * |
| 14298 | sizeof(wlan_host_memory_chunk))); |
| 14299 | |
| 14300 | WMITLV_SET_HDR(&hw_mode->tlv_header, |
| 14301 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 14302 | (WMITLV_GET_STRUCT_TLVLEN |
| 14303 | (wmi_pdev_set_hw_mode_cmd_fixed_param))); |
| 14304 | |
| 14305 | hw_mode->hw_mode_index = param->hw_mode_id; |
| 14306 | hw_mode->num_band_to_mac = param->num_band_to_mac; |
| 14307 | |
| 14308 | buf_ptr = (uint8_t *) (hw_mode + 1); |
| 14309 | band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr + |
| 14310 | WMI_TLV_HDR_SIZE); |
| 14311 | for (idx = 0; idx < param->num_band_to_mac; idx++) { |
| 14312 | WMITLV_SET_HDR(&band_to_mac[idx].tlv_header, |
| 14313 | WMITLV_TAG_STRUC_wmi_pdev_band_to_mac, |
| 14314 | WMITLV_GET_STRUCT_TLVLEN |
| 14315 | (wmi_pdev_band_to_mac)); |
| 14316 | band_to_mac[idx].pdev_id = |
| 14317 | param->band_to_mac[idx].pdev_id; |
| 14318 | band_to_mac[idx].start_freq = |
| 14319 | param->band_to_mac[idx].start_freq; |
| 14320 | band_to_mac[idx].end_freq = |
| 14321 | param->band_to_mac[idx].end_freq; |
| 14322 | } |
| 14323 | *len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 14324 | (param->num_band_to_mac * |
| 14325 | sizeof(wmi_pdev_band_to_mac)) + |
| 14326 | WMI_TLV_HDR_SIZE; |
| 14327 | |
| 14328 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 14329 | (param->num_band_to_mac * |
| 14330 | sizeof(wmi_pdev_band_to_mac))); |
| 14331 | } |
| 14332 | |
| 14333 | return buf_ptr; |
| 14334 | } |
| 14335 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14336 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 14337 | * send_multiple_vdev_restart_req_cmd_tlv() - send multiple vdev restart req |
| 14338 | * @wmi_handle: wmi handle |
| 14339 | * @param: wmi multiple vdev restart req param |
| 14340 | * |
| 14341 | * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw. |
| 14342 | * |
| 14343 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 14344 | */ |
| 14345 | static QDF_STATUS send_multiple_vdev_restart_req_cmd_tlv( |
| 14346 | wmi_unified_t wmi_handle, |
| 14347 | struct multiple_vdev_restart_params *param) |
| 14348 | { |
| 14349 | wmi_buf_t buf; |
| 14350 | QDF_STATUS qdf_status; |
| 14351 | wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *cmd; |
| 14352 | int i; |
| 14353 | uint8_t *buf_ptr; |
| 14354 | uint32_t *vdev_ids; |
| 14355 | wmi_channel *chan_info; |
| 14356 | struct channel_param *tchan_info; |
| 14357 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 14358 | |
| 14359 | len += sizeof(wmi_channel); |
| 14360 | if (param->num_vdevs) |
| 14361 | len += sizeof(uint32_t) * param->num_vdevs; |
| 14362 | |
| 14363 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14364 | if (!buf) { |
| 14365 | WMI_LOGE("Failed to allocate memory\n"); |
| 14366 | qdf_status = QDF_STATUS_E_NOMEM; |
| 14367 | goto end; |
| 14368 | } |
| 14369 | |
| 14370 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 14371 | cmd = (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *) |
| 14372 | buf_ptr; |
| 14373 | |
| 14374 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14375 | WMITLV_TAG_STRUC_wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param, |
| 14376 | WMITLV_GET_STRUCT_TLVLEN |
| 14377 | (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param)); |
| 14378 | cmd->pdev_id = param->pdev_id; |
| 14379 | cmd->requestor_id = param->requestor_id; |
| 14380 | cmd->disable_hw_ack = param->disable_hw_ack; |
| 14381 | cmd->cac_duration_ms = param->cac_duration_ms; |
| 14382 | cmd->num_vdevs = param->num_vdevs; |
| 14383 | |
| 14384 | buf_ptr += sizeof(*cmd); |
| 14385 | |
| 14386 | WMITLV_SET_HDR(buf_ptr, |
| 14387 | WMITLV_TAG_ARRAY_UINT32, |
| 14388 | sizeof(A_UINT32) * param->num_vdevs); |
| 14389 | vdev_ids = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 14390 | for (i = 0; i < param->num_vdevs; i++) { |
| 14391 | vdev_ids[i] = param->vdev_ids[i]; |
| 14392 | } |
| 14393 | |
| 14394 | buf_ptr += (sizeof(A_UINT32) * param->num_vdevs) + WMI_TLV_HDR_SIZE; |
| 14395 | |
| 14396 | WMITLV_SET_HDR(buf_ptr, |
| 14397 | WMITLV_TAG_STRUC_wmi_channel, |
| 14398 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
Sathish Kumar | 3e28e00 | 2017-03-07 15:53:04 +0530 | [diff] [blame] | 14399 | chan_info = (wmi_channel *)buf_ptr; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 14400 | tchan_info = &(param->ch_param); |
| 14401 | chan_info->mhz = tchan_info->mhz; |
| 14402 | chan_info->band_center_freq1 = tchan_info->cfreq1; |
| 14403 | chan_info->band_center_freq2 = tchan_info->cfreq2; |
| 14404 | if (tchan_info->is_chan_passive) |
| 14405 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 14406 | WMI_CHAN_FLAG_PASSIVE); |
| 14407 | if (tchan_info->allow_vht) |
| 14408 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 14409 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 14410 | else if (tchan_info->allow_ht) |
| 14411 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 14412 | WMI_CHAN_FLAG_ALLOW_HT); |
| 14413 | WMI_SET_CHANNEL_MODE(chan_info, tchan_info->phy_mode); |
| 14414 | WMI_SET_CHANNEL_MIN_POWER(chan_info, tchan_info->minpower); |
| 14415 | WMI_SET_CHANNEL_MAX_POWER(chan_info, tchan_info->maxpower); |
| 14416 | WMI_SET_CHANNEL_REG_POWER(chan_info, tchan_info->maxregpower); |
| 14417 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, tchan_info->antennamax); |
| 14418 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, tchan_info->reg_class_id); |
| 14419 | |
| 14420 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14421 | WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID); |
| 14422 | |
| 14423 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 14424 | WMI_LOGE("%s: Failed to send\n", __func__); |
| 14425 | wmi_buf_free(buf); |
| 14426 | } |
| 14427 | |
| 14428 | end: |
| 14429 | return qdf_status; |
| 14430 | } |
| 14431 | |
| 14432 | /** |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 14433 | * send_dfs_phyerr_offload_en_cmd_tlv() - send dfs phyerr offload enable cmd |
| 14434 | * @wmi_handle: wmi handle |
| 14435 | * @pdev_id: pdev id |
| 14436 | * |
| 14437 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID command to firmware. |
| 14438 | * |
| 14439 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 14440 | */ |
| 14441 | static QDF_STATUS send_dfs_phyerr_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 14442 | uint32_t pdev_id) |
| 14443 | { |
| 14444 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *cmd; |
| 14445 | wmi_buf_t buf; |
| 14446 | uint16_t len; |
| 14447 | QDF_STATUS ret; |
| 14448 | |
| 14449 | len = sizeof(*cmd); |
| 14450 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14451 | |
| 14452 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 14453 | |
| 14454 | if (!buf) { |
| 14455 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14456 | return QDF_STATUS_E_NOMEM; |
| 14457 | } |
| 14458 | |
| 14459 | cmd = (wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *) |
| 14460 | wmi_buf_data(buf); |
| 14461 | |
| 14462 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14463 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param, |
| 14464 | WMITLV_GET_STRUCT_TLVLEN( |
| 14465 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param)); |
| 14466 | |
| 14467 | cmd->pdev_id = pdev_id; |
| 14468 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14469 | WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 14470 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 14471 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 14472 | __func__, ret, pdev_id); |
| 14473 | wmi_buf_free(buf); |
| 14474 | return QDF_STATUS_E_FAILURE; |
| 14475 | } |
| 14476 | |
| 14477 | return QDF_STATUS_SUCCESS; |
| 14478 | } |
| 14479 | |
| 14480 | /** |
| 14481 | * send_dfs_phyerr_offload_dis_cmd_tlv() - send dfs phyerr offload disable cmd |
| 14482 | * @wmi_handle: wmi handle |
| 14483 | * @pdev_id: pdev id |
| 14484 | * |
| 14485 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID command to firmware. |
| 14486 | * |
| 14487 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 14488 | */ |
| 14489 | static QDF_STATUS send_dfs_phyerr_offload_dis_cmd_tlv(wmi_unified_t wmi_handle, |
| 14490 | uint32_t pdev_id) |
| 14491 | { |
| 14492 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *cmd; |
| 14493 | wmi_buf_t buf; |
| 14494 | uint16_t len; |
| 14495 | QDF_STATUS ret; |
| 14496 | |
| 14497 | len = sizeof(*cmd); |
| 14498 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14499 | |
| 14500 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 14501 | |
| 14502 | if (!buf) { |
| 14503 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14504 | return QDF_STATUS_E_NOMEM; |
| 14505 | } |
| 14506 | |
| 14507 | cmd = (wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *) |
| 14508 | wmi_buf_data(buf); |
| 14509 | |
| 14510 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14511 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param, |
| 14512 | WMITLV_GET_STRUCT_TLVLEN( |
| 14513 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param)); |
| 14514 | |
| 14515 | cmd->pdev_id = pdev_id; |
| 14516 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14517 | WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 14518 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 14519 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 14520 | __func__, ret, pdev_id); |
| 14521 | wmi_buf_free(buf); |
| 14522 | return QDF_STATUS_E_FAILURE; |
| 14523 | } |
| 14524 | |
| 14525 | return QDF_STATUS_SUCCESS; |
| 14526 | } |
| 14527 | |
| 14528 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14529 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 14530 | * @wmi_handle: wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14531 | * @param param: pointer to wmi init param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14532 | * |
| 14533 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14534 | */ |
| 14535 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14536 | struct wmi_init_cmd_param *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14537 | { |
| 14538 | wmi_buf_t buf; |
| 14539 | wmi_init_cmd_fixed_param *cmd; |
| 14540 | wmi_abi_version my_vers; |
| 14541 | int num_whitelist; |
| 14542 | uint8_t *buf_ptr; |
| 14543 | wmi_resource_config *resource_cfg; |
| 14544 | wlan_host_memory_chunk *host_mem_chunks; |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14545 | uint32_t mem_chunk_len = 0, hw_mode_len = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14546 | uint16_t idx; |
| 14547 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14548 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14549 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14550 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + |
| 14551 | WMI_TLV_HDR_SIZE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14552 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14553 | |
| 14554 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) |
| 14555 | hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 14556 | WMI_TLV_HDR_SIZE + |
| 14557 | (param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac)); |
| 14558 | |
| 14559 | 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] | 14560 | if (!buf) { |
| 14561 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14562 | return QDF_STATUS_E_FAILURE; |
| 14563 | } |
| 14564 | |
| 14565 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14566 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 14567 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 14568 | |
| 14569 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 14570 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 14571 | + WMI_TLV_HDR_SIZE); |
| 14572 | |
| 14573 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14574 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 14575 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 14576 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14577 | wmi_copy_resource_config(resource_cfg, param->res_cfg); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14578 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 14579 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 14580 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 14581 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14582 | for (idx = 0; idx < param->num_mem_chunks; ++idx) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14583 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 14584 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 14585 | WMITLV_GET_STRUCT_TLVLEN |
| 14586 | (wlan_host_memory_chunk)); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14587 | host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr; |
| 14588 | host_mem_chunks[idx].size = param->mem_chunks[idx].len; |
| 14589 | host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14590 | qdf_print("chunk %d len %d requested ,ptr 0x%x ", |
| 14591 | idx, host_mem_chunks[idx].size, |
| 14592 | host_mem_chunks[idx].ptr); |
| 14593 | } |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14594 | cmd->num_host_mem_chunks = param->num_mem_chunks; |
| 14595 | len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 14596 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14597 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 14598 | WMITLV_TAG_ARRAY_STRUC, |
| 14599 | (sizeof(wlan_host_memory_chunk) * |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14600 | param->num_mem_chunks)); |
| 14601 | |
| 14602 | /* Fill hw mode id config */ |
| 14603 | buf_ptr = copy_hw_mode_in_init_cmd(buf_ptr, &len, param); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14604 | |
| 14605 | num_whitelist = sizeof(version_whitelist) / |
| 14606 | sizeof(wmi_whitelist_version_info); |
| 14607 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 14608 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 14609 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 14610 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 14611 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 14612 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 14613 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14614 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14615 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 14616 | &my_vers, |
| 14617 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 14618 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14619 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14620 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 14621 | __func__, |
| 14622 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 14623 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 14624 | cmd->host_abi_vers.abi_version_ns_0, |
| 14625 | cmd->host_abi_vers.abi_version_ns_1, |
| 14626 | cmd->host_abi_vers.abi_version_ns_2, |
| 14627 | cmd->host_abi_vers.abi_version_ns_3); |
| 14628 | |
| 14629 | /* Save version sent from host - |
| 14630 | * Will be used to check ready event |
| 14631 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14632 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14633 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 14634 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14635 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14636 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 14637 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 14638 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 14639 | ret); |
| 14640 | wmi_buf_free(buf); |
| 14641 | } |
| 14642 | return ret; |
| 14643 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14644 | } |
| 14645 | |
| 14646 | /** |
| 14647 | * save_service_bitmap_tlv() - save service bitmap |
| 14648 | * @wmi_handle: wmi handle |
| 14649 | * @param evt_buf: pointer to event buffer |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14650 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14651 | * |
| 14652 | * Return: None |
| 14653 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 14654 | #ifndef CONFIG_MCL |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14655 | static |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14656 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 14657 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14658 | { |
| 14659 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14660 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14661 | |
| 14662 | qdf_mem_copy(wmi_handle->wmi_service_bitmap, |
| 14663 | param_buf->wmi_service_bitmap, |
| 14664 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14665 | |
| 14666 | if (bitmap_buf) |
| 14667 | qdf_mem_copy(bitmap_buf, |
| 14668 | param_buf->wmi_service_bitmap, |
| 14669 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14670 | } |
| 14671 | #else |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14672 | static |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14673 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 14674 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14675 | { |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14676 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14677 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14678 | |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14679 | if (bitmap_buf) |
| 14680 | qdf_mem_copy(bitmap_buf, |
| 14681 | param_buf->wmi_service_bitmap, |
| 14682 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
| 14683 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14684 | #endif |
| 14685 | |
| 14686 | /** |
| 14687 | * is_service_enabled_tlv() - Check if service enabled |
| 14688 | * @param wmi_handle: wmi handle |
| 14689 | * @param service_id: service identifier |
| 14690 | * |
| 14691 | * Return: 1 enabled, 0 disabled |
| 14692 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 14693 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14694 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 14695 | uint32_t service_id) |
| 14696 | { |
| 14697 | return WMI_SERVICE_IS_ENABLED(wmi_handle->wmi_service_bitmap, |
| 14698 | service_id); |
| 14699 | } |
| 14700 | #else |
| 14701 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 14702 | uint32_t service_id) |
| 14703 | { |
| 14704 | return false; |
| 14705 | } |
| 14706 | #endif |
| 14707 | |
| 14708 | /** |
| 14709 | * extract_service_ready_tlv() - extract service ready event |
| 14710 | * @wmi_handle: wmi handle |
| 14711 | * @param evt_buf: pointer to received event buffer |
| 14712 | * @param cap: pointer to hold target capability information extracted from even |
| 14713 | * |
| 14714 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14715 | */ |
| 14716 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 14717 | void *evt_buf, struct wlan_psoc_target_capability_info *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14718 | { |
| 14719 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14720 | wmi_service_ready_event_fixed_param *ev; |
| 14721 | |
| 14722 | |
| 14723 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14724 | |
| 14725 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 14726 | if (!ev) { |
| 14727 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14728 | return QDF_STATUS_E_FAILURE; |
| 14729 | } |
| 14730 | |
| 14731 | cap->phy_capability = ev->phy_capability; |
| 14732 | cap->max_frag_entry = ev->max_frag_entry; |
| 14733 | cap->num_rf_chains = ev->num_rf_chains; |
| 14734 | cap->ht_cap_info = ev->ht_cap_info; |
| 14735 | cap->vht_cap_info = ev->vht_cap_info; |
| 14736 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 14737 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 14738 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 14739 | cap->sys_cap_info = ev->sys_cap_info; |
| 14740 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 14741 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 14742 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 14743 | cap->max_supported_macs = ev->max_supported_macs; |
| 14744 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 14745 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 14746 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 14747 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 14748 | |
| 14749 | return QDF_STATUS_SUCCESS; |
| 14750 | } |
| 14751 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 14752 | /* convert_wireless_modes_tlv() - Convert REGDMN_MODE values sent by target |
| 14753 | * to host internal WMI_HOST_REGDMN_MODE values. |
| 14754 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 14755 | * host currently. Add this in the future if required. |
| 14756 | * 11AX (Phase II) : 11ax related values are not currently |
| 14757 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 14758 | * finalize the advertisement mechanism. |
| 14759 | * @target_wireless_mode: target wireless mode received in message |
| 14760 | * |
| 14761 | * Return: returns the host internal wireless mode. |
| 14762 | */ |
| 14763 | static inline uint32_t convert_wireless_modes_tlv(uint32_t target_wireless_mode) |
| 14764 | { |
| 14765 | |
| 14766 | uint32_t wireless_modes = 0; |
| 14767 | |
| 14768 | if (target_wireless_mode & REGDMN_MODE_11A) |
| 14769 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 14770 | |
| 14771 | if (target_wireless_mode & REGDMN_MODE_TURBO) |
| 14772 | wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 14773 | |
| 14774 | if (target_wireless_mode & REGDMN_MODE_11B) |
| 14775 | wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 14776 | |
| 14777 | if (target_wireless_mode & REGDMN_MODE_PUREG) |
| 14778 | wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 14779 | |
| 14780 | if (target_wireless_mode & REGDMN_MODE_11G) |
| 14781 | wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 14782 | |
| 14783 | if (target_wireless_mode & REGDMN_MODE_108G) |
| 14784 | wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 14785 | |
| 14786 | if (target_wireless_mode & REGDMN_MODE_108A) |
| 14787 | wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 14788 | |
| 14789 | if (target_wireless_mode & REGDMN_MODE_XR) |
| 14790 | wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 14791 | |
| 14792 | if (target_wireless_mode & REGDMN_MODE_11A_HALF_RATE) |
| 14793 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 14794 | |
| 14795 | if (target_wireless_mode & REGDMN_MODE_11A_QUARTER_RATE) |
| 14796 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 14797 | |
| 14798 | if (target_wireless_mode & REGDMN_MODE_11NG_HT20) |
| 14799 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 14800 | |
| 14801 | if (target_wireless_mode & REGDMN_MODE_11NA_HT20) |
| 14802 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 14803 | |
| 14804 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40PLUS) |
| 14805 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 14806 | |
| 14807 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40MINUS) |
| 14808 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 14809 | |
| 14810 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40PLUS) |
| 14811 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 14812 | |
| 14813 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40MINUS) |
| 14814 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 14815 | |
| 14816 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT20) |
| 14817 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 14818 | |
| 14819 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40PLUS) |
| 14820 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 14821 | |
| 14822 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40MINUS) |
| 14823 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 14824 | |
| 14825 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80) |
| 14826 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 14827 | |
| 14828 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT160) |
| 14829 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 14830 | |
| 14831 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80_80) |
| 14832 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 14833 | |
| 14834 | return wireless_modes; |
| 14835 | } |
| 14836 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14837 | /** |
| 14838 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 14839 | * @wmi_handle: wmi handle |
| 14840 | * @param evt_buf: Pointer to event buffer |
| 14841 | * @param cap: pointer to hold HAL reg capabilities |
| 14842 | * |
| 14843 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14844 | */ |
| 14845 | 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] | 14846 | void *evt_buf, struct wlan_psoc_hal_reg_capability *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14847 | { |
| 14848 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14849 | |
| 14850 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14851 | |
| 14852 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 14853 | sizeof(uint32_t)), |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 14854 | sizeof(struct wlan_psoc_hal_reg_capability)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14855 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 14856 | cap->wireless_modes = convert_wireless_modes_tlv( |
| 14857 | param_buf->hal_reg_capabilities->wireless_modes); |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 14858 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14859 | return QDF_STATUS_SUCCESS; |
| 14860 | } |
| 14861 | |
| 14862 | /** |
| 14863 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 14864 | * @wmi_handle: wmi handle |
| 14865 | * @param evt_buf: pointer to event buffer |
| 14866 | * @param num_entries: pointer to hold number of entries requested |
| 14867 | * |
| 14868 | * Return: Number of entries requested |
| 14869 | */ |
| 14870 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 14871 | void *evt_buf, uint8_t *num_entries) |
| 14872 | { |
| 14873 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14874 | wmi_service_ready_event_fixed_param *ev; |
| 14875 | |
| 14876 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14877 | |
| 14878 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 14879 | if (!ev) { |
| 14880 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14881 | return NULL; |
| 14882 | } |
| 14883 | |
| 14884 | *num_entries = ev->num_mem_reqs; |
| 14885 | |
| 14886 | return (host_mem_req *)param_buf->mem_reqs; |
| 14887 | } |
| 14888 | |
| 14889 | /** |
| 14890 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 14891 | * ready function |
| 14892 | * @wmi_handle: wmi handle |
| 14893 | * @param evt_buf: pointer to event buffer |
| 14894 | * |
| 14895 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14896 | */ |
| 14897 | static QDF_STATUS |
| 14898 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 14899 | { |
| 14900 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14901 | wmi_service_ready_event_fixed_param *ev; |
| 14902 | |
| 14903 | |
| 14904 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14905 | |
| 14906 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 14907 | if (!ev) { |
| 14908 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14909 | return QDF_STATUS_E_FAILURE; |
| 14910 | } |
| 14911 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14912 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14913 | /*Save fw version from service ready message */ |
| 14914 | /*This will be used while sending INIT message */ |
| 14915 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 14916 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14917 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14918 | return QDF_STATUS_SUCCESS; |
| 14919 | } |
| 14920 | |
| 14921 | /** |
| 14922 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 14923 | * @wmi_handle: wmi handle |
| 14924 | * @param evt_buf: Pointer to event buffer |
| 14925 | * |
| 14926 | * Return: ready status |
| 14927 | */ |
| 14928 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 14929 | void *evt_buf) |
| 14930 | { |
| 14931 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 14932 | wmi_ready_event_fixed_param *ev = NULL; |
| 14933 | |
| 14934 | |
| 14935 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 14936 | ev = param_buf->fixed_param; |
| 14937 | |
| 14938 | qdf_print("%s:%d\n", __func__, ev->status); |
| 14939 | |
| 14940 | return ev->status; |
| 14941 | } |
| 14942 | |
| 14943 | /** |
| 14944 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 14945 | * @wmi_handle: wmi handle |
| 14946 | * @param evt_buf: pointer to event buffer |
| 14947 | * @param macaddr: Pointer to hold MAC address |
| 14948 | * |
| 14949 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14950 | */ |
| 14951 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 14952 | void *evt_buf, uint8_t *macaddr) |
| 14953 | { |
| 14954 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 14955 | wmi_ready_event_fixed_param *ev = NULL; |
| 14956 | |
| 14957 | |
| 14958 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 14959 | ev = param_buf->fixed_param; |
| 14960 | |
| 14961 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 14962 | |
| 14963 | return QDF_STATUS_SUCCESS; |
| 14964 | } |
| 14965 | |
| 14966 | /** |
| 14967 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 14968 | * @wmi_handle: wmi handle |
| 14969 | * @param evt_buf: pointer to event buffer |
| 14970 | * |
| 14971 | * Return: length |
| 14972 | */ |
| 14973 | 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] | 14974 | void *evt_buf, uint32_t *len) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14975 | { |
| 14976 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 14977 | |
| 14978 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 14979 | |
| 14980 | *len = param_buf->num_bufp; |
| 14981 | |
| 14982 | return param_buf->bufp; |
| 14983 | } |
| 14984 | |
| 14985 | /** |
| 14986 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 14987 | * @wmi_handle: wmi handle |
| 14988 | * @param evt_buf: pointer to event buffer |
| 14989 | * @param vdev_rsp: Pointer to hold vdev response |
| 14990 | * |
| 14991 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14992 | */ |
| 14993 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 14994 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 14995 | { |
| 14996 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 14997 | wmi_vdev_start_response_event_fixed_param *ev; |
| 14998 | |
| 14999 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 15000 | if (!param_buf) { |
| 15001 | qdf_print("Invalid start response event buffer\n"); |
| 15002 | return QDF_STATUS_E_INVAL; |
| 15003 | } |
| 15004 | |
| 15005 | ev = param_buf->fixed_param; |
| 15006 | if (!ev) { |
| 15007 | qdf_print("Invalid start response event buffer\n"); |
| 15008 | return QDF_STATUS_E_INVAL; |
| 15009 | } |
| 15010 | |
| 15011 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 15012 | |
| 15013 | vdev_rsp->vdev_id = ev->vdev_id; |
| 15014 | vdev_rsp->requestor_id = ev->requestor_id; |
| 15015 | vdev_rsp->resp_type = ev->resp_type; |
| 15016 | vdev_rsp->status = ev->status; |
| 15017 | vdev_rsp->chain_mask = ev->chain_mask; |
| 15018 | vdev_rsp->smps_mode = ev->smps_mode; |
| 15019 | vdev_rsp->mac_id = ev->mac_id; |
| 15020 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 15021 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 15022 | |
| 15023 | return QDF_STATUS_SUCCESS; |
| 15024 | } |
| 15025 | |
| 15026 | /** |
| 15027 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset update param |
| 15028 | * @wmi_handle: wmi handle |
| 15029 | * @param evt_buf: pointer to event buffer |
| 15030 | * @param vdev_map: Pointer to hold vdev map |
| 15031 | * @param tbttoffset_list: Pointer to tbtt offset list |
| 15032 | * |
| 15033 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15034 | */ |
| 15035 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 15036 | void *evt_buf, uint32_t *vdev_map, uint32_t **tbttoffset_list) |
| 15037 | { |
| 15038 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 15039 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 15040 | |
| 15041 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 15042 | if (!param_buf) { |
| 15043 | qdf_print("Invalid tbtt update event buffer\n"); |
| 15044 | return QDF_STATUS_E_INVAL; |
| 15045 | } |
| 15046 | tbtt_offset_event = param_buf->fixed_param; |
| 15047 | |
| 15048 | *vdev_map = tbtt_offset_event->vdev_map; |
| 15049 | *tbttoffset_list = param_buf->tbttoffset_list; |
| 15050 | |
| 15051 | return QDF_STATUS_SUCCESS; |
| 15052 | } |
| 15053 | |
| 15054 | /** |
| 15055 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 15056 | * @wmi_handle: wmi handle |
| 15057 | * @param evt_buf: pointer to event buffer |
| 15058 | * @param hdr: Pointer to hold header |
| 15059 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 15060 | * |
| 15061 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15062 | */ |
| 15063 | 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] | 15064 | void *evt_buf, struct mgmt_rx_event_params *hdr, |
| 15065 | uint8_t **bufp) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15066 | { |
| 15067 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 15068 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 15069 | |
| 15070 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 15071 | if (!param_tlvs) { |
| 15072 | WMI_LOGE("Get NULL point message from FW"); |
| 15073 | return QDF_STATUS_E_INVAL; |
| 15074 | } |
| 15075 | |
| 15076 | ev_hdr = param_tlvs->hdr; |
| 15077 | if (!hdr) { |
| 15078 | WMI_LOGE("Rx event is NULL"); |
| 15079 | return QDF_STATUS_E_INVAL; |
| 15080 | } |
| 15081 | |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 15082 | hdr->pdev_id = ev_hdr->pdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15083 | |
| 15084 | hdr->channel = ev_hdr->channel; |
| 15085 | hdr->snr = ev_hdr->snr; |
| 15086 | hdr->rate = ev_hdr->rate; |
| 15087 | hdr->phy_mode = ev_hdr->phy_mode; |
| 15088 | hdr->buf_len = ev_hdr->buf_len; |
| 15089 | hdr->status = ev_hdr->status; |
| 15090 | hdr->flags = ev_hdr->flags; |
| 15091 | hdr->rssi = ev_hdr->rssi; |
| 15092 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 15093 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 15094 | |
| 15095 | *bufp = param_tlvs->bufp; |
| 15096 | |
| 15097 | return QDF_STATUS_SUCCESS; |
| 15098 | } |
| 15099 | |
| 15100 | /** |
| 15101 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 15102 | * @wmi_handle: wmi handle |
| 15103 | * @param evt_buf: pointer to event buffer |
| 15104 | * @param vdev_id: Pointer to hold vdev identifier |
| 15105 | * |
| 15106 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15107 | */ |
| 15108 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 15109 | void *evt_buf, uint32_t *vdev_id) |
| 15110 | { |
| 15111 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 15112 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 15113 | |
| 15114 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 15115 | if (!param_buf) { |
| 15116 | WMI_LOGE("Invalid event buffer"); |
| 15117 | return QDF_STATUS_E_INVAL; |
| 15118 | } |
| 15119 | resp_event = param_buf->fixed_param; |
| 15120 | *vdev_id = resp_event->vdev_id; |
| 15121 | |
| 15122 | return QDF_STATUS_SUCCESS; |
| 15123 | } |
| 15124 | |
| 15125 | /** |
| 15126 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 15127 | * @wmi_handle: wmi handle |
| 15128 | * @param evt_buf: pointer to event buffer |
| 15129 | * @param param: Pointer to hold roam param |
| 15130 | * |
| 15131 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15132 | */ |
| 15133 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 15134 | void *evt_buf, wmi_host_roam_event *param) |
| 15135 | { |
| 15136 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 15137 | wmi_roam_event_fixed_param *evt; |
| 15138 | |
| 15139 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 15140 | if (!param_buf) { |
| 15141 | WMI_LOGE("Invalid roam event buffer"); |
| 15142 | return QDF_STATUS_E_INVAL; |
| 15143 | } |
| 15144 | |
| 15145 | evt = param_buf->fixed_param; |
| 15146 | qdf_mem_zero(param, sizeof(*param)); |
| 15147 | |
| 15148 | param->vdev_id = evt->vdev_id; |
| 15149 | param->reason = evt->reason; |
| 15150 | param->rssi = evt->rssi; |
| 15151 | |
| 15152 | return QDF_STATUS_SUCCESS; |
| 15153 | } |
| 15154 | |
| 15155 | /** |
| 15156 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 15157 | * @wmi_handle: wmi handle |
| 15158 | * @param evt_buf: pointer to event buffer |
| 15159 | * @param param: Pointer to hold vdev scan param |
| 15160 | * |
| 15161 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15162 | */ |
| 15163 | 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] | 15164 | void *evt_buf, struct scan_event *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15165 | { |
| 15166 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 15167 | wmi_scan_event_fixed_param *evt = NULL; |
| 15168 | |
| 15169 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 15170 | evt = param_buf->fixed_param; |
| 15171 | |
| 15172 | qdf_mem_zero(param, sizeof(*param)); |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 15173 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15174 | switch (evt->event) { |
| 15175 | case WMI_SCAN_EVENT_STARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15176 | param->type = SCAN_EVENT_TYPE_STARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15177 | break; |
| 15178 | case WMI_SCAN_EVENT_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15179 | param->type = SCAN_EVENT_TYPE_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15180 | break; |
| 15181 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15182 | param->type = SCAN_EVENT_TYPE_BSS_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15183 | break; |
| 15184 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15185 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15186 | break; |
| 15187 | case WMI_SCAN_EVENT_DEQUEUED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15188 | param->type = SCAN_EVENT_TYPE_DEQUEUED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15189 | break; |
| 15190 | case WMI_SCAN_EVENT_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15191 | param->type = SCAN_EVENT_TYPE_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15192 | break; |
| 15193 | case WMI_SCAN_EVENT_START_FAILED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15194 | param->type = SCAN_EVENT_TYPE_START_FAILED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15195 | break; |
| 15196 | case WMI_SCAN_EVENT_RESTARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15197 | param->type = SCAN_EVENT_TYPE_RESTARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15198 | break; |
| 15199 | case WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15200 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15201 | break; |
| 15202 | case WMI_SCAN_EVENT_MAX: |
| 15203 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15204 | param->type = SCAN_EVENT_TYPE_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15205 | break; |
| 15206 | }; |
| 15207 | |
| 15208 | switch (evt->reason) { |
| 15209 | case WMI_SCAN_REASON_NONE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15210 | param->reason = SCAN_REASON_NONE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15211 | break; |
| 15212 | case WMI_SCAN_REASON_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15213 | param->reason = SCAN_REASON_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15214 | break; |
| 15215 | case WMI_SCAN_REASON_CANCELLED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15216 | param->reason = SCAN_REASON_CANCELLED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15217 | break; |
| 15218 | case WMI_SCAN_REASON_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15219 | param->reason = SCAN_REASON_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15220 | break; |
| 15221 | case WMI_SCAN_REASON_TIMEDOUT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15222 | param->reason = SCAN_REASON_TIMEDOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15223 | break; |
| 15224 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15225 | param->reason = SCAN_REASON_INTERNAL_FAILURE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15226 | break; |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 15227 | case WMI_SCAN_REASON_SUSPENDED: |
| 15228 | param->reason = SCAN_REASON_SUSPENDED; |
| 15229 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15230 | case WMI_SCAN_REASON_MAX: |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 15231 | param->reason = SCAN_REASON_MAX; |
| 15232 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15233 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15234 | param->reason = SCAN_REASON_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15235 | break; |
| 15236 | }; |
| 15237 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15238 | param->chan_freq = evt->channel_freq; |
| 15239 | param->requester = evt->requestor; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15240 | param->scan_id = evt->scan_id; |
| 15241 | param->vdev_id = evt->vdev_id; |
| 15242 | |
| 15243 | return QDF_STATUS_SUCCESS; |
| 15244 | } |
| 15245 | |
| 15246 | /** |
| 15247 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 15248 | * @wmi_handle: wmi handle |
| 15249 | * @param evt_buf: pointer to event buffer |
| 15250 | * @param param: Pointer to hold MGMT TX completion params |
| 15251 | * |
| 15252 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15253 | */ |
| 15254 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 15255 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 15256 | { |
| 15257 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 15258 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 15259 | |
| 15260 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 15261 | evt_buf; |
| 15262 | if (!param_buf) { |
| 15263 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 15264 | return QDF_STATUS_E_INVAL; |
| 15265 | } |
| 15266 | cmpl_params = param_buf->fixed_param; |
| 15267 | |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 15268 | param->pdev_id = cmpl_params->pdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15269 | param->desc_id = cmpl_params->desc_id; |
| 15270 | param->status = cmpl_params->status; |
| 15271 | |
| 15272 | return QDF_STATUS_SUCCESS; |
| 15273 | } |
| 15274 | |
| 15275 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15276 | * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count |
| 15277 | * status tlv |
| 15278 | * @wmi_handle: wmi handle |
| 15279 | * @param evt_buf: pointer to event buffer |
| 15280 | * @param param: Pointer to hold csa switch count status event param |
| 15281 | * |
| 15282 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15283 | */ |
| 15284 | static QDF_STATUS extract_pdev_csa_switch_count_status_tlv( |
| 15285 | wmi_unified_t wmi_handle, |
| 15286 | void *evt_buf, |
| 15287 | struct pdev_csa_switch_count_status *param) |
| 15288 | { |
| 15289 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *param_buf; |
| 15290 | wmi_pdev_csa_switch_count_status_event_fixed_param *csa_status; |
| 15291 | |
| 15292 | param_buf = (WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *) |
| 15293 | evt_buf; |
| 15294 | if (!param_buf) { |
| 15295 | WMI_LOGE("%s: Invalid CSA status event\n", __func__); |
| 15296 | return QDF_STATUS_E_INVAL; |
| 15297 | } |
| 15298 | |
| 15299 | csa_status = param_buf->fixed_param; |
| 15300 | |
| 15301 | param->pdev_id = csa_status->pdev_id; |
| 15302 | param->current_switch_count = csa_status->current_switch_count; |
| 15303 | param->num_vdevs = csa_status->num_vdevs; |
| 15304 | param->vdev_ids = param_buf->vdev_ids; |
| 15305 | |
| 15306 | return QDF_STATUS_SUCCESS; |
| 15307 | } |
| 15308 | |
| 15309 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15310 | * extract_swba_vdev_map_tlv() - extract swba vdev map from event |
| 15311 | * @wmi_handle: wmi handle |
| 15312 | * @param evt_buf: pointer to event buffer |
| 15313 | * @param vdev_map: Pointer to hold vdev map |
| 15314 | * |
| 15315 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15316 | */ |
| 15317 | static QDF_STATUS extract_swba_vdev_map_tlv(wmi_unified_t wmi_handle, |
| 15318 | void *evt_buf, uint32_t *vdev_map) |
| 15319 | { |
| 15320 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 15321 | wmi_host_swba_event_fixed_param *swba_event; |
| 15322 | |
| 15323 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 15324 | if (!param_buf) { |
| 15325 | WMI_LOGE("Invalid swba event buffer"); |
| 15326 | return QDF_STATUS_E_INVAL; |
| 15327 | } |
| 15328 | swba_event = param_buf->fixed_param; |
| 15329 | *vdev_map = swba_event->vdev_map; |
| 15330 | |
| 15331 | return QDF_STATUS_SUCCESS; |
| 15332 | } |
| 15333 | |
| 15334 | /** |
| 15335 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 15336 | * @wmi_handle: wmi handle |
| 15337 | * @param evt_buf: pointer to event buffer |
| 15338 | * @param idx: Index to bcn info |
| 15339 | * @param tim_info: Pointer to hold tim info |
| 15340 | * |
| 15341 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15342 | */ |
| 15343 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 15344 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 15345 | { |
| 15346 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 15347 | wmi_tim_info *tim_info_ev; |
| 15348 | |
| 15349 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 15350 | if (!param_buf) { |
| 15351 | WMI_LOGE("Invalid swba event buffer"); |
| 15352 | return QDF_STATUS_E_INVAL; |
| 15353 | } |
| 15354 | |
| 15355 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 15356 | |
| 15357 | tim_info->tim_len = tim_info_ev->tim_len; |
| 15358 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 15359 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 15360 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 15361 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 15362 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
| 15363 | |
| 15364 | return QDF_STATUS_SUCCESS; |
| 15365 | } |
| 15366 | |
| 15367 | /** |
| 15368 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 15369 | * @wmi_handle: wmi handle |
| 15370 | * @param evt_buf: pointer to event buffer |
| 15371 | * @param idx: Index to bcn info |
| 15372 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 15373 | * |
| 15374 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15375 | */ |
| 15376 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 15377 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 15378 | { |
| 15379 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 15380 | wmi_p2p_noa_info *p2p_noa_info; |
| 15381 | uint8_t i = 0; |
| 15382 | |
| 15383 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 15384 | if (!param_buf) { |
| 15385 | WMI_LOGE("Invalid swba event buffer"); |
| 15386 | return QDF_STATUS_E_INVAL; |
| 15387 | } |
| 15388 | |
| 15389 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 15390 | |
| 15391 | p2p_desc->modified = false; |
| 15392 | p2p_desc->num_descriptors = 0; |
| 15393 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 15394 | p2p_desc->modified = true; |
| 15395 | p2p_desc->index = |
| 15396 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 15397 | p2p_desc->oppPS = |
| 15398 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 15399 | p2p_desc->ctwindow = |
| 15400 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 15401 | p2p_desc->num_descriptors = |
| 15402 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 15403 | (p2p_noa_info); |
| 15404 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 15405 | p2p_desc->noa_descriptors[i].type_count = |
| 15406 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 15407 | type_count; |
| 15408 | p2p_desc->noa_descriptors[i].duration = |
| 15409 | p2p_noa_info->noa_descriptors[i].duration; |
| 15410 | p2p_desc->noa_descriptors[i].interval = |
| 15411 | p2p_noa_info->noa_descriptors[i].interval; |
| 15412 | p2p_desc->noa_descriptors[i].start_time = |
| 15413 | p2p_noa_info->noa_descriptors[i].start_time; |
| 15414 | } |
| 15415 | } |
| 15416 | |
| 15417 | return QDF_STATUS_SUCCESS; |
| 15418 | } |
| 15419 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 15420 | #ifdef CONVERGED_P2P_ENABLE |
| 15421 | /** |
| 15422 | * extract_p2p_noa_ev_param_tlv() - extract p2p noa information from event |
| 15423 | * @wmi_handle: wmi handle |
| 15424 | * @param evt_buf: pointer to event buffer |
| 15425 | * @param param: Pointer to hold p2p noa info |
| 15426 | * |
| 15427 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15428 | */ |
| 15429 | static QDF_STATUS extract_p2p_noa_ev_param_tlv( |
| 15430 | wmi_unified_t wmi_handle, void *evt_buf, |
| 15431 | struct p2p_noa_info *param) |
| 15432 | { |
| 15433 | WMI_P2P_NOA_EVENTID_param_tlvs *param_tlvs; |
| 15434 | wmi_p2p_noa_event_fixed_param *fixed_param; |
| 15435 | uint8_t i; |
| 15436 | wmi_p2p_noa_info *wmi_noa_info; |
| 15437 | uint8_t *buf_ptr; |
| 15438 | uint32_t descriptors; |
| 15439 | |
| 15440 | param_tlvs = (WMI_P2P_NOA_EVENTID_param_tlvs *) evt_buf; |
| 15441 | if (!param_tlvs) { |
| 15442 | WMI_LOGE("%s: Invalid P2P NoA event buffer", __func__); |
| 15443 | return QDF_STATUS_E_INVAL; |
| 15444 | } |
| 15445 | |
| 15446 | if (!param) { |
| 15447 | WMI_LOGE("noa information param is null"); |
| 15448 | return QDF_STATUS_E_INVAL; |
| 15449 | } |
| 15450 | |
| 15451 | fixed_param = param_tlvs->fixed_param; |
| 15452 | buf_ptr = (uint8_t *) fixed_param; |
| 15453 | buf_ptr += sizeof(wmi_p2p_noa_event_fixed_param); |
| 15454 | wmi_noa_info = (wmi_p2p_noa_info *) (buf_ptr); |
| 15455 | |
| 15456 | if (!WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(wmi_noa_info)) { |
| 15457 | WMI_LOGE("%s: noa attr is not modified", __func__); |
| 15458 | return QDF_STATUS_E_INVAL; |
| 15459 | } |
| 15460 | |
| 15461 | param->vdev_id = fixed_param->vdev_id; |
| 15462 | param->index = |
| 15463 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(wmi_noa_info); |
| 15464 | param->opps_ps = |
| 15465 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(wmi_noa_info); |
| 15466 | param->ct_window = |
| 15467 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(wmi_noa_info); |
| 15468 | descriptors = WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET(wmi_noa_info); |
| 15469 | param->num_desc = (uint8_t) descriptors; |
| 15470 | |
| 15471 | WMI_LOGD("%s:index %u, opps_ps %u, ct_window %u, num_descriptors = %u", __func__, |
| 15472 | param->index, param->opps_ps, param->ct_window, |
| 15473 | param->num_desc); |
| 15474 | for (i = 0; i < param->num_desc; i++) { |
| 15475 | param->noa_desc[i].type_count = |
| 15476 | (uint8_t) wmi_noa_info->noa_descriptors[i]. |
| 15477 | type_count; |
| 15478 | param->noa_desc[i].duration = |
| 15479 | wmi_noa_info->noa_descriptors[i].duration; |
| 15480 | param->noa_desc[i].interval = |
| 15481 | wmi_noa_info->noa_descriptors[i].interval; |
| 15482 | param->noa_desc[i].start_time = |
| 15483 | wmi_noa_info->noa_descriptors[i].start_time; |
| 15484 | WMI_LOGD("%s:NoA descriptor[%d] type_count %u, duration %u, interval %u, start_time = %u", |
| 15485 | __func__, i, param->noa_desc[i].type_count, |
| 15486 | param->noa_desc[i].duration, |
| 15487 | param->noa_desc[i].interval, |
| 15488 | param->noa_desc[i].start_time); |
| 15489 | } |
| 15490 | |
| 15491 | return QDF_STATUS_SUCCESS; |
| 15492 | } |
| 15493 | |
| 15494 | /** |
| 15495 | * extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop |
| 15496 | * information from event |
| 15497 | * @wmi_handle: wmi handle |
| 15498 | * @param evt_buf: pointer to event buffer |
| 15499 | * @param param: Pointer to hold p2p lo stop event information |
| 15500 | * |
| 15501 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15502 | */ |
| 15503 | static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv( |
| 15504 | wmi_unified_t wmi_handle, void *evt_buf, |
| 15505 | struct p2p_lo_event *param) |
| 15506 | { |
| 15507 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *param_tlvs; |
| 15508 | wmi_p2p_lo_stopped_event_fixed_param *lo_param; |
| 15509 | |
| 15510 | param_tlvs = (WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *) |
| 15511 | evt_buf; |
| 15512 | if (!param_tlvs) { |
| 15513 | WMI_LOGE("%s: Invalid P2P lo stop event buffer", __func__); |
| 15514 | return QDF_STATUS_E_INVAL; |
| 15515 | } |
| 15516 | |
| 15517 | if (!param) { |
| 15518 | WMI_LOGE("lo stop event param is null"); |
| 15519 | return QDF_STATUS_E_INVAL; |
| 15520 | } |
| 15521 | |
| 15522 | lo_param = param_tlvs->fixed_param; |
| 15523 | param->vdev_id = lo_param->vdev_id; |
| 15524 | param->reason_code = lo_param->reason; |
| 15525 | WMI_LOGD("%s: vdev_id:%d, reason:%d", __func__, |
| 15526 | param->vdev_id, param->reason_code); |
| 15527 | |
| 15528 | return QDF_STATUS_SUCCESS; |
| 15529 | } |
| 15530 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 15531 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15532 | /** |
| 15533 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 15534 | * @wmi_handle: wmi handle |
| 15535 | * @param evt_buf: pointer to event buffer |
| 15536 | * @param ev: Pointer to hold peer param |
| 15537 | * |
| 15538 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15539 | */ |
| 15540 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 15541 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 15542 | { |
| 15543 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 15544 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 15545 | |
| 15546 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 15547 | kickout_event = param_buf->fixed_param; |
| 15548 | |
| 15549 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 15550 | ev->peer_macaddr); |
| 15551 | |
| 15552 | ev->reason = kickout_event->reason; |
| 15553 | ev->rssi = kickout_event->rssi; |
| 15554 | |
| 15555 | return QDF_STATUS_SUCCESS; |
| 15556 | } |
| 15557 | |
| 15558 | /** |
| 15559 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 15560 | * @wmi_handle: wmi handle |
| 15561 | * @param evt_buf: pointer to event buffer |
| 15562 | * @param stats_param: Pointer to hold stats count |
| 15563 | * |
| 15564 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15565 | */ |
| 15566 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 15567 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 15568 | { |
| 15569 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 15570 | wmi_stats_event_fixed_param *ev; |
| 15571 | |
| 15572 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 15573 | |
| 15574 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 15575 | if (!ev) { |
| 15576 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 15577 | return QDF_STATUS_E_FAILURE; |
| 15578 | } |
| 15579 | |
| 15580 | switch (ev->stats_id) { |
| 15581 | case WMI_REQUEST_PEER_STAT: |
| 15582 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 15583 | break; |
| 15584 | |
| 15585 | case WMI_REQUEST_AP_STAT: |
| 15586 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 15587 | break; |
| 15588 | |
| 15589 | case WMI_REQUEST_PDEV_STAT: |
| 15590 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 15591 | break; |
| 15592 | |
| 15593 | case WMI_REQUEST_VDEV_STAT: |
| 15594 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 15595 | break; |
| 15596 | |
| 15597 | case WMI_REQUEST_BCNFLT_STAT: |
| 15598 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 15599 | break; |
| 15600 | |
| 15601 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 15602 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 15603 | break; |
| 15604 | |
| 15605 | default: |
| 15606 | stats_param->stats_id = 0; |
| 15607 | break; |
| 15608 | |
| 15609 | } |
| 15610 | |
| 15611 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 15612 | stats_param->num_pdev_ext_stats = 0; |
| 15613 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 15614 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 15615 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 15616 | stats_param->num_chan_stats = ev->num_chan_stats; |
| 15617 | |
| 15618 | return QDF_STATUS_SUCCESS; |
| 15619 | } |
| 15620 | |
| 15621 | /** |
| 15622 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 15623 | * @wmi_handle: wmi handle |
| 15624 | * @param evt_buf: pointer to event buffer |
| 15625 | * @param index: Index into pdev stats |
| 15626 | * @param pdev_stats: Pointer to hold pdev stats |
| 15627 | * |
| 15628 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15629 | */ |
| 15630 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 15631 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 15632 | { |
| 15633 | return QDF_STATUS_SUCCESS; |
| 15634 | } |
| 15635 | |
| 15636 | /** |
| 15637 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 15638 | * @wmi_handle: wmi handle |
| 15639 | * @param evt_buf: pointer to event buffer |
| 15640 | * @param index: Index into extended pdev stats |
| 15641 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 15642 | * |
| 15643 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15644 | */ |
| 15645 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 15646 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 15647 | { |
| 15648 | return QDF_STATUS_SUCCESS; |
| 15649 | } |
| 15650 | |
| 15651 | /** |
| 15652 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 15653 | * @wmi_handle: wmi handle |
| 15654 | * @param evt_buf: pointer to event buffer |
| 15655 | * @param index: Index into vdev stats |
| 15656 | * @param vdev_stats: Pointer to hold vdev stats |
| 15657 | * |
| 15658 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15659 | */ |
| 15660 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 15661 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 15662 | { |
| 15663 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 15664 | wmi_stats_event_fixed_param *ev_param; |
| 15665 | uint8_t *data; |
| 15666 | |
| 15667 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 15668 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 15669 | data = (uint8_t *) param_buf->data; |
| 15670 | |
| 15671 | if (index < ev_param->num_vdev_stats) { |
| 15672 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 15673 | ((ev_param->num_pdev_stats) * |
| 15674 | sizeof(wmi_pdev_stats)) + |
| 15675 | (index * sizeof(wmi_vdev_stats))); |
| 15676 | |
| 15677 | vdev_stats->vdev_id = ev->vdev_id; |
| 15678 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 15679 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 15680 | |
| 15681 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 15682 | sizeof(ev->tx_frm_cnt)); |
| 15683 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 15684 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 15685 | ev->multiple_retry_cnt, |
| 15686 | sizeof(ev->multiple_retry_cnt)); |
| 15687 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 15688 | sizeof(ev->fail_cnt)); |
| 15689 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 15690 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 15691 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 15692 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 15693 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 15694 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 15695 | sizeof(ev->tx_rate_history)); |
| 15696 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 15697 | sizeof(ev->bcn_rssi_history)); |
| 15698 | |
| 15699 | } |
| 15700 | |
| 15701 | return QDF_STATUS_SUCCESS; |
| 15702 | } |
| 15703 | |
| 15704 | /** |
| 15705 | * extract_peer_stats_tlv() - extract peer stats from event |
| 15706 | * @wmi_handle: wmi handle |
| 15707 | * @param evt_buf: pointer to event buffer |
| 15708 | * @param index: Index into peer stats |
| 15709 | * @param peer_stats: Pointer to hold peer stats |
| 15710 | * |
| 15711 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15712 | */ |
| 15713 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 15714 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 15715 | { |
| 15716 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 15717 | wmi_stats_event_fixed_param *ev_param; |
| 15718 | uint8_t *data; |
| 15719 | |
| 15720 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 15721 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 15722 | data = (uint8_t *) param_buf->data; |
| 15723 | |
| 15724 | if (index < ev_param->num_peer_stats) { |
| 15725 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 15726 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 15727 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 15728 | (index * sizeof(wmi_peer_stats))); |
| 15729 | |
| 15730 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 15731 | |
| 15732 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 15733 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 15734 | |
| 15735 | peer_stats->peer_rssi = ev->peer_rssi; |
| 15736 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 15737 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 15738 | } |
| 15739 | |
| 15740 | return QDF_STATUS_SUCCESS; |
| 15741 | } |
| 15742 | |
| 15743 | /** |
| 15744 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 15745 | * @wmi_handle: wmi handle |
| 15746 | * @param evt_buf: pointer to event buffer |
| 15747 | * @param index: Index into bcn fault stats |
| 15748 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 15749 | * |
| 15750 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15751 | */ |
| 15752 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 15753 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 15754 | { |
| 15755 | return QDF_STATUS_SUCCESS; |
| 15756 | } |
| 15757 | |
| 15758 | /** |
| 15759 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 15760 | * @wmi_handle: wmi handle |
| 15761 | * @param evt_buf: pointer to event buffer |
| 15762 | * @param index: Index into extended peer stats |
| 15763 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 15764 | * |
| 15765 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15766 | */ |
| 15767 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 15768 | void *evt_buf, uint32_t index, |
| 15769 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 15770 | { |
| 15771 | return QDF_STATUS_SUCCESS; |
| 15772 | } |
| 15773 | |
| 15774 | /** |
| 15775 | * extract_chan_stats_tlv() - extract chan stats from event |
| 15776 | * @wmi_handle: wmi handle |
| 15777 | * @param evt_buf: pointer to event buffer |
| 15778 | * @param index: Index into chan stats |
| 15779 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 15780 | * |
| 15781 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15782 | */ |
| 15783 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 15784 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 15785 | { |
| 15786 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 15787 | wmi_stats_event_fixed_param *ev_param; |
| 15788 | uint8_t *data; |
| 15789 | |
| 15790 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 15791 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 15792 | data = (uint8_t *) param_buf->data; |
| 15793 | |
| 15794 | if (index < ev_param->num_chan_stats) { |
| 15795 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 15796 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 15797 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 15798 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 15799 | (index * sizeof(wmi_chan_stats))); |
| 15800 | |
| 15801 | |
| 15802 | /* Non-TLV doesnt have num_chan_stats */ |
| 15803 | chan_stats->chan_mhz = ev->chan_mhz; |
| 15804 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 15805 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 15806 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 15807 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 15808 | } |
| 15809 | |
| 15810 | return QDF_STATUS_SUCCESS; |
| 15811 | } |
| 15812 | |
| 15813 | /** |
| 15814 | * extract_profile_ctx_tlv() - extract profile context from event |
| 15815 | * @wmi_handle: wmi handle |
| 15816 | * @param evt_buf: pointer to event buffer |
| 15817 | * @idx: profile stats index to extract |
| 15818 | * @param profile_ctx: Pointer to hold profile context |
| 15819 | * |
| 15820 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15821 | */ |
| 15822 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 15823 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 15824 | { |
| 15825 | return QDF_STATUS_SUCCESS; |
| 15826 | } |
| 15827 | |
| 15828 | /** |
| 15829 | * extract_profile_data_tlv() - extract profile data from event |
| 15830 | * @wmi_handle: wmi handle |
| 15831 | * @param evt_buf: pointer to event buffer |
| 15832 | * @param profile_data: Pointer to hold profile data |
| 15833 | * |
| 15834 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15835 | */ |
| 15836 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 15837 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 15838 | { |
| 15839 | |
| 15840 | return QDF_STATUS_SUCCESS; |
| 15841 | } |
| 15842 | |
| 15843 | /** |
| 15844 | * extract_chan_info_event_tlv() - extract chan information from event |
| 15845 | * @wmi_handle: wmi handle |
| 15846 | * @param evt_buf: pointer to event buffer |
| 15847 | * @param chan_info: Pointer to hold chan information |
| 15848 | * |
| 15849 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15850 | */ |
| 15851 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 15852 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 15853 | { |
| 15854 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 15855 | wmi_chan_info_event_fixed_param *ev; |
| 15856 | |
| 15857 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 15858 | |
| 15859 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 15860 | if (!ev) { |
| 15861 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 15862 | return QDF_STATUS_E_FAILURE; |
| 15863 | } |
| 15864 | |
| 15865 | chan_info->err_code = ev->err_code; |
| 15866 | chan_info->freq = ev->freq; |
| 15867 | chan_info->cmd_flags = ev->cmd_flags; |
| 15868 | chan_info->noise_floor = ev->noise_floor; |
| 15869 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 15870 | chan_info->cycle_count = ev->cycle_count; |
| 15871 | |
| 15872 | return QDF_STATUS_SUCCESS; |
| 15873 | } |
| 15874 | |
| 15875 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 15876 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 15877 | * @wmi_handle: WMI handle |
| 15878 | * @param evt_buf: Pointer to event buffer |
| 15879 | * @param param: Pointer to hold data |
| 15880 | * |
| 15881 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 15882 | */ |
| 15883 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 15884 | uint8_t *evt_buf, |
| 15885 | struct wmi_host_pdev_utf_event *event) |
| 15886 | { |
| 15887 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
| 15888 | |
| 15889 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 15890 | event->data = param_buf->data; |
| 15891 | event->datalen = param_buf->num_data; |
Kiran Venkatappa | 15978c6 | 2017-02-28 12:42:36 +0530 | [diff] [blame] | 15892 | /* Set pdev_id=1 until FW adds support to include pdev_id */ |
| 15893 | event->pdev_id = 1; |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 15894 | |
| 15895 | return QDF_STATUS_SUCCESS; |
| 15896 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15897 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15898 | /** |
| 15899 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 15900 | * from event |
| 15901 | * @wmi_handle: wmi handle |
| 15902 | * @param evt_buf: pointer to event buffer |
| 15903 | * @param param: Pointer to hold evt buf |
| 15904 | * |
| 15905 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15906 | */ |
| 15907 | 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] | 15908 | uint8_t *event, struct wlan_psoc_host_service_ext_param *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15909 | { |
| 15910 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 15911 | wmi_service_ready_ext_event_fixed_param *ev; |
| 15912 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 15913 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 15914 | |
| 15915 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 15916 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15917 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15918 | |
| 15919 | ev = param_buf->fixed_param; |
| 15920 | if (!ev) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15921 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15922 | |
| 15923 | /* Move this to host based bitmap */ |
| 15924 | param->default_conc_scan_config_bits = |
| 15925 | ev->default_conc_scan_config_bits; |
| 15926 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 15927 | param->he_cap_info = ev->he_cap_info; |
| 15928 | param->mpdu_density = ev->mpdu_density; |
| 15929 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 15930 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 15931 | |
| 15932 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15933 | if (hw_caps) |
| 15934 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 15935 | else |
| 15936 | param->num_hw_modes = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15937 | |
| 15938 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15939 | if (reg_caps) |
| 15940 | param->num_phy = reg_caps->num_phy; |
| 15941 | else |
| 15942 | param->num_phy = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15943 | |
| 15944 | return QDF_STATUS_SUCCESS; |
| 15945 | } |
| 15946 | |
| 15947 | /** |
| 15948 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 15949 | * extract HW mode cap from service ready event |
| 15950 | * @wmi_handle: wmi handle |
| 15951 | * @param evt_buf: pointer to event buffer |
| 15952 | * @param param: Pointer to hold evt buf |
| 15953 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 15954 | * |
| 15955 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15956 | */ |
| 15957 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 15958 | wmi_unified_t wmi_handle, |
| 15959 | uint8_t *event, uint8_t hw_mode_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15960 | struct wlan_psoc_host_hw_mode_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15961 | { |
| 15962 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 15963 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 15964 | |
| 15965 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 15966 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15967 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15968 | |
| 15969 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15970 | if (!hw_caps) |
| 15971 | return QDF_STATUS_E_INVAL; |
| 15972 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15973 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15974 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15975 | |
| 15976 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 15977 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 15978 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15979 | param->hw_mode_config_type = |
| 15980 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 15981 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15982 | return QDF_STATUS_SUCCESS; |
| 15983 | } |
| 15984 | |
| 15985 | /** |
| 15986 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 15987 | * extract MAC phy cap from service ready event |
| 15988 | * @wmi_handle: wmi handle |
| 15989 | * @param evt_buf: pointer to event buffer |
| 15990 | * @param param: Pointer to hold evt buf |
| 15991 | * @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] | 15992 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15993 | * |
| 15994 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15995 | */ |
| 15996 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 15997 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15998 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15999 | struct wlan_psoc_host_mac_phy_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16000 | { |
| 16001 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16002 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16003 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 16004 | uint32_t phy_map; |
| 16005 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16006 | |
| 16007 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 16008 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16009 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16010 | |
| 16011 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16012 | if (!hw_caps) |
| 16013 | return QDF_STATUS_E_INVAL; |
| 16014 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16015 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 16016 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 16017 | break; |
| 16018 | |
| 16019 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 16020 | while (phy_map) { |
| 16021 | phy_map >>= 1; |
| 16022 | phy_idx++; |
| 16023 | } |
| 16024 | } |
| 16025 | |
| 16026 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16027 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16028 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16029 | phy_idx += phy_id; |
| 16030 | if (phy_idx >= param_buf->num_mac_phy_caps) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16031 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16032 | |
| 16033 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16034 | |
| 16035 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
| 16036 | param->pdev_id = mac_phy_caps->pdev_id; |
| 16037 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16038 | param->supports_11b = |
| 16039 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 16040 | param->supports_11g = |
| 16041 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 16042 | param->supports_11a = |
| 16043 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 16044 | param->supports_11n = |
| 16045 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 16046 | param->supports_11ac = |
| 16047 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 16048 | param->supports_11ax = |
| 16049 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16050 | |
| 16051 | param->supported_bands = mac_phy_caps->supported_bands; |
| 16052 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 16053 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 16054 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 16055 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 16056 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 16057 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 16058 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 16059 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 16060 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 16061 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 16062 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 16063 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 16064 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 16065 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 16066 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 16067 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 16068 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
Kris Muthusamy | 61fe369 | 2017-02-20 02:35:47 -0800 | [diff] [blame] | 16069 | qdf_mem_copy(¶m->he_cap_phy_info_2G, |
| 16070 | &mac_phy_caps->he_cap_phy_info_2G, |
| 16071 | sizeof(param->he_cap_phy_info_2G)); |
| 16072 | qdf_mem_copy(¶m->he_cap_phy_info_5G, |
| 16073 | &mac_phy_caps->he_cap_phy_info_5G, |
| 16074 | sizeof(param->he_cap_phy_info_5G)); |
| 16075 | qdf_mem_copy(¶m->he_ppet2G, &mac_phy_caps->he_ppet2G, |
| 16076 | sizeof(param->he_ppet2G)); |
| 16077 | qdf_mem_copy(¶m->he_ppet5G, &mac_phy_caps->he_ppet5G, |
| 16078 | sizeof(param->he_ppet5G)); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16079 | |
| 16080 | return QDF_STATUS_SUCCESS; |
| 16081 | } |
| 16082 | |
| 16083 | /** |
| 16084 | * extract_reg_cap_service_ready_ext_tlv() - |
| 16085 | * extract REG cap from service ready event |
| 16086 | * @wmi_handle: wmi handle |
| 16087 | * @param evt_buf: pointer to event buffer |
| 16088 | * @param param: Pointer to hold evt buf |
| 16089 | * @param phy_idx: phy idx should be less than num_mode |
| 16090 | * |
| 16091 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16092 | */ |
| 16093 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 16094 | wmi_unified_t wmi_handle, |
| 16095 | uint8_t *event, uint8_t phy_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16096 | struct wlan_psoc_host_hal_reg_capabilities_ext *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16097 | { |
| 16098 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 16099 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 16100 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 16101 | |
| 16102 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 16103 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16104 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16105 | |
| 16106 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16107 | if (!reg_caps) |
| 16108 | return QDF_STATUS_E_INVAL; |
| 16109 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16110 | if (phy_idx >= reg_caps->num_phy) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16111 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16112 | |
| 16113 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 16114 | |
| 16115 | param->phy_id = ext_reg_cap->phy_id; |
| 16116 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 16117 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 16118 | param->regcap1 = ext_reg_cap->regcap1; |
| 16119 | param->regcap2 = ext_reg_cap->regcap2; |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 16120 | param->wireless_modes = convert_wireless_modes_tlv( |
| 16121 | ext_reg_cap->wireless_modes); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16122 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 16123 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 16124 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 16125 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 16126 | |
| 16127 | return QDF_STATUS_SUCCESS; |
| 16128 | } |
| 16129 | |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16130 | /** |
| 16131 | * extract_dcs_interference_type_tlv() - extract dcs interference type |
| 16132 | * from event |
| 16133 | * @wmi_handle: wmi handle |
| 16134 | * @param evt_buf: pointer to event buffer |
| 16135 | * @param param: Pointer to hold dcs interference param |
| 16136 | * |
| 16137 | * Return: 0 for success or error code |
| 16138 | */ |
| 16139 | static QDF_STATUS extract_dcs_interference_type_tlv( |
| 16140 | wmi_unified_t wmi_handle, |
| 16141 | void *evt_buf, struct wmi_host_dcs_interference_param *param) |
| 16142 | { |
| 16143 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 16144 | |
| 16145 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 16146 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16147 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16148 | |
| 16149 | param->interference_type = param_buf->fixed_param->interference_type; |
| 16150 | param->pdev_id = param_buf->fixed_param->pdev_id; |
| 16151 | |
| 16152 | return QDF_STATUS_SUCCESS; |
| 16153 | } |
| 16154 | |
| 16155 | /* |
| 16156 | * extract_dcs_cw_int_tlv() - extract dcs cw interference from event |
| 16157 | * @wmi_handle: wmi handle |
| 16158 | * @param evt_buf: pointer to event buffer |
| 16159 | * @param cw_int: Pointer to hold cw interference |
| 16160 | * |
| 16161 | * Return: 0 for success or error code |
| 16162 | */ |
| 16163 | static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle, |
| 16164 | void *evt_buf, |
| 16165 | wmi_host_ath_dcs_cw_int *cw_int) |
| 16166 | { |
| 16167 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 16168 | wlan_dcs_cw_int *ev; |
| 16169 | |
| 16170 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 16171 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16172 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16173 | |
| 16174 | ev = param_buf->cw_int; |
| 16175 | |
| 16176 | cw_int->channel = ev->channel; |
| 16177 | |
| 16178 | return QDF_STATUS_SUCCESS; |
| 16179 | } |
| 16180 | |
| 16181 | /** |
| 16182 | * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event |
| 16183 | * @wmi_handle: wmi handle |
| 16184 | * @param evt_buf: pointer to event buffer |
| 16185 | * @param wlan_stat: Pointer to hold wlan stats |
| 16186 | * |
| 16187 | * Return: 0 for success or error code |
| 16188 | */ |
| 16189 | static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle, |
| 16190 | void *evt_buf, |
| 16191 | wmi_host_dcs_im_tgt_stats_t *wlan_stat) |
| 16192 | { |
| 16193 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 16194 | wlan_dcs_im_tgt_stats_t *ev; |
| 16195 | |
| 16196 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 16197 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16198 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16199 | |
| 16200 | ev = param_buf->wlan_stat; |
| 16201 | wlan_stat->reg_tsf32 = ev->reg_tsf32; |
| 16202 | wlan_stat->last_ack_rssi = ev->last_ack_rssi; |
| 16203 | wlan_stat->tx_waste_time = ev->tx_waste_time; |
| 16204 | wlan_stat->rx_time = ev->rx_time; |
| 16205 | wlan_stat->phyerr_cnt = ev->phyerr_cnt; |
| 16206 | wlan_stat->mib_stats.listen_time = ev->listen_time; |
| 16207 | wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt; |
| 16208 | wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt; |
| 16209 | wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt; |
| 16210 | wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt; |
| 16211 | wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt; |
| 16212 | wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt; |
| 16213 | wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt; |
| 16214 | wlan_stat->chan_nf = ev->chan_nf; |
| 16215 | wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 16216 | |
| 16217 | return QDF_STATUS_SUCCESS; |
| 16218 | } |
| 16219 | |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 16220 | #ifdef BIG_ENDIAN_HOST |
| 16221 | /** |
| 16222 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 16223 | * @param data_len - data length |
| 16224 | * @param data - pointer to data |
| 16225 | * |
| 16226 | * Return: QDF_STATUS - success or error status |
| 16227 | */ |
| 16228 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 16229 | { |
| 16230 | uint8_t *data_aligned = NULL; |
| 16231 | int c; |
| 16232 | unsigned char *data_unaligned; |
| 16233 | |
| 16234 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 16235 | FIPS_ALIGN)); |
| 16236 | /* Assigning unaligned space to copy the data */ |
| 16237 | /* Checking if kmalloc does succesful allocation */ |
| 16238 | if (data_unaligned == NULL) |
| 16239 | return QDF_STATUS_E_FAILURE; |
| 16240 | |
| 16241 | /* Checking if space is alligned */ |
| 16242 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 16243 | /* align the data space */ |
| 16244 | data_aligned = |
| 16245 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 16246 | } else { |
| 16247 | data_aligned = (u_int8_t *)data_unaligned; |
| 16248 | } |
| 16249 | |
| 16250 | /* memset and copy content from data to data aligned */ |
| 16251 | OS_MEMSET(data_aligned, 0, data_len); |
| 16252 | OS_MEMCPY(data_aligned, data, data_len); |
| 16253 | /* Endianness to LE */ |
| 16254 | for (c = 0; c < data_len/4; c++) { |
| 16255 | *((u_int32_t *)data_aligned + c) = |
| 16256 | qdf_os_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
| 16257 | } |
| 16258 | |
| 16259 | /* Copy content to event->data */ |
| 16260 | OS_MEMCPY(data, data_aligned, data_len); |
| 16261 | |
| 16262 | /* clean up allocated space */ |
| 16263 | qdf_mem_free(data_unaligned); |
| 16264 | data_aligned = NULL; |
| 16265 | data_unaligned = NULL; |
| 16266 | |
| 16267 | /*************************************************************/ |
| 16268 | |
| 16269 | return QDF_STATUS_SUCCESS; |
| 16270 | } |
| 16271 | #else |
| 16272 | /** |
| 16273 | * fips_conv_data_be() - DUMMY for LE platform |
| 16274 | * |
| 16275 | * Return: QDF_STATUS - success |
| 16276 | */ |
| 16277 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 16278 | { |
| 16279 | return QDF_STATUS_SUCCESS; |
| 16280 | } |
| 16281 | #endif |
| 16282 | |
| 16283 | /** |
| 16284 | * extract_fips_event_data_tlv() - extract fips event data |
| 16285 | * @wmi_handle: wmi handle |
| 16286 | * @param evt_buf: pointer to event buffer |
| 16287 | * @param param: pointer FIPS event params |
| 16288 | * |
| 16289 | * Return: 0 for success or error code |
| 16290 | */ |
| 16291 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 16292 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 16293 | { |
| 16294 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 16295 | wmi_pdev_fips_event_fixed_param *event; |
| 16296 | |
| 16297 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 16298 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 16299 | |
| 16300 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 16301 | QDF_STATUS_SUCCESS) |
| 16302 | return QDF_STATUS_E_FAILURE; |
| 16303 | |
| 16304 | param->data = (uint32_t *)param_buf->data; |
| 16305 | param->data_len = event->data_len; |
| 16306 | param->error_status = event->error_status; |
Kiran Venkatappa | aa07514 | 2017-03-30 15:22:50 +0530 | [diff] [blame] | 16307 | param->pdev_id = event->pdev_id; |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 16308 | |
| 16309 | return QDF_STATUS_SUCCESS; |
| 16310 | } |
| 16311 | |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 16312 | /* |
| 16313 | * extract_peer_delete_response_event_tlv() - extract peer delete response event |
| 16314 | * @wmi_handle: wmi handle |
| 16315 | * @param evt_buf: pointer to event buffer |
| 16316 | * @param vdev_id: Pointer to hold vdev_id |
| 16317 | * @param mac_addr: Pointer to hold peer mac address |
| 16318 | * |
| 16319 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16320 | */ |
| 16321 | static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl, |
| 16322 | void *evt_buf, struct wmi_host_peer_delete_response_event *param) |
| 16323 | { |
| 16324 | WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 16325 | wmi_peer_delete_resp_event_fixed_param *ev; |
| 16326 | |
| 16327 | param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf; |
| 16328 | |
| 16329 | ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param; |
| 16330 | if (!ev) { |
| 16331 | WMI_LOGE("%s: Invalid peer_delete response\n", __func__); |
| 16332 | return QDF_STATUS_E_FAILURE; |
| 16333 | } |
| 16334 | |
| 16335 | param->vdev_id = ev->vdev_id; |
| 16336 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr, |
| 16337 | ¶m->mac_address.bytes[0]); |
| 16338 | |
| 16339 | return QDF_STATUS_SUCCESS; |
| 16340 | } |
| 16341 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 16342 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 16343 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 16344 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 16345 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16346 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 16347 | return false; |
| 16348 | } |
| 16349 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 16350 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 16351 | { |
| 16352 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 16353 | |
| 16354 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 16355 | |
| 16356 | switch (set_cmd->param_id) { |
| 16357 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 16358 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 16359 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 16360 | default: |
| 16361 | break; |
| 16362 | } |
| 16363 | |
| 16364 | return 0; |
| 16365 | } |
| 16366 | |
| 16367 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 16368 | { |
| 16369 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 16370 | |
| 16371 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 16372 | |
| 16373 | switch (ps_cmd->param) { |
| 16374 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 16375 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 16376 | case WMI_STA_PS_ENABLE_QPOWER: |
| 16377 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 16378 | default: |
| 16379 | break; |
| 16380 | } |
| 16381 | |
| 16382 | return 0; |
| 16383 | } |
| 16384 | |
| 16385 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 16386 | uint32_t cmd_id) |
| 16387 | { |
| 16388 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 16389 | return 0; |
| 16390 | |
| 16391 | switch (cmd_id) { |
| 16392 | case WMI_VDEV_SET_PARAM_CMDID: |
| 16393 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 16394 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 16395 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 16396 | default: |
| 16397 | break; |
| 16398 | } |
| 16399 | |
| 16400 | return 0; |
| 16401 | } |
| 16402 | |
| 16403 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 16404 | { |
| 16405 | uint16_t tag = 0; |
| 16406 | |
| 16407 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
| 16408 | pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", |
| 16409 | __func__); |
| 16410 | return tag; |
| 16411 | } |
| 16412 | |
| 16413 | if (wmi_handle->tag_crash_inject) |
| 16414 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 16415 | |
| 16416 | wmi_handle->tag_crash_inject = false; |
| 16417 | return tag; |
| 16418 | } |
| 16419 | |
| 16420 | /** |
| 16421 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 16422 | * @wmi_handle: WMI handle |
| 16423 | * @buf: WMI buffer |
| 16424 | * @cmd_id: WMI command Id |
| 16425 | * |
| 16426 | * Return htc_tx_tag |
| 16427 | */ |
| 16428 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 16429 | wmi_buf_t buf, |
| 16430 | uint32_t cmd_id) |
| 16431 | { |
| 16432 | uint16_t htc_tx_tag = 0; |
| 16433 | |
| 16434 | switch (cmd_id) { |
| 16435 | case WMI_WOW_ENABLE_CMDID: |
| 16436 | case WMI_PDEV_SUSPEND_CMDID: |
| 16437 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 16438 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 16439 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 16440 | case WMI_PDEV_RESUME_CMDID: |
| 16441 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 16442 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 16443 | #ifdef FEATURE_WLAN_D0WOW |
| 16444 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 16445 | #endif |
| 16446 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 16447 | break; |
| 16448 | case WMI_FORCE_FW_HANG_CMDID: |
| 16449 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 16450 | break; |
| 16451 | case WMI_VDEV_SET_PARAM_CMDID: |
| 16452 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 16453 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 16454 | default: |
| 16455 | break; |
| 16456 | } |
| 16457 | |
| 16458 | return htc_tx_tag; |
| 16459 | } |
| 16460 | |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 16461 | /** |
| 16462 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 16463 | * from event |
| 16464 | * @wmi_handle: wmi handle |
| 16465 | * @param evt_buf: pointer to event buffer |
| 16466 | * @param ch_hopping: Pointer to hold channel hopping param |
| 16467 | * |
| 16468 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 16469 | */ |
| 16470 | static QDF_STATUS extract_channel_hopping_event_tlv( |
| 16471 | wmi_unified_t wmi_handle, void *evt_buf, |
| 16472 | wmi_host_pdev_channel_hopping_event *ch_hopping) |
| 16473 | { |
| 16474 | WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *param_buf; |
| 16475 | wmi_pdev_channel_hopping_event_fixed_param *event; |
| 16476 | |
| 16477 | param_buf = (WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *)evt_buf; |
| 16478 | event = (wmi_pdev_channel_hopping_event_fixed_param *) |
| 16479 | param_buf->fixed_param; |
| 16480 | |
| 16481 | ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter; |
| 16482 | ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter; |
Kiran Venkatappa | aa07514 | 2017-03-30 15:22:50 +0530 | [diff] [blame] | 16483 | ch_hopping->pdev_id = event->pdev_id; |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 16484 | |
| 16485 | return QDF_STATUS_SUCCESS; |
| 16486 | } |
| 16487 | |
| 16488 | /** |
| 16489 | * extract_pdev_tpc_ev_param_tlv() - extract tpc param from event |
| 16490 | * @wmi_handle: wmi handle |
| 16491 | * @param evt_buf: pointer to event buffer |
| 16492 | * @param param: Pointer to hold tpc param |
| 16493 | * |
| 16494 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 16495 | */ |
| 16496 | static QDF_STATUS extract_pdev_tpc_ev_param_tlv(wmi_unified_t wmi_handle, |
| 16497 | void *evt_buf, |
| 16498 | wmi_host_pdev_tpc_event *param) |
| 16499 | { |
| 16500 | WMI_PDEV_TPC_EVENTID_param_tlvs *param_buf; |
| 16501 | wmi_pdev_tpc_event_fixed_param *event; |
| 16502 | |
| 16503 | param_buf = (WMI_PDEV_TPC_EVENTID_param_tlvs *)evt_buf; |
| 16504 | event = (wmi_pdev_tpc_event_fixed_param *)param_buf->fixed_param; |
| 16505 | |
Kiran Venkatappa | aa07514 | 2017-03-30 15:22:50 +0530 | [diff] [blame] | 16506 | param->pdev_id = event->pdev_id; |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 16507 | qdf_mem_copy(param->tpc, param_buf->tpc, sizeof(param->tpc)); |
| 16508 | |
| 16509 | return QDF_STATUS_SUCCESS; |
| 16510 | } |
| 16511 | |
| 16512 | |
| 16513 | #ifdef BIG_ENDIAN_HOST |
| 16514 | /** |
| 16515 | * wds_addr_ev_conv_data_be() - LE to BE conversion of wds addr event |
| 16516 | * @param data_len - data length |
| 16517 | * @param data - pointer to data |
| 16518 | * |
| 16519 | * Return: QDF_STATUS - success or error status |
| 16520 | */ |
| 16521 | static QDF_STATUS wds_addr_ev_conv_data_be(uint16_t data_len, uint8_t *ev) |
| 16522 | { |
| 16523 | uint8_t *datap = (uint8_t *)ev; |
| 16524 | /* Skip swapping the first word */ |
| 16525 | datap += sizeof(uint32_t); |
| 16526 | for (i = 0; i < ((data_len / sizeof(uint32_t))-1); |
| 16527 | i++, datap += sizeof(uint32_t)) { |
| 16528 | *(uint32_t *)datap = qdf_le32_to_cpu(*(uint32_t *)datap); |
| 16529 | } |
| 16530 | |
| 16531 | return QDF_STATUS_SUCCESS; |
| 16532 | } |
| 16533 | #else |
| 16534 | /** |
| 16535 | * wds_addr_ev_conv_data_be() - Dummy operation for LE platforms |
| 16536 | * @param data_len - data length |
| 16537 | * @param data - pointer to data |
| 16538 | * |
| 16539 | * Return: QDF_STATUS - success or error status |
| 16540 | */ |
| 16541 | static QDF_STATUS wds_addr_ev_conv_data_be(uint32_t data_len, uint8_t *ev) |
| 16542 | { |
| 16543 | return QDF_STATUS_SUCCESS; |
| 16544 | } |
| 16545 | #endif |
| 16546 | |
| 16547 | /** |
| 16548 | * extract_wds_addr_event_tlv() - extract wds address from event |
| 16549 | * @wmi_handle: wmi handle |
| 16550 | * @param evt_buf: pointer to event buffer |
| 16551 | * @param wds_ev: Pointer to hold wds address |
| 16552 | * |
| 16553 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 16554 | */ |
| 16555 | static QDF_STATUS extract_wds_addr_event_tlv(wmi_unified_t wmi_handle, |
| 16556 | void *evt_buf, |
| 16557 | uint16_t len, wds_addr_event_t *wds_ev) |
| 16558 | { |
| 16559 | WMI_WDS_PEER_EVENTID_param_tlvs *param_buf; |
| 16560 | wmi_wds_addr_event_fixed_param *ev; |
| 16561 | int i; |
| 16562 | |
| 16563 | param_buf = (WMI_WDS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 16564 | ev = (wmi_wds_addr_event_fixed_param *)param_buf->fixed_param; |
| 16565 | |
| 16566 | if (wds_addr_ev_conv_data_be(len, (uint8_t *)ev) != QDF_STATUS_SUCCESS) |
| 16567 | return QDF_STATUS_E_FAILURE; |
| 16568 | |
| 16569 | qdf_mem_copy(wds_ev->event_type, ev->event_type, |
| 16570 | sizeof(wds_ev->event_type)); |
| 16571 | for (i = 0; i < 4; i++) { |
| 16572 | wds_ev->peer_mac[i] = |
| 16573 | ((u_int8_t *)&(ev->peer_mac.mac_addr31to0))[i]; |
| 16574 | wds_ev->dest_mac[i] = |
| 16575 | ((u_int8_t *)&(ev->dest_mac.mac_addr31to0))[i]; |
| 16576 | } |
| 16577 | for (i = 0; i < 2; i++) { |
| 16578 | wds_ev->peer_mac[4+i] = |
| 16579 | ((u_int8_t *)&(ev->peer_mac.mac_addr47to32))[i]; |
| 16580 | wds_ev->dest_mac[4+i] = |
| 16581 | ((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i]; |
| 16582 | } |
| 16583 | return QDF_STATUS_SUCCESS; |
| 16584 | } |
| 16585 | |
| 16586 | /** |
| 16587 | * extract_peer_sta_ps_statechange_ev_tlv() - extract peer sta ps state |
| 16588 | * from event |
| 16589 | * @wmi_handle: wmi handle |
| 16590 | * @param evt_buf: pointer to event buffer |
| 16591 | * @param ev: Pointer to hold peer param and ps state |
| 16592 | * |
| 16593 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 16594 | */ |
| 16595 | static QDF_STATUS extract_peer_sta_ps_statechange_ev_tlv(wmi_unified_t wmi_handle, |
| 16596 | void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev) |
| 16597 | { |
| 16598 | WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf; |
| 16599 | wmi_peer_sta_ps_statechange_event_fixed_param *event; |
| 16600 | |
| 16601 | param_buf = (WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *)evt_buf; |
| 16602 | event = (wmi_peer_sta_ps_statechange_event_fixed_param *) |
| 16603 | param_buf->fixed_param; |
| 16604 | |
| 16605 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, ev->peer_macaddr); |
| 16606 | ev->peer_ps_state = event->peer_ps_state; |
| 16607 | |
| 16608 | return QDF_STATUS_SUCCESS; |
| 16609 | } |
| 16610 | |
| 16611 | /** |
| 16612 | * extract_inst_rssi_stats_event_tlv() - extract inst rssi stats from event |
| 16613 | * @wmi_handle: wmi handle |
| 16614 | * @param evt_buf: pointer to event buffer |
| 16615 | * @param inst_rssi_resp: Pointer to hold inst rssi response |
| 16616 | * |
| 16617 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 16618 | */ |
| 16619 | static QDF_STATUS extract_inst_rssi_stats_event_tlv( |
| 16620 | wmi_unified_t wmi_handle, void *evt_buf, |
| 16621 | wmi_host_inst_stats_resp *inst_rssi_resp) |
| 16622 | { |
| 16623 | WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf; |
| 16624 | wmi_inst_rssi_stats_resp_fixed_param *event; |
| 16625 | |
| 16626 | param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf; |
| 16627 | event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param; |
| 16628 | |
| 16629 | qdf_mem_copy(&(inst_rssi_resp->peer_macaddr), |
| 16630 | &(event->peer_macaddr), sizeof(wmi_mac_addr)); |
| 16631 | inst_rssi_resp->iRSSI = event->iRSSI; |
| 16632 | |
| 16633 | return QDF_STATUS_SUCCESS; |
| 16634 | } |
| 16635 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16636 | static struct cur_reg_rule |
| 16637 | *create_reg_rules_from_wmi(uint32_t num_reg_rules, |
| 16638 | wmi_regulatory_rule_struct *wmi_reg_rule) |
| 16639 | { |
| 16640 | struct cur_reg_rule *reg_rule_ptr; |
| 16641 | uint32_t count; |
| 16642 | |
| 16643 | reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); |
| 16644 | |
| 16645 | if (NULL == reg_rule_ptr) { |
| 16646 | WMI_LOGE("memory allocation failure"); |
| 16647 | return NULL; |
| 16648 | } |
| 16649 | |
| 16650 | for (count = 0; count < num_reg_rules; count++) { |
| 16651 | reg_rule_ptr[count].start_freq = |
| 16652 | WMI_REG_RULE_START_FREQ_GET( |
| 16653 | wmi_reg_rule[count].freq_info); |
| 16654 | reg_rule_ptr[count].end_freq = |
| 16655 | WMI_REG_RULE_END_FREQ_GET( |
| 16656 | wmi_reg_rule[count].freq_info); |
| 16657 | reg_rule_ptr[count].max_bw = |
| 16658 | WMI_REG_RULE_MAX_BW_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 16659 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16660 | reg_rule_ptr[count].reg_power = |
| 16661 | WMI_REG_RULE_REG_POWER_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 16662 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16663 | reg_rule_ptr[count].flags = |
| 16664 | WMI_REG_RULE_FLAGS_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 16665 | wmi_reg_rule[count].flag_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16666 | } |
| 16667 | |
| 16668 | return reg_rule_ptr; |
| 16669 | } |
| 16670 | |
| 16671 | static QDF_STATUS extract_reg_chan_list_update_event_tlv( |
| 16672 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 16673 | struct cur_regulatory_info *reg_info, uint32_t len) |
| 16674 | { |
| 16675 | WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *param_buf; |
| 16676 | wmi_reg_chan_list_cc_event_fixed_param *chan_list_event_hdr; |
| 16677 | wmi_regulatory_rule_struct *wmi_reg_rule; |
| 16678 | uint32_t num_2g_reg_rules, num_5g_reg_rules; |
| 16679 | |
| 16680 | WMI_LOGD("processing regulatory channel list"); |
| 16681 | |
| 16682 | param_buf = (WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *)evt_buf; |
| 16683 | if (!param_buf) { |
| 16684 | WMI_LOGE("invalid channel list event buf"); |
| 16685 | return QDF_STATUS_E_FAILURE; |
| 16686 | } |
| 16687 | |
| 16688 | chan_list_event_hdr = param_buf->fixed_param; |
| 16689 | |
| 16690 | reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; |
| 16691 | reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; |
| 16692 | qdf_mem_copy(reg_info->alpha2, &(chan_list_event_hdr->alpha2), |
| 16693 | REG_ALPHA2_LEN); |
| 16694 | reg_info->dfs_region = chan_list_event_hdr->dfs_region; |
| 16695 | reg_info->phybitmap = chan_list_event_hdr->phybitmap; |
| 16696 | reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; |
| 16697 | reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; |
| 16698 | reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; |
| 16699 | reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; |
| 16700 | |
| 16701 | num_2g_reg_rules = reg_info->num_2g_reg_rules; |
| 16702 | num_5g_reg_rules = reg_info->num_5g_reg_rules; |
| 16703 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16704 | |
Kiran Kumar Lokere | dd64e04 | 2017-03-31 15:50:26 -0700 | [diff] [blame] | 16705 | wmi_reg_rule = |
| 16706 | (wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr |
| 16707 | + sizeof(wmi_reg_chan_list_cc_event_fixed_param) |
| 16708 | + WMI_TLV_HDR_SIZE); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16709 | reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, |
| 16710 | wmi_reg_rule); |
| 16711 | wmi_reg_rule += num_2g_reg_rules; |
| 16712 | |
| 16713 | reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, |
| 16714 | wmi_reg_rule); |
| 16715 | |
| 16716 | WMI_LOGD("processed regulatory channel list"); |
| 16717 | |
| 16718 | return QDF_STATUS_SUCCESS; |
| 16719 | } |
| 16720 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16721 | struct wmi_ops tlv_ops = { |
| 16722 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 16723 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 16724 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 16725 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 16726 | .send_hidden_ssid_vdev_restart_cmd = |
| 16727 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16728 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 16729 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 16730 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16731 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16732 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16733 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 16734 | .send_peer_rx_reorder_queue_setup_cmd = |
| 16735 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 16736 | .send_peer_rx_reorder_queue_remove_cmd = |
| 16737 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 16738 | .send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv, |
| 16739 | .send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv, |
| 16740 | .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] | 16741 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 16742 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 16743 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 16744 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 16745 | .send_resume_cmd = send_resume_cmd_tlv, |
| 16746 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 16747 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 16748 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 16749 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 16750 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 16751 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 16752 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 16753 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
| 16754 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16755 | #ifndef CONFIG_MCL |
| 16756 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
| 16757 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16758 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 16759 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 16760 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 16761 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16762 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
| 16763 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 16764 | .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] | 16765 | .send_set_sta_uapsd_auto_trig_cmd = |
| 16766 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16767 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 16768 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 16769 | .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] | 16770 | #ifdef CONVERGED_P2P_ENABLE |
| 16771 | .send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv, |
| 16772 | .send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv, |
| 16773 | #endif |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16774 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 16775 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 16776 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 16777 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 16778 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 16779 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 16780 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 16781 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 16782 | .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] | 16783 | .send_ocb_start_timing_advert_cmd = |
| 16784 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 16785 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 16786 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 16787 | .send_set_mcc_channel_time_latency_cmd = |
| 16788 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 16789 | .send_set_mcc_channel_time_quota_cmd = |
| 16790 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 16791 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 16792 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 16793 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16794 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 16795 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 16796 | .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] | 16797 | .send_probe_rsp_tmpl_send_cmd = |
| 16798 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 16799 | .send_p2p_go_set_beacon_ie_cmd = |
| 16800 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 16801 | .send_setup_install_key_cmd = |
| 16802 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16803 | .send_set_gateway_params_cmd = |
| 16804 | send_set_gateway_params_cmd_tlv, |
| 16805 | .send_set_rssi_monitoring_cmd = |
| 16806 | send_set_rssi_monitoring_cmd_tlv, |
| 16807 | .send_scan_probe_setoui_cmd = |
| 16808 | send_scan_probe_setoui_cmd_tlv, |
| 16809 | .send_reset_passpoint_network_list_cmd = |
| 16810 | send_reset_passpoint_network_list_cmd_tlv, |
| 16811 | .send_set_passpoint_network_list_cmd = |
| 16812 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 16813 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 16814 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
| 16815 | .send_roam_scan_filter_cmd = |
| 16816 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16817 | .send_set_epno_network_list_cmd = |
| 16818 | send_set_epno_network_list_cmd_tlv, |
| 16819 | .send_ipa_offload_control_cmd = |
| 16820 | send_ipa_offload_control_cmd_tlv, |
| 16821 | .send_extscan_get_capabilities_cmd = |
| 16822 | send_extscan_get_capabilities_cmd_tlv, |
| 16823 | .send_extscan_get_cached_results_cmd = |
| 16824 | send_extscan_get_cached_results_cmd_tlv, |
| 16825 | .send_extscan_stop_change_monitor_cmd = |
| 16826 | send_extscan_stop_change_monitor_cmd_tlv, |
| 16827 | .send_extscan_start_change_monitor_cmd = |
| 16828 | send_extscan_start_change_monitor_cmd_tlv, |
| 16829 | .send_extscan_stop_hotlist_monitor_cmd = |
| 16830 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 16831 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 16832 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 16833 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 16834 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 16835 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16836 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16837 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16838 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16839 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 16840 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 16841 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 16842 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 16843 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16844 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 16845 | .send_snr_cmd = send_snr_cmd_tlv, |
| 16846 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 16847 | #ifdef WLAN_PMO_ENABLE |
| 16848 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 16849 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 16850 | .send_enable_arp_ns_offload_cmd = send_enable_arp_ns_offload_cmd_tlv, |
| 16851 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
| 16852 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 16853 | .send_process_gtk_offload_getinfo_cmd = |
| 16854 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 16855 | .send_enable_enhance_multicast_offload_cmd = |
| 16856 | send_enable_enhance_multicast_offload_tlv, |
| 16857 | .extract_gtk_rsp_event = extract_gtk_rsp_event_tlv, |
| 16858 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 16859 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
| 16860 | #endif |
| 16861 | .send_action_frame_patterns_cmd = send_action_frame_patterns_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16862 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 16863 | .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] | 16864 | .send_lphb_config_tcp_pkt_filter_cmd = |
| 16865 | send_lphb_config_tcp_pkt_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16866 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 16867 | .send_lphb_config_udp_pkt_filter_cmd = |
| 16868 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 16869 | #endif /* End of WLAN_PMO_ENABLE */ |
| 16870 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16871 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 16872 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 16873 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16874 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
| 16875 | .send_process_update_edca_param_cmd = |
| 16876 | send_process_update_edca_param_cmd_tlv, |
| 16877 | .send_roam_scan_offload_mode_cmd = |
| 16878 | send_roam_scan_offload_mode_cmd_tlv, |
| 16879 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 16880 | .send_roam_scan_offload_ap_profile_cmd = |
| 16881 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 16882 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16883 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 16884 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16885 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 16886 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
| 16887 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 16888 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16889 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 16890 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 16891 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 16892 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 16893 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
| 16894 | .send_enable_disable_packet_filter_cmd = |
| 16895 | send_enable_disable_packet_filter_cmd_tlv, |
| 16896 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16897 | .send_process_add_periodic_tx_ptrn_cmd = |
| 16898 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 16899 | .send_process_del_periodic_tx_ptrn_cmd = |
| 16900 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 16901 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 16902 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 16903 | .send_set_app_type2_params_in_fw_cmd = |
| 16904 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 16905 | .send_set_auto_shutdown_timer_cmd = |
| 16906 | send_set_auto_shutdown_timer_cmd_tlv, |
| 16907 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 16908 | .send_process_dhcpserver_offload_cmd = |
| 16909 | send_process_dhcpserver_offload_cmd_tlv, |
| 16910 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 16911 | .send_process_ch_avoid_update_cmd = |
| 16912 | send_process_ch_avoid_update_cmd_tlv, |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 16913 | .send_pdev_set_regdomain_cmd = |
| 16914 | send_pdev_set_regdomain_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16915 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 16916 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 16917 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 16918 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 16919 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 16920 | .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] | 16921 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 16922 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 16923 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 16924 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16925 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16926 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 16927 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16928 | .send_set_base_macaddr_indicate_cmd = |
| 16929 | send_set_base_macaddr_indicate_cmd_tlv, |
| 16930 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 16931 | .send_enable_specific_fw_logs_cmd = |
| 16932 | send_enable_specific_fw_logs_cmd_tlv, |
| 16933 | .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] | 16934 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 16935 | .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] | 16936 | .send_pdev_set_dual_mac_config_cmd = |
| 16937 | send_pdev_set_dual_mac_config_cmd_tlv, |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 16938 | .send_enable_broadcast_filter_cmd = |
| 16939 | send_enable_broadcast_filter_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16940 | .send_app_type1_params_in_fw_cmd = |
| 16941 | send_app_type1_params_in_fw_cmd_tlv, |
| 16942 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 16943 | .send_process_roam_synch_complete_cmd = |
| 16944 | send_process_roam_synch_complete_cmd_tlv, |
| 16945 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 16946 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 16947 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16948 | .send_roam_scan_offload_scan_period_cmd = |
| 16949 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 16950 | .send_roam_scan_offload_chan_list_cmd = |
| 16951 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 16952 | .send_roam_scan_offload_rssi_change_cmd = |
| 16953 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 16954 | .send_get_buf_extscan_hotlist_cmd = |
| 16955 | send_get_buf_extscan_hotlist_cmd_tlv, |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 16956 | .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] | 16957 | .send_adapt_dwelltime_params_cmd = |
| 16958 | send_adapt_dwelltime_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16959 | .init_cmd_send = init_cmd_send_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 16960 | .send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv, |
| 16961 | .send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv, |
| 16962 | .send_set_ctl_table_cmd = send_set_ctl_table_cmd_tlv, |
| 16963 | .send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv, |
| 16964 | .send_packet_power_info_get_cmd = send_packet_power_info_get_cmd_tlv, |
| 16965 | .send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv, |
| 16966 | .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, |
| 16967 | .send_vdev_set_neighbour_rx_cmd = send_vdev_set_neighbour_rx_cmd_tlv, |
| 16968 | .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] | 16969 | .send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv, |
| 16970 | .send_smart_ant_set_training_info_cmd = |
| 16971 | send_smart_ant_set_training_info_cmd_tlv, |
| 16972 | .send_smart_ant_set_node_config_cmd = |
| 16973 | send_smart_ant_set_node_config_cmd_tlv, |
| 16974 | .send_set_atf_cmd = send_set_atf_cmd_tlv, |
| 16975 | .send_vdev_set_fwtest_param_cmd = send_vdev_set_fwtest_param_cmd_tlv, |
| 16976 | .send_set_qboost_param_cmd = send_set_qboost_param_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 16977 | .send_gpio_config_cmd = send_gpio_config_cmd_tlv, |
| 16978 | .send_gpio_output_cmd = send_gpio_output_cmd_tlv, |
| 16979 | .send_phyerr_disable_cmd = send_phyerr_disable_cmd_tlv, |
| 16980 | .send_phyerr_enable_cmd = send_phyerr_enable_cmd_tlv, |
| 16981 | .send_nf_dbr_dbm_info_get_cmd = send_nf_dbr_dbm_info_get_cmd_tlv, |
| 16982 | .send_set_ht_ie_cmd = send_set_ht_ie_cmd_tlv, |
| 16983 | .send_set_vht_ie_cmd = send_set_vht_ie_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 16984 | .send_set_quiet_mode_cmd = send_set_quiet_mode_cmd_tlv, |
| 16985 | .send_set_bwf_cmd = send_set_bwf_cmd_tlv, |
| 16986 | .send_mcast_group_update_cmd = send_mcast_group_update_cmd_tlv, |
| 16987 | .send_vdev_spectral_configure_cmd = |
| 16988 | send_vdev_spectral_configure_cmd_tlv, |
| 16989 | .send_vdev_spectral_enable_cmd = |
| 16990 | send_vdev_spectral_enable_cmd_tlv, |
| 16991 | .send_pdev_qvit_cmd = send_pdev_qvit_cmd_tlv, |
| 16992 | .send_wmm_update_cmd = send_wmm_update_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16993 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 16994 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 16995 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 16996 | .save_service_bitmap = save_service_bitmap_tlv, |
| 16997 | .is_service_enabled = is_service_enabled_tlv, |
| 16998 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 16999 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 17000 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
| 17001 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 17002 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 17003 | .extract_tbttoffset_update_params = |
| 17004 | extract_tbttoffset_update_params_tlv, |
| 17005 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 17006 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 17007 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 17008 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
| 17009 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
| 17010 | .extract_swba_vdev_map = extract_swba_vdev_map_tlv, |
| 17011 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 17012 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 17013 | #ifdef CONVERGED_P2P_ENABLE |
| 17014 | .extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv, |
| 17015 | .extract_p2p_lo_stop_ev_param = |
| 17016 | extract_p2p_lo_stop_ev_param_tlv, |
| 17017 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17018 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 17019 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 17020 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 17021 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 17022 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 17023 | .extract_peer_stats = extract_peer_stats_tlv, |
| 17024 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 17025 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 17026 | .extract_chan_stats = extract_chan_stats_tlv, |
| 17027 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 17028 | .extract_profile_data = extract_profile_data_tlv, |
| 17029 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 17030 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 17031 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 17032 | .send_encrypt_decrypt_send_cmd = |
| 17033 | send_encrypt_decrypt_send_cmd_tlv, |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 17034 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 17035 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17036 | .send_multiple_vdev_restart_req_cmd = |
| 17037 | send_multiple_vdev_restart_req_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17038 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 17039 | .extract_hw_mode_cap_service_ready_ext = |
| 17040 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 17041 | .extract_mac_phy_cap_service_ready_ext = |
| 17042 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 17043 | .extract_reg_cap_service_ready_ext = |
| 17044 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17045 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 17046 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 17047 | .extract_dcs_interference_type = extract_dcs_interference_type_tlv, |
| 17048 | .extract_dcs_cw_int = extract_dcs_cw_int_tlv, |
| 17049 | .extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 17050 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 17051 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 17052 | .extract_peer_delete_response_event = |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17053 | extract_peer_delete_response_event_tlv, |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17054 | .is_management_record = is_management_record_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17055 | .extract_pdev_csa_switch_count_status = |
| 17056 | extract_pdev_csa_switch_count_status_tlv, |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 17057 | .extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv, |
| 17058 | .extract_wds_addr_event = extract_wds_addr_event_tlv, |
| 17059 | .extract_peer_sta_ps_statechange_ev = |
| 17060 | extract_peer_sta_ps_statechange_ev_tlv, |
| 17061 | .extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv, |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 17062 | .send_per_roam_config_cmd = send_per_roam_config_cmd_tlv, |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 17063 | .send_dfs_phyerr_offload_en_cmd = send_dfs_phyerr_offload_en_cmd_tlv, |
| 17064 | .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] | 17065 | .extract_reg_chan_list_update_event = |
| 17066 | extract_reg_chan_list_update_event_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17067 | }; |
| 17068 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17069 | /** |
| 17070 | * populate_tlv_event_id() - populates wmi event ids |
| 17071 | * |
| 17072 | * @param event_ids: Pointer to hold event ids |
| 17073 | * Return: None |
| 17074 | */ |
| 17075 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 17076 | { |
| 17077 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 17078 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 17079 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 17080 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 17081 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 17082 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 17083 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 17084 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 17085 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 17086 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 17087 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 17088 | event_ids[wmi_service_ready_ext_event_id] = |
| 17089 | WMI_SERVICE_READY_EXT_EVENTID; |
| 17090 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 17091 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 17092 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 17093 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 17094 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 17095 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 17096 | |
| 17097 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 17098 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 17099 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 17100 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 17101 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 17102 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 17103 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 17104 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 17105 | event_ids[wmi_peer_delete_response_event_id] = |
| 17106 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17107 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 17108 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 17109 | event_ids[wmi_tbttoffset_update_event_id] = |
| 17110 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
| 17111 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 17112 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 17113 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 17114 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 17115 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 17116 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 17117 | |
| 17118 | event_ids[wmi_tx_delba_complete_event_id] = |
| 17119 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 17120 | event_ids[wmi_tx_addba_complete_event_id] = |
| 17121 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 17122 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 17123 | |
| 17124 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 17125 | |
| 17126 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 17127 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 17128 | |
| 17129 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 17130 | |
| 17131 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 17132 | |
| 17133 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
Wu Gao | 84ed340 | 2017-03-15 19:12:20 +0800 | [diff] [blame] | 17134 | event_ids[wmi_p2p_lo_stop_event_id] = |
| 17135 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17136 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 17137 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 17138 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 17139 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 17140 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 17141 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 17142 | |
| 17143 | event_ids[wmi_rtt_meas_report_event_id] = |
| 17144 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 17145 | event_ids[wmi_tsf_meas_report_event_id] = |
| 17146 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 17147 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 17148 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 17149 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 17150 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 17151 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 17152 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 17153 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 17154 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 17155 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 17156 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 17157 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 17158 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 17159 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 17160 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 17161 | |
| 17162 | event_ids[wmi_gtk_offload_status_event_id] = |
| 17163 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 17164 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 17165 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 17166 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 17167 | |
| 17168 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 17169 | |
| 17170 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 17171 | |
| 17172 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 17173 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 17174 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 17175 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 17176 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 17177 | event_ids[wmi_wlan_profile_data_event_id] = |
| 17178 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 17179 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 17180 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 17181 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 17182 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 17183 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 17184 | |
| 17185 | event_ids[wmi_diag_container_event_id] = |
| 17186 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 17187 | |
| 17188 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 17189 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 17190 | |
| 17191 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 17192 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 17193 | |
| 17194 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 17195 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 17196 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 17197 | |
| 17198 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 17199 | |
| 17200 | /** Set OCB Sched Response, deprecated */ |
| 17201 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 17202 | |
| 17203 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 17204 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 17205 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 17206 | |
| 17207 | /* GPIO Event */ |
| 17208 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 17209 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 17210 | |
| 17211 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 17212 | event_ids[wmi_rfkill_state_change_event_id] = |
| 17213 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 17214 | |
| 17215 | /* TDLS Event */ |
| 17216 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 17217 | |
| 17218 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 17219 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 17220 | event_ids[wmi_batch_scan_result_event_id] = |
| 17221 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 17222 | /* OEM Event */ |
| 17223 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 17224 | event_ids[wmi_oem_meas_report_event_id] = |
| 17225 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 17226 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 17227 | |
| 17228 | /* NAN Event */ |
| 17229 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 17230 | |
| 17231 | /* LPI Event */ |
| 17232 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 17233 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 17234 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 17235 | |
| 17236 | /* ExtScan events */ |
| 17237 | event_ids[wmi_extscan_start_stop_event_id] = |
| 17238 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 17239 | event_ids[wmi_extscan_operation_event_id] = |
| 17240 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 17241 | event_ids[wmi_extscan_table_usage_event_id] = |
| 17242 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 17243 | event_ids[wmi_extscan_cached_results_event_id] = |
| 17244 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 17245 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 17246 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 17247 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 17248 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 17249 | event_ids[wmi_extscan_capabilities_event_id] = |
| 17250 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 17251 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 17252 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 17253 | |
| 17254 | /* mDNS offload events */ |
| 17255 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 17256 | |
| 17257 | /* SAP Authentication offload events */ |
| 17258 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 17259 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 17260 | |
| 17261 | /** Out-of-context-of-bss (OCB) events */ |
| 17262 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 17263 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 17264 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 17265 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 17266 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 17267 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 17268 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 17269 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 17270 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 17271 | /* System-On-Chip events */ |
| 17272 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 17273 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 17274 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 17275 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 17276 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 17277 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 17278 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17279 | event_ids[wmi_pdev_csa_switch_count_status_event_id] = |
| 17280 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID; |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17281 | 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] | 17282 | event_ids[wmi_inst_rssi_stats_event_id] = WMI_INST_RSSI_STATS_EVENTID; |
| 17283 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 17284 | event_ids[wmi_peer_sta_ps_statechg_event_id] = |
| 17285 | WMI_PEER_STA_PS_STATECHG_EVENTID; |
| 17286 | event_ids[wmi_pdev_channel_hopping_event_id] = |
| 17287 | WMI_PDEV_CHANNEL_HOPPING_EVENTID; |
| 17288 | event_ids[wmi_wds_peer_event_id] = WMI_WDS_PEER_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17289 | } |
| 17290 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 17291 | #ifndef CONFIG_MCL |
| 17292 | /** |
| 17293 | * populate_tlv_service() - populates wmi services |
| 17294 | * |
| 17295 | * @param wmi_service: Pointer to hold wmi_service |
| 17296 | * Return: None |
| 17297 | */ |
| 17298 | static void populate_tlv_service(uint32_t *wmi_service) |
| 17299 | { |
| 17300 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
| 17301 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 17302 | wmi_service[wmi_service_roam_scan_offload] = |
| 17303 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 17304 | wmi_service[wmi_service_bcn_miss_offload] = |
| 17305 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 17306 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 17307 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 17308 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 17309 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 17310 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 17311 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 17312 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 17313 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 17314 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 17315 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 17316 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 17317 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 17318 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 17319 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 17320 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 17321 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 17322 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 17323 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 17324 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 17325 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 17326 | wmi_service[wmi_service_packet_power_save] = |
| 17327 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 17328 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 17329 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 17330 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 17331 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 17332 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 17333 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 17334 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 17335 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 17336 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 17337 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 17338 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 17339 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 17340 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 17341 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 17342 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 17343 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 17344 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 17345 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 17346 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 17347 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 17348 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 17349 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 17350 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 17351 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 17352 | wmi_service[wmi_service_lte_ant_share_support] = |
| 17353 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 17354 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 17355 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 17356 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 17357 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 17358 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 17359 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 17360 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 17361 | wmi_service[wmi_service_bcn_txrate_override] = |
| 17362 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 17363 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 17364 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 17365 | wmi_service[wmi_service_estimate_linkspeed] = |
| 17366 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 17367 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 17368 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 17369 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 17370 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 17371 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 17372 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 17373 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 17374 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 17375 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 17376 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 17377 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 17378 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 17379 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 17380 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 17381 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 17382 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 17383 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 17384 | wmi_service[wmi_service_sap_auth_offload] = |
| 17385 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 17386 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 17387 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 17388 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 17389 | wmi_service[wmi_service_ap_arpns_offload] = |
| 17390 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 17391 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 17392 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 17393 | wmi_service[wmi_service_packet_filter_offload] = |
| 17394 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 17395 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 17396 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 17397 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 17398 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 17399 | wmi_service[wmi_service_multiple_vdev_restart] = |
| 17400 | WMI_SERVICE_MULTIPLE_VDEV_RESTART; |
| 17401 | |
| 17402 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 17403 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 17404 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 17405 | WMI_SERVICE_UNAVAILABLE; |
| 17406 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 17407 | WMI_SERVICE_UNAVAILABLE; |
| 17408 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 17409 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
| 17410 | wmi_service[wmi_service_atf] = WMI_SERVICE_UNAVAILABLE; |
| 17411 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 17412 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 17413 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 17414 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 17415 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 17416 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 17417 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 17418 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
| 17419 | |
| 17420 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 17421 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 17422 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 17423 | WMI_SERVICE_UNAVAILABLE; |
| 17424 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 17425 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 17426 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 17427 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
| 17428 | wmi_service[wmi_service_4_wire_coex_support] = WMI_SERVICE_UNAVAILABLE; |
| 17429 | wmi_service[wmi_service_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
| 17430 | } |
| 17431 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17432 | /** |
| 17433 | * populate_pdev_param_tlv() - populates pdev params |
| 17434 | * |
| 17435 | * @param pdev_param: Pointer to hold pdev params |
| 17436 | * Return: None |
| 17437 | */ |
| 17438 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 17439 | { |
| 17440 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 17441 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 17442 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 17443 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 17444 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 17445 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 17446 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 17447 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 17448 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 17449 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 17450 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 17451 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 17452 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 17453 | pdev_param[wmi_pdev_param_protection_mode] = |
| 17454 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 17455 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 17456 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 17457 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 17458 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 17459 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 17460 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 17461 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 17462 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 17463 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 17464 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 17465 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 17466 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 17467 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 17468 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 17469 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 17470 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 17471 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 17472 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 17473 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 17474 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 17475 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 17476 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 17477 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 17478 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 17479 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 17480 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 17481 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 17482 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 17483 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 17484 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 17485 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 17486 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 17487 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 17488 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 17489 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 17490 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 17491 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 17492 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 17493 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 17494 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 17495 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 17496 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 17497 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 17498 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 17499 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 17500 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 17501 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 17502 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 17503 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 17504 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 17505 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 17506 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 17507 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 17508 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 17509 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 17510 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 17511 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 17512 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 17513 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 17514 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 17515 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 17516 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 17517 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 17518 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 17519 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 17520 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 17521 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 17522 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 17523 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 17524 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 17525 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 17526 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 17527 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 17528 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 17529 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 17530 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 17531 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 17532 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 17533 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 17534 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 17535 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 17536 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 17537 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 17538 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 17539 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 17540 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 17541 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 17542 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 17543 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 17544 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 17545 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 17546 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 17547 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 17548 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 17549 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 17550 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 17551 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 17552 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 17553 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 17554 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 17555 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 17556 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 17557 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 17558 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 17559 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 17560 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 17561 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 17562 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 17563 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 17564 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 17565 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 17566 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 17567 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 17568 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 17569 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 17570 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 17571 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
| 17572 | pdev_param[wmi_pdev_param_rx_filter] = WMI_UNAVAILABLE_PARAM; |
| 17573 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = WMI_UNAVAILABLE_PARAM; |
| 17574 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = WMI_UNAVAILABLE_PARAM; |
| 17575 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_UNAVAILABLE_PARAM; |
| 17576 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
| 17577 | WMI_UNAVAILABLE_PARAM; |
| 17578 | pdev_param[wmi_pdev_param_proxy_sta_mode] = WMI_UNAVAILABLE_PARAM; |
| 17579 | pdev_param[wmi_pdev_param_mu_group_policy] = WMI_UNAVAILABLE_PARAM; |
| 17580 | pdev_param[wmi_pdev_param_noise_detection] = WMI_UNAVAILABLE_PARAM; |
| 17581 | pdev_param[wmi_pdev_param_noise_threshold] = WMI_UNAVAILABLE_PARAM; |
| 17582 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_UNAVAILABLE_PARAM; |
| 17583 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = WMI_UNAVAILABLE_PARAM; |
| 17584 | pdev_param[wmi_pdev_param_atf_strict_sch] = WMI_UNAVAILABLE_PARAM; |
| 17585 | pdev_param[wmi_pdev_param_atf_sched_duration] = WMI_UNAVAILABLE_PARAM; |
| 17586 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_UNAVAILABLE_PARAM; |
| 17587 | pdev_param[wmi_pdev_param_sensitivity_level] = WMI_UNAVAILABLE_PARAM; |
| 17588 | pdev_param[wmi_pdev_param_signed_txpower_2g] = WMI_UNAVAILABLE_PARAM; |
| 17589 | pdev_param[wmi_pdev_param_signed_txpower_5g] = WMI_UNAVAILABLE_PARAM; |
| 17590 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = WMI_UNAVAILABLE_PARAM; |
| 17591 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = WMI_UNAVAILABLE_PARAM; |
| 17592 | pdev_param[wmi_pdev_param_cca_threshold] = WMI_UNAVAILABLE_PARAM; |
| 17593 | pdev_param[wmi_pdev_param_rts_fixed_rate] = WMI_UNAVAILABLE_PARAM; |
| 17594 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
| 17595 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_UNAVAILABLE_PARAM; |
| 17596 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = WMI_UNAVAILABLE_PARAM; |
| 17597 | pdev_param[wmi_pdev_param_arp_srcaddr] = WMI_UNAVAILABLE_PARAM; |
| 17598 | pdev_param[wmi_pdev_param_arp_dstaddr] = WMI_UNAVAILABLE_PARAM; |
| 17599 | pdev_param[wmi_pdev_param_txpower_decr_db] = WMI_UNAVAILABLE_PARAM; |
| 17600 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 17601 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
| 17602 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = WMI_UNAVAILABLE_PARAM; |
| 17603 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
| 17604 | WMI_UNAVAILABLE_PARAM; |
| 17605 | pdev_param[wmi_pdev_param_cust_txpower_scale] = WMI_UNAVAILABLE_PARAM; |
| 17606 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = WMI_UNAVAILABLE_PARAM; |
| 17607 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 17608 | WMI_UNAVAILABLE_PARAM; |
| 17609 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 17610 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
| 17611 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_UNAVAILABLE_PARAM; |
| 17612 | pdev_param[wmi_pdev_param_block_interbss] = WMI_UNAVAILABLE_PARAM; |
| 17613 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
| 17614 | WMI_UNAVAILABLE_PARAM; |
| 17615 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 17616 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
| 17617 | WMI_UNAVAILABLE_PARAM; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 17618 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 17619 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17620 | pdev_param[wmi_pdev_param_en_stats] = WMI_UNAVAILABLE_PARAM; |
Venkateswara Swamy Bandaru | 21cc1ca | 2017-02-24 17:09:46 +0530 | [diff] [blame] | 17621 | pdev_param[wmi_pdev_param_mesh_mcast_enable] = |
| 17622 | WMI_PDEV_PARAM_MESH_MCAST_ENABLE; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 17623 | pdev_param[wmi_pdev_param_set_promisc_mode_cmdid] = |
| 17624 | WMI_PDEV_PARAM_SET_PROMISC_MODE_CMDID; |
| 17625 | pdev_param[wmi_pdev_param_set_ppdu_duration_cmdid] = |
| 17626 | WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID; |
| 17627 | pdev_param[wmi_pdev_param_igmpmld_ac_override] = |
| 17628 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
| 17629 | pdev_param[wmi_pdev_param_remove_mcast2ucast_buffer] = |
| 17630 | WMI_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER; |
| 17631 | pdev_param[wmi_pdev_param_set_mcast2ucast_buffer] = |
| 17632 | WMI_PDEV_PARAM_SET_MCAST2UCAST_BUFFER; |
| 17633 | pdev_param[wmi_pdev_param_set_mcast2ucast_mode] = |
| 17634 | WMI_PDEV_PARAM_SET_MCAST2UCAST_MODE; |
| 17635 | pdev_param[wmi_pdev_param_smart_antenna_default_antenna] = |
| 17636 | WMI_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA; |
| 17637 | pdev_param[wmi_pdev_param_fast_channel_reset] = |
| 17638 | WMI_PDEV_PARAM_FAST_CHANNEL_RESET; |
| 17639 | 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] | 17640 | } |
| 17641 | |
| 17642 | /** |
| 17643 | * populate_vdev_param_tlv() - populates vdev params |
| 17644 | * |
| 17645 | * @param vdev_param: Pointer to hold vdev params |
| 17646 | * Return: None |
| 17647 | */ |
| 17648 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 17649 | { |
| 17650 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 17651 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 17652 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 17653 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 17654 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 17655 | vdev_param[wmi_vdev_param_listen_interval] = |
| 17656 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 17657 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 17658 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 17659 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 17660 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 17661 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 17662 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 17663 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 17664 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 17665 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 17666 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 17667 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 17668 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 17669 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 17670 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 17671 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 17672 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 17673 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 17674 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 17675 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 17676 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 17677 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 17678 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 17679 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 17680 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 17681 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 17682 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 17683 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 17684 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 17685 | vdev_param[wmi_vdev_param_protection_mode] = |
| 17686 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 17687 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 17688 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 17689 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 17690 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 17691 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 17692 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 17693 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 17694 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 17695 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 17696 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 17697 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 17698 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 17699 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 17700 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 17701 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 17702 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 17703 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 17704 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 17705 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 17706 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 17707 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 17708 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 17709 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 17710 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 17711 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 17712 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 17713 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 17714 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 17715 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 17716 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 17717 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 17718 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 17719 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 17720 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 17721 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 17722 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 17723 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 17724 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 17725 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 17726 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 17727 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 17728 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 17729 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 17730 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 17731 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 17732 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 17733 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 17734 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 17735 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 17736 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 17737 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 17738 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 17739 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 17740 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 17741 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 17742 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 17743 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 17744 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 17745 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 17746 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 17747 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 17748 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 17749 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 17750 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 17751 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 17752 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 17753 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 17754 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 17755 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 17756 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 17757 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 17758 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 17759 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 17760 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 17761 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 17762 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 17763 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 17764 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 17765 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 17766 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 17767 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 17768 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 17769 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 17770 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 17771 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 17772 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 17773 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 17774 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 17775 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 17776 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Kalyan Tallapragada | d9a6abd | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 17777 | 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] | 17778 | vdev_param[wmi_vdev_param_he_dcm_enable] = WMI_VDEV_PARAM_HE_DCM; |
| 17779 | vdev_param[wmi_vdev_param_he_range_ext_enable] = |
| 17780 | WMI_VDEV_PARAM_HE_RANGE_EXT; |
| 17781 | vdev_param[wmi_vdev_param_he_bss_color] = WMI_VDEV_PARAM_BSS_COLOR; |
| 17782 | 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] | 17783 | vdev_param[wmi_vdev_param_sensor_ap] = WMI_VDEV_PARAM_SENSOR_AP; |
| 17784 | vdev_param[wmi_vdev_param_dtim_enable_cts] = |
| 17785 | WMI_VDEV_PARAM_DTIM_ENABLE_CTS; |
| 17786 | vdev_param[wmi_vdev_param_atf_ssid_sched_policy] = |
| 17787 | WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY; |
| 17788 | vdev_param[wmi_vdev_param_disable_dyn_bw_rts] = |
| 17789 | WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS; |
Sathish Kumar | 2ac4070 | 2017-03-22 19:18:45 +0530 | [diff] [blame] | 17790 | vdev_param[wmi_vdev_param_mcast2ucast_set] = |
| 17791 | WMI_VDEV_PARAM_MCAST2UCAST_SET; |
| 17792 | vdev_param[wmi_vdev_param_rc_num_retries] = |
| 17793 | WMI_VDEV_PARAM_RC_NUM_RETRIES; |
| 17794 | vdev_param[wmi_vdev_param_cabq_maxdur] = WMI_VDEV_PARAM_CABQ_MAXDUR; |
| 17795 | vdev_param[wmi_vdev_param_mfptest_set] = WMI_VDEV_PARAM_MFPTEST_SET; |
| 17796 | vdev_param[wmi_vdev_param_rts_fixed_rate] = |
| 17797 | WMI_VDEV_PARAM_RTS_FIXED_RATE; |
| 17798 | vdev_param[wmi_vdev_param_vht_sgimask] = WMI_VDEV_PARAM_VHT_SGIMASK; |
| 17799 | vdev_param[wmi_vdev_param_vht80_ratemask] = |
| 17800 | WMI_VDEV_PARAM_VHT80_RATEMASK; |
| 17801 | vdev_param[wmi_vdev_param_proxy_sta] = WMI_VDEV_PARAM_PROXY_STA; |
| 17802 | vdev_param[wmi_vdev_param_bw_nss_ratemask] = |
| 17803 | WMI_VDEV_PARAM_BW_NSS_RATEMASK; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17804 | } |
| 17805 | #endif |
| 17806 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17807 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17808 | * populate_target_defines_tlv() - Populate target defines and params |
| 17809 | * @wmi_handle: pointer to wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17810 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 17811 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17812 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 17813 | #ifndef CONFIG_MCL |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17814 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17815 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17816 | populate_tlv_service(wmi_handle->services); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17817 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 17818 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 17819 | } |
| 17820 | #else |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17821 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
| 17822 | { } |
| 17823 | #endif |
| 17824 | |
| 17825 | /** |
| 17826 | * wmi_tlv_attach() - Attach TLV APIs |
| 17827 | * |
| 17828 | * Return: None |
| 17829 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 17830 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17831 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 17832 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 17833 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 17834 | wmi_handle->log_info.buf_offset_command = 2; |
| 17835 | wmi_handle->log_info.buf_offset_event = 4; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 17836 | #endif |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 17837 | populate_tlv_events_id(wmi_handle->wmi_events); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17838 | populate_target_defines_tlv(wmi_handle); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17839 | } |