Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #include "wmi_unified_tlv.h" |
| 29 | #include "wmi_unified_api.h" |
| 30 | #include "wmi.h" |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 31 | #include "wmi_version.h" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 32 | #include "wmi_unified_priv.h" |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 33 | #include "wmi_version_whitelist.h" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 37 | * @wmi_handle: wmi handle |
| 38 | * @param: pointer to hold vdev create parameter |
| 39 | * @macaddr: vdev mac address |
| 40 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 41 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 42 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 43 | QDF_STATUS send_vdev_create_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 44 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 45 | struct vdev_create_params *param) |
| 46 | { |
| 47 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 48 | wmi_buf_t buf; |
| 49 | int32_t len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 50 | QDF_STATUS ret; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 51 | int num_bands = 2; |
| 52 | uint8_t *buf_ptr; |
| 53 | wmi_vdev_txrx_streams *txrx_streams; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 54 | |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 55 | len += (num_bands * sizeof(*txrx_streams) + WMI_TLV_HDR_SIZE); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 56 | buf = wmi_buf_alloc(wmi_handle, len); |
| 57 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 58 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 59 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 60 | } |
| 61 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 62 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 63 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 64 | WMITLV_GET_STRUCT_TLVLEN |
| 65 | (wmi_vdev_create_cmd_fixed_param)); |
| 66 | cmd->vdev_id = param->if_id; |
| 67 | cmd->vdev_type = param->type; |
| 68 | cmd->vdev_subtype = param->subtype; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 69 | cmd->num_cfg_txrx_streams = num_bands; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 70 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 71 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 72 | 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] | 73 | __func__, param->if_id, |
| 74 | macaddr[0], macaddr[1], macaddr[2], |
| 75 | macaddr[3], macaddr[4], macaddr[5]); |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 76 | buf_ptr = (uint8_t *)cmd + sizeof(*cmd); |
| 77 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 78 | (num_bands * sizeof(wmi_vdev_txrx_streams))); |
| 79 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 80 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 81 | 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] | 82 | param->type, param->subtype, |
| 83 | param->nss_2g, param->nss_5g); |
| 84 | txrx_streams = (wmi_vdev_txrx_streams *)buf_ptr; |
| 85 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_2G; |
| 86 | txrx_streams->supported_tx_streams = param->nss_2g; |
| 87 | txrx_streams->supported_rx_streams = param->nss_2g; |
| 88 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 89 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 90 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
| 91 | |
| 92 | txrx_streams++; |
| 93 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_5G; |
| 94 | txrx_streams->supported_tx_streams = param->nss_5g; |
| 95 | txrx_streams->supported_rx_streams = param->nss_5g; |
| 96 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 97 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 98 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 99 | 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] | 100 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 101 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 102 | wmi_buf_free(buf); |
| 103 | } |
| 104 | |
| 105 | return ret; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 110 | * @wmi_handle: wmi handle |
| 111 | * @if_id: vdev id |
| 112 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 113 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 114 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 115 | QDF_STATUS send_vdev_delete_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 116 | uint8_t if_id) |
| 117 | { |
| 118 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 119 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 120 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 121 | |
| 122 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 123 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 124 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 125 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 129 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 130 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 131 | WMITLV_GET_STRUCT_TLVLEN |
| 132 | (wmi_vdev_delete_cmd_fixed_param)); |
| 133 | cmd->vdev_id = if_id; |
| 134 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 135 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 136 | WMI_VDEV_DELETE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 137 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 138 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 139 | wmi_buf_free(buf); |
| 140 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 141 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 142 | |
| 143 | return ret; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 148 | * @wmi: wmi handle |
| 149 | * @vdev_id: vdev id |
| 150 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 151 | * Return: QDF_STATUS_SUCCESS for success or erro code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 152 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 153 | QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 154 | uint8_t vdev_id) |
| 155 | { |
| 156 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 157 | wmi_buf_t buf; |
| 158 | int32_t len = sizeof(*cmd); |
| 159 | |
| 160 | buf = wmi_buf_alloc(wmi, len); |
| 161 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 162 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 163 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 164 | } |
| 165 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 166 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 167 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 168 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 169 | cmd->vdev_id = vdev_id; |
| 170 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 171 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 172 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 173 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 181 | * @wmi: wmi handle |
| 182 | * @vdev_id: vdev id |
| 183 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 184 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 185 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 186 | 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] | 187 | { |
| 188 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 189 | wmi_buf_t buf; |
| 190 | int32_t len = sizeof(*cmd); |
| 191 | |
| 192 | buf = wmi_buf_alloc(wmi, len); |
| 193 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 194 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 195 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 196 | } |
| 197 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 198 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 199 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 200 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 201 | cmd->vdev_id = vdev_id; |
| 202 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 203 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 204 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 205 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 206 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 207 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 208 | |
| 209 | return 0; |
| 210 | } |
| 211 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 212 | #ifdef CONFIG_MCL |
| 213 | static inline void copy_channel_info( |
| 214 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 215 | wmi_channel *chan, |
| 216 | struct vdev_start_params *req) |
| 217 | { |
| 218 | chan->mhz = req->chan_freq; |
| 219 | |
| 220 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 221 | |
| 222 | chan->band_center_freq1 = req->band_center_freq1; |
| 223 | chan->band_center_freq2 = req->band_center_freq2; |
| 224 | |
| 225 | if (req->is_half_rate) |
| 226 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 227 | else if (req->is_quarter_rate) |
| 228 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 229 | |
| 230 | if (req->is_dfs) { |
| 231 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 232 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 233 | } |
| 234 | |
| 235 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 236 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 237 | |
| 238 | } |
| 239 | #else |
| 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->channel.mhz; |
| 246 | |
| 247 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 248 | |
| 249 | chan->band_center_freq1 = req->channel.cfreq1; |
| 250 | chan->band_center_freq2 = req->channel.cfreq2; |
| 251 | |
| 252 | if (req->channel.half_rate) |
| 253 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 254 | else if (req->channel.quarter_rate) |
| 255 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 256 | |
| 257 | if (req->channel.dfs_set) { |
| 258 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 259 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 260 | } |
| 261 | |
| 262 | /* FIXME: Find out min, max and regulatory power levels */ |
| 263 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
| 264 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxpower); |
| 265 | |
| 266 | } |
| 267 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 268 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 269 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 270 | * @wmi_handle: wmi handle |
| 271 | * @req: vdev start params |
| 272 | * |
| 273 | * Return: QDF status |
| 274 | */ |
| 275 | QDF_STATUS send_vdev_start_cmd_tlv(wmi_unified_t wmi_handle, |
| 276 | struct vdev_start_params *req) |
| 277 | { |
| 278 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 279 | wmi_buf_t buf; |
| 280 | wmi_channel *chan; |
| 281 | int32_t len, ret; |
| 282 | uint8_t *buf_ptr; |
| 283 | |
| 284 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 285 | buf = wmi_buf_alloc(wmi_handle, len); |
| 286 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 287 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 288 | return QDF_STATUS_E_NOMEM; |
| 289 | } |
| 290 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 291 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 292 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 293 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 294 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 295 | WMITLV_GET_STRUCT_TLVLEN |
| 296 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 297 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 298 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 299 | cmd->vdev_id = req->vdev_id; |
| 300 | |
| 301 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 302 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 303 | |
| 304 | cmd->beacon_interval = req->beacon_intval; |
| 305 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 306 | |
| 307 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 308 | cmd->beacon_interval = req->beacon_intval; |
| 309 | cmd->dtim_period = req->dtim_period; |
| 310 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 311 | /* Copy the SSID */ |
| 312 | if (req->ssid.length) { |
| 313 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 314 | cmd->ssid.ssid_len = req->ssid.length; |
| 315 | else |
| 316 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 317 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 318 | cmd->ssid.ssid_len); |
| 319 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 320 | |
| 321 | if (req->hidden_ssid) |
| 322 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 323 | |
| 324 | if (req->pmf_enabled) |
| 325 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 326 | } |
| 327 | |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 328 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 329 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 330 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
| 331 | |
| 332 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 333 | sizeof(wmi_channel)); |
| 334 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 335 | cmd->num_noa_descriptors * |
| 336 | sizeof(wmi_p2p_noa_descriptor)); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 337 | WMI_LOGA("\n%s: vdev_id %d freq %d chanmode %d is_dfs %d " |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 338 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 339 | "reg_info_1: 0x%x reg_info_2: 0x%x, req->max_txpow: 0x%x " |
| 340 | "Tx SS %d, Rx SS %d", |
| 341 | __func__, req->vdev_id, chan->mhz, req->chan_mode, |
| 342 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 343 | chan->band_center_freq1, chan->band_center_freq2, |
| 344 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
| 345 | req->preferred_tx_streams, req->preferred_rx_streams); |
| 346 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 347 | if (req->is_restart) |
| 348 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 349 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 350 | else |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 351 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 352 | WMI_VDEV_START_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 353 | if (ret) { |
| 354 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 355 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 356 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 357 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 358 | |
| 359 | return QDF_STATUS_SUCCESS; |
| 360 | } |
| 361 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 362 | /** |
| 363 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 364 | * @wmi_handle: wmi handle |
| 365 | * @restart_params: vdev restart params |
| 366 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 367 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 368 | */ |
| 369 | QDF_STATUS send_hidden_ssid_vdev_restart_cmd_tlv(wmi_unified_t wmi_handle, |
| 370 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 371 | { |
| 372 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 373 | wmi_buf_t buf; |
| 374 | wmi_channel *chan; |
| 375 | int32_t len; |
| 376 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 377 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 378 | |
| 379 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 380 | buf = wmi_buf_alloc(wmi_handle, len); |
| 381 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 382 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 383 | return QDF_STATUS_E_NOMEM; |
| 384 | } |
| 385 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 386 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 387 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 388 | |
| 389 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 390 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 391 | WMITLV_GET_STRUCT_TLVLEN |
| 392 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 393 | |
| 394 | WMITLV_SET_HDR(&chan->tlv_header, |
| 395 | WMITLV_TAG_STRUC_wmi_channel, |
| 396 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 397 | |
| 398 | cmd->vdev_id = restart_params->session_id; |
| 399 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 400 | qdf_mem_copy(cmd->ssid.ssid, |
| 401 | restart_params->ssid, |
| 402 | cmd->ssid.ssid_len); |
| 403 | cmd->flags = restart_params->flags; |
| 404 | cmd->requestor_id = restart_params->requestor_id; |
| 405 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 406 | |
| 407 | chan->mhz = restart_params->mhz; |
| 408 | chan->band_center_freq1 = |
| 409 | restart_params->band_center_freq1; |
| 410 | chan->band_center_freq2 = |
| 411 | restart_params->band_center_freq2; |
| 412 | chan->info = restart_params->info; |
| 413 | chan->reg_info_1 = restart_params->reg_info_1; |
| 414 | chan->reg_info_2 = restart_params->reg_info_2; |
| 415 | |
| 416 | cmd->num_noa_descriptors = 0; |
| 417 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 418 | sizeof(wmi_channel)); |
| 419 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 420 | cmd->num_noa_descriptors * |
| 421 | sizeof(wmi_p2p_noa_descriptor)); |
| 422 | |
| 423 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 424 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 425 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 426 | wmi_buf_free(buf); |
| 427 | return QDF_STATUS_E_FAILURE; |
| 428 | } |
| 429 | return QDF_STATUS_SUCCESS; |
| 430 | } |
| 431 | |
| 432 | |
| 433 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 434 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 435 | * @wmi: wmi handle |
| 436 | * @peer_addr: peer mac address |
| 437 | * @param: pointer to hold peer flush tid parameter |
| 438 | * |
| 439 | * Return: 0 for sucess or error code |
| 440 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 441 | QDF_STATUS send_peer_flush_tids_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 442 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 443 | struct peer_flush_params *param) |
| 444 | { |
| 445 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 446 | wmi_buf_t buf; |
| 447 | int32_t len = sizeof(*cmd); |
| 448 | |
| 449 | buf = wmi_buf_alloc(wmi, len); |
| 450 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 451 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 452 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 453 | } |
| 454 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 455 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 456 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 457 | WMITLV_GET_STRUCT_TLVLEN |
| 458 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 459 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 460 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 461 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 462 | 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] | 463 | peer_addr, param->vdev_id, |
| 464 | param->peer_tid_bitmap); |
| 465 | 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] | 466 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 467 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 468 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 469 | } |
| 470 | |
| 471 | return 0; |
| 472 | } |
| 473 | |
| 474 | /** |
| 475 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 476 | * @wmi: wmi handle |
| 477 | * @peer_addr: peer mac addr |
| 478 | * @vdev_id: vdev id |
| 479 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 480 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 481 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 482 | QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 483 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 484 | uint8_t vdev_id) |
| 485 | { |
| 486 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 487 | wmi_buf_t buf; |
| 488 | int32_t len = sizeof(*cmd); |
| 489 | buf = wmi_buf_alloc(wmi, len); |
| 490 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 491 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 492 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 493 | } |
| 494 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 495 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 496 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 497 | WMITLV_GET_STRUCT_TLVLEN |
| 498 | (wmi_peer_delete_cmd_fixed_param)); |
| 499 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 500 | cmd->vdev_id = vdev_id; |
| 501 | |
| 502 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 503 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 504 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 505 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 506 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 507 | 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] | 508 | |
| 509 | return 0; |
| 510 | } |
| 511 | |
| 512 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 513 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 514 | * to target id. |
| 515 | * @targ_paramid: Target parameter id to hold the result. |
| 516 | * @peer_param_id: host param id. |
| 517 | * |
| 518 | * Return: QDF_STATUS_SUCCESS for success |
| 519 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
| 520 | */ |
| 521 | #ifdef CONFIG_MCL |
| 522 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 523 | uint32_t *targ_paramid, |
| 524 | uint32_t peer_param_id) |
| 525 | { |
| 526 | *targ_paramid = peer_param_id; |
| 527 | return QDF_STATUS_SUCCESS; |
| 528 | } |
| 529 | #else |
| 530 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 531 | uint32_t *targ_paramid, |
| 532 | uint32_t peer_param_id) |
| 533 | { |
| 534 | switch (peer_param_id) { |
| 535 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 536 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 537 | break; |
| 538 | case WMI_HOST_PEER_AMPDU: |
| 539 | *targ_paramid = WMI_PEER_AMPDU; |
| 540 | break; |
| 541 | case WMI_HOST_PEER_AUTHORIZE: |
| 542 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 543 | break; |
| 544 | case WMI_HOST_PEER_CHWIDTH: |
| 545 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 546 | break; |
| 547 | case WMI_HOST_PEER_NSS: |
| 548 | *targ_paramid = WMI_PEER_NSS; |
| 549 | break; |
| 550 | case WMI_HOST_PEER_USE_4ADDR: |
| 551 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 552 | break; |
| 553 | case WMI_HOST_PEER_MEMBERSHIP: |
| 554 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 555 | break; |
| 556 | case WMI_HOST_PEER_USERPOS: |
| 557 | *targ_paramid = WMI_PEER_USERPOS; |
| 558 | break; |
| 559 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 560 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 561 | break; |
| 562 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 563 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 564 | break; |
| 565 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 566 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 567 | break; |
| 568 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 569 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 570 | break; |
| 571 | case WMI_HOST_PEER_PHYMODE: |
| 572 | *targ_paramid = WMI_PEER_PHYMODE; |
| 573 | break; |
| 574 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 575 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 576 | break; |
| 577 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 578 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 579 | break; |
| 580 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 581 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 582 | break; |
| 583 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 584 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 585 | break; |
| 586 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 587 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 588 | break; |
| 589 | default: |
| 590 | return QDF_STATUS_E_NOSUPPORT; |
| 591 | } |
| 592 | |
| 593 | return QDF_STATUS_SUCCESS; |
| 594 | } |
| 595 | #endif |
| 596 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 597 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 598 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 599 | * @peer_addr: peer mac address |
| 600 | * @param : pointer to hold peer set parameter |
| 601 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 602 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 603 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 604 | QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 605 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 606 | struct peer_set_params *param) |
| 607 | { |
| 608 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 609 | wmi_buf_t buf; |
| 610 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 611 | uint32_t param_id; |
| 612 | |
| 613 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 614 | param->param_id) != QDF_STATUS_SUCCESS) |
| 615 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 616 | |
| 617 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 618 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 619 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 620 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 621 | } |
| 622 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 623 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 624 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 625 | WMITLV_GET_STRUCT_TLVLEN |
| 626 | (wmi_peer_set_param_cmd_fixed_param)); |
| 627 | cmd->vdev_id = param->vdev_id; |
| 628 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 629 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 630 | cmd->param_value = param->param_value; |
| 631 | err = wmi_unified_cmd_send(wmi, buf, |
| 632 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 633 | WMI_PEER_SET_PARAM_CMDID); |
| 634 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 635 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 636 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 637 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 638 | } |
| 639 | |
| 640 | return 0; |
| 641 | } |
| 642 | |
| 643 | /** |
| 644 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 645 | * @wmi: wmi handle |
| 646 | * @bssid: bssid |
| 647 | * @vdev_up_params: pointer to hold vdev up parameter |
| 648 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 649 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 650 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 651 | QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 652 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 653 | struct vdev_up_params *params) |
| 654 | { |
| 655 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 656 | wmi_buf_t buf; |
| 657 | int32_t len = sizeof(*cmd); |
| 658 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 659 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 660 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 661 | params->vdev_id, params->assoc_id, bssid); |
| 662 | buf = wmi_buf_alloc(wmi, len); |
| 663 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 664 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 665 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 666 | } |
| 667 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 668 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 669 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 670 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 671 | cmd->vdev_id = params->vdev_id; |
| 672 | cmd->vdev_assoc_id = params->assoc_id; |
| 673 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 674 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 675 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 676 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 677 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 678 | } |
| 679 | |
| 680 | return 0; |
| 681 | } |
| 682 | |
| 683 | /** |
| 684 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 685 | * @wmi: wmi handle |
| 686 | * @peer_addr: peer mac address |
| 687 | * @peer_type: peer type |
| 688 | * @vdev_id: vdev id |
| 689 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 690 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 691 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 692 | QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 693 | struct peer_create_params *param) |
| 694 | { |
| 695 | wmi_peer_create_cmd_fixed_param *cmd; |
| 696 | wmi_buf_t buf; |
| 697 | int32_t len = sizeof(*cmd); |
| 698 | |
| 699 | buf = wmi_buf_alloc(wmi, len); |
| 700 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 701 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 702 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 703 | } |
| 704 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 705 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 706 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 707 | WMITLV_GET_STRUCT_TLVLEN |
| 708 | (wmi_peer_create_cmd_fixed_param)); |
| 709 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 710 | cmd->peer_type = param->peer_type; |
| 711 | cmd->vdev_id = param->vdev_id; |
| 712 | |
| 713 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 714 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 715 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 716 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 717 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 718 | 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] | 719 | param->vdev_id); |
| 720 | |
| 721 | return 0; |
| 722 | } |
| 723 | |
| 724 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 725 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 726 | * command to fw |
| 727 | * @wmi: wmi handle |
| 728 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 729 | * |
| 730 | * Return: 0 for success or error code |
| 731 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 732 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 733 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 734 | struct rx_reorder_queue_setup_params *param) |
| 735 | { |
| 736 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 737 | wmi_buf_t buf; |
| 738 | int32_t len = sizeof(*cmd); |
| 739 | |
| 740 | buf = wmi_buf_alloc(wmi, len); |
| 741 | if (!buf) { |
| 742 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 743 | return QDF_STATUS_E_NOMEM; |
| 744 | } |
| 745 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 746 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 747 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 748 | WMITLV_GET_STRUCT_TLVLEN |
| 749 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 750 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 751 | cmd->vdev_id = param->vdev_id; |
| 752 | cmd->tid = param->tid; |
| 753 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 754 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 755 | cmd->queue_no = param->queue_no; |
| 756 | |
| 757 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 758 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 759 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 760 | __func__); |
| 761 | qdf_nbuf_free(buf); |
| 762 | return QDF_STATUS_E_FAILURE; |
| 763 | } |
| 764 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 765 | param->peer_macaddr, param->vdev_id, param->tid); |
| 766 | |
| 767 | return QDF_STATUS_SUCCESS; |
| 768 | } |
| 769 | |
| 770 | /** |
| 771 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 772 | * command to fw |
| 773 | * @wmi: wmi handle |
| 774 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 775 | * |
| 776 | * Return: 0 for success or error code |
| 777 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 778 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 779 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 780 | struct rx_reorder_queue_remove_params *param) |
| 781 | { |
| 782 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 783 | wmi_buf_t buf; |
| 784 | int32_t len = sizeof(*cmd); |
| 785 | |
| 786 | buf = wmi_buf_alloc(wmi, len); |
| 787 | if (!buf) { |
| 788 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 789 | return QDF_STATUS_E_NOMEM; |
| 790 | } |
| 791 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 792 | wmi_buf_data(buf); |
| 793 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 794 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 795 | WMITLV_GET_STRUCT_TLVLEN |
| 796 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 797 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 798 | cmd->vdev_id = param->vdev_id; |
| 799 | cmd->tid_mask = param->peer_tid_bitmap; |
| 800 | |
| 801 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 802 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 803 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 804 | __func__); |
| 805 | qdf_nbuf_free(buf); |
| 806 | return QDF_STATUS_E_FAILURE; |
| 807 | } |
| 808 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 809 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 810 | |
| 811 | return QDF_STATUS_SUCCESS; |
| 812 | } |
| 813 | |
| 814 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 815 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 816 | * @wmi_handle: wmi handle |
| 817 | * @value: value |
| 818 | * @mac_id: mac id to have radio context |
| 819 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 820 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 821 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 822 | 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] | 823 | uint32_t value, uint8_t mac_id) |
| 824 | { |
| 825 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 826 | wmi_buf_t buf; |
| 827 | int32_t len = sizeof(*cmd); |
| 828 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 829 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 830 | |
| 831 | buf = wmi_buf_alloc(wmi_handle, len); |
| 832 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 833 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 834 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 835 | } |
| 836 | |
| 837 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 838 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 839 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 840 | WMITLV_GET_STRUCT_TLVLEN |
| 841 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 842 | cmd->pdev_id = 0; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 843 | cmd->enable = value; |
| 844 | |
| 845 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 846 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 847 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 848 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 849 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 850 | } |
| 851 | |
| 852 | return 0; |
| 853 | } |
| 854 | |
| 855 | /** |
| 856 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 857 | * @wmi_handle: wmi handle |
| 858 | * @param: pointer to pdev_utf_params |
| 859 | * @mac_id: mac id to have radio context |
| 860 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 861 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 862 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 863 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 864 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 865 | struct pdev_utf_params *param, |
| 866 | uint8_t mac_id) |
| 867 | { |
| 868 | wmi_buf_t buf; |
| 869 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 870 | /* if param->len is 0 no data is sent, return error */ |
| 871 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 872 | static uint8_t msgref = 1; |
| 873 | uint8_t segNumber = 0, segInfo, numSegments; |
| 874 | uint16_t chunk_len, total_bytes; |
| 875 | uint8_t *bufpos; |
| 876 | struct seg_hdr_info segHdrInfo; |
| 877 | |
| 878 | bufpos = param->utf_payload; |
| 879 | total_bytes = param->len; |
| 880 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 881 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 882 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 883 | |
| 884 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 885 | numSegments++; |
| 886 | |
| 887 | while (param->len) { |
| 888 | if (param->len > MAX_WMI_UTF_LEN) |
| 889 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 890 | else |
| 891 | chunk_len = param->len; |
| 892 | |
| 893 | buf = wmi_buf_alloc(wmi_handle, |
| 894 | (chunk_len + sizeof(segHdrInfo) + |
| 895 | WMI_TLV_HDR_SIZE)); |
| 896 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 897 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 898 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 899 | } |
| 900 | |
| 901 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 902 | |
| 903 | segHdrInfo.len = total_bytes; |
| 904 | segHdrInfo.msgref = msgref; |
| 905 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 906 | segHdrInfo.segmentInfo = segInfo; |
| 907 | segHdrInfo.pad = 0; |
| 908 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 909 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 910 | " segHdrInfo.segmentInfo = %d", |
| 911 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 912 | segHdrInfo.segmentInfo); |
| 913 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 914 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 915 | "chunk len %d", __func__, total_bytes, segNumber, |
| 916 | numSegments, chunk_len); |
| 917 | |
| 918 | segNumber++; |
| 919 | |
| 920 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 921 | (chunk_len + sizeof(segHdrInfo))); |
| 922 | cmd += WMI_TLV_HDR_SIZE; |
| 923 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 924 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 925 | |
| 926 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 927 | (chunk_len + sizeof(segHdrInfo) + |
| 928 | WMI_TLV_HDR_SIZE), |
| 929 | WMI_PDEV_UTF_CMDID); |
| 930 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 931 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 932 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 933 | wmi_buf_free(buf); |
| 934 | break; |
| 935 | } |
| 936 | |
| 937 | param->len -= chunk_len; |
| 938 | bufpos += chunk_len; |
| 939 | } |
| 940 | |
| 941 | msgref++; |
| 942 | |
| 943 | return ret; |
| 944 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 945 | #ifdef CONFIG_MCL |
| 946 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 947 | uint32_t host_param) |
| 948 | { |
| 949 | return host_param; |
| 950 | } |
| 951 | #else |
| 952 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 953 | uint32_t host_param) |
| 954 | { |
| 955 | if (host_param < wmi_pdev_param_max) |
| 956 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 957 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 958 | return WMI_UNAVAILABLE_PARAM; |
| 959 | } |
| 960 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 961 | /** |
| 962 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 963 | * @wmi_handle: wmi handle |
| 964 | * @param: pointer to pdev parameter |
| 965 | * @mac_id: radio context |
| 966 | * |
| 967 | * Return: 0 on success, errno on failure |
| 968 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 969 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 970 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 971 | struct pdev_params *param, |
| 972 | uint8_t mac_id) |
| 973 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 974 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 975 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 976 | wmi_buf_t buf; |
| 977 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 978 | uint32_t pdev_param; |
| 979 | |
| 980 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 981 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 982 | WMI_LOGW("%s: Unavailable param %d\n", |
| 983 | __func__, param->param_id); |
| 984 | return QDF_STATUS_E_INVAL; |
| 985 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 986 | |
| 987 | buf = wmi_buf_alloc(wmi_handle, len); |
| 988 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 989 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 990 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 991 | } |
| 992 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 993 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 994 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 995 | WMITLV_GET_STRUCT_TLVLEN |
| 996 | (wmi_pdev_set_param_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 997 | cmd->pdev_id = 0; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 998 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 999 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1000 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1001 | param->param_value); |
| 1002 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1003 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1004 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1005 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1006 | wmi_buf_free(buf); |
| 1007 | } |
| 1008 | return ret; |
| 1009 | } |
| 1010 | |
| 1011 | /** |
| 1012 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1013 | * @param wmi_handle : handle to WMI. |
| 1014 | * @param param : pointer to hold suspend parameter |
| 1015 | * @mac_id: radio context |
| 1016 | * |
| 1017 | * Return 0 on success and -ve on failure. |
| 1018 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1019 | QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1020 | struct suspend_params *param, |
| 1021 | uint8_t mac_id) |
| 1022 | { |
| 1023 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1024 | wmi_buf_t wmibuf; |
| 1025 | uint32_t len = sizeof(*cmd); |
| 1026 | int32_t ret; |
| 1027 | |
| 1028 | /* |
| 1029 | * send the comand to Target to ignore the |
| 1030 | * PCIE reset so as to ensure that Host and target |
| 1031 | * states are in sync |
| 1032 | */ |
| 1033 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1034 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1035 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1036 | |
| 1037 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1038 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1039 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1040 | WMITLV_GET_STRUCT_TLVLEN |
| 1041 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1042 | if (param->disable_target_intr) |
| 1043 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1044 | else |
| 1045 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
| 1046 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1047 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1048 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1049 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1050 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1051 | } |
| 1052 | |
| 1053 | return ret; |
| 1054 | } |
| 1055 | |
| 1056 | /** |
| 1057 | * send_resume_cmd_tlv() - WMI resume function |
| 1058 | * @param wmi_handle : handle to WMI. |
| 1059 | * @mac_id: radio context |
| 1060 | * |
| 1061 | * Return: 0 on success and -ve on failure. |
| 1062 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1063 | QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1064 | uint8_t mac_id) |
| 1065 | { |
| 1066 | wmi_buf_t wmibuf; |
| 1067 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1068 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1069 | |
| 1070 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1071 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1072 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1073 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1074 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1075 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1076 | WMITLV_GET_STRUCT_TLVLEN |
| 1077 | (wmi_pdev_resume_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 1078 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1079 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1080 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1081 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1082 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1083 | wmi_buf_free(wmibuf); |
| 1084 | } |
| 1085 | |
| 1086 | return ret; |
| 1087 | } |
| 1088 | |
| 1089 | /** |
| 1090 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1091 | * @param wmi_handle : handle to WMI. |
| 1092 | * @param param : pointer to hold wow enable parameter |
| 1093 | * @mac_id: radio context |
| 1094 | * |
| 1095 | * Return: 0 on success and -ve on failure. |
| 1096 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1097 | QDF_STATUS send_wow_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1098 | struct wow_cmd_params *param, |
| 1099 | uint8_t mac_id) |
| 1100 | { |
| 1101 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1102 | wmi_buf_t buf; |
| 1103 | int32_t len; |
| 1104 | int32_t ret; |
| 1105 | |
| 1106 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1107 | |
| 1108 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1109 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1110 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1111 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1112 | } |
| 1113 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1114 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1115 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1116 | WMITLV_GET_STRUCT_TLVLEN |
| 1117 | (wmi_wow_enable_cmd_fixed_param)); |
| 1118 | cmd->enable = param->enable; |
| 1119 | if (param->can_suspend_link) |
| 1120 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1121 | else |
| 1122 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
| 1123 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1124 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1125 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1126 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1127 | |
| 1128 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1129 | WMI_WOW_ENABLE_CMDID); |
| 1130 | if (ret) |
| 1131 | wmi_buf_free(buf); |
| 1132 | |
| 1133 | return ret; |
| 1134 | } |
| 1135 | |
| 1136 | /** |
| 1137 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1138 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1139 | * @peer_addr: peer mac address |
| 1140 | * @param: pointer to ap_ps parameter structure |
| 1141 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1142 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1143 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1144 | 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] | 1145 | uint8_t *peer_addr, |
| 1146 | struct ap_ps_params *param) |
| 1147 | { |
| 1148 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1149 | wmi_buf_t buf; |
| 1150 | int32_t err; |
| 1151 | |
| 1152 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1153 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1154 | 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] | 1155 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1156 | } |
| 1157 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1158 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1159 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1160 | WMITLV_GET_STRUCT_TLVLEN |
| 1161 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1162 | cmd->vdev_id = param->vdev_id; |
| 1163 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1164 | cmd->param = param->param; |
| 1165 | cmd->value = param->value; |
| 1166 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1167 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1168 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1169 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1170 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1171 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1172 | } |
| 1173 | |
| 1174 | return 0; |
| 1175 | } |
| 1176 | |
| 1177 | /** |
| 1178 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1179 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1180 | * @peer_addr: peer mac address |
| 1181 | * @param: pointer to sta_ps parameter structure |
| 1182 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1183 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1184 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1185 | 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] | 1186 | struct sta_ps_params *param) |
| 1187 | { |
| 1188 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1189 | wmi_buf_t buf; |
| 1190 | int32_t len = sizeof(*cmd); |
| 1191 | |
| 1192 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1193 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1194 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1195 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1196 | } |
| 1197 | |
| 1198 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1199 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1200 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1201 | WMITLV_GET_STRUCT_TLVLEN |
| 1202 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1203 | cmd->vdev_id = param->vdev_id; |
| 1204 | cmd->param = param->param; |
| 1205 | cmd->value = param->value; |
| 1206 | |
| 1207 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1208 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1209 | 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] | 1210 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1211 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1212 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1213 | } |
| 1214 | |
| 1215 | return 0; |
| 1216 | } |
| 1217 | |
| 1218 | /** |
| 1219 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1220 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1221 | * @param: ponirt to crash inject paramter structure |
| 1222 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1223 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1224 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1225 | QDF_STATUS send_crash_inject_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1226 | struct crash_inject *param) |
| 1227 | { |
| 1228 | int32_t ret = 0; |
| 1229 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1230 | uint16_t len = sizeof(*cmd); |
| 1231 | wmi_buf_t buf; |
| 1232 | |
| 1233 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1234 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1235 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1236 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1237 | } |
| 1238 | |
| 1239 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1240 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1241 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1242 | WMITLV_GET_STRUCT_TLVLEN |
| 1243 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1244 | cmd->type = param->type; |
| 1245 | cmd->delay_time_ms = param->delay_time_ms; |
| 1246 | |
| 1247 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1248 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1249 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1250 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1251 | __func__, ret); |
| 1252 | wmi_buf_free(buf); |
| 1253 | } |
| 1254 | |
| 1255 | return ret; |
| 1256 | } |
| 1257 | |
| 1258 | /** |
| 1259 | * send_dbglog_cmd_tlv() - set debug log level |
| 1260 | * @param wmi_handle : handle to WMI. |
| 1261 | * @param param : pointer to hold dbglog level parameter |
| 1262 | * |
| 1263 | * Return: 0 on success and -ve on failure. |
| 1264 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1265 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1266 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1267 | struct dbglog_params *dbglog_param) |
| 1268 | { |
| 1269 | wmi_buf_t buf; |
| 1270 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
| 1271 | A_STATUS status = A_OK; |
| 1272 | int32_t i; |
| 1273 | int32_t len; |
| 1274 | int8_t *buf_ptr; |
| 1275 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1276 | |
| 1277 | ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
| 1278 | |
| 1279 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1280 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1281 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1282 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1283 | if (buf == NULL) |
| 1284 | return A_NO_MEMORY; |
| 1285 | |
| 1286 | configmsg = |
| 1287 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1288 | buf_ptr = (int8_t *) configmsg; |
| 1289 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1290 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1291 | WMITLV_GET_STRUCT_TLVLEN |
| 1292 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1293 | configmsg->dbg_log_param = dbglog_param->param; |
| 1294 | configmsg->value = dbglog_param->val; |
| 1295 | /* Filling in the data part of second tlv -- should |
| 1296 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1297 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1298 | sizeof |
| 1299 | (wmi_debug_log_config_cmd_fixed_param) |
| 1300 | + WMI_TLV_HDR_SIZE); |
| 1301 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1302 | WMITLV_TAG_ARRAY_UINT32, |
| 1303 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1304 | if (dbglog_param->module_id_bitmap) { |
| 1305 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1306 | module_id_bitmap_array[i] = |
| 1307 | dbglog_param->module_id_bitmap[i]; |
| 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1312 | len, WMI_DBGLOG_CFG_CMDID); |
| 1313 | |
| 1314 | if (status != A_OK) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1315 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1316 | |
| 1317 | return status; |
| 1318 | } |
| 1319 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1320 | #ifdef CONFIG_MCL |
| 1321 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1322 | uint32_t host_param) |
| 1323 | { |
| 1324 | return host_param; |
| 1325 | } |
| 1326 | #else |
| 1327 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1328 | uint32_t host_param) |
| 1329 | { |
| 1330 | if (host_param < wmi_vdev_param_max) |
| 1331 | return wmi_handle->vdev_param[host_param]; |
| 1332 | |
| 1333 | return WMI_UNAVAILABLE_PARAM; |
| 1334 | } |
| 1335 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1336 | /** |
| 1337 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1338 | * @param wmi_handle : handle to WMI. |
| 1339 | * @param macaddr : MAC address |
| 1340 | * @param param : pointer to hold vdev set parameter |
| 1341 | * |
| 1342 | * Return: 0 on success and -ve on failure. |
| 1343 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1344 | 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] | 1345 | struct vdev_set_params *param) |
| 1346 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1347 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1348 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1349 | wmi_buf_t buf; |
| 1350 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1351 | uint32_t vdev_param; |
| 1352 | |
| 1353 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1354 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1355 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1356 | param->param_id); |
| 1357 | return QDF_STATUS_E_INVAL; |
| 1358 | |
| 1359 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1360 | |
| 1361 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1362 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1363 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1364 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1365 | } |
| 1366 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1367 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1368 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1369 | WMITLV_GET_STRUCT_TLVLEN |
| 1370 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1371 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1372 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1373 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1374 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1375 | param->if_id, param->param_id, param->param_value); |
| 1376 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1377 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1378 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1379 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1380 | wmi_buf_free(buf); |
| 1381 | } |
| 1382 | |
| 1383 | return ret; |
| 1384 | } |
| 1385 | |
| 1386 | /** |
| 1387 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1388 | * @param wmi_handle : handle to WMI. |
| 1389 | * @param macaddr : MAC address |
| 1390 | * @param param : pointer to hold stats request parameter |
| 1391 | * |
| 1392 | * Return: 0 on success and -ve on failure. |
| 1393 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1394 | QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1395 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1396 | struct stats_request_params *param) |
| 1397 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1398 | int32_t ret; |
| 1399 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1400 | wmi_buf_t buf; |
| 1401 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1402 | |
| 1403 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1404 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1405 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1406 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1407 | } |
| 1408 | |
| 1409 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1410 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1411 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1412 | WMITLV_GET_STRUCT_TLVLEN |
| 1413 | (wmi_request_stats_cmd_fixed_param)); |
| 1414 | cmd->stats_id = param->stats_id; |
| 1415 | cmd->vdev_id = param->vdev_id; |
| 1416 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1417 | WMI_REQUEST_STATS_CMDID); |
| 1418 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1419 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1420 | wmi_buf_free(buf); |
| 1421 | } |
| 1422 | |
| 1423 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1424 | } |
| 1425 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1426 | #ifdef CONFIG_WIN |
| 1427 | /** |
| 1428 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1429 | * @param wmi_handle : handle to WMI. |
| 1430 | * @param macaddr : MAC address |
| 1431 | * @param param : pointer to hold stats request parameter |
| 1432 | * |
| 1433 | * Return: 0 on success and -ve on failure. |
| 1434 | */ |
| 1435 | QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1436 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT) |
| 1437 | { |
| 1438 | return 0; |
| 1439 | } |
| 1440 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1441 | /** |
| 1442 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1443 | * @param wmi_handle : handle to WMI. |
| 1444 | * @param macaddr : MAC address |
| 1445 | * @param param : pointer to hold stats request parameter |
| 1446 | * |
| 1447 | * Return: 0 on success and -ve on failure. |
| 1448 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1449 | 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] | 1450 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1451 | struct packet_enable_params *param) |
| 1452 | { |
| 1453 | return 0; |
| 1454 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1455 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1456 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1457 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1458 | /** |
| 1459 | * send_beacon_send_cmd_tlv() - WMI beacon send function |
| 1460 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1461 | * @param param : pointer to hold beacon send cmd parameter |
| 1462 | * |
| 1463 | * Return: 0 on success and -ve on failure. |
| 1464 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1465 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1466 | struct beacon_params *param) |
| 1467 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1468 | int32_t ret; |
| 1469 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1470 | wmi_bcn_prb_info *bcn_prb_info; |
| 1471 | wmi_buf_t wmi_buf; |
| 1472 | uint8_t *buf_ptr; |
| 1473 | uint32_t wmi_buf_len; |
| 1474 | |
| 1475 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1476 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1477 | param->tmpl_len_aligned; |
| 1478 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1479 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1480 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1481 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1482 | } |
| 1483 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1484 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1485 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1486 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1487 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1488 | cmd->vdev_id = param->vdev_id; |
| 1489 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1490 | cmd->buf_len = param->tmpl_len; |
| 1491 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1492 | |
| 1493 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1494 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1495 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1496 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1497 | bcn_prb_info->caps = 0; |
| 1498 | bcn_prb_info->erp = 0; |
| 1499 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1500 | |
| 1501 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1502 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1503 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1504 | |
| 1505 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1506 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1507 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1508 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1509 | wmi_buf_free(wmi_buf); |
| 1510 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1511 | return 0; |
| 1512 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1513 | #else |
| 1514 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1515 | struct beacon_params *param) |
| 1516 | { |
| 1517 | return 0; |
| 1518 | } |
| 1519 | |
| 1520 | /** |
| 1521 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1522 | * @param wmi_handle : handle to WMI. |
| 1523 | * @param param : pointer to hold beacon send cmd parameter |
| 1524 | * |
| 1525 | * Return: 0 on success and -ve on failure. |
| 1526 | */ |
| 1527 | QDF_STATUS send_beacon_tmpl_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1528 | struct beacon_tmpl_params *param) |
| 1529 | { |
| 1530 | int32_t ret; |
| 1531 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1532 | wmi_bcn_prb_info *bcn_prb_info; |
| 1533 | wmi_buf_t wmi_buf; |
| 1534 | uint8_t *buf_ptr; |
| 1535 | uint32_t wmi_buf_len; |
| 1536 | |
| 1537 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1538 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1539 | param->tmpl_len_aligned; |
| 1540 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1541 | if (!wmi_buf) { |
| 1542 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1543 | return QDF_STATUS_E_NOMEM; |
| 1544 | } |
| 1545 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1546 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1547 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1548 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1549 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1550 | cmd->vdev_id = param->vdev_id; |
| 1551 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1552 | cmd->buf_len = param->tmpl_len; |
| 1553 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1554 | |
| 1555 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1556 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1557 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1558 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1559 | bcn_prb_info->caps = 0; |
| 1560 | bcn_prb_info->erp = 0; |
| 1561 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1562 | |
| 1563 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1564 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1565 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1566 | |
| 1567 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1568 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1569 | if (ret) { |
| 1570 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1571 | wmi_buf_free(wmi_buf); |
| 1572 | } |
| 1573 | return 0; |
| 1574 | } |
| 1575 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1576 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1577 | #ifdef CONFIG_MCL |
| 1578 | static inline void copy_peer_flags_tlv( |
| 1579 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1580 | struct peer_assoc_params *param) |
| 1581 | { |
| 1582 | cmd->peer_flags = param->peer_flags; |
| 1583 | } |
| 1584 | #else |
| 1585 | static inline void copy_peer_flags_tlv( |
| 1586 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1587 | struct peer_assoc_params *param) |
| 1588 | { |
| 1589 | /* |
| 1590 | * The target only needs a subset of the flags maintained in the host. |
| 1591 | * Just populate those flags and send it down |
| 1592 | */ |
| 1593 | cmd->peer_flags = 0; |
| 1594 | |
| 1595 | /* |
| 1596 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1597 | */ |
| 1598 | if (param->is_wme_set) { |
| 1599 | |
| 1600 | if (param->qos_flag) |
| 1601 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1602 | if (param->apsd_flag) |
| 1603 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1604 | if (param->ht_flag) |
| 1605 | cmd->peer_flags |= WMI_PEER_HT; |
| 1606 | if (param->bw_40) |
| 1607 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1608 | if (param->bw_80) |
| 1609 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1610 | if (param->bw_160) |
| 1611 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1612 | |
| 1613 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1614 | * for HT as well |
| 1615 | **/ |
| 1616 | if (param->stbc_flag) |
| 1617 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1618 | |
| 1619 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1620 | * for HT as well |
| 1621 | **/ |
| 1622 | if (param->ldpc_flag) |
| 1623 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1624 | |
| 1625 | if (param->static_mimops_flag) |
| 1626 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1627 | if (param->dynamic_mimops_flag) |
| 1628 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1629 | if (param->spatial_mux_flag) |
| 1630 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1631 | if (param->vht_flag) |
| 1632 | cmd->peer_flags |= WMI_PEER_VHT; |
| 1633 | } |
| 1634 | /* |
| 1635 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1636 | * (during re-association). |
| 1637 | * Authorization will be done for these modes on key installation. |
| 1638 | */ |
| 1639 | if (param->auth_flag) |
| 1640 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1641 | if (param->need_ptk_4_way) |
| 1642 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1643 | else |
| 1644 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1645 | if (param->need_gtk_2_way) |
| 1646 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1647 | /* safe mode bypass the 4-way handshake */ |
| 1648 | if (param->safe_mode_enabled) |
| 1649 | cmd->peer_flags &= |
| 1650 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1651 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1652 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1653 | * it |
| 1654 | * if (param->amsdu_disable) Add after FW support |
| 1655 | **/ |
| 1656 | |
| 1657 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1658 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1659 | * iwpriv |
| 1660 | **/ |
| 1661 | if (param->peer_ht_rates.num_rates == 0) |
| 1662 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1663 | } |
| 1664 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1665 | /** |
| 1666 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1667 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1668 | * @param param : pointer to peer assoc parameter |
| 1669 | * |
| 1670 | * Return: 0 on success and -ve on failure. |
| 1671 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1672 | QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1673 | struct peer_assoc_params *param) |
| 1674 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1675 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1676 | wmi_vht_rate_set *mcs; |
| 1677 | wmi_buf_t buf; |
| 1678 | int32_t len; |
| 1679 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1680 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1681 | uint32_t peer_legacy_rates_align; |
| 1682 | uint32_t peer_ht_rates_align; |
| 1683 | |
| 1684 | |
| 1685 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1686 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1687 | |
| 1688 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1689 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1690 | WMI_TLV_HDR_SIZE + |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1691 | (peer_ht_rates_align * sizeof(uint8_t)) + |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1692 | sizeof(wmi_vht_rate_set); |
| 1693 | |
| 1694 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1695 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1696 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1697 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1698 | } |
| 1699 | |
| 1700 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1701 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1702 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1703 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1704 | WMITLV_GET_STRUCT_TLVLEN |
| 1705 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1706 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1707 | cmd->vdev_id = param->vdev_id; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1708 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1709 | sizeof(param->peer_macaddr)); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1710 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1711 | cmd->peer_associd = param->peer_associd; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1712 | copy_peer_flags_tlv(cmd, param); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1713 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1714 | cmd->peer_caps = param->peer_caps; |
| 1715 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1716 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1717 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1718 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1719 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1720 | cmd->peer_phymode = param->peer_phymode; |
| 1721 | |
| 1722 | /* Update peer legacy rate information */ |
| 1723 | buf_ptr += sizeof(*cmd); |
| 1724 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1725 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1726 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1727 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1728 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1729 | param->peer_legacy_rates.num_rates); |
| 1730 | |
| 1731 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1732 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1733 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1734 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1735 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1736 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1737 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1738 | param->peer_ht_rates.num_rates); |
| 1739 | |
| 1740 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1741 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1742 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 1743 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 1744 | |
| 1745 | cmd->peer_nss = param->peer_nss; |
| 1746 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 1747 | if (param->vht_capable) { |
| 1748 | mcs->rx_max_rate = param->rx_max_rate; |
| 1749 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 1750 | mcs->tx_max_rate = param->tx_max_rate; |
| 1751 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 1752 | } |
| 1753 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1754 | 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] | 1755 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 1756 | "nss %d phymode %d peer_mpdu_density %d " |
| 1757 | "cmd->peer_vht_caps %x", __func__, |
| 1758 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 1759 | cmd->peer_rate_caps, cmd->peer_caps, |
| 1760 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 1761 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 1762 | cmd->peer_mpdu_density, |
| 1763 | cmd->peer_vht_caps); |
| 1764 | |
| 1765 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1766 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1767 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1768 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1769 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1770 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1771 | } |
| 1772 | |
| 1773 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1774 | } |
| 1775 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1776 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 1777 | */ |
| 1778 | #ifdef CONFIG_MCL |
| 1779 | static inline void copy_scan_notify_ev_flags( |
| 1780 | wmi_start_scan_cmd_fixed_param * cmd, |
| 1781 | struct scan_start_params *params) |
| 1782 | { |
| 1783 | cmd->notify_scan_events = params->notify_scan_events; |
| 1784 | cmd->scan_ctrl_flags = params->scan_ctrl_flags; |
| 1785 | } |
| 1786 | #else |
| 1787 | static inline void copy_scan_notify_ev_flags( |
| 1788 | wmi_start_scan_cmd_fixed_param * cmd, |
| 1789 | struct scan_start_params *params) |
| 1790 | { |
| 1791 | cmd->notify_scan_events = WMI_SCAN_EVENT_STARTED | |
| 1792 | WMI_SCAN_EVENT_COMPLETED | |
| 1793 | WMI_SCAN_EVENT_BSS_CHANNEL | |
| 1794 | WMI_SCAN_EVENT_FOREIGN_CHANNEL | |
| 1795 | WMI_SCAN_EVENT_DEQUEUED |
| 1796 | ; |
| 1797 | cmd->scan_ctrl_flags = params->scan_ctrl_flags; |
| 1798 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
| 1799 | |
| 1800 | if (params->is_phy_error) |
| 1801 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
| 1802 | } |
| 1803 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1804 | /** |
| 1805 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 1806 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1807 | * @param param : pointer to hold scan start cmd parameter |
| 1808 | * |
| 1809 | * Return: 0 on success and -ve on failure. |
| 1810 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1811 | QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1812 | struct scan_start_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1813 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1814 | int32_t ret = 0; |
| 1815 | int32_t i; |
| 1816 | wmi_buf_t wmi_buf; |
| 1817 | wmi_start_scan_cmd_fixed_param *cmd; |
| 1818 | uint8_t *buf_ptr; |
| 1819 | uint32_t *tmp_ptr; |
| 1820 | wmi_ssid *ssid = NULL; |
| 1821 | wmi_mac_addr *bssid; |
| 1822 | int len = sizeof(*cmd); |
| 1823 | |
| 1824 | /* Length TLV placeholder for array of uint32_t */ |
| 1825 | len += WMI_TLV_HDR_SIZE; |
| 1826 | /* calculate the length of buffer required */ |
| 1827 | if (params->num_chan) |
| 1828 | len += params->num_chan * sizeof(uint32_t); |
| 1829 | |
| 1830 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 1831 | len += WMI_TLV_HDR_SIZE; |
| 1832 | if (params->num_ssids) |
| 1833 | len += params->num_ssids * sizeof(wmi_ssid); |
| 1834 | |
| 1835 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 1836 | len += WMI_TLV_HDR_SIZE; |
| 1837 | len += sizeof(wmi_mac_addr); |
| 1838 | |
| 1839 | /* Length TLV placeholder for array of bytes */ |
| 1840 | len += WMI_TLV_HDR_SIZE; |
| 1841 | if (params->ie_len) |
| 1842 | len += roundup(params->ie_len, sizeof(uint32_t)); |
| 1843 | |
| 1844 | /* Allocate the memory */ |
| 1845 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1846 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1847 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1848 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1849 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1850 | } |
| 1851 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1852 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 1853 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1854 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 1855 | WMITLV_GET_STRUCT_TLVLEN |
| 1856 | (wmi_start_scan_cmd_fixed_param)); |
| 1857 | |
| 1858 | cmd->scan_id = params->scan_id; |
| 1859 | cmd->scan_req_id = params->scan_req_id; |
| 1860 | cmd->vdev_id = params->vdev_id; |
| 1861 | cmd->scan_priority = params->scan_priority; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1862 | copy_scan_notify_ev_flags(cmd, params); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1863 | cmd->dwell_time_active = params->dwell_time_active; |
| 1864 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 1865 | cmd->min_rest_time = params->min_rest_time; |
| 1866 | cmd->max_rest_time = params->max_rest_time; |
| 1867 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 1868 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 1869 | cmd->idle_time = params->idle_time; |
| 1870 | cmd->max_scan_time = params->max_scan_time; |
| 1871 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1872 | cmd->burst_duration = params->burst_duration; |
| 1873 | cmd->num_chan = params->num_chan; |
| 1874 | cmd->num_bssid = params->num_bssid; |
| 1875 | cmd->num_ssids = params->num_ssids; |
| 1876 | cmd->ie_len = params->ie_len; |
| 1877 | cmd->n_probes = params->n_probes; |
| 1878 | buf_ptr += sizeof(*cmd); |
| 1879 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1880 | for (i = 0; i < params->num_chan; ++i) |
| 1881 | tmp_ptr[i] = params->chan_list[i]; |
| 1882 | |
| 1883 | WMITLV_SET_HDR(buf_ptr, |
| 1884 | WMITLV_TAG_ARRAY_UINT32, |
| 1885 | (params->num_chan * sizeof(uint32_t))); |
| 1886 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 1887 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1888 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1889 | goto error; |
| 1890 | } |
| 1891 | |
| 1892 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1893 | (params->num_ssids * sizeof(wmi_ssid))); |
| 1894 | |
| 1895 | if (params->num_ssids) { |
| 1896 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1897 | for (i = 0; i < params->num_ssids; ++i) { |
| 1898 | ssid->ssid_len = params->ssid[i].length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1899 | qdf_mem_copy(ssid->ssid, params->ssid[i].mac_ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1900 | params->ssid[i].length); |
| 1901 | ssid++; |
| 1902 | } |
| 1903 | } |
| 1904 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 1905 | |
| 1906 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1907 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 1908 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1909 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->mac_add_bytes, bssid); |
| 1910 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_bssid * sizeof(wmi_mac_addr)); |
| 1911 | |
| 1912 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, params->ie_len_with_pad); |
| 1913 | if (params->ie_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1914 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1915 | (uint8_t *) params->ie_base + |
| 1916 | (params->uie_fieldOffset), params->ie_len); |
| 1917 | } |
| 1918 | buf_ptr += WMI_TLV_HDR_SIZE + params->ie_len_with_pad; |
| 1919 | |
| 1920 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 1921 | len, WMI_START_SCAN_CMDID); |
| 1922 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1923 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1924 | wmi_buf_free(wmi_buf); |
| 1925 | } |
| 1926 | return ret; |
| 1927 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1928 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1929 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1930 | } |
| 1931 | |
| 1932 | /** |
| 1933 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 1934 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1935 | * @param param : pointer to hold scan start cmd parameter |
| 1936 | * |
| 1937 | * Return: 0 on success and -ve on failure. |
| 1938 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1939 | QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1940 | struct scan_stop_params *param) |
| 1941 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1942 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 1943 | int ret; |
| 1944 | int len = sizeof(*cmd); |
| 1945 | wmi_buf_t wmi_buf; |
| 1946 | |
| 1947 | /* Allocate the memory */ |
| 1948 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1949 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1950 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1951 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1952 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1953 | goto error; |
| 1954 | } |
| 1955 | |
| 1956 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 1957 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1958 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 1959 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 1960 | cmd->vdev_id = param->vdev_id; |
| 1961 | cmd->requestor = param->requestor; |
| 1962 | cmd->scan_id = param->scan_id; |
| 1963 | /* stop the scan with the corresponding scan_id */ |
| 1964 | cmd->req_type = param->req_type; |
| 1965 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 1966 | len, WMI_STOP_SCAN_CMDID); |
| 1967 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1968 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1969 | wmi_buf_free(wmi_buf); |
| 1970 | } |
| 1971 | |
| 1972 | error: |
| 1973 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1974 | } |
| 1975 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1976 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1977 | /** |
| 1978 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 1979 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1980 | * @param param : pointer to hold scan channel list parameter |
| 1981 | * |
| 1982 | * Return: 0 on success and -ve on failure. |
| 1983 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1984 | 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] | 1985 | struct scan_chan_list_params *chan_list) |
| 1986 | { |
| 1987 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1988 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1989 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1990 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1991 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 1992 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1993 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 1994 | |
| 1995 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 1996 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1997 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1998 | WMI_LOGE("Failed to allocate memory"); |
| 1999 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2000 | goto end; |
| 2001 | } |
| 2002 | |
| 2003 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2004 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2005 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2006 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2007 | WMITLV_GET_STRUCT_TLVLEN |
| 2008 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2009 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2010 | 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] | 2011 | |
| 2012 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2013 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2014 | WMITLV_TAG_ARRAY_STRUC, |
| 2015 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2016 | chan_info = (wmi_channel_param *) |
| 2017 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2018 | tchan_info = chan_list->chan_info; |
| 2019 | |
| 2020 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2021 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2022 | WMITLV_TAG_STRUC_wmi_channel, |
| 2023 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2024 | chan_info->mhz = tchan_info->mhz; |
| 2025 | chan_info->band_center_freq1 = |
| 2026 | tchan_info->band_center_freq1; |
| 2027 | chan_info->band_center_freq2 = |
| 2028 | tchan_info->band_center_freq2; |
| 2029 | chan_info->info = tchan_info->info; |
| 2030 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2031 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2032 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2033 | |
| 2034 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2035 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2036 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2037 | tchan_info++; |
| 2038 | chan_info++; |
| 2039 | } |
| 2040 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2041 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2042 | WMI_SCAN_CHAN_LIST_CMDID); |
| 2043 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2044 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2045 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2046 | wmi_buf_free(buf); |
| 2047 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2048 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2049 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2050 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2051 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2052 | #else |
| 2053 | QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle, |
| 2054 | struct scan_chan_list_params *chan_list) |
| 2055 | { |
| 2056 | wmi_buf_t buf; |
| 2057 | QDF_STATUS qdf_status; |
| 2058 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2059 | int i; |
| 2060 | uint8_t *buf_ptr; |
| 2061 | wmi_channel *chan_info; |
| 2062 | struct channel_param *tchan_info; |
| 2063 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2064 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2065 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2066 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2067 | if (!buf) { |
| 2068 | WMI_LOGE("Failed to allocate memory"); |
| 2069 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2070 | goto end; |
| 2071 | } |
| 2072 | |
| 2073 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2074 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2075 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2076 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2077 | WMITLV_GET_STRUCT_TLVLEN |
| 2078 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2079 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2080 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2081 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2082 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2083 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2084 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2085 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2086 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2087 | tchan_info = &(chan_list->ch_param[0]); |
| 2088 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2089 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2090 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2091 | WMITLV_TAG_STRUC_wmi_channel, |
| 2092 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2093 | chan_info->mhz = tchan_info->mhz; |
| 2094 | chan_info->band_center_freq1 = |
| 2095 | tchan_info->cfreq1; |
| 2096 | chan_info->band_center_freq2 = |
| 2097 | tchan_info->cfreq2; |
| 2098 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2099 | if (tchan_info->is_chan_passive) |
| 2100 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2101 | WMI_CHAN_FLAG_PASSIVE); |
| 2102 | |
| 2103 | if (tchan_info->allow_vht) |
| 2104 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2105 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2106 | else if (tchan_info->allow_ht) |
| 2107 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2108 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2109 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2110 | tchan_info->phy_mode); |
| 2111 | |
| 2112 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2113 | * after FW support |
| 2114 | */ |
| 2115 | |
| 2116 | /* also fill in power information */ |
| 2117 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2118 | tchan_info->minpower); |
| 2119 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2120 | tchan_info->maxpower); |
| 2121 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2122 | tchan_info->maxregpower); |
| 2123 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2124 | tchan_info->antennamax); |
| 2125 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2126 | tchan_info->reg_class_id); |
| 2127 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2128 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2129 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2130 | tchan_info++; |
| 2131 | chan_info++; |
| 2132 | } |
| 2133 | |
| 2134 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2135 | WMI_SCAN_CHAN_LIST_CMDID); |
| 2136 | |
| 2137 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2138 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2139 | wmi_buf_free(buf); |
| 2140 | } |
| 2141 | |
| 2142 | end: |
| 2143 | return qdf_status; |
| 2144 | } |
| 2145 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2146 | /** |
| 2147 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2148 | * @wmi_handle : handle to WMI. |
| 2149 | * @param : pointer to hold mgmt cmd parameter |
| 2150 | * |
| 2151 | * Return: 0 on success and -ve on failure. |
| 2152 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2153 | QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2154 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2155 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2156 | wmi_buf_t buf; |
| 2157 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2158 | int32_t cmd_len; |
| 2159 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2160 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2161 | uint8_t *bufp; |
| 2162 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2163 | mgmt_tx_dl_frm_len; |
| 2164 | |
| 2165 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 2166 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 2167 | |
| 2168 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2169 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2170 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2171 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2172 | } |
| 2173 | |
| 2174 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2175 | bufp = (uint8_t *) cmd; |
| 2176 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2177 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2178 | WMITLV_GET_STRUCT_TLVLEN |
| 2179 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2180 | |
| 2181 | cmd->vdev_id = param->vdev_id; |
| 2182 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2183 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2184 | cmd->chanfreq = param->chanfreq; |
| 2185 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2186 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2187 | sizeof(uint32_t))); |
| 2188 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2189 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2190 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2191 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2192 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 2193 | #if defined(HELIUMPLUS_PADDR64) |
| 2194 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2195 | #endif |
| 2196 | cmd->frame_len = param->frm_len; |
| 2197 | cmd->buf_len = bufp_len; |
| 2198 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2199 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2200 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2201 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2202 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2203 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2204 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2205 | goto err1; |
| 2206 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2207 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2208 | |
| 2209 | err1: |
| 2210 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2211 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2212 | } |
| 2213 | |
| 2214 | /** |
| 2215 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2216 | * @wmi_handle: wmi handle |
| 2217 | * @param_value: parameter value |
| 2218 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2219 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2220 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2221 | 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] | 2222 | uint32_t param_value) |
| 2223 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2224 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2225 | wmi_modem_power_state_cmd_param *cmd; |
| 2226 | wmi_buf_t buf; |
| 2227 | uint16_t len = sizeof(*cmd); |
| 2228 | |
| 2229 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2230 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2231 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2232 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2233 | } |
| 2234 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2235 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2236 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2237 | WMITLV_GET_STRUCT_TLVLEN |
| 2238 | (wmi_modem_power_state_cmd_param)); |
| 2239 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2240 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2241 | param_value); |
| 2242 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2243 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2244 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2245 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2246 | wmi_buf_free(buf); |
| 2247 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2248 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2249 | return ret; |
| 2250 | } |
| 2251 | |
| 2252 | /** |
| 2253 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2254 | * @wmi_handle: wmi handle |
| 2255 | * @vdev_id: vdev id |
| 2256 | * @val: value |
| 2257 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2258 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2259 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2260 | 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] | 2261 | uint32_t vdev_id, uint8_t val) |
| 2262 | { |
| 2263 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2264 | wmi_buf_t buf; |
| 2265 | int32_t len = sizeof(*cmd); |
| 2266 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2267 | 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] | 2268 | |
| 2269 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2270 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2271 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2272 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2273 | } |
| 2274 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2275 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2276 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2277 | WMITLV_GET_STRUCT_TLVLEN |
| 2278 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2279 | cmd->vdev_id = vdev_id; |
| 2280 | if (val) |
| 2281 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2282 | else |
| 2283 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2284 | |
| 2285 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2286 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2287 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2288 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2289 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2290 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2291 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2292 | return 0; |
| 2293 | } |
| 2294 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2295 | /** |
| 2296 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2297 | * @wmi_handle: wmi handle |
| 2298 | * @vdev_id: vdev id |
| 2299 | * @value: value |
| 2300 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2301 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2302 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2303 | QDF_STATUS send_set_mimops_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2304 | uint8_t vdev_id, int value) |
| 2305 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2306 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2307 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2308 | wmi_buf_t buf; |
| 2309 | uint16_t len = sizeof(*cmd); |
| 2310 | |
| 2311 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2312 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2313 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2314 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2315 | } |
| 2316 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2317 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2318 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2319 | WMITLV_GET_STRUCT_TLVLEN |
| 2320 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2321 | |
| 2322 | cmd->vdev_id = vdev_id; |
| 2323 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2324 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2325 | * to SM power save values defined in the specification. |
| 2326 | * Make sure to send the right mapping. |
| 2327 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2328 | switch (value) { |
| 2329 | case 0: |
| 2330 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 2331 | break; |
| 2332 | case 1: |
| 2333 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 2334 | break; |
| 2335 | case 2: |
| 2336 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 2337 | break; |
| 2338 | case 3: |
| 2339 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 2340 | break; |
| 2341 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2342 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 2343 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2344 | } |
| 2345 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2346 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2347 | |
| 2348 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2349 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2350 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2351 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2352 | wmi_buf_free(buf); |
| 2353 | } |
| 2354 | |
| 2355 | return ret; |
| 2356 | } |
| 2357 | |
| 2358 | /** |
| 2359 | * send_set_smps_params_cmd_tlv() - set smps params |
| 2360 | * @wmi_handle: wmi handle |
| 2361 | * @vdev_id: vdev id |
| 2362 | * @value: value |
| 2363 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2364 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2365 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2366 | 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] | 2367 | int value) |
| 2368 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2369 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2370 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 2371 | wmi_buf_t buf; |
| 2372 | uint16_t len = sizeof(*cmd); |
| 2373 | |
| 2374 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2375 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2376 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2377 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2378 | } |
| 2379 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 2380 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2381 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 2382 | WMITLV_GET_STRUCT_TLVLEN |
| 2383 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 2384 | |
| 2385 | cmd->vdev_id = vdev_id; |
| 2386 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 2387 | cmd->param = |
| 2388 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 2389 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2390 | 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] | 2391 | cmd->param); |
| 2392 | |
| 2393 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2394 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2395 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2396 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2397 | wmi_buf_free(buf); |
| 2398 | } |
| 2399 | |
| 2400 | return ret; |
| 2401 | } |
| 2402 | |
| 2403 | /** |
| 2404 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 2405 | * @wmi_handle: wmi handle |
| 2406 | * @noa: p2p power save parameters |
| 2407 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2408 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2409 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2410 | 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] | 2411 | struct p2p_ps_params *noa) |
| 2412 | { |
| 2413 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 2414 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 2415 | wmi_buf_t buf; |
| 2416 | uint8_t *buf_ptr; |
| 2417 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2418 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2419 | uint32_t duration; |
| 2420 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2421 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2422 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 2423 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2424 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2425 | WMI_LOGE("Failed to allocate memory"); |
| 2426 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2427 | goto end; |
| 2428 | } |
| 2429 | |
| 2430 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2431 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 2432 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2433 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 2434 | WMITLV_GET_STRUCT_TLVLEN |
| 2435 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 2436 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 2437 | cmd->vdev_id = noa->session_id; |
| 2438 | cmd->enable = (duration) ? true : false; |
| 2439 | cmd->num_noa = 1; |
| 2440 | |
| 2441 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 2442 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 2443 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 2444 | sizeof |
| 2445 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 2446 | + WMI_TLV_HDR_SIZE); |
| 2447 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 2448 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 2449 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 2450 | noa_discriptor->type_count = noa->count; |
| 2451 | noa_discriptor->duration = duration; |
| 2452 | noa_discriptor->interval = noa->interval; |
| 2453 | noa_discriptor->start_time = 0; |
| 2454 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2455 | 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] | 2456 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 2457 | noa->interval); |
| 2458 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2459 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2460 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2461 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2462 | wmi_buf_free(buf); |
| 2463 | } |
| 2464 | |
| 2465 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2466 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2467 | return status; |
| 2468 | } |
| 2469 | |
| 2470 | |
| 2471 | /** |
| 2472 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 2473 | * @wmi_handle: wmi handle |
| 2474 | * @noa: p2p opp power save parameters |
| 2475 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2476 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2477 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2478 | 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] | 2479 | struct p2p_ps_params *oppps) |
| 2480 | { |
| 2481 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 2482 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2483 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2484 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2485 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2486 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2487 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2488 | WMI_LOGE("Failed to allocate memory"); |
| 2489 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2490 | goto end; |
| 2491 | } |
| 2492 | |
| 2493 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 2494 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2495 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 2496 | WMITLV_GET_STRUCT_TLVLEN |
| 2497 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 2498 | cmd->vdev_id = oppps->session_id; |
| 2499 | if (oppps->ctwindow) |
| 2500 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 2501 | |
| 2502 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2503 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2504 | cmd->vdev_id, oppps->ctwindow); |
| 2505 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 2506 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2507 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2508 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2509 | wmi_buf_free(buf); |
| 2510 | } |
| 2511 | |
| 2512 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2513 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2514 | return status; |
| 2515 | } |
| 2516 | |
| 2517 | /** |
| 2518 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 2519 | * @wmi_handle: wmi handle |
| 2520 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2521 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2522 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2523 | QDF_STATUS send_get_temperature_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2524 | { |
| 2525 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 2526 | wmi_buf_t wmi_buf; |
| 2527 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 2528 | uint8_t *buf_ptr; |
| 2529 | |
| 2530 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2531 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 2532 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2533 | } |
| 2534 | |
| 2535 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2536 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2537 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2538 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2539 | } |
| 2540 | |
| 2541 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2542 | |
| 2543 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 2544 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2545 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 2546 | WMITLV_GET_STRUCT_TLVLEN |
| 2547 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 2548 | |
| 2549 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 2550 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2551 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2552 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2553 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2554 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2555 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2556 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2557 | } |
| 2558 | |
| 2559 | /** |
| 2560 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 2561 | * @wmi_handle: wmi handle |
| 2562 | * @vdevid: vdev id |
| 2563 | * @peer_addr: peer mac address |
| 2564 | * @auto_triggerparam: auto trigger parameters |
| 2565 | * @num_ac: number of access category |
| 2566 | * |
| 2567 | * This function sets the trigger |
| 2568 | * uapsd params such as service interval, delay interval |
| 2569 | * and suspend interval which will be used by the firmware |
| 2570 | * to send trigger frames periodically when there is no |
| 2571 | * traffic on the transmit side. |
| 2572 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2573 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2574 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2575 | 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] | 2576 | struct sta_uapsd_trig_params *param) |
| 2577 | { |
| 2578 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2579 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2580 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 2581 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 2582 | uint32_t i; |
| 2583 | wmi_buf_t buf; |
| 2584 | uint8_t *buf_ptr; |
| 2585 | |
| 2586 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2587 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2588 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2589 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2590 | } |
| 2591 | |
| 2592 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2593 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 2594 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2595 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 2596 | WMITLV_GET_STRUCT_TLVLEN |
| 2597 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 2598 | cmd->vdev_id = param->vdevid; |
| 2599 | cmd->num_ac = param->num_ac; |
| 2600 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 2601 | |
| 2602 | /* TLV indicating array of structures to follow */ |
| 2603 | buf_ptr += sizeof(*cmd); |
| 2604 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 2605 | |
| 2606 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2607 | qdf_mem_copy(buf_ptr, param->auto_triggerparam, param_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2608 | |
| 2609 | /* |
| 2610 | * Update tag and length for uapsd auto trigger params (this will take |
| 2611 | * care of updating tag and length if it is not pre-filled by caller). |
| 2612 | */ |
| 2613 | for (i = 0; i < param->num_ac; i++) { |
| 2614 | WMITLV_SET_HDR((buf_ptr + |
| 2615 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 2616 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 2617 | WMITLV_GET_STRUCT_TLVLEN |
| 2618 | (wmi_sta_uapsd_auto_trig_param)); |
| 2619 | } |
| 2620 | |
| 2621 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2622 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2623 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2624 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2625 | wmi_buf_free(buf); |
| 2626 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2627 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2628 | return ret; |
| 2629 | } |
| 2630 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2631 | /** |
| 2632 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 2633 | * @wmi_handle: pointer to the wmi handle |
| 2634 | * @utc: pointer to the UTC time struct |
| 2635 | * |
| 2636 | * Return: 0 on succes |
| 2637 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2638 | 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] | 2639 | struct ocb_utc_param *utc) |
| 2640 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2641 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2642 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 2643 | uint8_t *buf_ptr; |
| 2644 | uint32_t len, i; |
| 2645 | wmi_buf_t buf; |
| 2646 | |
| 2647 | len = sizeof(*cmd); |
| 2648 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2649 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2650 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2651 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2652 | } |
| 2653 | |
| 2654 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2655 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 2656 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2657 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 2658 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 2659 | cmd->vdev_id = utc->vdev_id; |
| 2660 | |
| 2661 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 2662 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 2663 | |
| 2664 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 2665 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 2666 | |
| 2667 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2668 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2669 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2670 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2671 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2672 | } |
| 2673 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2674 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2675 | } |
| 2676 | |
| 2677 | /** |
| 2678 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 2679 | * frames on a channel |
| 2680 | * @wmi_handle: pointer to the wmi handle |
| 2681 | * @timing_advert: pointer to the timing advertisement struct |
| 2682 | * |
| 2683 | * Return: 0 on succes |
| 2684 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2685 | 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] | 2686 | struct ocb_timing_advert_param *timing_advert) |
| 2687 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2688 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2689 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 2690 | uint8_t *buf_ptr; |
| 2691 | uint32_t len, len_template; |
| 2692 | wmi_buf_t buf; |
| 2693 | |
| 2694 | len = sizeof(*cmd) + |
| 2695 | WMI_TLV_HDR_SIZE; |
| 2696 | |
| 2697 | len_template = timing_advert->template_length; |
| 2698 | /* Add padding to the template if needed */ |
| 2699 | if (len_template % 4 != 0) |
| 2700 | len_template += 4 - (len_template % 4); |
| 2701 | len += len_template; |
| 2702 | |
| 2703 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2704 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2705 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2706 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2707 | } |
| 2708 | |
| 2709 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2710 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 2711 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2712 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 2713 | WMITLV_GET_STRUCT_TLVLEN( |
| 2714 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 2715 | cmd->vdev_id = timing_advert->vdev_id; |
| 2716 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 2717 | cmd->channel_freq = timing_advert->chan_freq; |
| 2718 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 2719 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 2720 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 2721 | buf_ptr += sizeof(*cmd); |
| 2722 | |
| 2723 | /* Add the timing advert template */ |
| 2724 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2725 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2726 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2727 | (uint8_t *)timing_advert->template_value, |
| 2728 | timing_advert->template_length); |
| 2729 | |
| 2730 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2731 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2732 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2733 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2734 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2735 | } |
| 2736 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2737 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2738 | } |
| 2739 | |
| 2740 | /** |
| 2741 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 2742 | * on a channel |
| 2743 | * @wmi_handle: pointer to the wmi handle |
| 2744 | * @timing_advert: pointer to the timing advertisement struct |
| 2745 | * |
| 2746 | * Return: 0 on succes |
| 2747 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2748 | 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] | 2749 | struct ocb_timing_advert_param *timing_advert) |
| 2750 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2751 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2752 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 2753 | uint8_t *buf_ptr; |
| 2754 | uint32_t len; |
| 2755 | wmi_buf_t buf; |
| 2756 | |
| 2757 | len = sizeof(*cmd); |
| 2758 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2759 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2760 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2761 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2762 | } |
| 2763 | |
| 2764 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2765 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 2766 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2767 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 2768 | WMITLV_GET_STRUCT_TLVLEN( |
| 2769 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 2770 | cmd->vdev_id = timing_advert->vdev_id; |
| 2771 | cmd->channel_freq = timing_advert->chan_freq; |
| 2772 | |
| 2773 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2774 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2775 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2776 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2777 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2778 | } |
| 2779 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2780 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2781 | } |
| 2782 | |
| 2783 | /** |
| 2784 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 2785 | * @wmi_handle: pointer to the wmi handle |
| 2786 | * @request: pointer to the request |
| 2787 | * |
| 2788 | * Return: 0 on succes |
| 2789 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2790 | 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] | 2791 | uint8_t vdev_id) |
| 2792 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2793 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2794 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 2795 | uint8_t *buf_ptr; |
| 2796 | wmi_buf_t buf; |
| 2797 | int32_t len; |
| 2798 | |
| 2799 | len = sizeof(*cmd); |
| 2800 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2801 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2802 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2803 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2804 | } |
| 2805 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2806 | |
| 2807 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2808 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2809 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2810 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 2811 | WMITLV_GET_STRUCT_TLVLEN( |
| 2812 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 2813 | cmd->vdev_id = vdev_id; |
| 2814 | |
| 2815 | /* Send the WMI command */ |
| 2816 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2817 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 2818 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2819 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2820 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2821 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2822 | } |
| 2823 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2824 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2825 | } |
| 2826 | |
| 2827 | /** |
| 2828 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 2829 | * @wmi_handle: pointer to the wmi handle |
| 2830 | * @get_stats_param: pointer to the dcc stats |
| 2831 | * |
| 2832 | * Return: 0 on succes |
| 2833 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2834 | 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] | 2835 | struct dcc_get_stats_param *get_stats_param) |
| 2836 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2837 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2838 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 2839 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 2840 | wmi_buf_t buf; |
| 2841 | uint8_t *buf_ptr; |
| 2842 | uint32_t len; |
| 2843 | uint32_t i; |
| 2844 | |
| 2845 | /* Validate the input */ |
| 2846 | if (get_stats_param->request_array_len != |
| 2847 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2848 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2849 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2850 | } |
| 2851 | |
| 2852 | /* Allocate memory for the WMI command */ |
| 2853 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 2854 | get_stats_param->request_array_len; |
| 2855 | |
| 2856 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2857 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2858 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2859 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2860 | } |
| 2861 | |
| 2862 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2863 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2864 | |
| 2865 | /* Populate the WMI command */ |
| 2866 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 2867 | buf_ptr += sizeof(*cmd); |
| 2868 | |
| 2869 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2870 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 2871 | WMITLV_GET_STRUCT_TLVLEN( |
| 2872 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 2873 | cmd->vdev_id = get_stats_param->vdev_id; |
| 2874 | cmd->num_channels = get_stats_param->channel_count; |
| 2875 | |
| 2876 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2877 | get_stats_param->request_array_len); |
| 2878 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2879 | |
| 2880 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2881 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2882 | get_stats_param->request_array_len); |
| 2883 | for (i = 0; i < cmd->num_channels; i++) |
| 2884 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 2885 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 2886 | WMITLV_GET_STRUCT_TLVLEN( |
| 2887 | wmi_dcc_channel_stats_request)); |
| 2888 | |
| 2889 | /* Send the WMI command */ |
| 2890 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2891 | WMI_DCC_GET_STATS_CMDID); |
| 2892 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2893 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2894 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2895 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2896 | } |
| 2897 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2898 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2899 | } |
| 2900 | |
| 2901 | /** |
| 2902 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 2903 | * @wmi_handle: pointer to the wmi handle |
| 2904 | * @vdev_id: vdev id |
| 2905 | * @dcc_stats_bitmap: dcc status bitmap |
| 2906 | * |
| 2907 | * Return: 0 on succes |
| 2908 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2909 | 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] | 2910 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 2911 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2912 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2913 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 2914 | wmi_buf_t buf; |
| 2915 | uint8_t *buf_ptr; |
| 2916 | uint32_t len; |
| 2917 | |
| 2918 | /* Allocate memory for the WMI command */ |
| 2919 | len = sizeof(*cmd); |
| 2920 | |
| 2921 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2922 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2923 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2924 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2925 | } |
| 2926 | |
| 2927 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2928 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2929 | |
| 2930 | /* Populate the WMI command */ |
| 2931 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 2932 | |
| 2933 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2934 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 2935 | WMITLV_GET_STRUCT_TLVLEN( |
| 2936 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 2937 | cmd->vdev_id = vdev_id; |
| 2938 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 2939 | |
| 2940 | /* Send the WMI command */ |
| 2941 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2942 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2943 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2944 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2945 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2946 | } |
| 2947 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2948 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2949 | } |
| 2950 | |
| 2951 | /** |
| 2952 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 2953 | * @wmi_handle: pointer to the wmi handle |
| 2954 | * @update_ndl_param: pointer to the request parameters |
| 2955 | * |
| 2956 | * Return: 0 on success |
| 2957 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2958 | 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] | 2959 | struct dcc_update_ndl_param *update_ndl_param) |
| 2960 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2961 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2962 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 2963 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 2964 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 2965 | uint32_t active_state_count; |
| 2966 | wmi_buf_t buf; |
| 2967 | uint8_t *buf_ptr; |
| 2968 | uint32_t len; |
| 2969 | uint32_t i; |
| 2970 | |
| 2971 | /* validate the input */ |
| 2972 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 2973 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2974 | WMI_LOGE(FL("Invalid parameter")); |
| 2975 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2976 | } |
| 2977 | active_state_count = 0; |
| 2978 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 2979 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 2980 | active_state_count += |
| 2981 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 2982 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 2983 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2984 | WMI_LOGE(FL("Invalid parameter")); |
| 2985 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2986 | } |
| 2987 | |
| 2988 | /* Allocate memory for the WMI command */ |
| 2989 | len = sizeof(*cmd) + |
| 2990 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 2991 | WMI_TLV_HDR_SIZE + |
| 2992 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 2993 | |
| 2994 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2995 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2996 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2997 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2998 | } |
| 2999 | |
| 3000 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3001 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3002 | |
| 3003 | /* Populate the WMI command */ |
| 3004 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3005 | buf_ptr += sizeof(*cmd); |
| 3006 | |
| 3007 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3008 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3009 | WMITLV_GET_STRUCT_TLVLEN( |
| 3010 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3011 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3012 | cmd->num_channel = update_ndl_param->channel_count; |
| 3013 | |
| 3014 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3015 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3016 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3017 | |
| 3018 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3019 | 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] | 3020 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3021 | for (i = 0; i < cmd->num_channel; i++) |
| 3022 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3023 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3024 | WMITLV_GET_STRUCT_TLVLEN( |
| 3025 | wmi_dcc_ndl_chan)); |
| 3026 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3027 | |
| 3028 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3029 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3030 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3031 | |
| 3032 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3033 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3034 | update_ndl_param->dcc_ndl_active_state_list, |
| 3035 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3036 | for (i = 0; i < active_state_count; i++) { |
| 3037 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3038 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3039 | WMITLV_GET_STRUCT_TLVLEN( |
| 3040 | wmi_dcc_ndl_active_state_config)); |
| 3041 | } |
| 3042 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3043 | |
| 3044 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3045 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3046 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3047 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3048 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3049 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3050 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3051 | } |
| 3052 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3053 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3054 | } |
| 3055 | |
| 3056 | /** |
| 3057 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3058 | * @wmi_handle: pointer to the wmi handle |
| 3059 | * @config: the OCB configuration |
| 3060 | * |
| 3061 | * Return: 0 on success |
| 3062 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3063 | 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] | 3064 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3065 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3066 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3067 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3068 | wmi_channel *chan; |
| 3069 | wmi_ocb_channel *ocb_chan; |
| 3070 | wmi_qos_parameter *qos_param; |
| 3071 | wmi_dcc_ndl_chan *ndl_chan; |
| 3072 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3073 | wmi_ocb_schedule_element *sched_elem; |
| 3074 | uint8_t *buf_ptr; |
| 3075 | wmi_buf_t buf; |
| 3076 | int32_t len; |
| 3077 | int32_t i, j, active_state_count; |
| 3078 | |
| 3079 | /* |
| 3080 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3081 | * states. Validate dcc_ndl_active_state_list_len. |
| 3082 | */ |
| 3083 | active_state_count = 0; |
| 3084 | if (config->dcc_ndl_chan_list_len) { |
| 3085 | if (!config->dcc_ndl_chan_list || |
| 3086 | config->dcc_ndl_chan_list_len != |
| 3087 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3088 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3089 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3090 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3091 | } |
| 3092 | |
| 3093 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3094 | i < config->channel_count; ++i, ++ndl_chan) |
| 3095 | active_state_count += |
| 3096 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3097 | |
| 3098 | if (active_state_count) { |
| 3099 | if (!config->dcc_ndl_active_state_list || |
| 3100 | config->dcc_ndl_active_state_list_len != |
| 3101 | active_state_count * |
| 3102 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3103 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3104 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3105 | } |
| 3106 | } |
| 3107 | } |
| 3108 | |
| 3109 | len = sizeof(*cmd) + |
| 3110 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3111 | sizeof(wmi_channel) + |
| 3112 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3113 | sizeof(wmi_ocb_channel) + |
| 3114 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3115 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3116 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3117 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3118 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3119 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3120 | sizeof(wmi_ocb_schedule_element); |
| 3121 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3122 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3123 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3124 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3125 | } |
| 3126 | |
| 3127 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3128 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3129 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3130 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3131 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3132 | cmd->vdev_id = config->session_id; |
| 3133 | cmd->channel_count = config->channel_count; |
| 3134 | cmd->schedule_size = config->schedule_size; |
| 3135 | cmd->flags = config->flags; |
| 3136 | buf_ptr += sizeof(*cmd); |
| 3137 | |
| 3138 | /* Add the wmi_channel info */ |
| 3139 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3140 | config->channel_count*sizeof(wmi_channel)); |
| 3141 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3142 | for (i = 0; i < config->channel_count; i++) { |
| 3143 | chan = (wmi_channel *)buf_ptr; |
| 3144 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3145 | WMITLV_TAG_STRUC_wmi_channel, |
| 3146 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3147 | chan->mhz = config->channels[i].chan_freq; |
| 3148 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3149 | chan->band_center_freq2 = 0; |
| 3150 | chan->info = 0; |
| 3151 | |
| 3152 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3153 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3154 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3155 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3156 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3157 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3158 | config->channels[i].antenna_max); |
| 3159 | |
| 3160 | if (config->channels[i].bandwidth < 10) |
| 3161 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3162 | else if (config->channels[i].bandwidth < 20) |
| 3163 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3164 | buf_ptr += sizeof(*chan); |
| 3165 | } |
| 3166 | |
| 3167 | /* Add the wmi_ocb_channel info */ |
| 3168 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3169 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3170 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3171 | for (i = 0; i < config->channel_count; i++) { |
| 3172 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3173 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3174 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 3175 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 3176 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 3177 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 3178 | config->channels[i].mac_address.bytes, |
| 3179 | &ocb_chan->mac_address); |
| 3180 | buf_ptr += sizeof(*ocb_chan); |
| 3181 | } |
| 3182 | |
| 3183 | /* Add the wmi_qos_parameter info */ |
| 3184 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3185 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 3186 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3187 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 3188 | for (i = 0; i < config->channel_count; i++) { |
| 3189 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 3190 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 3191 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 3192 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 3193 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 3194 | qos_param->aifsn = |
| 3195 | config->channels[i].qos_params[j].aifsn; |
| 3196 | qos_param->cwmin = |
| 3197 | config->channels[i].qos_params[j].cwmin; |
| 3198 | qos_param->cwmax = |
| 3199 | config->channels[i].qos_params[j].cwmax; |
| 3200 | buf_ptr += sizeof(*qos_param); |
| 3201 | } |
| 3202 | } |
| 3203 | |
| 3204 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 3205 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3206 | config->dcc_ndl_chan_list_len); |
| 3207 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3208 | if (config->dcc_ndl_chan_list_len) { |
| 3209 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3210 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3211 | config->dcc_ndl_chan_list_len); |
| 3212 | for (i = 0; i < config->channel_count; i++) |
| 3213 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 3214 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3215 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 3216 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 3217 | } |
| 3218 | |
| 3219 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 3220 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 3221 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 3222 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3223 | if (active_state_count) { |
| 3224 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3225 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3226 | config->dcc_ndl_active_state_list, |
| 3227 | active_state_count * sizeof(*ndl_active_config)); |
| 3228 | for (i = 0; i < active_state_count; ++i) |
| 3229 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 3230 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3231 | WMITLV_GET_STRUCT_TLVLEN( |
| 3232 | wmi_dcc_ndl_active_state_config)); |
| 3233 | buf_ptr += active_state_count * |
| 3234 | sizeof(*ndl_active_config); |
| 3235 | } |
| 3236 | |
| 3237 | /* Add the wmi_ocb_schedule_element info */ |
| 3238 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3239 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 3240 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3241 | for (i = 0; i < config->schedule_size; i++) { |
| 3242 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 3243 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 3244 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 3245 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 3246 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 3247 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 3248 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 3249 | buf_ptr += sizeof(*sched_elem); |
| 3250 | } |
| 3251 | |
| 3252 | |
| 3253 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3254 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3255 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3256 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3257 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3258 | } |
| 3259 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3260 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3261 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3262 | |
| 3263 | /** |
| 3264 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 3265 | * @wmi_handle: wmi handle |
| 3266 | * @mcc_adaptive_scheduler: enable/disable |
| 3267 | * |
| 3268 | * This function enable/disable mcc adaptive scheduler in fw. |
| 3269 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3270 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3271 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3272 | QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3273 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 3274 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3275 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3276 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3277 | wmi_buf_t buf = 0; |
| 3278 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 3279 | uint16_t len = |
| 3280 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 3281 | |
| 3282 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3283 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3284 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 3285 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3286 | } |
| 3287 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 3288 | wmi_buf_data(buf); |
| 3289 | |
| 3290 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3291 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 3292 | WMITLV_GET_STRUCT_TLVLEN |
| 3293 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 3294 | cmd->enable = mcc_adaptive_scheduler; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3295 | cmd->pdev_id = pdev_id; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3296 | |
| 3297 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3298 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3299 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3300 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3301 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3302 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3303 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3304 | |
| 3305 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3306 | } |
| 3307 | |
| 3308 | /** |
| 3309 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 3310 | * @wmi: wmi handle |
| 3311 | * @mcc_channel: mcc channel |
| 3312 | * @mcc_channel_time_latency: MCC channel time latency. |
| 3313 | * |
| 3314 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 3315 | * channel of it and channel number. The info is provided run time using |
| 3316 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 3317 | * |
| 3318 | * Return: CDF status |
| 3319 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3320 | 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] | 3321 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 3322 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3323 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3324 | wmi_buf_t buf = 0; |
| 3325 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 3326 | uint16_t len = 0; |
| 3327 | uint8_t *buf_ptr = NULL; |
| 3328 | wmi_resmgr_chan_latency chan_latency; |
| 3329 | /* Note: we only support MCC time latency for a single channel */ |
| 3330 | uint32_t num_channels = 1; |
| 3331 | uint32_t chan1_freq = mcc_channel_freq; |
| 3332 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 3333 | |
| 3334 | |
| 3335 | /* If 0ms latency is provided, then FW will set to a default. |
| 3336 | * Otherwise, latency must be at least 30ms. |
| 3337 | */ |
| 3338 | if ((latency_chan1 > 0) && |
| 3339 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3340 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3341 | "Minimum is 30ms (or 0 to use default value by " |
| 3342 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3343 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3344 | } |
| 3345 | |
| 3346 | /* Set WMI CMD for channel time latency here */ |
| 3347 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 3348 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 3349 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 3350 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3351 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3352 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3353 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3354 | } |
| 3355 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3356 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 3357 | wmi_buf_data(buf); |
| 3358 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 3359 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 3360 | WMITLV_GET_STRUCT_TLVLEN |
| 3361 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 3362 | cmdTL->num_chans = num_channels; |
| 3363 | /* Update channel time latency information for home channel(s) */ |
| 3364 | buf_ptr += sizeof(*cmdTL); |
| 3365 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3366 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 3367 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3368 | chan_latency.chan_mhz = chan1_freq; |
| 3369 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3370 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3371 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3372 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3373 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3374 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3375 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3376 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3377 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3378 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3379 | |
| 3380 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3381 | } |
| 3382 | |
| 3383 | /** |
| 3384 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 3385 | * @wmi: wmi handle |
| 3386 | * @adapter_1_chan_number: adapter 1 channel number |
| 3387 | * @adapter_1_quota: adapter 1 quota |
| 3388 | * @adapter_2_chan_number: adapter 2 channel number |
| 3389 | * |
| 3390 | * Return: CDF status |
| 3391 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3392 | 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] | 3393 | uint32_t adapter_1_chan_freq, |
| 3394 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 3395 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3396 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3397 | wmi_buf_t buf = 0; |
| 3398 | uint16_t len = 0; |
| 3399 | uint8_t *buf_ptr = NULL; |
| 3400 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 3401 | wmi_resmgr_chan_time_quota chan_quota; |
| 3402 | uint32_t quota_chan1 = adapter_1_quota; |
| 3403 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 3404 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 3405 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 3406 | uint32_t num_channels = 2; |
| 3407 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 3408 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 3409 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3410 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3411 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 3412 | chan1_freq, quota_chan1, chan2_freq, |
| 3413 | quota_chan2); |
| 3414 | |
| 3415 | /* |
| 3416 | * Perform sanity check on time quota values provided. |
| 3417 | */ |
| 3418 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 3419 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3420 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3421 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3422 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3423 | } |
| 3424 | /* Set WMI CMD for channel time quota here */ |
| 3425 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 3426 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 3427 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 3428 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3429 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3430 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3431 | QDF_ASSERT(0); |
| 3432 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3433 | } |
| 3434 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3435 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 3436 | wmi_buf_data(buf); |
| 3437 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 3438 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 3439 | WMITLV_GET_STRUCT_TLVLEN |
| 3440 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 3441 | cmdTQ->num_chans = num_channels; |
| 3442 | |
| 3443 | /* Update channel time quota information for home channel(s) */ |
| 3444 | buf_ptr += sizeof(*cmdTQ); |
| 3445 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3446 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 3447 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3448 | chan_quota.chan_mhz = chan1_freq; |
| 3449 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3450 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3451 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 3452 | buf_ptr += sizeof(chan_quota); |
| 3453 | chan_quota.chan_mhz = chan2_freq; |
| 3454 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3455 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3456 | |
| 3457 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3458 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3459 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3460 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3461 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3462 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3463 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3464 | |
| 3465 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3466 | } |
| 3467 | |
| 3468 | /** |
| 3469 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 3470 | * @wmi_handle: Pointer to wmi handle |
| 3471 | * @thermal_info: Thermal command information |
| 3472 | * |
| 3473 | * This function sends the thermal management command |
| 3474 | * to the firmware |
| 3475 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3476 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3477 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3478 | 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] | 3479 | struct thermal_cmd_params *thermal_info) |
| 3480 | { |
| 3481 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 3482 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3483 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3484 | uint32_t len = 0; |
| 3485 | |
| 3486 | len = sizeof(*cmd); |
| 3487 | |
| 3488 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3489 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3490 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3491 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3492 | } |
| 3493 | |
| 3494 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 3495 | |
| 3496 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3497 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 3498 | WMITLV_GET_STRUCT_TLVLEN |
| 3499 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 3500 | |
| 3501 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 3502 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 3503 | cmd->enable = thermal_info->thermal_enable; |
| 3504 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3505 | 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] | 3506 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 3507 | |
| 3508 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3509 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3510 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3511 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3512 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3513 | } |
| 3514 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3515 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3516 | } |
| 3517 | |
| 3518 | |
| 3519 | /** |
| 3520 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3521 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3522 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 3523 | * |
| 3524 | * This function sends down the LRO configuration parameters to |
| 3525 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 3526 | * seed values for the toeplitz hash generation |
| 3527 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3528 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3529 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3530 | QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3531 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 3532 | { |
| 3533 | wmi_lro_info_cmd_fixed_param *cmd; |
| 3534 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3535 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3536 | |
| 3537 | |
| 3538 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3539 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3540 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3541 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3542 | } |
| 3543 | |
| 3544 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 3545 | |
| 3546 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3547 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 3548 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 3549 | |
| 3550 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 3551 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 3552 | wmi_lro_cmd->tcp_flag); |
| 3553 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 3554 | wmi_lro_cmd->tcp_flag_mask); |
| 3555 | cmd->toeplitz_hash_ipv4_0_3 = |
| 3556 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 3557 | cmd->toeplitz_hash_ipv4_4_7 = |
| 3558 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 3559 | cmd->toeplitz_hash_ipv4_8_11 = |
| 3560 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 3561 | cmd->toeplitz_hash_ipv4_12_15 = |
| 3562 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 3563 | cmd->toeplitz_hash_ipv4_16 = |
| 3564 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 3565 | |
| 3566 | cmd->toeplitz_hash_ipv6_0_3 = |
| 3567 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 3568 | cmd->toeplitz_hash_ipv6_4_7 = |
| 3569 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 3570 | cmd->toeplitz_hash_ipv6_8_11 = |
| 3571 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 3572 | cmd->toeplitz_hash_ipv6_12_15 = |
| 3573 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 3574 | cmd->toeplitz_hash_ipv6_16_19 = |
| 3575 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 3576 | cmd->toeplitz_hash_ipv6_20_23 = |
| 3577 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 3578 | cmd->toeplitz_hash_ipv6_24_27 = |
| 3579 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 3580 | cmd->toeplitz_hash_ipv6_28_31 = |
| 3581 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 3582 | cmd->toeplitz_hash_ipv6_32_35 = |
| 3583 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 3584 | cmd->toeplitz_hash_ipv6_36_39 = |
| 3585 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 3586 | cmd->toeplitz_hash_ipv6_40 = |
| 3587 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 3588 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3589 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3590 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 3591 | |
| 3592 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 3593 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3594 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3595 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3596 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3597 | } |
| 3598 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3599 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3600 | } |
| 3601 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3602 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3603 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 3604 | * @wmi_handle: Pointer to wmi handle |
| 3605 | * @rate_report_params: Pointer to peer rate report parameters |
| 3606 | * |
| 3607 | * |
| 3608 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 3609 | */ |
| 3610 | QDF_STATUS send_peer_rate_report_cmd_tlv(wmi_unified_t wmi_handle, |
| 3611 | struct wmi_peer_rate_report_params *rate_report_params) |
| 3612 | { |
| 3613 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 3614 | wmi_buf_t buf = NULL; |
| 3615 | QDF_STATUS status = 0; |
| 3616 | uint32_t len = 0; |
| 3617 | uint32_t i, j; |
| 3618 | |
| 3619 | len = sizeof(*cmd); |
| 3620 | |
| 3621 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3622 | if (!buf) { |
| 3623 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 3624 | return QDF_STATUS_E_FAILURE; |
| 3625 | } |
| 3626 | |
| 3627 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 3628 | wmi_buf_data(buf); |
| 3629 | |
| 3630 | WMITLV_SET_HDR( |
| 3631 | &cmd->tlv_header, |
| 3632 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 3633 | WMITLV_GET_STRUCT_TLVLEN( |
| 3634 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 3635 | |
| 3636 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 3637 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 3638 | cmd->report_timer_period = rate_report_params->timer_period; |
| 3639 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 3640 | cmd->cond_per_phy[i].val_cond_flags = |
| 3641 | rate_report_params->report_per_phy[i].cond_flags; |
| 3642 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 3643 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 3644 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 3645 | rate_report_params->report_per_phy[i].delta.percent; |
| 3646 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 3647 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 3648 | rate_report_params->report_per_phy[i]. |
| 3649 | report_rate_threshold[j]; |
| 3650 | } |
| 3651 | } |
| 3652 | |
| 3653 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 3654 | cmd->enable_rate_report, |
| 3655 | cmd->report_backoff_time, cmd->report_timer_period); |
| 3656 | |
| 3657 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3658 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 3659 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3660 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3661 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 3662 | __func__); |
| 3663 | } |
| 3664 | return status; |
| 3665 | } |
| 3666 | |
| 3667 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3668 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 3669 | * @wmi_handle: wmi handle |
| 3670 | * @param: bcn ll cmd parameter |
| 3671 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3672 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3673 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3674 | 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] | 3675 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 3676 | { |
| 3677 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 3678 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3679 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3680 | |
| 3681 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3682 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3683 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3684 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3685 | } |
| 3686 | |
| 3687 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 3688 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3689 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 3690 | WMITLV_GET_STRUCT_TLVLEN |
| 3691 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 3692 | cmd->vdev_id = param->vdev_id; |
| 3693 | cmd->data_len = param->data_len; |
| 3694 | cmd->frame_ctrl = param->frame_ctrl; |
| 3695 | cmd->frag_ptr = param->frag_ptr; |
| 3696 | cmd->dtim_flag = param->dtim_flag; |
| 3697 | |
| 3698 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 3699 | WMI_PDEV_SEND_BCN_CMDID); |
| 3700 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3701 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3702 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3703 | wmi_buf_free(wmi_buf); |
| 3704 | } |
| 3705 | |
| 3706 | return ret; |
| 3707 | } |
| 3708 | |
| 3709 | /** |
| 3710 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 3711 | * @wmi_handle: wmi handle |
| 3712 | * @vdev_id: vdev id |
| 3713 | * @max_retries: max retries |
| 3714 | * @retry_interval: retry interval |
| 3715 | * This function sets sta query related parameters in fw. |
| 3716 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3717 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3718 | */ |
| 3719 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3720 | 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] | 3721 | uint8_t vdev_id, uint32_t max_retries, |
| 3722 | uint32_t retry_interval) |
| 3723 | { |
| 3724 | wmi_buf_t buf; |
| 3725 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 3726 | int len; |
| 3727 | |
| 3728 | len = sizeof(*cmd); |
| 3729 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3730 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3731 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3732 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3733 | } |
| 3734 | |
| 3735 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 3736 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3737 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 3738 | WMITLV_GET_STRUCT_TLVLEN |
| 3739 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 3740 | |
| 3741 | |
| 3742 | cmd->vdev_id = vdev_id; |
| 3743 | cmd->sa_query_max_retry_count = max_retries; |
| 3744 | cmd->sa_query_retry_interval = retry_interval; |
| 3745 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3746 | 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] | 3747 | vdev_id, retry_interval, max_retries); |
| 3748 | |
| 3749 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3750 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3751 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3752 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3753 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3754 | } |
| 3755 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3756 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3757 | return 0; |
| 3758 | } |
| 3759 | |
| 3760 | /** |
| 3761 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 3762 | * @wmi_handle: wmi handle |
| 3763 | * @params: sta keep alive parameter |
| 3764 | * |
| 3765 | * This function sets keep alive related parameters in fw. |
| 3766 | * |
| 3767 | * Return: CDF status |
| 3768 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3769 | 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] | 3770 | struct sta_params *params) |
| 3771 | { |
| 3772 | wmi_buf_t buf; |
| 3773 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 3774 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 3775 | uint8_t *buf_ptr; |
| 3776 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3777 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3778 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3779 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3780 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3781 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 3782 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3783 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3784 | WMI_LOGE("wmi_buf_alloc failed"); |
| 3785 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3786 | } |
| 3787 | |
| 3788 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 3789 | buf_ptr = (uint8_t *) cmd; |
| 3790 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3791 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 3792 | WMITLV_GET_STRUCT_TLVLEN |
| 3793 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 3794 | cmd->interval = params->timeperiod; |
| 3795 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 3796 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3797 | 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] | 3798 | params->timeperiod, params->method); |
| 3799 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 3800 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 3801 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 3802 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 3803 | |
| 3804 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 3805 | if ((NULL == params->hostv4addr) || |
| 3806 | (NULL == params->destv4addr) || |
| 3807 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3808 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3809 | "destv4addr:%p destmac:%p ", __func__, |
| 3810 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3811 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3812 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3813 | } |
| 3814 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3815 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3816 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3817 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3818 | WMI_IPV4_ADDR_LEN); |
| 3819 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 3820 | } else { |
| 3821 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 3822 | } |
| 3823 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3824 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3825 | WMI_STA_KEEPALIVE_CMDID); |
| 3826 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3827 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3828 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3829 | } |
| 3830 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3831 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3832 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3833 | } |
| 3834 | |
| 3835 | /** |
| 3836 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 3837 | * @wmi_handle: wmi handle |
| 3838 | * @if_id: vdev id |
| 3839 | * @gtx_info: GTX config params |
| 3840 | * |
| 3841 | * This function set GTX related params in firmware. |
| 3842 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3843 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3844 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3845 | 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] | 3846 | struct wmi_gtx_config *gtx_info) |
| 3847 | { |
| 3848 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 3849 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3850 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3851 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3852 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3853 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3854 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3855 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3856 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3857 | } |
| 3858 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 3859 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3860 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 3861 | WMITLV_GET_STRUCT_TLVLEN |
| 3862 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 3863 | cmd->vdev_id = if_id; |
| 3864 | |
| 3865 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 3866 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 3867 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 3868 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 3869 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 3870 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 3871 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 3872 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 3873 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3874 | 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] | 3875 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 3876 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 3877 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 3878 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 3879 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3880 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3881 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3882 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 3883 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 3884 | wmi_buf_free(buf); |
| 3885 | } |
| 3886 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3887 | } |
| 3888 | |
| 3889 | /** |
| 3890 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 3891 | * @wmi_handle: wmi handle |
| 3892 | * @edca_params: edca parameters |
| 3893 | * |
| 3894 | * This function updates EDCA parameters to the target |
| 3895 | * |
| 3896 | * Return: CDF Status |
| 3897 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3898 | 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] | 3899 | uint8_t vdev_id, |
| 3900 | wmi_wmm_vparams gwmm_param[WMI_MAX_NUM_AC]) |
| 3901 | { |
| 3902 | uint8_t *buf_ptr; |
| 3903 | wmi_buf_t buf; |
| 3904 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
| 3905 | wmi_wmm_vparams *wmm_param, *twmm_param; |
| 3906 | int len = sizeof(*cmd); |
| 3907 | int ac; |
| 3908 | |
| 3909 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3910 | |
| 3911 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3912 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3913 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3914 | } |
| 3915 | |
| 3916 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3917 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 3918 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3919 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3920 | WMITLV_GET_STRUCT_TLVLEN |
| 3921 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 3922 | cmd->vdev_id = vdev_id; |
| 3923 | |
| 3924 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 3925 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
| 3926 | twmm_param = (wmi_wmm_vparams *) (&gwmm_param[ac]); |
| 3927 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 3928 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3929 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 3930 | wmm_param->cwmin = twmm_param->cwmin; |
| 3931 | wmm_param->cwmax = twmm_param->cwmax; |
| 3932 | wmm_param->aifs = twmm_param->aifs; |
| 3933 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 3934 | wmm_param->acm = twmm_param->acm; |
| 3935 | wmm_param->no_ack = twmm_param->no_ack; |
| 3936 | } |
| 3937 | |
| 3938 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3939 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 3940 | goto fail; |
| 3941 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3942 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3943 | |
| 3944 | fail: |
| 3945 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3946 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 3947 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3948 | } |
| 3949 | |
| 3950 | /** |
| 3951 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 3952 | * @wmi_handle: wmi handle |
| 3953 | * @vdev_id: vdev id |
| 3954 | * @probe_rsp_info: probe response info |
| 3955 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3956 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3957 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3958 | 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] | 3959 | uint8_t vdev_id, |
| 3960 | struct wmi_probe_resp_params *probe_rsp_info, |
| 3961 | uint8_t *frm) |
| 3962 | { |
| 3963 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 3964 | wmi_bcn_prb_info *bcn_prb_info; |
| 3965 | wmi_buf_t wmi_buf; |
| 3966 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 3967 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3968 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3969 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3970 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3971 | |
| 3972 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 3973 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 3974 | |
| 3975 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 3976 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 3977 | tmpl_len_aligned; |
| 3978 | |
| 3979 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3980 | 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] | 3981 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3982 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3983 | } |
| 3984 | |
| 3985 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 3986 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3987 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3988 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3989 | } |
| 3990 | |
| 3991 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3992 | |
| 3993 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 3994 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3995 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 3996 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 3997 | cmd->vdev_id = vdev_id; |
| 3998 | cmd->buf_len = tmpl_len; |
| 3999 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 4000 | |
| 4001 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4002 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4003 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4004 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4005 | bcn_prb_info->caps = 0; |
| 4006 | bcn_prb_info->erp = 0; |
| 4007 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4008 | |
| 4009 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4010 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4011 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4012 | |
| 4013 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4014 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4015 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4016 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4017 | wmi_buf_free(wmi_buf); |
| 4018 | } |
| 4019 | |
| 4020 | return ret; |
| 4021 | } |
| 4022 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4023 | #ifdef FEATURE_WLAN_WAPI |
| 4024 | #define WPI_IV_LEN 16 |
| 4025 | |
| 4026 | /** |
| 4027 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4028 | * |
| 4029 | * @dest_tx: destination address of tsc key counter |
| 4030 | * @src_tx: source address of tsc key counter |
| 4031 | * @dest_rx: destination address of rsc key counter |
| 4032 | * @src_rx: source address of rsc key counter |
| 4033 | * |
| 4034 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4035 | * |
| 4036 | * Return: None |
| 4037 | * |
| 4038 | */ |
| 4039 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4040 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4041 | { |
| 4042 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4043 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4044 | } |
| 4045 | #else |
| 4046 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4047 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4048 | { |
| 4049 | return; |
| 4050 | } |
| 4051 | #endif |
| 4052 | |
| 4053 | /** |
| 4054 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4055 | * @wmi_handle: wmi handle |
| 4056 | * @key_params: key parameters |
| 4057 | * |
| 4058 | * This function fills structure from information |
| 4059 | * passed in key_params. |
| 4060 | * |
| 4061 | * Return: QDF_STATUS_SUCCESS - success |
| 4062 | * QDF_STATUS_E_FAILURE - failure |
| 4063 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4064 | */ |
| 4065 | QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle, |
| 4066 | struct set_key_params *key_params) |
| 4067 | { |
| 4068 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4069 | wmi_buf_t buf; |
| 4070 | uint8_t *buf_ptr; |
| 4071 | uint32_t len; |
| 4072 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4073 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4074 | |
| 4075 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4076 | WMI_TLV_HDR_SIZE; |
| 4077 | |
| 4078 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4079 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4080 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4081 | return QDF_STATUS_E_NOMEM; |
| 4082 | } |
| 4083 | |
| 4084 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4085 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4086 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4087 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4088 | WMITLV_GET_STRUCT_TLVLEN |
| 4089 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4090 | cmd->vdev_id = key_params->vdev_id; |
| 4091 | cmd->key_ix = key_params->key_idx; |
| 4092 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4093 | cmd->key_flags |= key_params->key_flags; |
| 4094 | cmd->key_cipher = key_params->key_cipher; |
| 4095 | if ((key_params->key_txmic_len) && |
| 4096 | (key_params->key_rxmic_len)) { |
| 4097 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4098 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4099 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4100 | #ifdef FEATURE_WLAN_WAPI |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4101 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4102 | key_params->tx_iv, |
| 4103 | cmd->wpi_key_rsc_counter, |
| 4104 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4105 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4106 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4107 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4108 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4109 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4110 | qdf_mem_copy((void *)key_data, |
| 4111 | (const void *)key_params->key_data, key_params->key_len); |
| 4112 | cmd->key_len = key_params->key_len; |
| 4113 | |
| 4114 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4115 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4116 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4117 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4118 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4119 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4120 | } |
| 4121 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4122 | /** |
| 4123 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 4124 | * @wmi_handle: wmi handle |
| 4125 | * @params: encrypt/decrypt params |
| 4126 | * |
| 4127 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4128 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 4129 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4130 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 4131 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 4132 | { |
| 4133 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 4134 | wmi_buf_t wmi_buf; |
| 4135 | uint8_t *buf_ptr; |
| 4136 | QDF_STATUS ret; |
| 4137 | uint32_t len; |
| 4138 | |
| 4139 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 4140 | |
| 4141 | len = sizeof(*cmd) + |
| 4142 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 4143 | WMI_TLV_HDR_SIZE; |
| 4144 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4145 | if (!wmi_buf) { |
| 4146 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 4147 | __func__); |
| 4148 | return QDF_STATUS_E_NOMEM; |
| 4149 | } |
| 4150 | |
| 4151 | buf_ptr = wmi_buf_data(wmi_buf); |
| 4152 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 4153 | |
| 4154 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4155 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 4156 | WMITLV_GET_STRUCT_TLVLEN( |
| 4157 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 4158 | |
| 4159 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 4160 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 4161 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 4162 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 4163 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 4164 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 4165 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 4166 | |
| 4167 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 4168 | encrypt_decrypt_params->key_len); |
| 4169 | |
| 4170 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 4171 | MAX_MAC_HEADER_LEN); |
| 4172 | |
| 4173 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 4174 | |
| 4175 | if (cmd->data_len) { |
| 4176 | buf_ptr += sizeof(*cmd); |
| 4177 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4178 | roundup(encrypt_decrypt_params->data_len, |
| 4179 | sizeof(A_UINT32))); |
| 4180 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4181 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 4182 | encrypt_decrypt_params->data_len); |
| 4183 | } |
| 4184 | |
| 4185 | /* This conversion is to facilitate data to FW in little endian */ |
| 4186 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 4187 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 4188 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 4189 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 4190 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 4191 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 4192 | |
| 4193 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4194 | wmi_buf, len, |
| 4195 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 4196 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4197 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 4198 | wmi_buf_free(wmi_buf); |
| 4199 | } |
| 4200 | |
| 4201 | return ret; |
| 4202 | } |
| 4203 | |
| 4204 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4205 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4206 | /** |
| 4207 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 4208 | * @wmi_handle: wmi handle |
| 4209 | * @vdev_id: vdev id |
| 4210 | * @p2p_ie: p2p IE |
| 4211 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4212 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4213 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4214 | 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] | 4215 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 4216 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4217 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4218 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 4219 | wmi_buf_t wmi_buf; |
| 4220 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 4221 | uint8_t *buf_ptr; |
| 4222 | |
| 4223 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 4224 | |
| 4225 | /* More than one P2P IE may be included in a single frame. |
| 4226 | If multiple P2P IEs are present, the complete P2P attribute |
| 4227 | data consists of the concatenation of the P2P Attribute |
| 4228 | fields of the P2P IEs. The P2P Attributes field of each |
| 4229 | P2P IE may be any length up to the maximum (251 octets). |
| 4230 | In this case host sends one P2P IE to firmware so the length |
| 4231 | should not exceed more than 251 bytes |
| 4232 | */ |
| 4233 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4234 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4235 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4236 | } |
| 4237 | |
| 4238 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 4239 | |
| 4240 | wmi_buf_len = |
| 4241 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 4242 | WMI_TLV_HDR_SIZE; |
| 4243 | |
| 4244 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4245 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4246 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4247 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4248 | } |
| 4249 | |
| 4250 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4251 | |
| 4252 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 4253 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4254 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 4255 | WMITLV_GET_STRUCT_TLVLEN |
| 4256 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 4257 | cmd->vdev_id = vdev_id; |
| 4258 | cmd->ie_buf_len = ie_len; |
| 4259 | |
| 4260 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 4261 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 4262 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4263 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4264 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4265 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4266 | |
| 4267 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4268 | wmi_buf, wmi_buf_len, |
| 4269 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4270 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4271 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4272 | wmi_buf_free(wmi_buf); |
| 4273 | } |
| 4274 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4275 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4276 | return ret; |
| 4277 | } |
| 4278 | |
| 4279 | /** |
| 4280 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 4281 | * @wmi_handle: wmi handle |
| 4282 | * @req: gateway parameter update request structure |
| 4283 | * |
| 4284 | * This function reads the incoming @req and fill in the destination |
| 4285 | * WMI structure and sends down the gateway configs down to the firmware |
| 4286 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4287 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4288 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4289 | 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] | 4290 | struct gateway_update_req_param *req) |
| 4291 | { |
| 4292 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 4293 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4294 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4295 | int len = sizeof(*cmd); |
| 4296 | |
| 4297 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4298 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4299 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4300 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4301 | } |
| 4302 | |
| 4303 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 4304 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4305 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 4306 | WMITLV_GET_STRUCT_TLVLEN( |
| 4307 | wmi_roam_subnet_change_config_fixed_param)); |
| 4308 | |
| 4309 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4310 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 4311 | QDF_IPV4_ADDR_SIZE); |
| 4312 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 4313 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4314 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 4315 | &cmd->inet_gw_mac_addr); |
| 4316 | cmd->max_retries = req->max_retries; |
| 4317 | cmd->timeout = req->timeout; |
| 4318 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 4319 | cmd->flag = 0; |
| 4320 | if (req->ipv4_addr_type) |
| 4321 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 4322 | |
| 4323 | if (req->ipv6_addr_type) |
| 4324 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 4325 | |
| 4326 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4327 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4328 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4329 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4330 | ret); |
| 4331 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4332 | } |
| 4333 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4334 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4335 | } |
| 4336 | |
| 4337 | /** |
| 4338 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 4339 | * @wmi_handle: wmi handle |
| 4340 | * @req: rssi monitoring request structure |
| 4341 | * |
| 4342 | * This function reads the incoming @req and fill in the destination |
| 4343 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 4344 | * |
| 4345 | * Return: 0 on success; error number otherwise |
| 4346 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4347 | 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] | 4348 | struct rssi_monitor_param *req) |
| 4349 | { |
| 4350 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 4351 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4352 | QDF_STATUS ret; |
| 4353 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4354 | |
| 4355 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4356 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4357 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4358 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4359 | } |
| 4360 | |
| 4361 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 4362 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4363 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 4364 | WMITLV_GET_STRUCT_TLVLEN( |
| 4365 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 4366 | |
| 4367 | cmd->vdev_id = req->session_id; |
| 4368 | cmd->request_id = req->request_id; |
| 4369 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 4370 | cmd->hi_rssi_reenable_histeresis = 0; |
| 4371 | cmd->min_report_interval = 0; |
| 4372 | cmd->max_num_report = 1; |
| 4373 | if (req->control) { |
| 4374 | /* enable one threshold for each min/max */ |
| 4375 | cmd->enabled_bitmap = 0x09; |
| 4376 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 4377 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 4378 | } else { |
| 4379 | cmd->enabled_bitmap = 0; |
| 4380 | cmd->low_rssi_breach_threshold[0] = 0; |
| 4381 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 4382 | } |
| 4383 | |
| 4384 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4385 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4386 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4387 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4388 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4389 | } |
| 4390 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4391 | WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4392 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4393 | } |
| 4394 | |
| 4395 | /** |
| 4396 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 4397 | * @wmi_handle: wmi handle |
| 4398 | * @psetoui: OUI parameters |
| 4399 | * |
| 4400 | * set scan probe OUI parameters in firmware |
| 4401 | * |
| 4402 | * Return: CDF status |
| 4403 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4404 | 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] | 4405 | struct scan_mac_oui *psetoui) |
| 4406 | { |
| 4407 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 4408 | wmi_buf_t wmi_buf; |
| 4409 | uint32_t len; |
| 4410 | uint8_t *buf_ptr; |
| 4411 | uint32_t *oui_buf; |
| 4412 | |
| 4413 | len = sizeof(*cmd); |
| 4414 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4415 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4416 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4417 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4418 | } |
| 4419 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4420 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 4421 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4422 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 4423 | WMITLV_GET_STRUCT_TLVLEN |
| 4424 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 4425 | |
| 4426 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4427 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4428 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 4429 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4430 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4431 | cmd->prob_req_oui); |
| 4432 | |
| 4433 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4434 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4435 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4436 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4437 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4438 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4439 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4440 | } |
| 4441 | |
| 4442 | /** |
| 4443 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 4444 | * @wmi_handle: wmi handle |
| 4445 | * @req: passpoint network request structure |
| 4446 | * |
| 4447 | * This function sends down WMI command with network id set to wildcard id. |
| 4448 | * firmware shall clear all the config entries |
| 4449 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4450 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4451 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4452 | 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] | 4453 | struct wifi_passpoint_req_param *req) |
| 4454 | { |
| 4455 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 4456 | wmi_buf_t buf; |
| 4457 | uint32_t len; |
| 4458 | int ret; |
| 4459 | |
| 4460 | len = sizeof(*cmd); |
| 4461 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4462 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4463 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4464 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4465 | } |
| 4466 | |
| 4467 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 4468 | |
| 4469 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4470 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 4471 | WMITLV_GET_STRUCT_TLVLEN( |
| 4472 | wmi_passpoint_config_cmd_fixed_param)); |
| 4473 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 4474 | |
| 4475 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4476 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 4477 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4478 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4479 | __func__); |
| 4480 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4481 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4482 | } |
| 4483 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4484 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4485 | } |
| 4486 | |
| 4487 | /** |
| 4488 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 4489 | * @wmi_handle: wmi handle |
| 4490 | * @req: passpoint network request structure |
| 4491 | * |
| 4492 | * This function reads the incoming @req and fill in the destination |
| 4493 | * WMI structure and send down the passpoint configs down to the firmware |
| 4494 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4495 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4496 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4497 | 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] | 4498 | struct wifi_passpoint_req_param *req) |
| 4499 | { |
| 4500 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 4501 | u_int8_t i, j, *bytes; |
| 4502 | wmi_buf_t buf; |
| 4503 | uint32_t len; |
| 4504 | int ret; |
| 4505 | |
| 4506 | len = sizeof(*cmd); |
| 4507 | for (i = 0; i < req->num_networks; i++) { |
| 4508 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4509 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4510 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4511 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4512 | } |
| 4513 | |
| 4514 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 4515 | wmi_buf_data(buf); |
| 4516 | |
| 4517 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4518 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 4519 | WMITLV_GET_STRUCT_TLVLEN( |
| 4520 | wmi_passpoint_config_cmd_fixed_param)); |
| 4521 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4522 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 4523 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4524 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4525 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4526 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 4527 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4528 | 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] | 4529 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 4530 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 4531 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4532 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4533 | &req->networks[i].roaming_consortium_ids[j], |
| 4534 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 4535 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4536 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4537 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4538 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4539 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 4540 | |
| 4541 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4542 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 4543 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4544 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4545 | __func__); |
| 4546 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4547 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4548 | } |
| 4549 | } |
| 4550 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4551 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4552 | } |
| 4553 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4554 | /** |
| 4555 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 4556 | * @wmi_handle: wmi handle |
| 4557 | * @scan_cmd_fp: start scan command ptr |
| 4558 | * @roam_req: roam request param |
| 4559 | * |
| 4560 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 4561 | * of WMI_ROAM_SCAN_MODE. |
| 4562 | * |
| 4563 | * Return: QDF status |
| 4564 | */ |
| 4565 | QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 4566 | wmi_start_scan_cmd_fixed_param * |
| 4567 | scan_cmd_fp, |
| 4568 | struct roam_offload_scan_params *roam_req) |
| 4569 | { |
| 4570 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4571 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4572 | int len; |
| 4573 | uint8_t *buf_ptr; |
| 4574 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4575 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4576 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4577 | int auth_mode = roam_req->auth_mode; |
| 4578 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 4579 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 4580 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 4581 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4582 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4583 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4584 | /* Need to create a buf with roam_scan command at |
| 4585 | * front and piggyback with scan command */ |
| 4586 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 4587 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4588 | (2 * WMI_TLV_HDR_SIZE) + |
| 4589 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4590 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 4591 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4592 | if (roam_req->is_roam_req_valid && |
| 4593 | roam_req->roam_offload_enabled) { |
| 4594 | len += sizeof(wmi_roam_offload_tlv_param); |
| 4595 | len += WMI_TLV_HDR_SIZE; |
| 4596 | if ((auth_mode != WMI_AUTH_NONE) && |
| 4597 | ((auth_mode != WMI_AUTH_OPEN) || |
| 4598 | (auth_mode == WMI_AUTH_OPEN && |
| 4599 | roam_req->mdid.mdie_present) || |
| 4600 | roam_req->is_ese_assoc)) { |
| 4601 | len += WMI_TLV_HDR_SIZE; |
| 4602 | if (roam_req->is_ese_assoc) |
| 4603 | len += |
| 4604 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 4605 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 4606 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 4607 | (auth_mode == WMI_AUTH_OPEN && |
| 4608 | roam_req->mdid.mdie_present)) |
| 4609 | len += |
| 4610 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 4611 | else |
| 4612 | len += |
| 4613 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 4614 | } else { |
| 4615 | len += WMI_TLV_HDR_SIZE; |
| 4616 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4617 | |
| 4618 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 4619 | + roundup(roam_req->assoc_ie_length, |
| 4620 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4621 | } else { |
| 4622 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4623 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4624 | __func__, roam_req->roam_offload_enabled); |
| 4625 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4626 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4627 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4628 | } |
| 4629 | if (roam_req->is_roam_req_valid && |
| 4630 | roam_req->roam_offload_enabled) { |
| 4631 | roam_req->mode = roam_req->mode | |
| 4632 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 4633 | } |
| 4634 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4635 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4636 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 4637 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 4638 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 4639 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4640 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4641 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4642 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4643 | return QDF_STATUS_E_NOMEM; |
| 4644 | } |
| 4645 | |
| 4646 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4647 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4648 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 4649 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 4650 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 4651 | WMITLV_GET_STRUCT_TLVLEN |
| 4652 | (wmi_roam_scan_mode_fixed_param)); |
| 4653 | |
| 4654 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 4655 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4656 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 4657 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 4658 | goto send_roam_scan_mode_cmd; |
| 4659 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4660 | /* Fill in scan parameters suitable for roaming scan */ |
| 4661 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4662 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4663 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 4664 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 4665 | /* Ensure there is no additional IEs */ |
| 4666 | scan_cmd_fp->ie_len = 0; |
| 4667 | WMITLV_SET_HDR(buf_ptr, |
| 4668 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 4669 | WMITLV_GET_STRUCT_TLVLEN |
| 4670 | (wmi_start_scan_cmd_fixed_param)); |
| 4671 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4672 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 4673 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 4674 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4675 | sizeof(wmi_roam_offload_tlv_param)); |
| 4676 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4677 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 4678 | WMITLV_SET_HDR(buf_ptr, |
| 4679 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 4680 | WMITLV_GET_STRUCT_TLVLEN |
| 4681 | (wmi_roam_offload_tlv_param)); |
| 4682 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 4683 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 4684 | roam_offload_params->select_5g_margin = |
| 4685 | roam_req->select_5ghz_margin; |
| 4686 | roam_offload_params->reassoc_failure_timeout = |
| 4687 | roam_req->reassoc_failure_timeout; |
| 4688 | |
| 4689 | /* Fill the capabilities */ |
| 4690 | roam_offload_params->capability = |
| 4691 | roam_req->roam_offload_params.capability; |
| 4692 | roam_offload_params->ht_caps_info = |
| 4693 | roam_req->roam_offload_params.ht_caps_info; |
| 4694 | roam_offload_params->ampdu_param = |
| 4695 | roam_req->roam_offload_params.ampdu_param; |
| 4696 | roam_offload_params->ht_ext_cap = |
| 4697 | roam_req->roam_offload_params.ht_ext_cap; |
| 4698 | roam_offload_params->ht_txbf = |
| 4699 | roam_req->roam_offload_params.ht_txbf; |
| 4700 | roam_offload_params->asel_cap = |
| 4701 | roam_req->roam_offload_params.asel_cap; |
| 4702 | roam_offload_params->qos_caps = |
| 4703 | roam_req->roam_offload_params.qos_caps; |
| 4704 | roam_offload_params->wmm_caps = |
| 4705 | roam_req->roam_offload_params.wmm_caps; |
| 4706 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 4707 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 4708 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 4709 | |
| 4710 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 4711 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 4712 | * they are filled in the same order.Depending on the |
| 4713 | * authentication type, the other mode TLV's are nullified |
| 4714 | * and only headers are filled.*/ |
| 4715 | if ((auth_mode != WMI_AUTH_NONE) && |
| 4716 | ((auth_mode != WMI_AUTH_OPEN) || |
| 4717 | (auth_mode == WMI_AUTH_OPEN |
| 4718 | && roam_req->mdid.mdie_present) || |
| 4719 | roam_req->is_ese_assoc)) { |
| 4720 | if (roam_req->is_ese_assoc) { |
| 4721 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4722 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4723 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4724 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4725 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4726 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4727 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4728 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 4729 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4730 | roam_offload_ese = |
| 4731 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 4732 | qdf_mem_copy(roam_offload_ese->krk, |
| 4733 | roam_req->krk, |
| 4734 | sizeof(roam_req->krk)); |
| 4735 | qdf_mem_copy(roam_offload_ese->btk, |
| 4736 | roam_req->btk, |
| 4737 | sizeof(roam_req->btk)); |
| 4738 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 4739 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 4740 | WMITLV_GET_STRUCT_TLVLEN |
| 4741 | (wmi_roam_ese_offload_tlv_param)); |
| 4742 | buf_ptr += |
| 4743 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 4744 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 4745 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 4746 | || (auth_mode == WMI_AUTH_OPEN |
| 4747 | && roam_req->mdid.mdie_present)) { |
| 4748 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4749 | 0); |
| 4750 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4751 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4752 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 4753 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4754 | roam_offload_11r = |
| 4755 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 4756 | roam_offload_11r->r0kh_id_len = |
| 4757 | roam_req->rokh_id_length; |
| 4758 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 4759 | roam_req->rokh_id, |
| 4760 | roam_offload_11r->r0kh_id_len); |
| 4761 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 4762 | roam_req->psk_pmk, |
| 4763 | sizeof(roam_req->psk_pmk)); |
| 4764 | roam_offload_11r->psk_msk_len = |
| 4765 | roam_req->pmk_len; |
| 4766 | roam_offload_11r->mdie_present = |
| 4767 | roam_req->mdid.mdie_present; |
| 4768 | roam_offload_11r->mdid = |
| 4769 | roam_req->mdid.mobility_domain; |
| 4770 | if (auth_mode == WMI_AUTH_OPEN) { |
| 4771 | /* If FT-Open ensure pmk length |
| 4772 | and r0khid len are zero */ |
| 4773 | roam_offload_11r->r0kh_id_len = 0; |
| 4774 | roam_offload_11r->psk_msk_len = 0; |
| 4775 | } |
| 4776 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 4777 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 4778 | WMITLV_GET_STRUCT_TLVLEN |
| 4779 | (wmi_roam_11r_offload_tlv_param)); |
| 4780 | buf_ptr += |
| 4781 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 4782 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4783 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4784 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4785 | } else { |
| 4786 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4787 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 4788 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4789 | roam_offload_11i = |
| 4790 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 4791 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 4792 | roam_req->okc_enabled) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4793 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 4794 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4795 | WMI_LOGE("LFR3:OKC Enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4796 | } else { |
| 4797 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 4798 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4799 | WMI_LOGE("LFR3:OKC Disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4800 | } |
| 4801 | |
| 4802 | qdf_mem_copy(roam_offload_11i->pmk, |
| 4803 | roam_req->psk_pmk, |
| 4804 | sizeof(roam_req->psk_pmk)); |
| 4805 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 4806 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 4807 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 4808 | WMITLV_GET_STRUCT_TLVLEN |
| 4809 | (wmi_roam_11i_offload_tlv_param)); |
| 4810 | buf_ptr += |
| 4811 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 4812 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4813 | 0); |
| 4814 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4815 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4816 | 0); |
| 4817 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4818 | } |
| 4819 | } else { |
| 4820 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4821 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4822 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4823 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4824 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4825 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4826 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4827 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4828 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4829 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4830 | |
| 4831 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4832 | sizeof(*assoc_ies)); |
| 4833 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4834 | |
| 4835 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 4836 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 4837 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 4838 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 4839 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 4840 | |
| 4841 | buf_ptr += sizeof(*assoc_ies); |
| 4842 | |
| 4843 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4844 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 4845 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4846 | |
| 4847 | if (assoc_ies->buf_len != 0) { |
| 4848 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 4849 | assoc_ies->buf_len); |
| 4850 | } |
| 4851 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4852 | } else { |
| 4853 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4854 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4855 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4856 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4857 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4858 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4859 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4860 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4861 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4862 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4863 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4864 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4865 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4866 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4867 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4868 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4869 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4870 | } |
| 4871 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4872 | |
| 4873 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4874 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4875 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4876 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4877 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4878 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 4879 | status); |
| 4880 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4881 | } |
| 4882 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4883 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4884 | } |
| 4885 | |
| 4886 | |
| 4887 | /** |
| 4888 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 4889 | * rssi threashold |
| 4890 | * @wmi_handle: wmi handle |
| 4891 | * @roam_req: Roaming request buffer |
| 4892 | * |
| 4893 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 4894 | * |
| 4895 | * Return: QDF status |
| 4896 | */ |
| 4897 | QDF_STATUS send_roam_scan_offload_rssi_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
| 4898 | struct roam_offload_scan_rssi_params *roam_req) |
| 4899 | { |
| 4900 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4901 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4902 | int len; |
| 4903 | uint8_t *buf_ptr; |
| 4904 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 4905 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 4906 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 4907 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4908 | |
| 4909 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 4910 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 4911 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 4912 | len += WMI_TLV_HDR_SIZE; |
| 4913 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 4914 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 4915 | len += sizeof(wmi_roam_dense_thres_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4916 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4917 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4918 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4919 | return QDF_STATUS_E_NOMEM; |
| 4920 | } |
| 4921 | |
| 4922 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4923 | rssi_threshold_fp = |
| 4924 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 4925 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 4926 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 4927 | WMITLV_GET_STRUCT_TLVLEN |
| 4928 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 4929 | /* fill in threshold values */ |
| 4930 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 4931 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 4932 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 4933 | rssi_threshold_fp->hirssi_scan_max_count = |
| 4934 | roam_req->hi_rssi_scan_max_count; |
| 4935 | rssi_threshold_fp->hirssi_scan_delta = |
| 4936 | roam_req->hi_rssi_scan_rssi_delta; |
| 4937 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
| 4938 | |
| 4939 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 4940 | WMITLV_SET_HDR(buf_ptr, |
| 4941 | WMITLV_TAG_ARRAY_STRUC, |
| 4942 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 4943 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4944 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 4945 | |
| 4946 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 4947 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 4948 | ext_thresholds->boost_threshold_5g = |
| 4949 | roam_req->boost_threshold_5g; |
| 4950 | |
| 4951 | ext_thresholds->boost_algorithm_5g = |
| 4952 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 4953 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 4954 | ext_thresholds->penalty_algorithm_5g = |
| 4955 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 4956 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 4957 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 4958 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 4959 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 4960 | |
| 4961 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 4962 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 4963 | WMITLV_GET_STRUCT_TLVLEN |
| 4964 | (wmi_roam_scan_extended_threshold_param)); |
| 4965 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 4966 | WMITLV_SET_HDR(buf_ptr, |
| 4967 | WMITLV_TAG_ARRAY_STRUC, |
| 4968 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 4969 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4970 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 4971 | early_stop_thresholds->roam_earlystop_thres_min = |
| 4972 | roam_req->roam_earlystop_thres_min; |
| 4973 | early_stop_thresholds->roam_earlystop_thres_max = |
| 4974 | roam_req->roam_earlystop_thres_max; |
| 4975 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 4976 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 4977 | WMITLV_GET_STRUCT_TLVLEN |
| 4978 | (wmi_roam_earlystop_rssi_thres_param)); |
| 4979 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 4980 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 4981 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4982 | sizeof(wmi_roam_dense_thres_param)); |
| 4983 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4984 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 4985 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 4986 | roam_req->dense_rssi_thresh_offset; |
| 4987 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 4988 | dense_thresholds->roam_dense_traffic_thres = |
| 4989 | roam_req->traffic_threshold; |
| 4990 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 4991 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 4992 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 4993 | WMITLV_GET_STRUCT_TLVLEN |
| 4994 | (wmi_roam_dense_thres_param)); |
| 4995 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4996 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4997 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4998 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4999 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5000 | status); |
| 5001 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5002 | } |
| 5003 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5004 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5005 | } |
| 5006 | |
| 5007 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5008 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 5009 | * configuration params |
| 5010 | * @wma_handle: wma handler |
| 5011 | * @dwelltime_params: pointer to dwelltime_params |
| 5012 | * |
| 5013 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 5014 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 5015 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5016 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5017 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 5018 | { |
| 5019 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 5020 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 5021 | wmi_buf_t buf; |
| 5022 | uint8_t *buf_ptr; |
| 5023 | int32_t err; |
| 5024 | int len; |
| 5025 | |
| 5026 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5027 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5028 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 5029 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5030 | if (!buf) { |
| 5031 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 5032 | __func__); |
| 5033 | return QDF_STATUS_E_NOMEM; |
| 5034 | } |
| 5035 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5036 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 5037 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 5038 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 5039 | WMITLV_GET_STRUCT_TLVLEN |
| 5040 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 5041 | |
| 5042 | dwell_param->enable = dwelltime_params->is_enabled; |
| 5043 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5044 | WMITLV_SET_HDR(buf_ptr, |
| 5045 | WMITLV_TAG_ARRAY_STRUC, |
| 5046 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5047 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5048 | |
| 5049 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 5050 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5051 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 5052 | WMITLV_GET_STRUCT_TLVLEN( |
| 5053 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5054 | |
| 5055 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 5056 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 5057 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 5058 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 5059 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 5060 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 5061 | if (err) { |
| 5062 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 5063 | wmi_buf_free(buf); |
| 5064 | return QDF_STATUS_E_FAILURE; |
| 5065 | } |
| 5066 | |
| 5067 | return QDF_STATUS_SUCCESS; |
| 5068 | } |
| 5069 | |
| 5070 | |
| 5071 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5072 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 5073 | * @wmi_handle: wmi handle |
| 5074 | * @roam_req: Request which contains the filters |
| 5075 | * |
| 5076 | * There are filters such as whitelist, blacklist and preferred |
| 5077 | * list that need to be applied to the scan results to form the |
| 5078 | * probable candidates for roaming. |
| 5079 | * |
| 5080 | * Return: Return success upon succesfully passing the |
| 5081 | * parameters to the firmware, otherwise failure. |
| 5082 | */ |
| 5083 | QDF_STATUS send_roam_scan_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 5084 | struct roam_scan_filter_params *roam_req) |
| 5085 | { |
| 5086 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5087 | QDF_STATUS status; |
| 5088 | uint32_t i; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5089 | uint32_t len; |
| 5090 | uint8_t *buf_ptr; |
| 5091 | wmi_roam_filter_fixed_param *roam_filter; |
| 5092 | uint8_t *bssid_src_ptr = NULL; |
| 5093 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 5094 | wmi_ssid *ssid_ptr = NULL; |
| 5095 | uint32_t *bssid_preferred_factor_ptr = NULL; |
| 5096 | |
| 5097 | len = sizeof(wmi_roam_filter_fixed_param); |
| 5098 | len += WMI_TLV_HDR_SIZE; |
| 5099 | len += roam_req->len; |
| 5100 | |
| 5101 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5102 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5103 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5104 | return QDF_STATUS_E_NOMEM; |
| 5105 | } |
| 5106 | |
| 5107 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 5108 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 5109 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 5110 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 5111 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 5112 | /* fill in fixed values */ |
| 5113 | roam_filter->vdev_id = roam_req->session_id; |
| 5114 | roam_filter->flags = 0; |
| 5115 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 5116 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 5117 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 5118 | roam_filter->num_bssid_preferred_list = |
| 5119 | roam_req->num_bssid_preferred_list; |
| 5120 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 5121 | |
| 5122 | WMITLV_SET_HDR((buf_ptr), |
| 5123 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5124 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 5125 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 5126 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5127 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 5128 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 5129 | bssid_src_ptr += ATH_MAC_LEN; |
| 5130 | bssid_dst_ptr++; |
| 5131 | } |
| 5132 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5133 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 5134 | WMITLV_SET_HDR((buf_ptr), |
| 5135 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5136 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 5137 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5138 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 5139 | qdf_mem_copy(&ssid_ptr->ssid, |
| 5140 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 5141 | roam_req->ssid_allowed_list[i].length); |
| 5142 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 5143 | ssid_ptr++; |
| 5144 | } |
| 5145 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 5146 | sizeof(wmi_ssid)); |
| 5147 | WMITLV_SET_HDR((buf_ptr), |
| 5148 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5149 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 5150 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 5151 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5152 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5153 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 5154 | (wmi_mac_addr *)bssid_dst_ptr); |
| 5155 | bssid_src_ptr += ATH_MAC_LEN; |
| 5156 | bssid_dst_ptr++; |
| 5157 | } |
| 5158 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5159 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 5160 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 5161 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 5162 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5163 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5164 | *bssid_preferred_factor_ptr = |
| 5165 | roam_req->bssid_favored_factor[i]; |
| 5166 | bssid_preferred_factor_ptr++; |
| 5167 | } |
| 5168 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5169 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 5170 | |
| 5171 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5172 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5173 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5174 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5175 | status); |
| 5176 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5177 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5178 | |
| 5179 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5180 | } |
| 5181 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5182 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 5183 | * @wmi_handle: wmi handle |
| 5184 | * @req: epno config params request structure |
| 5185 | * |
| 5186 | * This function reads the incoming epno config request structure |
| 5187 | * and constructs the WMI message to the firmware. |
| 5188 | * |
| 5189 | * Returns: 0 on success, error number otherwise |
| 5190 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5191 | 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] | 5192 | struct wifi_enhanched_pno_params *req) |
| 5193 | { |
| 5194 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 5195 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5196 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5197 | u_int8_t i, *buf_ptr; |
| 5198 | wmi_buf_t buf; |
| 5199 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5200 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5201 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5202 | /* Fixed Params */ |
| 5203 | len = sizeof(*cmd); |
| 5204 | if (req->num_networks) { |
| 5205 | /* TLV place holder for array of structures |
| 5206 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 5207 | */ |
| 5208 | len += WMI_TLV_HDR_SIZE; |
| 5209 | len += (sizeof(nlo_configured_parameters) |
| 5210 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 5211 | /* TLV for array of uint32 channel_list */ |
| 5212 | len += WMI_TLV_HDR_SIZE; |
| 5213 | /* TLV for nlo_channel_prediction_cfg */ |
| 5214 | len += WMI_TLV_HDR_SIZE; |
| 5215 | /* TLV for candidate score params */ |
| 5216 | len += sizeof(enlo_candidate_score_params); |
| 5217 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5218 | |
| 5219 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5220 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5221 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5222 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5223 | } |
| 5224 | |
| 5225 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5226 | |
| 5227 | buf_ptr = (u_int8_t *) cmd; |
| 5228 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5229 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5230 | WMITLV_GET_STRUCT_TLVLEN( |
| 5231 | wmi_nlo_config_cmd_fixed_param)); |
| 5232 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5233 | |
| 5234 | /* set flag to reset if num of networks are 0 */ |
| 5235 | cmd->flags = (req->num_networks == 0 ? |
| 5236 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5237 | |
| 5238 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 5239 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5240 | 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] | 5241 | WMI_LOGD("SSID count: %d flags: %d", |
| 5242 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5243 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5244 | /* Fill nlo_config only when num_networks are non zero */ |
| 5245 | if (cmd->no_of_ssids) { |
| 5246 | /* Fill networks */ |
| 5247 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5248 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 5249 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5250 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5251 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 5252 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 5253 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 5254 | WMITLV_TAG_ARRAY_BYTE, |
| 5255 | WMITLV_GET_STRUCT_TLVLEN( |
| 5256 | nlo_configured_parameters)); |
| 5257 | /* Copy ssid and it's length */ |
| 5258 | nlo_list[i].ssid.valid = true; |
| 5259 | nlo_list[i].ssid.ssid.ssid_len = |
| 5260 | req->networks[i].ssid.length; |
| 5261 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 5262 | req->networks[i].ssid.mac_ssid, |
| 5263 | nlo_list[i].ssid.ssid.ssid_len); |
| 5264 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 5265 | nlo_list[i].ssid.ssid.ssid_len, |
| 5266 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 5267 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5268 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5269 | /* Copy pno flags */ |
| 5270 | nlo_list[i].bcast_nw_type.valid = true; |
| 5271 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 5272 | req->networks[i].flags; |
| 5273 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5274 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 5275 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5276 | /* Copy auth bit field */ |
| 5277 | nlo_list[i].auth_type.valid = true; |
| 5278 | nlo_list[i].auth_type.auth_type = |
| 5279 | req->networks[i].auth_bit_field; |
| 5280 | WMI_LOGD("Auth bit field (%u)", |
| 5281 | nlo_list[i].auth_type.auth_type); |
| 5282 | } |
| 5283 | |
| 5284 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 5285 | /* Fill the channel list */ |
| 5286 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 5287 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5288 | |
| 5289 | /* Fill prediction_param */ |
| 5290 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5291 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5292 | |
| 5293 | /* Fill epno candidate score params */ |
| 5294 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 5295 | WMITLV_SET_HDR(buf_ptr, |
| 5296 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 5297 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 5298 | cand_score_params->min5GHz_rssi = |
| 5299 | req->min_5ghz_rssi; |
| 5300 | cand_score_params->min24GHz_rssi = |
| 5301 | req->min_24ghz_rssi; |
| 5302 | cand_score_params->initial_score_max = |
| 5303 | req->initial_score_max; |
| 5304 | cand_score_params->current_connection_bonus = |
| 5305 | req->current_connection_bonus; |
| 5306 | cand_score_params->same_network_bonus = |
| 5307 | req->same_network_bonus; |
| 5308 | cand_score_params->secure_bonus = |
| 5309 | req->secure_bonus; |
| 5310 | cand_score_params->band5GHz_bonus = |
| 5311 | req->band_5ghz_bonus; |
| 5312 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5313 | } |
| 5314 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5315 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5316 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5317 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5318 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5319 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5320 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5321 | } |
| 5322 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5323 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5324 | req->session_id); |
| 5325 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5326 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5327 | } |
| 5328 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5329 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5330 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 5331 | * @wmi_handle: wmi handle |
| 5332 | * @ipa_offload: ipa offload control parameter |
| 5333 | * |
| 5334 | * Returns: 0 on success, error number otherwise |
| 5335 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5336 | 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] | 5337 | struct ipa_offload_control_params *ipa_offload) |
| 5338 | { |
| 5339 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 5340 | wmi_buf_t wmi_buf; |
| 5341 | uint32_t len; |
| 5342 | u_int8_t *buf_ptr; |
| 5343 | |
| 5344 | len = sizeof(*cmd); |
| 5345 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5346 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5347 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 5348 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5349 | } |
| 5350 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5351 | WMI_LOGE("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5352 | ipa_offload->offload_type, ipa_offload->enable); |
| 5353 | |
| 5354 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 5355 | |
| 5356 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 5357 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5358 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 5359 | WMITLV_GET_STRUCT_TLVLEN( |
| 5360 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 5361 | |
| 5362 | cmd->offload_type = ipa_offload->offload_type; |
| 5363 | cmd->vdev_id = ipa_offload->vdev_id; |
| 5364 | cmd->enable = ipa_offload->enable; |
| 5365 | |
| 5366 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5367 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5368 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5369 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5370 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5371 | } |
| 5372 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5373 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5374 | } |
| 5375 | |
| 5376 | /** |
| 5377 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 5378 | * @wmi_handle: wmi handle |
| 5379 | * @pgetcapab: get capabilities params |
| 5380 | * |
| 5381 | * This function send request to fw to get extscan capabilities. |
| 5382 | * |
| 5383 | * Return: CDF status |
| 5384 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5385 | 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] | 5386 | struct extscan_capabilities_params *pgetcapab) |
| 5387 | { |
| 5388 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 5389 | wmi_buf_t wmi_buf; |
| 5390 | uint32_t len; |
| 5391 | uint8_t *buf_ptr; |
| 5392 | |
| 5393 | len = sizeof(*cmd); |
| 5394 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5395 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5396 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5397 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5398 | } |
| 5399 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5400 | |
| 5401 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 5402 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5403 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 5404 | WMITLV_GET_STRUCT_TLVLEN |
| 5405 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 5406 | |
| 5407 | cmd->request_id = pgetcapab->request_id; |
| 5408 | |
| 5409 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5410 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5411 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5412 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5413 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5414 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5415 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5416 | } |
| 5417 | |
| 5418 | /** |
| 5419 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 5420 | * @wmi_handle: wmi handle |
| 5421 | * @pcached_results: cached results parameters |
| 5422 | * |
| 5423 | * This function send request to fw to get cached results. |
| 5424 | * |
| 5425 | * Return: CDF status |
| 5426 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5427 | 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] | 5428 | struct extscan_cached_result_params *pcached_results) |
| 5429 | { |
| 5430 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 5431 | wmi_buf_t wmi_buf; |
| 5432 | uint32_t len; |
| 5433 | uint8_t *buf_ptr; |
| 5434 | |
| 5435 | len = sizeof(*cmd); |
| 5436 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5437 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5438 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5439 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5440 | } |
| 5441 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5442 | |
| 5443 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 5444 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5445 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 5446 | WMITLV_GET_STRUCT_TLVLEN |
| 5447 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 5448 | |
| 5449 | cmd->request_id = pcached_results->request_id; |
| 5450 | cmd->vdev_id = pcached_results->session_id; |
| 5451 | cmd->control_flags = pcached_results->flush; |
| 5452 | |
| 5453 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5454 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5455 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5456 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5457 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5458 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5459 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5460 | } |
| 5461 | |
| 5462 | /** |
| 5463 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 5464 | * @wmi_handle: wmi handle |
| 5465 | * @reset_req: Reset change request params |
| 5466 | * |
| 5467 | * This function sends stop change monitor request to fw. |
| 5468 | * |
| 5469 | * Return: CDF status |
| 5470 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5471 | 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] | 5472 | struct extscan_capabilities_reset_params *reset_req) |
| 5473 | { |
| 5474 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 5475 | wmi_buf_t wmi_buf; |
| 5476 | uint32_t len; |
| 5477 | uint8_t *buf_ptr; |
| 5478 | int change_list = 0; |
| 5479 | |
| 5480 | len = sizeof(*cmd); |
| 5481 | |
| 5482 | /* reset significant change tlv is set to 0 */ |
| 5483 | len += WMI_TLV_HDR_SIZE; |
| 5484 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 5485 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5486 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5487 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5488 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5489 | } |
| 5490 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5491 | |
| 5492 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 5493 | buf_ptr; |
| 5494 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5495 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 5496 | WMITLV_GET_STRUCT_TLVLEN |
| 5497 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 5498 | |
| 5499 | cmd->request_id = reset_req->request_id; |
| 5500 | cmd->vdev_id = reset_req->session_id; |
| 5501 | cmd->mode = 0; |
| 5502 | |
| 5503 | buf_ptr += sizeof(*cmd); |
| 5504 | WMITLV_SET_HDR(buf_ptr, |
| 5505 | WMITLV_TAG_ARRAY_STRUC, |
| 5506 | change_list * |
| 5507 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5508 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 5509 | sizeof |
| 5510 | (wmi_extscan_wlan_change_bssid_param)); |
| 5511 | |
| 5512 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5513 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5514 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5515 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5516 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5517 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5518 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5519 | } |
| 5520 | |
| 5521 | /** |
| 5522 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 5523 | * @wmi_handle: wmi handle |
| 5524 | * @psigchange: change monitor request params |
| 5525 | * @buf: wmi buffer |
| 5526 | * @buf_len: buffer length |
| 5527 | * |
| 5528 | * This function fills elements of change monitor request buffer. |
| 5529 | * |
| 5530 | * Return: CDF status |
| 5531 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5532 | 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] | 5533 | struct extscan_set_sig_changereq_params |
| 5534 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 5535 | { |
| 5536 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 5537 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 5538 | uint8_t *buf_ptr; |
| 5539 | int j; |
| 5540 | int len = sizeof(*cmd); |
| 5541 | int numap = psigchange->num_ap; |
| 5542 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 5543 | |
| 5544 | if (!numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5545 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 5546 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5547 | } |
| 5548 | len += WMI_TLV_HDR_SIZE; |
| 5549 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 5550 | |
| 5551 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 5552 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5553 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5554 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5555 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5556 | } |
| 5557 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 5558 | cmd = |
| 5559 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 5560 | buf_ptr; |
| 5561 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5562 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 5563 | WMITLV_GET_STRUCT_TLVLEN |
| 5564 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 5565 | |
| 5566 | cmd->request_id = psigchange->request_id; |
| 5567 | cmd->vdev_id = psigchange->session_id; |
| 5568 | cmd->total_entries = numap; |
| 5569 | cmd->mode = 1; |
| 5570 | cmd->num_entries_in_page = numap; |
| 5571 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 5572 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 5573 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 5574 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 5575 | |
| 5576 | buf_ptr += sizeof(*cmd); |
| 5577 | WMITLV_SET_HDR(buf_ptr, |
| 5578 | WMITLV_TAG_ARRAY_STRUC, |
| 5579 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5580 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 5581 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5582 | |
| 5583 | for (j = 0; j < numap; j++) { |
| 5584 | WMITLV_SET_HDR(dest_chglist, |
| 5585 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 5586 | WMITLV_GET_STRUCT_TLVLEN |
| 5587 | (wmi_extscan_wlan_change_bssid_param)); |
| 5588 | |
| 5589 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 5590 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 5591 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 5592 | &dest_chglist->bssid); |
| 5593 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5594 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5595 | dest_chglist->lower_rssi_limit); |
| 5596 | dest_chglist++; |
| 5597 | src_ap++; |
| 5598 | } |
| 5599 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5600 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5601 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5602 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5603 | } |
| 5604 | |
| 5605 | /** |
| 5606 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 5607 | * @wmi_handle: wmi handle |
| 5608 | * @psigchange: change monitor request params |
| 5609 | * |
| 5610 | * This function sends start change monitor request to fw. |
| 5611 | * |
| 5612 | * Return: CDF status |
| 5613 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5614 | 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] | 5615 | struct extscan_set_sig_changereq_params * |
| 5616 | psigchange) |
| 5617 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5618 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5619 | wmi_buf_t buf; |
| 5620 | int len; |
| 5621 | |
| 5622 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5623 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5624 | psigchange, &buf, |
| 5625 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5626 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 5627 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5628 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5629 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5630 | } |
| 5631 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5632 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 5633 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5634 | } |
| 5635 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5636 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5637 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5638 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5639 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5640 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5641 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5642 | } |
| 5643 | |
| 5644 | /** |
| 5645 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 5646 | * @wmi_handle: wmi handle |
| 5647 | * @photlist_reset: hotlist reset params |
| 5648 | * |
| 5649 | * This function configures hotlist monitor to stop in fw. |
| 5650 | * |
| 5651 | * Return: CDF status |
| 5652 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5653 | 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] | 5654 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 5655 | { |
| 5656 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 5657 | wmi_buf_t wmi_buf; |
| 5658 | uint32_t len; |
| 5659 | uint8_t *buf_ptr; |
| 5660 | int hotlist_entries = 0; |
| 5661 | |
| 5662 | len = sizeof(*cmd); |
| 5663 | |
| 5664 | /* reset bssid hotlist with tlv set to 0 */ |
| 5665 | len += WMI_TLV_HDR_SIZE; |
| 5666 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 5667 | |
| 5668 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5669 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5670 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5671 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5672 | } |
| 5673 | |
| 5674 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5675 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 5676 | buf_ptr; |
| 5677 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5678 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 5679 | WMITLV_GET_STRUCT_TLVLEN |
| 5680 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 5681 | |
| 5682 | cmd->request_id = photlist_reset->request_id; |
| 5683 | cmd->vdev_id = photlist_reset->session_id; |
| 5684 | cmd->mode = 0; |
| 5685 | |
| 5686 | buf_ptr += sizeof(*cmd); |
| 5687 | WMITLV_SET_HDR(buf_ptr, |
| 5688 | WMITLV_TAG_ARRAY_STRUC, |
| 5689 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 5690 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5691 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 5692 | |
| 5693 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5694 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5695 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5696 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5697 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5698 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5699 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5700 | } |
| 5701 | |
| 5702 | /** |
| 5703 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 5704 | * @wmi_handle: wmi handle |
| 5705 | * @pstopcmd: stop scan command request params |
| 5706 | * |
| 5707 | * This function sends stop extscan request to fw. |
| 5708 | * |
| 5709 | * Return: CDF Status. |
| 5710 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5711 | QDF_STATUS send_stop_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5712 | struct extscan_stop_req_params *pstopcmd) |
| 5713 | { |
| 5714 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 5715 | wmi_buf_t wmi_buf; |
| 5716 | uint32_t len; |
| 5717 | uint8_t *buf_ptr; |
| 5718 | |
| 5719 | len = sizeof(*cmd); |
| 5720 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5721 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5722 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5723 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5724 | } |
| 5725 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5726 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 5727 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5728 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 5729 | WMITLV_GET_STRUCT_TLVLEN |
| 5730 | (wmi_extscan_stop_cmd_fixed_param)); |
| 5731 | |
| 5732 | cmd->request_id = pstopcmd->request_id; |
| 5733 | cmd->vdev_id = pstopcmd->session_id; |
| 5734 | |
| 5735 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5736 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5737 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5738 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5739 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5740 | } |
| 5741 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5742 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5743 | } |
| 5744 | |
| 5745 | /** |
| 5746 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 5747 | * @wmi_handle: wmi handle |
| 5748 | * @pstart: scan command request params |
| 5749 | * @buf: event buffer |
| 5750 | * @buf_len: length of buffer |
| 5751 | * |
| 5752 | * This function fills individual elements of extscan request and |
| 5753 | * TLV for buckets, channel list. |
| 5754 | * |
| 5755 | * Return: CDF Status. |
| 5756 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 5757 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5758 | 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] | 5759 | struct wifi_scan_cmd_req_params *pstart, |
| 5760 | wmi_buf_t *buf, int *buf_len) |
| 5761 | { |
| 5762 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 5763 | wmi_extscan_bucket *dest_blist; |
| 5764 | wmi_extscan_bucket_channel *dest_clist; |
| 5765 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 5766 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 5767 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 5768 | |
| 5769 | uint8_t *buf_ptr; |
| 5770 | int i, k, count = 0; |
| 5771 | int len = sizeof(*cmd); |
| 5772 | int nbuckets = pstart->numBuckets; |
| 5773 | int nchannels = 0; |
| 5774 | |
| 5775 | /* These TLV's are are NULL by default */ |
| 5776 | uint32_t ie_len_with_pad = 0; |
| 5777 | int num_ssid = 0; |
| 5778 | int num_bssid = 0; |
| 5779 | int ie_len = 0; |
| 5780 | |
| 5781 | uint32_t base_period = pstart->basePeriod; |
| 5782 | |
| 5783 | /* TLV placeholder for ssid_list (NULL) */ |
| 5784 | len += WMI_TLV_HDR_SIZE; |
| 5785 | len += num_ssid * sizeof(wmi_ssid); |
| 5786 | |
| 5787 | /* TLV placeholder for bssid_list (NULL) */ |
| 5788 | len += WMI_TLV_HDR_SIZE; |
| 5789 | len += num_bssid * sizeof(wmi_mac_addr); |
| 5790 | |
| 5791 | /* TLV placeholder for ie_data (NULL) */ |
| 5792 | len += WMI_TLV_HDR_SIZE; |
| 5793 | len += ie_len * sizeof(uint32_t); |
| 5794 | |
| 5795 | /* TLV placeholder for bucket */ |
| 5796 | len += WMI_TLV_HDR_SIZE; |
| 5797 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 5798 | |
| 5799 | /* TLV channel placeholder */ |
| 5800 | len += WMI_TLV_HDR_SIZE; |
| 5801 | for (i = 0; i < nbuckets; i++) { |
| 5802 | nchannels += src_bucket->numChannels; |
| 5803 | src_bucket++; |
| 5804 | } |
| 5805 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5806 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5807 | __func__, nbuckets, nchannels); |
| 5808 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 5809 | /* Allocate the memory */ |
| 5810 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 5811 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5812 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5813 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5814 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5815 | } |
| 5816 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 5817 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 5818 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5819 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 5820 | WMITLV_GET_STRUCT_TLVLEN |
| 5821 | (wmi_extscan_start_cmd_fixed_param)); |
| 5822 | |
| 5823 | cmd->request_id = pstart->requestId; |
| 5824 | cmd->vdev_id = pstart->sessionId; |
| 5825 | cmd->base_period = pstart->basePeriod; |
| 5826 | cmd->num_buckets = nbuckets; |
| 5827 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 5828 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5829 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5830 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5831 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5832 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5833 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 5834 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5835 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 5836 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 5837 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5838 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 5839 | |
| 5840 | /* The max dwell time is retrieved from the first channel |
| 5841 | * of the first bucket and kept common for all channels. |
| 5842 | */ |
| 5843 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 5844 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 5845 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 5846 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 5847 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 5848 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 5849 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 5850 | |
| 5851 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5852 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5853 | cmd->probe_delay = 0; |
| 5854 | cmd->probe_spacing_time = 0; |
| 5855 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5856 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 5857 | WMI_SCAN_ADD_CCK_RATES | |
| 5858 | WMI_SCAN_ADD_OFDM_RATES | |
| 5859 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 5860 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5861 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 5862 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 5863 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5864 | cmd->num_ssids = 0; |
| 5865 | cmd->num_bssid = 0; |
| 5866 | cmd->ie_len = 0; |
| 5867 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 5868 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 5869 | |
| 5870 | buf_ptr += sizeof(*cmd); |
| 5871 | WMITLV_SET_HDR(buf_ptr, |
| 5872 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5873 | num_ssid * sizeof(wmi_ssid)); |
| 5874 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 5875 | |
| 5876 | WMITLV_SET_HDR(buf_ptr, |
| 5877 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5878 | num_bssid * sizeof(wmi_mac_addr)); |
| 5879 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 5880 | |
| 5881 | ie_len_with_pad = 0; |
| 5882 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5883 | ie_len_with_pad); |
| 5884 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 5885 | |
| 5886 | WMITLV_SET_HDR(buf_ptr, |
| 5887 | WMITLV_TAG_ARRAY_STRUC, |
| 5888 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 5889 | dest_blist = (wmi_extscan_bucket *) |
| 5890 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5891 | src_bucket = pstart->buckets; |
| 5892 | |
| 5893 | /* Retrieve scanning information from each bucket and |
| 5894 | * channels and send it to the target |
| 5895 | */ |
| 5896 | for (i = 0; i < nbuckets; i++) { |
| 5897 | WMITLV_SET_HDR(dest_blist, |
| 5898 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 5899 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 5900 | |
| 5901 | dest_blist->bucket_id = src_bucket->bucket; |
| 5902 | dest_blist->base_period_multiplier = |
| 5903 | src_bucket->period / base_period; |
| 5904 | dest_blist->min_period = src_bucket->period; |
| 5905 | dest_blist->max_period = src_bucket->max_period; |
| 5906 | dest_blist->exp_backoff = src_bucket->exponent; |
| 5907 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 5908 | dest_blist->channel_band = src_bucket->band; |
| 5909 | dest_blist->num_channels = src_bucket->numChannels; |
| 5910 | dest_blist->notify_extscan_events = 0; |
| 5911 | |
| 5912 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 5913 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 5914 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 5915 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5916 | |
| 5917 | if (src_bucket->reportEvents & |
| 5918 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 5919 | dest_blist->forwarding_flags = |
| 5920 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 5921 | dest_blist->notify_extscan_events |= |
| 5922 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 5923 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 5924 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 5925 | } else { |
| 5926 | dest_blist->forwarding_flags = |
| 5927 | WMI_EXTSCAN_NO_FORWARDING; |
| 5928 | } |
| 5929 | |
| 5930 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 5931 | dest_blist->configuration_flags = 0; |
| 5932 | else |
| 5933 | dest_blist->configuration_flags = |
| 5934 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 5935 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5936 | 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] | 5937 | __func__, dest_blist->notify_extscan_events, |
| 5938 | dest_blist->configuration_flags, |
| 5939 | dest_blist->forwarding_flags); |
| 5940 | |
| 5941 | dest_blist->min_dwell_time_active = |
| 5942 | src_bucket->min_dwell_time_active; |
| 5943 | dest_blist->max_dwell_time_active = |
| 5944 | src_bucket->max_dwell_time_active; |
| 5945 | dest_blist->min_dwell_time_passive = |
| 5946 | src_bucket->min_dwell_time_passive; |
| 5947 | dest_blist->max_dwell_time_passive = |
| 5948 | src_bucket->max_dwell_time_passive; |
| 5949 | src_channel = src_bucket->channels; |
| 5950 | |
| 5951 | /* save the channel info to later populate |
| 5952 | * the channel TLV |
| 5953 | */ |
| 5954 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 5955 | save_channel[count++].channel = src_channel->channel; |
| 5956 | src_channel++; |
| 5957 | } |
| 5958 | dest_blist++; |
| 5959 | src_bucket++; |
| 5960 | } |
| 5961 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 5962 | WMITLV_SET_HDR(buf_ptr, |
| 5963 | WMITLV_TAG_ARRAY_STRUC, |
| 5964 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 5965 | dest_clist = (wmi_extscan_bucket_channel *) |
| 5966 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5967 | |
| 5968 | /* Active or passive scan is based on the bucket dwell time |
| 5969 | * and channel specific active,passive scans are not |
| 5970 | * supported yet |
| 5971 | */ |
| 5972 | for (i = 0; i < nchannels; i++) { |
| 5973 | WMITLV_SET_HDR(dest_clist, |
| 5974 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 5975 | WMITLV_GET_STRUCT_TLVLEN |
| 5976 | (wmi_extscan_bucket_channel)); |
| 5977 | dest_clist->channel = save_channel[i].channel; |
| 5978 | dest_clist++; |
| 5979 | } |
| 5980 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5981 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 5982 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5983 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5984 | } |
| 5985 | |
| 5986 | /** |
| 5987 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 5988 | * @wmi_handle: wmi handle |
| 5989 | * @pstart: scan command request params |
| 5990 | * |
| 5991 | * This function sends start extscan request to fw. |
| 5992 | * |
| 5993 | * Return: CDF Status. |
| 5994 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5995 | QDF_STATUS send_start_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5996 | struct wifi_scan_cmd_req_params *pstart) |
| 5997 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5998 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5999 | wmi_buf_t buf; |
| 6000 | int len; |
| 6001 | |
| 6002 | /* Fill individual elements of extscan request and |
| 6003 | * TLV for buckets, channel list. |
| 6004 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6005 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6006 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6007 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6008 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 6009 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6010 | } |
| 6011 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6012 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6013 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6014 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6015 | } |
| 6016 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 6017 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6018 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6019 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6020 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6021 | } |
| 6022 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6023 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6024 | } |
| 6025 | |
| 6026 | /** |
| 6027 | * send_plm_stop_cmd_tlv() - plm stop request |
| 6028 | * @wmi_handle: wmi handle |
| 6029 | * @plm: plm request parameters |
| 6030 | * |
| 6031 | * This function request FW to stop PLM. |
| 6032 | * |
| 6033 | * Return: CDF status |
| 6034 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6035 | QDF_STATUS send_plm_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6036 | const struct plm_req_params *plm) |
| 6037 | { |
| 6038 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 6039 | int32_t len; |
| 6040 | wmi_buf_t buf; |
| 6041 | uint8_t *buf_ptr; |
| 6042 | int ret; |
| 6043 | |
| 6044 | len = sizeof(*cmd); |
| 6045 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6046 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6047 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6048 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6049 | } |
| 6050 | |
| 6051 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 6052 | |
| 6053 | buf_ptr = (uint8_t *) cmd; |
| 6054 | |
| 6055 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6056 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 6057 | WMITLV_GET_STRUCT_TLVLEN |
| 6058 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 6059 | |
| 6060 | cmd->vdev_id = plm->session_id; |
| 6061 | |
| 6062 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6063 | 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] | 6064 | |
| 6065 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6066 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 6067 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6068 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6069 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6070 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6071 | } |
| 6072 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6073 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6074 | } |
| 6075 | |
| 6076 | /** |
| 6077 | * send_plm_start_cmd_tlv() - plm start request |
| 6078 | * @wmi_handle: wmi handle |
| 6079 | * @plm: plm request parameters |
| 6080 | * |
| 6081 | * This function request FW to start PLM. |
| 6082 | * |
| 6083 | * Return: CDF status |
| 6084 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6085 | QDF_STATUS send_plm_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6086 | const struct plm_req_params *plm, |
| 6087 | uint32_t *gchannel_list) |
| 6088 | { |
| 6089 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 6090 | uint32_t *channel_list; |
| 6091 | int32_t len; |
| 6092 | wmi_buf_t buf; |
| 6093 | uint8_t *buf_ptr; |
| 6094 | uint8_t count; |
| 6095 | int ret; |
| 6096 | |
| 6097 | /* TLV place holder for channel_list */ |
| 6098 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 6099 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 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_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6104 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6105 | } |
| 6106 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 6107 | |
| 6108 | buf_ptr = (uint8_t *) cmd; |
| 6109 | |
| 6110 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6111 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 6112 | WMITLV_GET_STRUCT_TLVLEN |
| 6113 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 6114 | |
| 6115 | cmd->vdev_id = plm->session_id; |
| 6116 | |
| 6117 | cmd->meas_token = plm->meas_token; |
| 6118 | cmd->dialog_token = plm->diag_token; |
| 6119 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6120 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6121 | cmd->off_duration = plm->meas_duration; |
| 6122 | cmd->burst_cycle = plm->burst_len; |
| 6123 | cmd->tx_power = plm->desired_tx_pwr; |
| 6124 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 6125 | cmd->num_chans = plm->plm_num_ch; |
| 6126 | |
| 6127 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 6128 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6129 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 6130 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 6131 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 6132 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 6133 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 6134 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 6135 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 6136 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6137 | |
| 6138 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6139 | (cmd->num_chans * sizeof(uint32_t))); |
| 6140 | |
| 6141 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6142 | if (cmd->num_chans) { |
| 6143 | channel_list = (uint32_t *) buf_ptr; |
| 6144 | for (count = 0; count < cmd->num_chans; count++) { |
| 6145 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6146 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6147 | channel_list[count] = |
| 6148 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6149 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6150 | } |
| 6151 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 6152 | } |
| 6153 | |
| 6154 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6155 | WMI_VDEV_PLMREQ_START_CMDID); |
| 6156 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6157 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6158 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6159 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6160 | } |
| 6161 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6162 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6163 | } |
| 6164 | |
| 6165 | /** |
| 6166 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 6167 | * @wmi_handle: wmi handle |
| 6168 | * @vdev_id: vdev id |
| 6169 | * |
| 6170 | * This function request FW to stop ongoing PNO operation. |
| 6171 | * |
| 6172 | * Return: CDF status |
| 6173 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6174 | 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] | 6175 | { |
| 6176 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6177 | int32_t len = sizeof(*cmd); |
| 6178 | wmi_buf_t buf; |
| 6179 | uint8_t *buf_ptr; |
| 6180 | int ret; |
| 6181 | |
| 6182 | /* |
| 6183 | * TLV place holder for array of structures nlo_configured_parameters |
| 6184 | * TLV place holder for array of uint32_t channel_list |
| 6185 | * TLV place holder for chnl prediction cfg |
| 6186 | */ |
| 6187 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6188 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6189 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6190 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6191 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6192 | } |
| 6193 | |
| 6194 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6195 | buf_ptr = (uint8_t *) cmd; |
| 6196 | |
| 6197 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6198 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6199 | WMITLV_GET_STRUCT_TLVLEN |
| 6200 | (wmi_nlo_config_cmd_fixed_param)); |
| 6201 | |
| 6202 | cmd->vdev_id = vdev_id; |
| 6203 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 6204 | buf_ptr += sizeof(*cmd); |
| 6205 | |
| 6206 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6207 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6208 | |
| 6209 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6210 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6211 | |
| 6212 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6213 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6214 | |
| 6215 | |
| 6216 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6217 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6218 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6219 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6220 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6221 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6222 | } |
| 6223 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6224 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6225 | } |
| 6226 | |
| 6227 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6228 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 6229 | * @buf_ptr: Buffer passed by upper layers |
| 6230 | * @pno: Buffer to be sent to the firmware |
| 6231 | * |
| 6232 | * Copy the PNO Channel prediction configuration parameters |
| 6233 | * passed by the upper layers to a WMI format TLV and send it |
| 6234 | * down to the firmware. |
| 6235 | * |
| 6236 | * Return: None |
| 6237 | */ |
| 6238 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 6239 | struct pno_scan_req_params *pno) |
| 6240 | { |
| 6241 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 6242 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 6243 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 6244 | WMITLV_TAG_ARRAY_BYTE, |
| 6245 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6246 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6247 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 6248 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 6249 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 6250 | channel_prediction_cfg->full_scan_period_ms = |
| 6251 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6252 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6253 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 6254 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 6255 | channel_prediction_cfg->enable, |
| 6256 | channel_prediction_cfg->top_k_num, |
| 6257 | channel_prediction_cfg->stationary_threshold, |
| 6258 | channel_prediction_cfg->full_scan_period_ms); |
| 6259 | } |
| 6260 | |
| 6261 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6262 | * send_pno_start_cmd_tlv() - PNO start request |
| 6263 | * @wmi_handle: wmi handle |
| 6264 | * @pno: PNO request |
| 6265 | * |
| 6266 | * This function request FW to start PNO request. |
| 6267 | * Request: CDF status |
| 6268 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6269 | QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6270 | struct pno_scan_req_params *pno, |
| 6271 | uint32_t *gchannel_freq_list) |
| 6272 | { |
| 6273 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6274 | nlo_configured_parameters *nlo_list; |
| 6275 | uint32_t *channel_list; |
| 6276 | int32_t len; |
| 6277 | wmi_buf_t buf; |
| 6278 | uint8_t *buf_ptr; |
| 6279 | uint8_t i; |
| 6280 | int ret; |
| 6281 | |
| 6282 | /* |
| 6283 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 6284 | * TLV place holder for array of uint32_t channel_list |
| 6285 | * TLV place holder for chnnl prediction cfg |
| 6286 | */ |
| 6287 | len = sizeof(*cmd) + |
| 6288 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6289 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6290 | len += sizeof(uint32_t) * QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6291 | WMI_NLO_MAX_CHAN); |
| 6292 | len += sizeof(nlo_configured_parameters) * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6293 | QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6294 | len += sizeof(nlo_channel_prediction_cfg); |
| 6295 | |
| 6296 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6297 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6298 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6299 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6300 | } |
| 6301 | |
| 6302 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6303 | |
| 6304 | buf_ptr = (uint8_t *) cmd; |
| 6305 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6306 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6307 | WMITLV_GET_STRUCT_TLVLEN |
| 6308 | (wmi_nlo_config_cmd_fixed_param)); |
| 6309 | cmd->vdev_id = pno->sessionId; |
| 6310 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 6311 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6312 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6313 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
| 6314 | pno->pnoscan_adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6315 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6316 | /* Current FW does not support min-max range for dwell time */ |
| 6317 | cmd->active_dwell_time = pno->active_max_time; |
| 6318 | cmd->passive_dwell_time = pno->passive_max_time; |
| 6319 | |
| 6320 | /* Copy scan interval */ |
| 6321 | cmd->fast_scan_period = pno->fast_scan_period; |
| 6322 | cmd->slow_scan_period = pno->slow_scan_period; |
| 6323 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6324 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6325 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6326 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6327 | |
| 6328 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6329 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6330 | cmd->no_of_ssids = QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
| 6331 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6332 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6333 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6334 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6335 | |
| 6336 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6337 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6338 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6339 | WMITLV_TAG_ARRAY_BYTE, |
| 6340 | WMITLV_GET_STRUCT_TLVLEN |
| 6341 | (nlo_configured_parameters)); |
| 6342 | /* Copy ssid and it's length */ |
| 6343 | nlo_list[i].ssid.valid = true; |
| 6344 | nlo_list[i].ssid.ssid.ssid_len = pno->aNetworks[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6345 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6346 | pno->aNetworks[i].ssid.mac_ssid, |
| 6347 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6348 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6349 | nlo_list[i].ssid.ssid.ssid_len, |
| 6350 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 6351 | nlo_list[i].ssid.ssid.ssid_len); |
| 6352 | |
| 6353 | /* Copy rssi threshold */ |
| 6354 | if (pno->aNetworks[i].rssiThreshold && |
| 6355 | pno->aNetworks[i].rssiThreshold > WMI_RSSI_THOLD_DEFAULT) { |
| 6356 | nlo_list[i].rssi_cond.valid = true; |
| 6357 | nlo_list[i].rssi_cond.rssi = |
| 6358 | pno->aNetworks[i].rssiThreshold; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6359 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6360 | nlo_list[i].rssi_cond.rssi); |
| 6361 | } |
| 6362 | nlo_list[i].bcast_nw_type.valid = true; |
| 6363 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6364 | pno->aNetworks[i].bcastNetwType; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6365 | WMI_LOGI("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6366 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6367 | } |
| 6368 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6369 | |
| 6370 | /* Copy channel info */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6371 | cmd->num_of_channels = QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6372 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6373 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6374 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6375 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 6376 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6377 | |
| 6378 | channel_list = (uint32_t *) buf_ptr; |
| 6379 | for (i = 0; i < cmd->num_of_channels; i++) { |
| 6380 | channel_list[i] = pno->aNetworks[0].aChannels[i]; |
| 6381 | |
| 6382 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
| 6383 | channel_list[i] = gchannel_freq_list[i]; |
| 6384 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6385 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6386 | } |
| 6387 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 6388 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6389 | sizeof(nlo_channel_prediction_cfg)); |
| 6390 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6391 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6392 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6393 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 6394 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 6395 | */ |
| 6396 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6397 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6398 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6399 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6400 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6401 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6402 | } |
| 6403 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6404 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6405 | } |
| 6406 | |
| 6407 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 6408 | * @wmi_handle: wmi handle |
| 6409 | * @msg: message |
| 6410 | * @is_add_ts: is addts required |
| 6411 | * |
| 6412 | * This function sets ric request element for 11r roaming. |
| 6413 | * |
| 6414 | * Return: CDF status |
| 6415 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6416 | 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] | 6417 | void *msg, uint8_t is_add_ts) |
| 6418 | { |
| 6419 | wmi_ric_request_fixed_param *cmd; |
| 6420 | wmi_ric_tspec *tspec_param; |
| 6421 | wmi_buf_t buf; |
| 6422 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6423 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6424 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 6425 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 6426 | |
| 6427 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6428 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6429 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6430 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6431 | } |
| 6432 | |
| 6433 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6434 | |
| 6435 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 6436 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6437 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 6438 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 6439 | if (is_add_ts) |
| 6440 | cmd->vdev_id = ((struct add_ts_param *) msg)->sessionId; |
| 6441 | else |
| 6442 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 6443 | cmd->num_ric_request = 1; |
| 6444 | cmd->is_add_ric = is_add_ts; |
| 6445 | |
| 6446 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 6447 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 6448 | |
| 6449 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6450 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 6451 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 6452 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 6453 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 6454 | |
| 6455 | if (is_add_ts) |
| 6456 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6457 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6458 | else |
| 6459 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6460 | #endif |
| 6461 | if (ptspecIE) { |
| 6462 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6463 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6464 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 6465 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6466 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6467 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 6468 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6469 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 6470 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6471 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 6472 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 6473 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 6474 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 6475 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 6476 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 6477 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 6478 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 6479 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 6480 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 6481 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 6482 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 6483 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 6484 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 6485 | tspec_param->medium_time = 0; |
| 6486 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6487 | 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] | 6488 | |
| 6489 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6490 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6491 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6492 | __func__); |
| 6493 | if (is_add_ts) |
| 6494 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6495 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6496 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6497 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6498 | } |
| 6499 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6500 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6501 | } |
| 6502 | |
| 6503 | /** |
| 6504 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 6505 | * @wmi_handle: wmi handle |
| 6506 | * @clear_req: ll stats clear request command params |
| 6507 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6508 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6509 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6510 | 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] | 6511 | const struct ll_stats_clear_params *clear_req, |
| 6512 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6513 | { |
| 6514 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 6515 | int32_t len; |
| 6516 | wmi_buf_t buf; |
| 6517 | uint8_t *buf_ptr; |
| 6518 | int ret; |
| 6519 | |
| 6520 | len = sizeof(*cmd); |
| 6521 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6522 | |
| 6523 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6524 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6525 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6526 | } |
| 6527 | |
| 6528 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6529 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6530 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 6531 | |
| 6532 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6533 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 6534 | WMITLV_GET_STRUCT_TLVLEN |
| 6535 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 6536 | |
| 6537 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 6538 | cmd->vdev_id = clear_req->sta_id; |
| 6539 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 6540 | |
| 6541 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 6542 | &cmd->peer_macaddr); |
| 6543 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6544 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 6545 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 6546 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 6547 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 6548 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6549 | cmd->peer_macaddr); */ |
| 6550 | |
| 6551 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6552 | WMI_CLEAR_LINK_STATS_CMDID); |
| 6553 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6554 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6555 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6556 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6557 | } |
| 6558 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6559 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 6560 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6561 | } |
| 6562 | |
| 6563 | /** |
| 6564 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 6565 | * @wmi_handle: wmi handle |
| 6566 | * @setReq: ll stats set request command params |
| 6567 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6568 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6569 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6570 | 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] | 6571 | const struct ll_stats_set_params *set_req) |
| 6572 | { |
| 6573 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 6574 | int32_t len; |
| 6575 | wmi_buf_t buf; |
| 6576 | uint8_t *buf_ptr; |
| 6577 | int ret; |
| 6578 | |
| 6579 | len = sizeof(*cmd); |
| 6580 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6581 | |
| 6582 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6583 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6584 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6585 | } |
| 6586 | |
| 6587 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6588 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6589 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 6590 | |
| 6591 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6592 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 6593 | WMITLV_GET_STRUCT_TLVLEN |
| 6594 | (wmi_start_link_stats_cmd_fixed_param)); |
| 6595 | |
| 6596 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 6597 | cmd->aggressive_statistics_gathering = |
| 6598 | set_req->aggressive_statistics_gathering; |
| 6599 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6600 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 6601 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 6602 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6603 | |
| 6604 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6605 | WMI_START_LINK_STATS_CMDID); |
| 6606 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6607 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6608 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6609 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6610 | } |
| 6611 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6612 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6613 | } |
| 6614 | |
| 6615 | /** |
| 6616 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 6617 | * @wmi_handle:wmi handle |
| 6618 | * @get_req:ll stats get request command params |
| 6619 | * @addr: mac address |
| 6620 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6621 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6622 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6623 | 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] | 6624 | const struct ll_stats_get_params *get_req, |
| 6625 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6626 | { |
| 6627 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 6628 | int32_t len; |
| 6629 | wmi_buf_t buf; |
| 6630 | uint8_t *buf_ptr; |
| 6631 | int ret; |
| 6632 | |
| 6633 | len = sizeof(*cmd); |
| 6634 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6635 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 6636 | if (!buf) { |
| 6637 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 6638 | return QDF_STATUS_E_NOMEM; |
| 6639 | } |
| 6640 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6641 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6642 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6643 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 6644 | |
| 6645 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6646 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 6647 | WMITLV_GET_STRUCT_TLVLEN |
| 6648 | (wmi_request_link_stats_cmd_fixed_param)); |
| 6649 | |
| 6650 | cmd->request_id = get_req->req_id; |
| 6651 | cmd->stats_type = get_req->param_id_mask; |
| 6652 | cmd->vdev_id = get_req->sta_id; |
| 6653 | |
| 6654 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 6655 | &cmd->peer_macaddr); |
| 6656 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6657 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
| 6658 | WMI_LOGD("Request ID : %d", cmd->request_id); |
| 6659 | WMI_LOGD("Stats Type : %d", cmd->stats_type); |
| 6660 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 6661 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6662 | |
| 6663 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6664 | WMI_REQUEST_LINK_STATS_CMDID); |
| 6665 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6666 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6667 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6668 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6669 | } |
| 6670 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6671 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6672 | } |
| 6673 | |
| 6674 | /** |
| 6675 | * send_get_stats_cmd_tlv() - get stats request |
| 6676 | * @wmi_handle: wmi handle |
| 6677 | * @get_stats_param: stats params |
| 6678 | * @addr: mac address |
| 6679 | * |
| 6680 | * Return: CDF status |
| 6681 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6682 | QDF_STATUS send_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6683 | struct pe_stats_req *get_stats_param, |
| 6684 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6685 | { |
| 6686 | wmi_buf_t buf; |
| 6687 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6688 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6689 | |
| 6690 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6691 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6692 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 6693 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6694 | } |
| 6695 | |
| 6696 | |
| 6697 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6698 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6699 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6700 | WMITLV_GET_STRUCT_TLVLEN |
| 6701 | (wmi_request_stats_cmd_fixed_param)); |
| 6702 | cmd->stats_id = |
| 6703 | WMI_REQUEST_PEER_STAT | WMI_REQUEST_PDEV_STAT | |
Himanshu Agarwal | c9fc2a3 | 2016-07-21 14:46:58 +0530 | [diff] [blame] | 6704 | WMI_REQUEST_VDEV_STAT | WMI_REQUEST_RSSI_PER_CHAIN_STAT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6705 | cmd->vdev_id = get_stats_param->session_id; |
| 6706 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6707 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6708 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6709 | WMI_REQUEST_STATS_CMDID)) { |
| 6710 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6711 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6712 | __func__); |
| 6713 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6714 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6715 | } |
| 6716 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6717 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6718 | |
| 6719 | } |
| 6720 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6721 | /** |
| 6722 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 6723 | * @wmi_handle: wmi handle |
| 6724 | * @rssi_req: get RSSI request |
| 6725 | * |
| 6726 | * Return: CDF status |
| 6727 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6728 | QDF_STATUS send_snr_request_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6729 | { |
| 6730 | wmi_buf_t buf; |
| 6731 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6732 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6733 | |
| 6734 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6735 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6736 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6737 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6738 | } |
| 6739 | |
| 6740 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6741 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6742 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6743 | WMITLV_GET_STRUCT_TLVLEN |
| 6744 | (wmi_request_stats_cmd_fixed_param)); |
| 6745 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 6746 | if (wmi_unified_cmd_send |
| 6747 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6748 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6749 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6750 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6751 | } |
| 6752 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6753 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6754 | } |
| 6755 | |
| 6756 | /** |
| 6757 | * send_snr_cmd_tlv() - get RSSI from fw |
| 6758 | * @wmi_handle: wmi handle |
| 6759 | * @vdev_id: vdev id |
| 6760 | * |
| 6761 | * Return: CDF status |
| 6762 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6763 | 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] | 6764 | { |
| 6765 | wmi_buf_t buf; |
| 6766 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6767 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6768 | |
| 6769 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6770 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6771 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6772 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6773 | } |
| 6774 | |
| 6775 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6776 | cmd->vdev_id = vdev_id; |
| 6777 | |
| 6778 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6779 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6780 | WMITLV_GET_STRUCT_TLVLEN |
| 6781 | (wmi_request_stats_cmd_fixed_param)); |
| 6782 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 6783 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6784 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6785 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6786 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6787 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6788 | } |
| 6789 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6790 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6791 | } |
| 6792 | |
| 6793 | /** |
| 6794 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 6795 | * @wmi_handle: wmi handle |
| 6796 | * @link_status: get link params |
| 6797 | * |
| 6798 | * Return: CDF status |
| 6799 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6800 | 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] | 6801 | struct link_status_params *link_status) |
| 6802 | { |
| 6803 | wmi_buf_t buf; |
| 6804 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6805 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6806 | |
| 6807 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6808 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6809 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6810 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6811 | } |
| 6812 | |
| 6813 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6814 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6815 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6816 | WMITLV_GET_STRUCT_TLVLEN |
| 6817 | (wmi_request_stats_cmd_fixed_param)); |
| 6818 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 6819 | cmd->vdev_id = link_status->session_id; |
| 6820 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6821 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6822 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6823 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6824 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6825 | } |
| 6826 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6827 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6828 | } |
| 6829 | |
| 6830 | #ifdef FEATURE_WLAN_LPHB |
| 6831 | |
| 6832 | /** |
| 6833 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 6834 | * @wmi_handle: wmi handle |
| 6835 | * @lphb_conf_req: configuration info |
| 6836 | * |
| 6837 | * Return: CDF status |
| 6838 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6839 | QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6840 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 6841 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6842 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6843 | wmi_buf_t buf = NULL; |
| 6844 | uint8_t *buf_ptr; |
| 6845 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 6846 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 6847 | |
| 6848 | |
| 6849 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6850 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6851 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6852 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6853 | } |
| 6854 | |
| 6855 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6856 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 6857 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 6858 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 6859 | WMITLV_GET_STRUCT_TLVLEN |
| 6860 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 6861 | |
| 6862 | /* fill in values */ |
| 6863 | hb_enable_fp->vdev_id = params->session; |
| 6864 | hb_enable_fp->enable = params->enable; |
| 6865 | hb_enable_fp->item = params->item; |
| 6866 | hb_enable_fp->session = params->session; |
| 6867 | |
| 6868 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6869 | len, WMI_HB_SET_ENABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6870 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6871 | WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_ENABLE returned Error %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6872 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6873 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6874 | } |
| 6875 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6876 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6877 | } |
| 6878 | |
| 6879 | /** |
| 6880 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 6881 | * @wmi_handle: wmi handle |
| 6882 | * @lphb_conf_req: lphb config request |
| 6883 | * |
| 6884 | * Return: CDF status |
| 6885 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6886 | QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6887 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 6888 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6889 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6890 | wmi_buf_t buf = NULL; |
| 6891 | uint8_t *buf_ptr; |
| 6892 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 6893 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 6894 | |
| 6895 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6896 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6897 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6898 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6899 | } |
| 6900 | |
| 6901 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6902 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 6903 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 6904 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 6905 | WMITLV_GET_STRUCT_TLVLEN |
| 6906 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 6907 | |
| 6908 | /* fill in values */ |
| 6909 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 6910 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 6911 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 6912 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 6913 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 6914 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 6915 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 6916 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 6917 | hb_tcp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6918 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6919 | &lphb_conf_req->gateway_mac, |
| 6920 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 6921 | |
| 6922 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6923 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6924 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6925 | WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6926 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 6927 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6928 | } |
| 6929 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6930 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6931 | } |
| 6932 | |
| 6933 | /** |
| 6934 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 6935 | * @wmi_handle: wmi handle |
| 6936 | * @lphb_conf_req: lphb config request |
| 6937 | * |
| 6938 | * Return: CDF status |
| 6939 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6940 | QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6941 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 6942 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6943 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6944 | wmi_buf_t buf = NULL; |
| 6945 | uint8_t *buf_ptr; |
| 6946 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 6947 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 6948 | |
| 6949 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6950 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6951 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6952 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6953 | } |
| 6954 | |
| 6955 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6956 | hb_tcp_filter_fp = |
| 6957 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 6958 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 6959 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 6960 | WMITLV_GET_STRUCT_TLVLEN |
| 6961 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 6962 | |
| 6963 | /* fill in values */ |
| 6964 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 6965 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 6966 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 6967 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 6968 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 6969 | (void *)&g_hb_tcp_filter_fp->filter, |
| 6970 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 6971 | |
| 6972 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6973 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6974 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6975 | WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6976 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 6977 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6978 | } |
| 6979 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6980 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6981 | } |
| 6982 | |
| 6983 | /** |
| 6984 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 6985 | * @wmi_handle: wmi handle |
| 6986 | * @lphb_conf_req: lphb config request |
| 6987 | * |
| 6988 | * Return: CDF status |
| 6989 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6990 | QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6991 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 6992 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6993 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6994 | wmi_buf_t buf = NULL; |
| 6995 | uint8_t *buf_ptr; |
| 6996 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 6997 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 6998 | |
| 6999 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7000 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7001 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7002 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7003 | } |
| 7004 | |
| 7005 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7006 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 7007 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 7008 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 7009 | WMITLV_GET_STRUCT_TLVLEN |
| 7010 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 7011 | |
| 7012 | /* fill in values */ |
| 7013 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7014 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 7015 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 7016 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 7017 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 7018 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 7019 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 7020 | hb_udp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7021 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7022 | &lphb_conf_req->gateway_mac, |
| 7023 | sizeof(lphb_conf_req->gateway_mac)); |
| 7024 | |
| 7025 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7026 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7027 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7028 | WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7029 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7030 | wmi_buf_free(buf); |
| 7031 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7032 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7033 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7034 | } |
| 7035 | |
| 7036 | /** |
| 7037 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 7038 | * @wmi_handle: wmi handle |
| 7039 | * @lphb_conf_req: lphb config request |
| 7040 | * |
| 7041 | * Return: CDF status |
| 7042 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7043 | QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7044 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 7045 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7046 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7047 | wmi_buf_t buf = NULL; |
| 7048 | uint8_t *buf_ptr; |
| 7049 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 7050 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 7051 | |
| 7052 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7053 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7054 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7055 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7056 | } |
| 7057 | |
| 7058 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7059 | hb_udp_filter_fp = |
| 7060 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 7061 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 7062 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 7063 | WMITLV_GET_STRUCT_TLVLEN |
| 7064 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 7065 | |
| 7066 | /* fill in values */ |
| 7067 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7068 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 7069 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 7070 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 7071 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 7072 | (void *)&lphb_conf_req->filter, |
| 7073 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 7074 | |
| 7075 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7076 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7077 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7078 | WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7079 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7080 | wmi_buf_free(buf); |
| 7081 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7082 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7083 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7084 | } |
| 7085 | #endif /* FEATURE_WLAN_LPHB */ |
| 7086 | |
| 7087 | /** |
| 7088 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 7089 | * @wmi_handle: wmi handle |
| 7090 | * @ta_dhcp_ind: DHCP indication parameter |
| 7091 | * |
| 7092 | * Return: CDF Status |
| 7093 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7094 | 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] | 7095 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 7096 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7097 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7098 | wmi_buf_t buf = NULL; |
| 7099 | uint8_t *buf_ptr; |
| 7100 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 7101 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 7102 | |
| 7103 | |
| 7104 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7105 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7106 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7107 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7108 | } |
| 7109 | |
| 7110 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7111 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 7112 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 7113 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 7114 | WMITLV_GET_STRUCT_TLVLEN |
| 7115 | (wmi_peer_set_param_cmd_fixed_param)); |
| 7116 | |
| 7117 | /* fill in values */ |
| 7118 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 7119 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 7120 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7121 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7122 | &ta_dhcp_ind->peer_macaddr, |
| 7123 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 7124 | |
| 7125 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7126 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7127 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7128 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7129 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7130 | wmi_buf_free(buf); |
| 7131 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7132 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7133 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7134 | } |
| 7135 | |
| 7136 | /** |
| 7137 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 7138 | * @wmi_handle: wmi handle |
| 7139 | * @pLinkSpeed: link speed info |
| 7140 | * |
| 7141 | * Return: CDF status |
| 7142 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7143 | 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] | 7144 | wmi_mac_addr peer_macaddr) |
| 7145 | { |
| 7146 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 7147 | wmi_buf_t wmi_buf; |
| 7148 | uint32_t len; |
| 7149 | uint8_t *buf_ptr; |
| 7150 | |
| 7151 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 7152 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7153 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7154 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7155 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7156 | } |
| 7157 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7158 | |
| 7159 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 7160 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7161 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 7162 | WMITLV_GET_STRUCT_TLVLEN |
| 7163 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 7164 | |
| 7165 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7166 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7167 | &peer_macaddr, |
| 7168 | sizeof(peer_macaddr)); |
| 7169 | |
| 7170 | |
| 7171 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7172 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7173 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7174 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7175 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7176 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7177 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7178 | } |
| 7179 | |
| 7180 | /** |
| 7181 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 7182 | * @wmi_handle: wmi handler |
| 7183 | * @egap_params: pointer to egap_params |
| 7184 | * |
| 7185 | * Return: 0 for success, otherwise appropriate error code |
| 7186 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7187 | 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] | 7188 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 7189 | { |
| 7190 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 7191 | wmi_buf_t buf; |
| 7192 | int32_t err; |
| 7193 | |
| 7194 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7195 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7196 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 7197 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7198 | } |
| 7199 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 7200 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7201 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 7202 | WMITLV_GET_STRUCT_TLVLEN( |
| 7203 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 7204 | |
| 7205 | cmd->enable = egap_params->enable; |
| 7206 | cmd->inactivity_time = egap_params->inactivity_time; |
| 7207 | cmd->wait_time = egap_params->wait_time; |
| 7208 | cmd->flags = egap_params->flags; |
| 7209 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7210 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 7211 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7212 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7213 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7214 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7215 | } |
| 7216 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7217 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7218 | } |
| 7219 | |
| 7220 | /** |
| 7221 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 7222 | * @wmi_handl: wmi handle |
| 7223 | * @cmd: Profiling command index |
| 7224 | * @value1: parameter1 value |
| 7225 | * @value2: parameter2 value |
| 7226 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7227 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7228 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7229 | QDF_STATUS send_fw_profiling_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7230 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 7231 | { |
| 7232 | wmi_buf_t buf; |
| 7233 | int32_t len = 0; |
| 7234 | int ret; |
| 7235 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 7236 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 7237 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 7238 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 7239 | |
| 7240 | switch (cmd) { |
| 7241 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 7242 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 7243 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7244 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7245 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7246 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7247 | } |
| 7248 | prof_trig_cmd = |
| 7249 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 7250 | wmi_buf_data(buf); |
| 7251 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 7252 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 7253 | WMITLV_GET_STRUCT_TLVLEN |
| 7254 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 7255 | prof_trig_cmd->enable = value1; |
| 7256 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7257 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 7258 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7259 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7260 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7261 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7262 | return ret; |
| 7263 | } |
| 7264 | break; |
| 7265 | |
| 7266 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 7267 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 7268 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7269 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7270 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7271 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7272 | } |
| 7273 | profile_getdata_cmd = |
| 7274 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 7275 | wmi_buf_data(buf); |
| 7276 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 7277 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 7278 | WMITLV_GET_STRUCT_TLVLEN |
| 7279 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 7280 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7281 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 7282 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7283 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7284 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7285 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7286 | return ret; |
| 7287 | } |
| 7288 | break; |
| 7289 | |
| 7290 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 7291 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 7292 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7293 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7294 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7295 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7296 | } |
| 7297 | hist_intvl_cmd = |
| 7298 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 7299 | wmi_buf_data(buf); |
| 7300 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 7301 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 7302 | WMITLV_GET_STRUCT_TLVLEN |
| 7303 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 7304 | hist_intvl_cmd->profile_id = value1; |
| 7305 | hist_intvl_cmd->value = value2; |
| 7306 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7307 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 7308 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7309 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7310 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7311 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7312 | return ret; |
| 7313 | } |
| 7314 | break; |
| 7315 | |
| 7316 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 7317 | len = |
| 7318 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 7319 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7320 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7321 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7322 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7323 | } |
| 7324 | profile_enable_cmd = |
| 7325 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 7326 | wmi_buf_data(buf); |
| 7327 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 7328 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 7329 | WMITLV_GET_STRUCT_TLVLEN |
| 7330 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 7331 | profile_enable_cmd->profile_id = value1; |
| 7332 | profile_enable_cmd->enable = value2; |
| 7333 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7334 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 7335 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7336 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7337 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7338 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7339 | return ret; |
| 7340 | } |
| 7341 | break; |
| 7342 | |
| 7343 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7344 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7345 | break; |
| 7346 | } |
| 7347 | |
| 7348 | return 0; |
| 7349 | } |
| 7350 | |
| 7351 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 7352 | /** |
| 7353 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 7354 | * @wmi_handle: wmi handle |
| 7355 | * @vdev_id: vdev id |
| 7356 | * |
| 7357 | * Return: CDF status |
| 7358 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7359 | QDF_STATUS send_wow_sta_ra_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7360 | uint8_t vdev_id, uint8_t default_pattern, |
| 7361 | uint16_t rate_limit_interval) |
| 7362 | { |
| 7363 | |
| 7364 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 7365 | wmi_buf_t buf; |
| 7366 | uint8_t *buf_ptr; |
| 7367 | int32_t len; |
| 7368 | int ret; |
| 7369 | |
| 7370 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 7371 | WMI_TLV_HDR_SIZE + |
| 7372 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 7373 | WMI_TLV_HDR_SIZE + |
| 7374 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 7375 | WMI_TLV_HDR_SIZE + |
| 7376 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 7377 | WMI_TLV_HDR_SIZE + |
| 7378 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 7379 | WMI_TLV_HDR_SIZE + |
| 7380 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 7381 | |
| 7382 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7383 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7384 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7385 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7386 | } |
| 7387 | |
| 7388 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7389 | buf_ptr = (uint8_t *) cmd; |
| 7390 | |
| 7391 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7392 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 7393 | WMITLV_GET_STRUCT_TLVLEN |
| 7394 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 7395 | cmd->vdev_id = vdev_id; |
| 7396 | cmd->pattern_id = default_pattern, |
| 7397 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 7398 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 7399 | |
| 7400 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 7401 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7402 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7403 | |
| 7404 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 7405 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7406 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7407 | |
| 7408 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 7409 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7410 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7411 | |
| 7412 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 7413 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7414 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7415 | |
| 7416 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 7417 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7418 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7419 | |
| 7420 | /* Fill TLV for ra_ratelimit_interval. */ |
| 7421 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 7422 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7423 | |
| 7424 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 7425 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7426 | WMI_LOGD("%s: send RA rate limit [%d] to fw vdev = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7427 | rate_limit_interval, vdev_id); |
| 7428 | |
| 7429 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7430 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 7431 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7432 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7433 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7434 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7435 | } |
| 7436 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7437 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7438 | |
| 7439 | } |
| 7440 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 7441 | |
| 7442 | /** |
| 7443 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 7444 | * @wmi_handle: wmi handle |
| 7445 | * @vdev_id: vdev id |
| 7446 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7447 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7448 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7449 | 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] | 7450 | { |
| 7451 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 7452 | wmi_buf_t buf; |
| 7453 | int32_t len = sizeof(*cmd); |
| 7454 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7455 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7456 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7457 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7458 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7459 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7460 | } |
| 7461 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 7462 | wmi_buf_data(buf); |
| 7463 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7464 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 7465 | WMITLV_GET_STRUCT_TLVLEN |
| 7466 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 7467 | cmd->vdev_id = vdev_id; |
| 7468 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 7469 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7470 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7471 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7472 | __func__); |
| 7473 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7474 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7475 | } |
| 7476 | |
| 7477 | return 0; |
| 7478 | } |
| 7479 | |
| 7480 | /** |
| 7481 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 7482 | * @wmi_handle: wmi handle |
| 7483 | * @vdev_id: vdev id |
| 7484 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7485 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7486 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7487 | 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] | 7488 | uint8_t vdev_id) |
| 7489 | { |
| 7490 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 7491 | wmi_buf_t buf; |
| 7492 | int32_t len = sizeof(*cmd); |
| 7493 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7494 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7495 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7496 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7497 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7498 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7499 | } |
| 7500 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 7501 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7502 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 7503 | WMITLV_GET_STRUCT_TLVLEN |
| 7504 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 7505 | cmd->vdev_id = vdev_id; |
| 7506 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 7507 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7508 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7509 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7510 | __func__); |
| 7511 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7512 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7513 | } |
| 7514 | |
| 7515 | return 0; |
| 7516 | } |
| 7517 | |
| 7518 | /** |
| 7519 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 7520 | * @wmi_handle: wmi handle |
| 7521 | * @startOemDataReq: start request params |
| 7522 | * |
| 7523 | * Return: CDF status |
| 7524 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7525 | 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] | 7526 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7527 | uint8_t *data) |
| 7528 | { |
| 7529 | wmi_buf_t buf; |
| 7530 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7531 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7532 | |
| 7533 | buf = wmi_buf_alloc(wmi_handle, |
| 7534 | (data_len + WMI_TLV_HDR_SIZE)); |
| 7535 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7536 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 7537 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7538 | } |
| 7539 | |
| 7540 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 7541 | |
| 7542 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 7543 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7544 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7545 | data_len); |
| 7546 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7547 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7548 | data_len); |
| 7549 | |
| 7550 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 7551 | (data_len + |
| 7552 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 7553 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7554 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7555 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7556 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7557 | } |
| 7558 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7559 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7560 | } |
| 7561 | |
| 7562 | /** |
| 7563 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 7564 | * @wmi_handle: wmi handle |
| 7565 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 7566 | * |
| 7567 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 7568 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 7569 | * to firmware based on phyerr filtering |
| 7570 | * offload status. |
| 7571 | * |
| 7572 | * Return: 1 success, 0 failure |
| 7573 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7574 | QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7575 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 7576 | bool dfs_phyerr_filter_offload) |
| 7577 | { |
| 7578 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 7579 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 7580 | wmi_buf_t buf; |
| 7581 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7582 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7583 | |
| 7584 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 7585 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7586 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7587 | __func__); |
| 7588 | len = sizeof(*disable_phyerr_offload_cmd); |
| 7589 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7590 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7591 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7592 | return 0; |
| 7593 | } |
| 7594 | disable_phyerr_offload_cmd = |
| 7595 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 7596 | wmi_buf_data(buf); |
| 7597 | |
| 7598 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 7599 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 7600 | WMITLV_GET_STRUCT_TLVLEN |
| 7601 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 7602 | |
| 7603 | /* |
| 7604 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 7605 | * to the firmware to disable the phyerror |
| 7606 | * filtering offload. |
| 7607 | */ |
| 7608 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7609 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7610 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7611 | 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] | 7612 | __func__, ret); |
| 7613 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7614 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7615 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7616 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7617 | __func__); |
| 7618 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7619 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7620 | __func__); |
| 7621 | |
| 7622 | len = sizeof(*enable_phyerr_offload_cmd); |
| 7623 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7624 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7625 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7626 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7627 | } |
| 7628 | |
| 7629 | enable_phyerr_offload_cmd = |
| 7630 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 7631 | wmi_buf_data(buf); |
| 7632 | |
| 7633 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 7634 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 7635 | WMITLV_GET_STRUCT_TLVLEN |
| 7636 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 7637 | |
| 7638 | /* |
| 7639 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 7640 | * to the firmware to enable the phyerror |
| 7641 | * filtering offload. |
| 7642 | */ |
| 7643 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7644 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 7645 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7646 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7647 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7648 | __func__, ret); |
| 7649 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7650 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7651 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7652 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7653 | __func__); |
| 7654 | } |
| 7655 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7656 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7657 | } |
| 7658 | |
| 7659 | #if !defined(REMOVE_PKT_LOG) |
| 7660 | /** |
| 7661 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 7662 | * @wmi_handle: wmi handle |
| 7663 | * @pktlog_event: pktlog event |
| 7664 | * @cmd_id: pktlog cmd id |
| 7665 | * |
| 7666 | * Return: CDF status |
| 7667 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7668 | 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] | 7669 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7670 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7671 | { |
| 7672 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 7673 | WMI_CMD_ID CMD_ID; |
| 7674 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 7675 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 7676 | int len = 0; |
| 7677 | wmi_buf_t buf; |
| 7678 | |
| 7679 | PKTLOG_EVENT = pktlog_event; |
| 7680 | CMD_ID = cmd_id; |
| 7681 | |
| 7682 | switch (CMD_ID) { |
| 7683 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 7684 | len = sizeof(*cmd); |
| 7685 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7686 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7687 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7688 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7689 | } |
| 7690 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 7691 | wmi_buf_data(buf); |
| 7692 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7693 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 7694 | WMITLV_GET_STRUCT_TLVLEN |
| 7695 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 7696 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7697 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 7698 | : WMI_PKTLOG_ENABLE_AUTO; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7699 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7700 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7701 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7702 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7703 | goto wmi_send_failed; |
| 7704 | } |
| 7705 | break; |
| 7706 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 7707 | len = sizeof(*disable_cmd); |
| 7708 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7709 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7710 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7711 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7712 | } |
| 7713 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 7714 | wmi_buf_data(buf); |
| 7715 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 7716 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 7717 | WMITLV_GET_STRUCT_TLVLEN |
| 7718 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7719 | disable_cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7720 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7721 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7722 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7723 | goto wmi_send_failed; |
| 7724 | } |
| 7725 | break; |
| 7726 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7727 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7728 | break; |
| 7729 | } |
| 7730 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7731 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7732 | |
| 7733 | wmi_send_failed: |
| 7734 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7735 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7736 | } |
| 7737 | #endif /* REMOVE_PKT_LOG */ |
| 7738 | |
| 7739 | /** |
| 7740 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 7741 | * @wmi_handle: wmi handle |
| 7742 | * @vdev_id: vdev id |
| 7743 | * @bitmap: Event bitmap |
| 7744 | * @enable: enable/disable |
| 7745 | * |
| 7746 | * Return: CDF status |
| 7747 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7748 | QDF_STATUS send_add_wow_wakeup_event_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7749 | uint32_t vdev_id, |
| 7750 | uint32_t bitmap, |
| 7751 | bool enable) |
| 7752 | { |
| 7753 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 7754 | uint16_t len; |
| 7755 | wmi_buf_t buf; |
| 7756 | int ret; |
| 7757 | |
| 7758 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 7759 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7760 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7761 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7762 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7763 | } |
| 7764 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 7765 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7766 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 7767 | WMITLV_GET_STRUCT_TLVLEN |
| 7768 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 7769 | cmd->vdev_id = vdev_id; |
| 7770 | cmd->is_add = enable; |
| 7771 | cmd->event_bitmap = bitmap; |
| 7772 | |
| 7773 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7774 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 7775 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7776 | WMI_LOGE("Failed to config wow wakeup event"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7777 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7778 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7779 | } |
| 7780 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7781 | WMI_LOGD("Wakeup pattern 0x%x %s in fw", bitmap, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7782 | enable ? "enabled" : "disabled"); |
| 7783 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7784 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7785 | } |
| 7786 | |
| 7787 | /** |
| 7788 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 7789 | * @wmi_handle: wmi handle |
| 7790 | * @vdev_id: vdev id |
| 7791 | * @ptrn_id: pattern id |
| 7792 | * @ptrn: pattern |
| 7793 | * @ptrn_len: pattern length |
| 7794 | * @ptrn_offset: pattern offset |
| 7795 | * @mask: mask |
| 7796 | * @mask_len: mask length |
| 7797 | * @user: true for user configured pattern and false for default pattern |
| 7798 | * @default_patterns: default patterns |
| 7799 | * |
| 7800 | * Return: CDF status |
| 7801 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7802 | QDF_STATUS send_wow_patterns_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7803 | uint8_t vdev_id, uint8_t ptrn_id, |
| 7804 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 7805 | uint8_t ptrn_offset, const uint8_t *mask, |
| 7806 | uint8_t mask_len, bool user, |
| 7807 | uint8_t default_patterns) |
| 7808 | { |
| 7809 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 7810 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 7811 | wmi_buf_t buf; |
| 7812 | uint8_t *buf_ptr; |
| 7813 | int32_t len; |
| 7814 | int ret; |
| 7815 | |
| 7816 | |
| 7817 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 7818 | WMI_TLV_HDR_SIZE + |
| 7819 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 7820 | WMI_TLV_HDR_SIZE + |
| 7821 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 7822 | WMI_TLV_HDR_SIZE + |
| 7823 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 7824 | WMI_TLV_HDR_SIZE + |
| 7825 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 7826 | WMI_TLV_HDR_SIZE + |
| 7827 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 7828 | |
| 7829 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7830 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7831 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7832 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7833 | } |
| 7834 | |
| 7835 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7836 | buf_ptr = (uint8_t *) cmd; |
| 7837 | |
| 7838 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7839 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 7840 | WMITLV_GET_STRUCT_TLVLEN |
| 7841 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 7842 | cmd->vdev_id = vdev_id; |
| 7843 | cmd->pattern_id = ptrn_id; |
| 7844 | |
| 7845 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 7846 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 7847 | |
| 7848 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7849 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 7850 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7851 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 7852 | |
| 7853 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 7854 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 7855 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 7856 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7857 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 7858 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7859 | |
| 7860 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 7861 | bitmap_pattern->pattern_len = ptrn_len; |
| 7862 | |
| 7863 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 7864 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 7865 | |
| 7866 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 7867 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 7868 | |
| 7869 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 7870 | bitmap_pattern->pattern_id = ptrn_id; |
| 7871 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7872 | WMI_LOGI("vdev id : %d, ptrn id: %d, ptrn len: %d, ptrn offset: %d user %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7873 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 7874 | bitmap_pattern->pattern_offset, user); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7875 | #ifdef CONFIG_MCL |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7876 | WMI_LOGI("Pattern : "); |
| 7877 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7878 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 7879 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7880 | WMI_LOGI("Mask : "); |
| 7881 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7882 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7883 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7884 | |
| 7885 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 7886 | |
| 7887 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 7888 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7889 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7890 | |
| 7891 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 7892 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7893 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7894 | |
| 7895 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 7896 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7897 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7898 | |
| 7899 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 7900 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7901 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7902 | |
| 7903 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 7904 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 7905 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7906 | *(A_UINT32 *) buf_ptr = 0; |
| 7907 | |
| 7908 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7909 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 7910 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7911 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7912 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7913 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7914 | } |
| 7915 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7916 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7917 | } |
| 7918 | |
| 7919 | /** |
| 7920 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 7921 | * @wmi_handle: wmi handle |
| 7922 | * @ptrn_id: pattern id |
| 7923 | * @vdev_id: vdev id |
| 7924 | * |
| 7925 | * Return: CDF status |
| 7926 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7927 | QDF_STATUS send_wow_delete_pattern_cmd_tlv(wmi_unified_t wmi_handle, uint8_t ptrn_id, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7928 | uint8_t vdev_id) |
| 7929 | { |
| 7930 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 7931 | wmi_buf_t buf; |
| 7932 | int32_t len; |
| 7933 | int ret; |
| 7934 | |
| 7935 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 7936 | |
| 7937 | |
| 7938 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7939 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7940 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7941 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7942 | } |
| 7943 | |
| 7944 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7945 | |
| 7946 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7947 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 7948 | WMITLV_GET_STRUCT_TLVLEN( |
| 7949 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 7950 | cmd->vdev_id = vdev_id; |
| 7951 | cmd->pattern_id = ptrn_id; |
| 7952 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 7953 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7954 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7955 | cmd->pattern_id, vdev_id); |
| 7956 | |
| 7957 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7958 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 7959 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7960 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7961 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7962 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7963 | } |
| 7964 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7965 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7966 | } |
| 7967 | |
| 7968 | /** |
| 7969 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 7970 | * @wmi_handle: wmi handle |
| 7971 | * |
| 7972 | * Sends host wakeup indication to FW. On receiving this indication, |
| 7973 | * FW will come out of WOW. |
| 7974 | * |
| 7975 | * Return: CDF status |
| 7976 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7977 | 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] | 7978 | { |
| 7979 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 7980 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7981 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7982 | int32_t len; |
| 7983 | int ret; |
| 7984 | |
| 7985 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 7986 | |
| 7987 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7988 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7989 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7990 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7991 | } |
| 7992 | |
| 7993 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 7994 | wmi_buf_data(buf); |
| 7995 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7996 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 7997 | WMITLV_GET_STRUCT_TLVLEN |
| 7998 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 7999 | |
| 8000 | |
| 8001 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8002 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 8003 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8004 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8005 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8006 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8007 | } |
| 8008 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8009 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8010 | } |
| 8011 | |
| 8012 | /** |
| 8013 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8014 | * @wmi_handle: wmi handle |
| 8015 | * @msg: delts params |
| 8016 | * |
| 8017 | * Return: CDF status |
| 8018 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8019 | 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] | 8020 | uint8_t ac) |
| 8021 | { |
| 8022 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8023 | wmi_buf_t buf; |
| 8024 | int32_t len = sizeof(*cmd); |
| 8025 | |
| 8026 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8027 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8028 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8029 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8030 | } |
| 8031 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8032 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8033 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8034 | WMITLV_GET_STRUCT_TLVLEN |
| 8035 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8036 | cmd->vdev_id = vdev_id; |
| 8037 | cmd->ac = ac; |
| 8038 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8039 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8040 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8041 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8042 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8043 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8044 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8045 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8046 | } |
| 8047 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8048 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8049 | } |
| 8050 | |
| 8051 | /** |
| 8052 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8053 | * @wmi_handle: handle to wmi |
| 8054 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8055 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8056 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8057 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8058 | * active flow. |
| 8059 | * |
| 8060 | * Return: CDF status |
| 8061 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8062 | QDF_STATUS send_aggr_qos_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8063 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8064 | { |
| 8065 | int i = 0; |
| 8066 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8067 | wmi_buf_t buf; |
| 8068 | int32_t len = sizeof(*cmd); |
| 8069 | |
| 8070 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 8071 | /* if flow in this AC is active */ |
| 8072 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 8073 | /* |
| 8074 | * as per implementation of wma_add_ts_req() we |
| 8075 | * are not waiting any response from firmware so |
| 8076 | * apart from sending ADDTS to firmware just send |
| 8077 | * success to upper layers |
| 8078 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8079 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8080 | |
| 8081 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8082 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8083 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8084 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8085 | } |
| 8086 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 8087 | wmi_buf_data(buf); |
| 8088 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8089 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8090 | WMITLV_GET_STRUCT_TLVLEN |
| 8091 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8092 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 8093 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 8094 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8095 | traffic.userPrio); |
| 8096 | cmd->medium_time_us = |
| 8097 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 8098 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8099 | 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] | 8100 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 8101 | cmd->medium_time_us, cmd->downgrade_type); |
| 8102 | if (wmi_unified_cmd_send |
| 8103 | (wmi_handle, buf, len, |
| 8104 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8105 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8106 | __func__); |
| 8107 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8108 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8109 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8110 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8111 | } |
| 8112 | } |
| 8113 | } |
| 8114 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8115 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8116 | } |
| 8117 | |
| 8118 | /** |
| 8119 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 8120 | * @wmi_handle: wmi handle |
| 8121 | * @msg: ADDTS params |
| 8122 | * |
| 8123 | * Return: CDF status |
| 8124 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8125 | QDF_STATUS send_add_ts_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8126 | struct add_ts_param *msg) |
| 8127 | { |
| 8128 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8129 | wmi_buf_t buf; |
| 8130 | int32_t len = sizeof(*cmd); |
| 8131 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8132 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8133 | |
| 8134 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8135 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8136 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8137 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8138 | } |
| 8139 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8140 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8141 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8142 | WMITLV_GET_STRUCT_TLVLEN |
| 8143 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8144 | cmd->vdev_id = msg->sme_session_id; |
| 8145 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 8146 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 8147 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8148 | 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] | 8149 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 8150 | cmd->downgrade_type, __func__, __LINE__); |
| 8151 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8152 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8153 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 8154 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8155 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8156 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8157 | } |
| 8158 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8159 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8160 | } |
| 8161 | |
| 8162 | /** |
| 8163 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter in target |
| 8164 | * @wmi_handle: wmi handle |
| 8165 | * @vdev_id: vdev id |
| 8166 | * @enable: Flag to enable/disable packet filter |
| 8167 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8168 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8169 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8170 | 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] | 8171 | uint8_t vdev_id, bool enable) |
| 8172 | { |
| 8173 | int32_t len; |
| 8174 | int ret = 0; |
| 8175 | wmi_buf_t buf; |
| 8176 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 8177 | |
| 8178 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 8179 | |
| 8180 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8181 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8182 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8183 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8184 | } |
| 8185 | |
| 8186 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 8187 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8188 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 8189 | WMITLV_GET_STRUCT_TLVLEN( |
| 8190 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 8191 | |
| 8192 | cmd->vdev_id = vdev_id; |
| 8193 | if (enable) |
| 8194 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 8195 | else |
| 8196 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 8197 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8198 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8199 | __func__, cmd->enable, vdev_id); |
| 8200 | |
| 8201 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8202 | WMI_PACKET_FILTER_ENABLE_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8203 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8204 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8205 | wmi_buf_free(buf); |
| 8206 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8207 | |
| 8208 | return ret; |
| 8209 | } |
| 8210 | |
| 8211 | /** |
| 8212 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 8213 | * @wmi_handle: wmi handle |
| 8214 | * @vdev_id: vdev id |
| 8215 | * @rcv_filter_param: Packet filter parameters |
| 8216 | * @filter_id: Filter id |
| 8217 | * @enable: Flag to add/delete packet filter configuration |
| 8218 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8219 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8220 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8221 | 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] | 8222 | uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param, |
| 8223 | uint8_t filter_id, bool enable) |
| 8224 | { |
| 8225 | int len, i; |
| 8226 | int err = 0; |
| 8227 | wmi_buf_t buf; |
| 8228 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 8229 | |
| 8230 | |
| 8231 | /* allocate the memory */ |
| 8232 | len = sizeof(*cmd); |
| 8233 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8234 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8235 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8236 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8237 | } |
| 8238 | |
| 8239 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 8240 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8241 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 8242 | WMITLV_GET_STRUCT_TLVLEN |
| 8243 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 8244 | |
| 8245 | cmd->vdev_id = vdev_id; |
| 8246 | cmd->filter_id = filter_id; |
| 8247 | if (enable) |
| 8248 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 8249 | else |
| 8250 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 8251 | |
| 8252 | if (enable) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8253 | cmd->num_params = QDF_MIN( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8254 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 8255 | rcv_filter_param->numFieldParams); |
| 8256 | cmd->filter_type = rcv_filter_param->filterType; |
| 8257 | cmd->coalesce_time = rcv_filter_param->coalesceTime; |
| 8258 | |
| 8259 | for (i = 0; i < cmd->num_params; i++) { |
| 8260 | cmd->paramsData[i].proto_type = |
| 8261 | rcv_filter_param->paramsData[i].protocolLayer; |
| 8262 | cmd->paramsData[i].cmp_type = |
| 8263 | rcv_filter_param->paramsData[i].cmpFlag; |
| 8264 | cmd->paramsData[i].data_length = |
| 8265 | rcv_filter_param->paramsData[i].dataLength; |
| 8266 | cmd->paramsData[i].data_offset = |
| 8267 | rcv_filter_param->paramsData[i].dataOffset; |
| 8268 | memcpy(&cmd->paramsData[i].compareData, |
| 8269 | rcv_filter_param->paramsData[i].compareData, |
| 8270 | sizeof(cmd->paramsData[i].compareData)); |
| 8271 | memcpy(&cmd->paramsData[i].dataMask, |
| 8272 | rcv_filter_param->paramsData[i].dataMask, |
| 8273 | sizeof(cmd->paramsData[i].dataMask)); |
| 8274 | } |
| 8275 | } |
| 8276 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8277 | 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] | 8278 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 8279 | /* send the command along with data */ |
| 8280 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8281 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 8282 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8283 | WMI_LOGE("Failed to send pkt_filter cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8284 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8285 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8286 | } |
| 8287 | |
| 8288 | |
| 8289 | return 0; |
| 8290 | } |
| 8291 | |
| 8292 | /** |
| 8293 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 8294 | * @wmi_handle: wmi handle |
| 8295 | * @vdev_id: vdev id |
| 8296 | * @multicastAddr: mcast address |
| 8297 | * @clearList: clear list flag |
| 8298 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8299 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8300 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8301 | QDF_STATUS send_add_clear_mcbc_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8302 | uint8_t vdev_id, |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8303 | struct qdf_mac_addr multicast_addr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8304 | bool clearList) |
| 8305 | { |
| 8306 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 8307 | wmi_buf_t buf; |
| 8308 | int err; |
| 8309 | |
| 8310 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8311 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8312 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8313 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8314 | } |
| 8315 | |
| 8316 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8317 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8318 | |
| 8319 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8320 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 8321 | WMITLV_GET_STRUCT_TLVLEN |
| 8322 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 8323 | cmd->action = |
| 8324 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 8325 | cmd->vdev_id = vdev_id; |
| 8326 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8327 | |
| 8328 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 8329 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 8330 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8331 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 8332 | sizeof(*cmd), |
| 8333 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 8334 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8335 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8336 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8337 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8338 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8339 | |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8340 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8341 | } |
| 8342 | |
| 8343 | /** |
| 8344 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 8345 | * @wmi_handle: wmi handle |
| 8346 | * @vdev_id: vdev id |
| 8347 | * @params: GTK offload parameters |
| 8348 | * |
| 8349 | * Return: CDF status |
| 8350 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8351 | QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8352 | struct gtk_offload_params *params, |
| 8353 | bool enable_offload, |
| 8354 | uint32_t gtk_offload_opcode) |
| 8355 | { |
| 8356 | int len; |
| 8357 | wmi_buf_t buf; |
| 8358 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8359 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8360 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8361 | WMI_LOGD("%s Enter", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8362 | |
| 8363 | len = sizeof(*cmd); |
| 8364 | |
| 8365 | /* alloc wmi buffer */ |
| 8366 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8367 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8368 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 8369 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8370 | goto out; |
| 8371 | } |
| 8372 | |
| 8373 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 8374 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8375 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 8376 | WMITLV_GET_STRUCT_TLVLEN |
| 8377 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 8378 | |
| 8379 | cmd->vdev_id = vdev_id; |
| 8380 | |
| 8381 | /* Request target to enable GTK offload */ |
Siddarth Poddar | 9500f2e | 2016-04-01 17:45:06 +0530 | [diff] [blame] | 8382 | if (enable_offload == WMI_GTK_OFFLOAD_ENABLE) { |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8383 | cmd->flags = gtk_offload_opcode; |
| 8384 | |
| 8385 | /* Copy the keys and replay counter */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8386 | qdf_mem_copy(cmd->KCK, params->aKCK, WMI_GTK_OFFLOAD_KCK_BYTES); |
| 8387 | qdf_mem_copy(cmd->KEK, params->aKEK, WMI_GTK_OFFLOAD_KEK_BYTES); |
| 8388 | qdf_mem_copy(cmd->replay_counter, ¶ms->ullKeyReplayCounter, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8389 | GTK_REPLAY_COUNTER_BYTES); |
| 8390 | } else { |
| 8391 | cmd->flags = gtk_offload_opcode; |
| 8392 | } |
| 8393 | |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8394 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 8395 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8396 | /* send the wmi command */ |
| 8397 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8398 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8399 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8400 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8401 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8402 | } |
| 8403 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8404 | out: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8405 | WMI_LOGD("%s Exit", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8406 | return status; |
| 8407 | } |
| 8408 | |
| 8409 | /** |
| 8410 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 8411 | * @wmi_handle: wmi handle |
| 8412 | * @params: GTK offload params |
| 8413 | * |
| 8414 | * Return: CDF status |
| 8415 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8416 | QDF_STATUS send_process_gtk_offload_getinfo_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8417 | uint8_t vdev_id, |
| 8418 | uint64_t offload_req_opcode) |
| 8419 | { |
| 8420 | int len; |
| 8421 | wmi_buf_t buf; |
| 8422 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8423 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8424 | |
| 8425 | len = sizeof(*cmd); |
| 8426 | |
| 8427 | /* alloc wmi buffer */ |
| 8428 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8429 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8430 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 8431 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8432 | goto out; |
| 8433 | } |
| 8434 | |
| 8435 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 8436 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8437 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 8438 | WMITLV_GET_STRUCT_TLVLEN |
| 8439 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 8440 | |
| 8441 | /* Request for GTK offload status */ |
| 8442 | cmd->flags = offload_req_opcode; |
| 8443 | cmd->vdev_id = vdev_id; |
| 8444 | |
| 8445 | /* send the wmi command */ |
| 8446 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8447 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8448 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8449 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8450 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8451 | } |
| 8452 | |
| 8453 | out: |
| 8454 | return status; |
| 8455 | } |
| 8456 | |
| 8457 | /** |
| 8458 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 8459 | * @wmi_handle: wmi handle |
| 8460 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 8461 | * |
| 8462 | * Retrun: CDF status |
| 8463 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8464 | 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] | 8465 | struct periodic_tx_pattern * |
| 8466 | pAddPeriodicTxPtrnParams, |
| 8467 | uint8_t vdev_id) |
| 8468 | { |
| 8469 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8470 | wmi_buf_t wmi_buf; |
| 8471 | uint32_t len; |
| 8472 | uint8_t *buf_ptr; |
| 8473 | uint32_t ptrn_len, ptrn_len_aligned; |
| 8474 | int j; |
| 8475 | |
| 8476 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8477 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 8478 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 8479 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 8480 | |
| 8481 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8482 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8483 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8484 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8485 | } |
| 8486 | |
| 8487 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8488 | |
| 8489 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 8490 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8491 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8492 | WMITLV_GET_STRUCT_TLVLEN |
| 8493 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8494 | |
| 8495 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8496 | cmd->vdev_id = vdev_id; |
| 8497 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 8498 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 8499 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8500 | |
| 8501 | /* Pattern info */ |
| 8502 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8503 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 8504 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8505 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8506 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8507 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8508 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8509 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8510 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8511 | |
| 8512 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8513 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8514 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8515 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8516 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8517 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8518 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8519 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8520 | } |
| 8521 | |
| 8522 | /** |
| 8523 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 8524 | * @wmi_handle: wmi handle |
| 8525 | * @vdev_id: vdev id |
| 8526 | * @pattern_id: pattern id |
| 8527 | * |
| 8528 | * Retrun: CDF status |
| 8529 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8530 | 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] | 8531 | uint8_t vdev_id, |
| 8532 | uint8_t pattern_id) |
| 8533 | { |
| 8534 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8535 | wmi_buf_t wmi_buf; |
| 8536 | uint32_t len = |
| 8537 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8538 | |
| 8539 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8540 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8541 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8542 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8543 | } |
| 8544 | |
| 8545 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 8546 | wmi_buf_data(wmi_buf); |
| 8547 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8548 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8549 | WMITLV_GET_STRUCT_TLVLEN |
| 8550 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8551 | |
| 8552 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8553 | cmd->vdev_id = vdev_id; |
| 8554 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8555 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8556 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8557 | |
| 8558 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8559 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8560 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8561 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8562 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8563 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8564 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8565 | } |
| 8566 | |
| 8567 | /** |
| 8568 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 8569 | * @wmi_handle: wmi handle |
| 8570 | * @preq: stats ext params |
| 8571 | * |
| 8572 | * Return: CDF status |
| 8573 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8574 | 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] | 8575 | struct stats_ext_params *preq) |
| 8576 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8577 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8578 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 8579 | wmi_buf_t buf; |
| 8580 | uint16_t len; |
| 8581 | uint8_t *buf_ptr; |
| 8582 | |
| 8583 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 8584 | |
| 8585 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8586 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8587 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8588 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8589 | } |
| 8590 | |
| 8591 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8592 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 8593 | |
| 8594 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8595 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 8596 | WMITLV_GET_STRUCT_TLVLEN |
| 8597 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 8598 | cmd->vdev_id = preq->vdev_id; |
| 8599 | cmd->data_len = preq->request_data_len; |
| 8600 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8601 | 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] | 8602 | __func__, preq->request_data_len, preq->vdev_id); |
| 8603 | |
| 8604 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 8605 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 8606 | |
| 8607 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8608 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8609 | |
| 8610 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8611 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8612 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8613 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8614 | ret); |
| 8615 | wmi_buf_free(buf); |
| 8616 | } |
| 8617 | |
| 8618 | return ret; |
| 8619 | } |
| 8620 | |
| 8621 | /** |
| 8622 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 8623 | * @wmi_handle: wmi handle |
| 8624 | * @params: ext wow params |
| 8625 | * |
| 8626 | * Return:0 for success or error code |
| 8627 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8628 | 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] | 8629 | struct ext_wow_params *params) |
| 8630 | { |
| 8631 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 8632 | wmi_buf_t buf; |
| 8633 | int32_t len; |
| 8634 | int ret; |
| 8635 | |
| 8636 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 8637 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8638 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8639 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8640 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8641 | } |
| 8642 | |
| 8643 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8644 | |
| 8645 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8646 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 8647 | WMITLV_GET_STRUCT_TLVLEN |
| 8648 | (wmi_extwow_enable_cmd_fixed_param)); |
| 8649 | |
| 8650 | cmd->vdev_id = params->vdev_id; |
| 8651 | cmd->type = params->type; |
| 8652 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 8653 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8654 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8655 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 8656 | |
| 8657 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8658 | WMI_EXTWOW_ENABLE_CMDID); |
| 8659 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8660 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8661 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8662 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8663 | } |
| 8664 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8665 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8666 | |
| 8667 | } |
| 8668 | |
| 8669 | /** |
| 8670 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 8671 | * @wmi_handle: wmi handle |
| 8672 | * @app_type1_params: app type1 params |
| 8673 | * |
| 8674 | * Return: CDF status |
| 8675 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8676 | 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] | 8677 | struct app_type1_params *app_type1_params) |
| 8678 | { |
| 8679 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 8680 | wmi_buf_t buf; |
| 8681 | int32_t len; |
| 8682 | int ret; |
| 8683 | |
| 8684 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 8685 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8686 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8687 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8688 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8689 | } |
| 8690 | |
| 8691 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 8692 | wmi_buf_data(buf); |
| 8693 | |
| 8694 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8695 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 8696 | WMITLV_GET_STRUCT_TLVLEN |
| 8697 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 8698 | |
| 8699 | cmd->vdev_id = app_type1_params->vdev_id; |
| 8700 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 8701 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8702 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8703 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8704 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8705 | cmd->passwd_len = app_type1_params->pass_length; |
| 8706 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8707 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8708 | "identification_id %.8s id_length %u " |
| 8709 | "password %.16s pass_length %u", |
| 8710 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 8711 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 8712 | |
| 8713 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8714 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 8715 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8716 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8717 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8718 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8719 | } |
| 8720 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8721 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8722 | } |
| 8723 | |
| 8724 | /** |
| 8725 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 8726 | * @wmi_handle: wmi handle |
| 8727 | * @appType2Params: app type2 params |
| 8728 | * |
| 8729 | * Return: CDF status |
| 8730 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8731 | 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] | 8732 | struct app_type2_params *appType2Params) |
| 8733 | { |
| 8734 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 8735 | wmi_buf_t buf; |
| 8736 | int32_t len; |
| 8737 | int ret; |
| 8738 | |
| 8739 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 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: Failed allocate wmi buffer", __func__); |
| 8743 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8744 | } |
| 8745 | |
| 8746 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 8747 | wmi_buf_data(buf); |
| 8748 | |
| 8749 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8750 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 8751 | WMITLV_GET_STRUCT_TLVLEN |
| 8752 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 8753 | |
| 8754 | cmd->vdev_id = appType2Params->vdev_id; |
| 8755 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8756 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8757 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 8758 | |
| 8759 | cmd->ip_id = appType2Params->ip_id; |
| 8760 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 8761 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 8762 | |
| 8763 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 8764 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 8765 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 8766 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 8767 | |
| 8768 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 8769 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 8770 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 8771 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 8772 | |
| 8773 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 8774 | &cmd->gateway_mac); |
| 8775 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 8776 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 8777 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8778 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8779 | "rc4_key %.16s rc4_key_len %u " |
| 8780 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 8781 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 8782 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 8783 | "keepalive_max %u keepalive_inc %u " |
| 8784 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 8785 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 8786 | cmd->rc4_key, cmd->rc4_key_len, |
| 8787 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 8788 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 8789 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 8790 | cmd->keepalive_max, cmd->keepalive_inc, |
| 8791 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 8792 | |
| 8793 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8794 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 8795 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8796 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8797 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8798 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8799 | } |
| 8800 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8801 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8802 | |
| 8803 | } |
| 8804 | |
| 8805 | /** |
| 8806 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 8807 | * @wmi_handle: wmi handle |
| 8808 | * @timer_val: auto shutdown timer value |
| 8809 | * |
| 8810 | * Return: CDF status |
| 8811 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8812 | 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] | 8813 | uint32_t timer_val) |
| 8814 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8815 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8816 | wmi_buf_t buf = NULL; |
| 8817 | uint8_t *buf_ptr; |
| 8818 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 8819 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 8820 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8821 | 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] | 8822 | __func__, timer_val); |
| 8823 | |
| 8824 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8825 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8826 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8827 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8828 | } |
| 8829 | |
| 8830 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8831 | wmi_auto_sh_cmd = |
| 8832 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 8833 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 8834 | |
| 8835 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 8836 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 8837 | WMITLV_GET_STRUCT_TLVLEN |
| 8838 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 8839 | |
| 8840 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8841 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8842 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8843 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8844 | __func__, status); |
| 8845 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8846 | } |
| 8847 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8848 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8849 | } |
| 8850 | |
| 8851 | /** |
| 8852 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 8853 | * @wmi_handle: wmi handle |
| 8854 | * @nan_req: request data which will be non-null |
| 8855 | * |
| 8856 | * Return: CDF status |
| 8857 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8858 | QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8859 | struct nan_req_params *nan_req) |
| 8860 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8861 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8862 | wmi_nan_cmd_param *cmd; |
| 8863 | wmi_buf_t buf; |
| 8864 | uint16_t len = sizeof(*cmd); |
| 8865 | uint16_t nan_data_len, nan_data_len_aligned; |
| 8866 | uint8_t *buf_ptr; |
| 8867 | |
| 8868 | /* |
| 8869 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 8870 | * +------------+----------+-----------------------+--------------+ |
| 8871 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 8872 | * +------------+----------+-----------------------+--------------+ |
| 8873 | */ |
| 8874 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8875 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 8876 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8877 | } |
| 8878 | nan_data_len = nan_req->request_data_len; |
| 8879 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 8880 | sizeof(uint32_t)); |
| 8881 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 8882 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8883 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8884 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8885 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8886 | } |
| 8887 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8888 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 8889 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8890 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 8891 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 8892 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8893 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8894 | __func__, nan_req->request_data_len); |
| 8895 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 8896 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 8897 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8898 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8899 | |
| 8900 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8901 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8902 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8903 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8904 | __func__, ret); |
| 8905 | wmi_buf_free(buf); |
| 8906 | } |
| 8907 | |
| 8908 | return ret; |
| 8909 | } |
| 8910 | |
| 8911 | /** |
| 8912 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 8913 | * @wmi_handle: wmi handle |
| 8914 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 8915 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8916 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8917 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8918 | 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] | 8919 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 8920 | { |
| 8921 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 8922 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8923 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8924 | |
| 8925 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8926 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8927 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8928 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8929 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8930 | } |
| 8931 | |
| 8932 | 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] | 8933 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8934 | |
| 8935 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8936 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 8937 | WMITLV_GET_STRUCT_TLVLEN |
| 8938 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 8939 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 8940 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 8941 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 8942 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 8943 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8944 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8945 | sizeof(*cmd), |
| 8946 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8947 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8948 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8949 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8950 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8951 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8952 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8953 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8954 | |
| 8955 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8956 | } |
| 8957 | |
| 8958 | /** |
| 8959 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 8960 | * @wmi_handle: wmi handle |
| 8961 | * @flashing: flashing request |
| 8962 | * |
| 8963 | * Return: CDF status |
| 8964 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8965 | 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] | 8966 | struct flashing_req_params *flashing) |
| 8967 | { |
| 8968 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8969 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8970 | wmi_buf_t buf; |
| 8971 | uint8_t *buf_ptr; |
| 8972 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 8973 | |
| 8974 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8975 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8976 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8977 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8978 | } |
| 8979 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8980 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 8981 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8982 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 8983 | WMITLV_GET_STRUCT_TLVLEN |
| 8984 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 8985 | cmd->pattern_id = flashing->pattern_id; |
| 8986 | cmd->led_x0 = flashing->led_x0; |
| 8987 | cmd->led_x1 = flashing->led_x1; |
| 8988 | |
| 8989 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8990 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8991 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8992 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8993 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8994 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8995 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8996 | |
| 8997 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8998 | } |
| 8999 | |
| 9000 | /** |
| 9001 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 9002 | * @wmi_handle: wmi handle |
| 9003 | * @ch_avoid_update_req: channel avoid update params |
| 9004 | * |
| 9005 | * Return: CDF status |
| 9006 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9007 | 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] | 9008 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9009 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9010 | wmi_buf_t buf = NULL; |
| 9011 | uint8_t *buf_ptr; |
| 9012 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 9013 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 9014 | |
| 9015 | |
| 9016 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9017 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9018 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9019 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9020 | } |
| 9021 | |
| 9022 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9023 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 9024 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 9025 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 9026 | WMITLV_GET_STRUCT_TLVLEN |
| 9027 | (wmi_chan_avoid_update_cmd_param)); |
| 9028 | |
| 9029 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9030 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9031 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9032 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9033 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 9034 | " returned Error %d", status); |
| 9035 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9036 | } |
| 9037 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9038 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9039 | } |
| 9040 | |
| 9041 | /** |
| 9042 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 9043 | * @wmi_handle: wmi handle |
| 9044 | * @reg_dmn: reg domain |
| 9045 | * @regdmn2G: 2G reg domain |
| 9046 | * @regdmn5G: 5G reg domain |
| 9047 | * @ctl2G: 2G test limit |
| 9048 | * @ctl5G: 5G test limit |
| 9049 | * |
| 9050 | * Return: none |
| 9051 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9052 | 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] | 9053 | uint32_t reg_dmn, uint16_t regdmn2G, |
| 9054 | uint16_t regdmn5G, int8_t ctl2G, |
| 9055 | int8_t ctl5G) |
| 9056 | { |
| 9057 | wmi_buf_t buf; |
| 9058 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9059 | int32_t len = sizeof(*cmd); |
| 9060 | |
| 9061 | |
| 9062 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9063 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9064 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9065 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9066 | } |
| 9067 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9068 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9069 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9070 | WMITLV_GET_STRUCT_TLVLEN |
| 9071 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9072 | cmd->reg_domain = reg_dmn; |
| 9073 | cmd->reg_domain_2G = regdmn2G; |
| 9074 | cmd->reg_domain_5G = regdmn5G; |
| 9075 | cmd->conformance_test_limit_2G = ctl2G; |
| 9076 | cmd->conformance_test_limit_5G = ctl5G; |
| 9077 | |
| 9078 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9079 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9080 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9081 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9082 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9083 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9084 | } |
| 9085 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9086 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9087 | } |
| 9088 | |
| 9089 | |
| 9090 | /** |
| 9091 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 9092 | * @wmi_handle: wmi handle |
| 9093 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 9094 | * |
| 9095 | * This function sets tdls off channel mode |
| 9096 | * |
| 9097 | * Return: 0 on success; Negative errno otherwise |
| 9098 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9099 | 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] | 9100 | struct tdls_channel_switch_params *chan_switch_params) |
| 9101 | { |
| 9102 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9103 | wmi_buf_t wmi_buf; |
| 9104 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9105 | |
| 9106 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9107 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9108 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9109 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9110 | } |
| 9111 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9112 | wmi_buf_data(wmi_buf); |
| 9113 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9114 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9115 | WMITLV_GET_STRUCT_TLVLEN( |
| 9116 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9117 | |
| 9118 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9119 | &cmd->peer_macaddr); |
| 9120 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9121 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9122 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9123 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9124 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9125 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9126 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9127 | 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] | 9128 | cmd->peer_macaddr.mac_addr31to0, |
| 9129 | cmd->peer_macaddr.mac_addr47to32); |
| 9130 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9131 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9132 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9133 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9134 | ), |
| 9135 | cmd->vdev_id, |
| 9136 | cmd->offchan_mode, |
| 9137 | cmd->offchan_num, |
| 9138 | cmd->offchan_bw_bitmap, |
| 9139 | cmd->is_peer_responder, |
| 9140 | cmd->offchan_oper_class); |
| 9141 | |
| 9142 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9143 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9144 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9145 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9146 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9147 | } |
| 9148 | |
| 9149 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9150 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9151 | } |
| 9152 | |
| 9153 | /** |
| 9154 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9155 | * @wmi_handle: wmi handle |
| 9156 | * @pwmaTdlsparams: TDLS params |
| 9157 | * |
| 9158 | * Return: 0 for sucess or error code |
| 9159 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9160 | 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] | 9161 | void *tdls_param, uint8_t tdls_state) |
| 9162 | { |
| 9163 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9164 | wmi_buf_t wmi_buf; |
| 9165 | |
| 9166 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9167 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9168 | |
| 9169 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9170 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9171 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9172 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9173 | } |
| 9174 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9175 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9176 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9177 | WMITLV_GET_STRUCT_TLVLEN |
| 9178 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9179 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9180 | cmd->state = tdls_state; |
| 9181 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9182 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9183 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9184 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9185 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9186 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9187 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9188 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9189 | wmi_tdls->peer_traffic_response_timeout; |
| 9190 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9191 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9192 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9193 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9194 | cmd->teardown_notification_ms = |
| 9195 | wmi_tdls->teardown_notification_ms; |
| 9196 | cmd->tdls_peer_kickout_threshold = |
| 9197 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9198 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9199 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9200 | "notification_interval_ms: %d, " |
| 9201 | "tx_discovery_threshold: %d, " |
| 9202 | "tx_teardown_threshold: %d, " |
| 9203 | "rssi_teardown_threshold: %d, " |
| 9204 | "rssi_delta: %d, " |
| 9205 | "tdls_options: 0x%x, " |
| 9206 | "tdls_peer_traffic_ind_window: %d, " |
| 9207 | "tdls_peer_traffic_response_timeout: %d, " |
| 9208 | "tdls_puapsd_mask: 0x%x, " |
| 9209 | "tdls_puapsd_inactivity_time: %d, " |
| 9210 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9211 | "teardown_notification_ms: %d, " |
| 9212 | "tdls_peer_kickout_threshold: %d", |
| 9213 | __func__, tdls_state, cmd->state, |
| 9214 | cmd->notification_interval_ms, |
| 9215 | cmd->tx_discovery_threshold, |
| 9216 | cmd->tx_teardown_threshold, |
| 9217 | cmd->rssi_teardown_threshold, |
| 9218 | cmd->rssi_delta, |
| 9219 | cmd->tdls_options, |
| 9220 | cmd->tdls_peer_traffic_ind_window, |
| 9221 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9222 | cmd->tdls_puapsd_mask, |
| 9223 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9224 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9225 | cmd->teardown_notification_ms, |
| 9226 | cmd->tdls_peer_kickout_threshold); |
| 9227 | |
| 9228 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9229 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9230 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9231 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9232 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9233 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9234 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9235 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9236 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9237 | } |
| 9238 | |
| 9239 | /** |
| 9240 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9241 | * @wmi_handle: wmi handle |
| 9242 | * @peerStateParams: TDLS peer state params |
| 9243 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9244 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9245 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9246 | 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] | 9247 | struct tdls_peer_state_params *peerStateParams, |
| 9248 | uint32_t *ch_mhz) |
| 9249 | { |
| 9250 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9251 | wmi_tdls_peer_capabilities *peer_cap; |
| 9252 | wmi_channel *chan_info; |
| 9253 | wmi_buf_t wmi_buf; |
| 9254 | uint8_t *buf_ptr; |
| 9255 | uint32_t i; |
| 9256 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9257 | sizeof(wmi_tdls_peer_capabilities); |
| 9258 | |
| 9259 | |
| 9260 | len += WMI_TLV_HDR_SIZE + |
| 9261 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9262 | |
| 9263 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9264 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9265 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9266 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9267 | } |
| 9268 | |
| 9269 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9270 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9271 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9272 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9273 | WMITLV_GET_STRUCT_TLVLEN |
| 9274 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9275 | |
| 9276 | cmd->vdev_id = peerStateParams->vdevId; |
| 9277 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9278 | &cmd->peer_macaddr); |
| 9279 | |
| 9280 | |
| 9281 | cmd->peer_state = peerStateParams->peerState; |
| 9282 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9283 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9284 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9285 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9286 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9287 | cmd->peer_macaddr.mac_addr31to0, |
| 9288 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9289 | |
| 9290 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9291 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9292 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9293 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9294 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9295 | |
| 9296 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9297 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9298 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9299 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9300 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9301 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9302 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9303 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9304 | |
| 9305 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9306 | * but fill SP |
| 9307 | */ |
| 9308 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9309 | peerStateParams->peerCap.peerMaxSp); |
| 9310 | |
| 9311 | peer_cap->buff_sta_support = |
| 9312 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9313 | peer_cap->off_chan_support = |
| 9314 | peerStateParams->peerCap.peerOffChanSupport; |
| 9315 | peer_cap->peer_curr_operclass = |
| 9316 | peerStateParams->peerCap.peerCurrOperClass; |
| 9317 | /* self curr operclass is not being used and so pass op class for |
| 9318 | * preferred off chan in it. |
| 9319 | */ |
| 9320 | peer_cap->self_curr_operclass = |
| 9321 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 9322 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 9323 | peer_cap->peer_operclass_len = |
| 9324 | peerStateParams->peerCap.peerOperClassLen; |
| 9325 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9326 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9327 | __func__, peer_cap->peer_operclass_len); |
| 9328 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 9329 | peer_cap->peer_operclass[i] = |
| 9330 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9331 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9332 | __func__, i, peer_cap->peer_operclass[i]); |
| 9333 | } |
| 9334 | |
| 9335 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 9336 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 9337 | peer_cap->pref_offchan_bw = |
| 9338 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 9339 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9340 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9341 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 9342 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 9343 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 9344 | " %d, pref_offchan_bw: %d", |
| 9345 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 9346 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 9347 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 9348 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 9349 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 9350 | |
| 9351 | /* next fill variable size array of peer chan info */ |
| 9352 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 9353 | WMITLV_SET_HDR(buf_ptr, |
| 9354 | WMITLV_TAG_ARRAY_STRUC, |
| 9355 | sizeof(wmi_channel) * |
| 9356 | peerStateParams->peerCap.peerChanLen); |
| 9357 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9358 | |
| 9359 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 9360 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 9361 | WMITLV_TAG_STRUC_wmi_channel, |
| 9362 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 9363 | chan_info->mhz = ch_mhz[i]; |
| 9364 | chan_info->band_center_freq1 = chan_info->mhz; |
| 9365 | chan_info->band_center_freq2 = 0; |
| 9366 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9367 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9368 | |
| 9369 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 9370 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9371 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9372 | peerStateParams->peerCap.peerChan[i].chanId, |
| 9373 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 9374 | } |
| 9375 | |
| 9376 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 9377 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 9378 | else |
| 9379 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 9380 | |
| 9381 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 9382 | peerStateParams->peerCap. |
| 9383 | peerChan[i].pwr); |
| 9384 | |
| 9385 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 9386 | peerStateParams->peerCap.peerChan[i]. |
| 9387 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9388 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9389 | peerStateParams->peerCap.peerChan[i].pwr); |
| 9390 | |
| 9391 | chan_info++; |
| 9392 | } |
| 9393 | |
| 9394 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9395 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9396 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9397 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9398 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9399 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9400 | } |
| 9401 | |
| 9402 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9403 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9404 | } |
| 9405 | |
| 9406 | /* |
| 9407 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 9408 | * firmware |
| 9409 | * @wmi_handle: Pointer to wmi handle |
| 9410 | * @mem_dump_req: Pointer for mem_dump_req |
| 9411 | * |
| 9412 | * This function sends memory dump request to firmware |
| 9413 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9414 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9415 | * |
| 9416 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9417 | 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] | 9418 | struct fw_dump_req_param *mem_dump_req) |
| 9419 | { |
| 9420 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 9421 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9422 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9423 | int32_t len; |
| 9424 | wmi_buf_t buf; |
| 9425 | u_int8_t *buf_ptr; |
| 9426 | int ret, loop; |
| 9427 | |
| 9428 | /* |
| 9429 | * len = sizeof(fixed param) that includes tlv header + |
| 9430 | * tlv header for array of struc + |
| 9431 | * sizeof (each struct) |
| 9432 | */ |
| 9433 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9434 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 9435 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9436 | |
| 9437 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9438 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 9439 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9440 | } |
| 9441 | |
| 9442 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9443 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9444 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 9445 | |
| 9446 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9447 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 9448 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 9449 | |
| 9450 | cmd->request_id = mem_dump_req->request_id; |
| 9451 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 9452 | |
| 9453 | /* TLV indicating array of structures to follow */ |
| 9454 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 9455 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9456 | sizeof(wmi_fw_mem_dump) * |
| 9457 | cmd->num_fw_mem_dump_segs); |
| 9458 | |
| 9459 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9460 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 9461 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9462 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9463 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 9464 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9465 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9466 | ((uint8_t *)(mem_dump_req->segment) + |
| 9467 | loop * sizeof(*seg_req)); |
| 9468 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 9469 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 9470 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 9471 | dump_params->seg_id = seg_req->seg_id; |
| 9472 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 9473 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 9474 | dump_params->seg_length = seg_req->seg_length; |
| 9475 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 9476 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9477 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 9478 | 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] | 9479 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 9480 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9481 | 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] | 9482 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 9483 | dump_params->dest_addr_hi); |
| 9484 | dump_params++; |
| 9485 | } |
| 9486 | |
| 9487 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9488 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 9489 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9490 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9491 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9492 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9493 | } |
| 9494 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9495 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 9496 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9497 | } |
| 9498 | |
| 9499 | /* |
| 9500 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 9501 | * @wmi_handle: Pointer to WMi handle |
| 9502 | * @ie_data: Pointer for ie data |
| 9503 | * |
| 9504 | * This function sends IE information to firmware |
| 9505 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9506 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9507 | * |
| 9508 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9509 | 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] | 9510 | struct vdev_ie_info_param *ie_info) |
| 9511 | { |
| 9512 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 9513 | wmi_buf_t buf; |
| 9514 | uint8_t *buf_ptr; |
| 9515 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9516 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9517 | |
| 9518 | |
| 9519 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 9520 | /* Allocate memory for the WMI command */ |
| 9521 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 9522 | |
| 9523 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9524 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9525 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9526 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9527 | } |
| 9528 | |
| 9529 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9530 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9531 | |
| 9532 | /* Populate the WMI command */ |
| 9533 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 9534 | |
| 9535 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9536 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 9537 | WMITLV_GET_STRUCT_TLVLEN( |
| 9538 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 9539 | cmd->vdev_id = ie_info->vdev_id; |
| 9540 | cmd->ie_id = ie_info->ie_id; |
| 9541 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 9542 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9543 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9544 | 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] | 9545 | ie_info->length, ie_info->vdev_id); |
| 9546 | |
| 9547 | buf_ptr += sizeof(*cmd); |
| 9548 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 9549 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9550 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9551 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9552 | |
| 9553 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9554 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9555 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9556 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9557 | wmi_buf_free(buf); |
| 9558 | } |
| 9559 | |
| 9560 | return ret; |
| 9561 | } |
| 9562 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 9563 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9564 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9565 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9566 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9567 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9568 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 9569 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 9570 | resource_cfg->num_offload_reorder_buffs = |
| 9571 | tgt_res_cfg->num_offload_reorder_buffs; |
| 9572 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 9573 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 9574 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 9575 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 9576 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 9577 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 9578 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 9579 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 9580 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 9581 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 9582 | resource_cfg->scan_max_pending_req = |
| 9583 | tgt_res_cfg->scan_max_pending_req; |
| 9584 | resource_cfg->bmiss_offload_max_vdev = |
| 9585 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 9586 | resource_cfg->roam_offload_max_vdev = |
| 9587 | tgt_res_cfg->roam_offload_max_vdev; |
| 9588 | resource_cfg->roam_offload_max_ap_profiles = |
| 9589 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 9590 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 9591 | resource_cfg->num_mcast_table_elems = |
| 9592 | tgt_res_cfg->num_mcast_table_elems; |
| 9593 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 9594 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 9595 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 9596 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 9597 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 9598 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 9599 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 9600 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 9601 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 9602 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 9603 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 9604 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 9605 | resource_cfg->num_tdls_conn_table_entries = |
| 9606 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 9607 | resource_cfg->beacon_tx_offload_max_vdev = |
| 9608 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 9609 | resource_cfg->num_multicast_filter_entries = |
| 9610 | tgt_res_cfg->num_multicast_filter_entries; |
| 9611 | resource_cfg->num_wow_filters = |
| 9612 | tgt_res_cfg->num_wow_filters; |
| 9613 | resource_cfg->num_keep_alive_pattern = |
| 9614 | tgt_res_cfg->num_keep_alive_pattern; |
| 9615 | resource_cfg->keep_alive_pattern_size = |
| 9616 | tgt_res_cfg->keep_alive_pattern_size; |
| 9617 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 9618 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 9619 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 9620 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 9621 | resource_cfg->wmi_send_separate = |
| 9622 | tgt_res_cfg->wmi_send_separate; |
| 9623 | resource_cfg->num_ocb_vdevs = |
| 9624 | tgt_res_cfg->num_ocb_vdevs; |
| 9625 | resource_cfg->num_ocb_channels = |
| 9626 | tgt_res_cfg->num_ocb_channels; |
| 9627 | resource_cfg->num_ocb_schedules = |
| 9628 | tgt_res_cfg->num_ocb_schedules; |
| 9629 | |
| 9630 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 9631 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9632 | /** |
| 9633 | * send_init_cmd_tlv() - wmi init command |
| 9634 | * @wmi_handle: pointer to wmi handle |
| 9635 | * @res_cfg: resource config |
| 9636 | * @num_mem_chunks: no of mem chunck |
| 9637 | * @mem_chunk: pointer to mem chunck structure |
| 9638 | * |
| 9639 | * This function sends IE information to firmware |
| 9640 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9641 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9642 | * |
| 9643 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9644 | QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9645 | wmi_resource_config *tgt_res_cfg, |
| 9646 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 9647 | bool action) |
| 9648 | { |
| 9649 | wmi_buf_t buf; |
| 9650 | wmi_init_cmd_fixed_param *cmd; |
| 9651 | wmi_abi_version my_vers; |
| 9652 | int num_whitelist; |
| 9653 | uint8_t *buf_ptr; |
| 9654 | wmi_resource_config *resource_cfg; |
| 9655 | wlan_host_memory_chunk *host_mem_chunks; |
| 9656 | uint32_t mem_chunk_len = 0; |
| 9657 | uint16_t idx; |
| 9658 | int len; |
| 9659 | int ret; |
| 9660 | |
| 9661 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 9662 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 9663 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 9664 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9665 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 9666 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9667 | } |
| 9668 | |
| 9669 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9670 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 9671 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 9672 | |
| 9673 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 9674 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 9675 | + WMI_TLV_HDR_SIZE); |
| 9676 | |
| 9677 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9678 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 9679 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 9680 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9681 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9682 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 9683 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 9684 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 9685 | |
| 9686 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 9687 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 9688 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 9689 | WMITLV_GET_STRUCT_TLVLEN |
| 9690 | (wlan_host_memory_chunk)); |
| 9691 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 9692 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 9693 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9694 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9695 | idx, host_mem_chunks[idx].size, |
| 9696 | host_mem_chunks[idx].ptr); |
| 9697 | } |
| 9698 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 9699 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 9700 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 9701 | WMITLV_TAG_ARRAY_STRUC, |
| 9702 | (sizeof(wlan_host_memory_chunk) * |
| 9703 | num_mem_chunks)); |
| 9704 | |
| 9705 | num_whitelist = sizeof(version_whitelist) / |
| 9706 | sizeof(wmi_whitelist_version_info); |
| 9707 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 9708 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 9709 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 9710 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 9711 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 9712 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9713 | #ifdef CONFIG_MCL |
| 9714 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 9715 | * 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] | 9716 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 9717 | &my_vers, |
| 9718 | &wmi_handle->fw_abi_version, |
| 9719 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9720 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9721 | 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] | 9722 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 9723 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 9724 | cmd->host_abi_vers.abi_version_ns_0, |
| 9725 | cmd->host_abi_vers.abi_version_ns_1, |
| 9726 | cmd->host_abi_vers.abi_version_ns_2, |
| 9727 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9728 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9729 | /* Save version sent from host - |
| 9730 | * Will be used to check ready event |
| 9731 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9732 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9733 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9734 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9735 | if (action) { |
| 9736 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9737 | WMI_INIT_CMDID); |
| 9738 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9739 | 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] | 9740 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9741 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9742 | } |
| 9743 | } else { |
| 9744 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 9745 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 9746 | } |
| 9747 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9748 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9749 | |
| 9750 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 9751 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9752 | /** |
| 9753 | * send_saved_init_cmd_tlv() - wmi init command |
| 9754 | * @wmi_handle: pointer to wmi handle |
| 9755 | * |
| 9756 | * This function sends IE information to firmware |
| 9757 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9758 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9759 | * |
| 9760 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9761 | QDF_STATUS send_saved_init_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9762 | { |
| 9763 | int status; |
| 9764 | |
| 9765 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 9766 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9767 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 9768 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9769 | } |
| 9770 | status = wmi_unified_cmd_send(wmi_handle, |
| 9771 | wmi_handle->saved_wmi_init_cmd.buf, |
| 9772 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 9773 | WMI_INIT_CMDID); |
| 9774 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9775 | 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] | 9776 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9777 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9778 | } |
| 9779 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 9780 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 9781 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9782 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9783 | } |
| 9784 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9785 | 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] | 9786 | { |
| 9787 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 9788 | wmi_service_ready_event_fixed_param *ev; |
| 9789 | |
| 9790 | |
| 9791 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 9792 | |
| 9793 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 9794 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9795 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9796 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9797 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9798 | /*Save fw version from service ready message */ |
| 9799 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9800 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9801 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9802 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9803 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9804 | } |
| 9805 | |
| 9806 | /** |
| 9807 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 9808 | * @wmi_handle: pointer to wmi handle |
| 9809 | * @res_cfg: resource config |
| 9810 | * @num_mem_chunks: no of mem chunck |
| 9811 | * @mem_chunk: pointer to mem chunck structure |
| 9812 | * |
| 9813 | * This function sends IE information to firmware |
| 9814 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9815 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9816 | * |
| 9817 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9818 | 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] | 9819 | void *evt_buf) |
| 9820 | { |
| 9821 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 9822 | wmi_ready_event_fixed_param *ev = NULL; |
| 9823 | |
| 9824 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 9825 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9826 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9827 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 9828 | &ev->fw_abi_vers)) { |
| 9829 | /* |
| 9830 | * Error: Our host version and the given firmware version |
| 9831 | * are incompatible. |
| 9832 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9833 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9834 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 9835 | __func__, |
| 9836 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 9837 | abi_version_0), |
| 9838 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 9839 | abi_version_0), |
| 9840 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 9841 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 9842 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 9843 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 9844 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 9845 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 9846 | ev->fw_abi_vers.abi_version_ns_0, |
| 9847 | ev->fw_abi_vers.abi_version_ns_1, |
| 9848 | ev->fw_abi_vers.abi_version_ns_2, |
| 9849 | ev->fw_abi_vers.abi_version_ns_3); |
| 9850 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9851 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9852 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9853 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9854 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9855 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9856 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9857 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9858 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9859 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9860 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9861 | |
| 9862 | /** |
| 9863 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 9864 | * @wmi_handle: wmi handle |
| 9865 | * @custom_addr: base mac address |
| 9866 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9867 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9868 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9869 | 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] | 9870 | uint8_t *custom_addr) |
| 9871 | { |
| 9872 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 9873 | wmi_buf_t buf; |
| 9874 | int err; |
| 9875 | |
| 9876 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 9877 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9878 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9879 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9880 | } |
| 9881 | |
| 9882 | 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] | 9883 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9884 | |
| 9885 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9886 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 9887 | WMITLV_GET_STRUCT_TLVLEN |
| 9888 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 9889 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 9890 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9891 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 9892 | sizeof(*cmd), |
| 9893 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 9894 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9895 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9896 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9897 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9898 | } |
| 9899 | |
| 9900 | return 0; |
| 9901 | } |
| 9902 | |
| 9903 | /** |
| 9904 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 9905 | * @handle: wmi handle |
| 9906 | * @event: Event received from FW |
| 9907 | * @len: Length of the event |
| 9908 | * |
| 9909 | * Enables the low frequency events and disables the high frequency |
| 9910 | * events. Bit 17 indicates if the event if low/high frequency. |
| 9911 | * 1 - high frequency, 0 - low frequency |
| 9912 | * |
| 9913 | * Return: 0 on successfully enabling/disabling the events |
| 9914 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9915 | 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] | 9916 | uint8_t *event, |
| 9917 | uint32_t len) |
| 9918 | { |
| 9919 | uint32_t num_of_diag_events_logs; |
| 9920 | wmi_diag_event_log_config_fixed_param *cmd; |
| 9921 | wmi_buf_t buf; |
| 9922 | uint8_t *buf_ptr; |
| 9923 | uint32_t *cmd_args, *evt_args; |
| 9924 | uint32_t buf_len, i; |
| 9925 | |
| 9926 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 9927 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 9928 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9929 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9930 | |
| 9931 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 9932 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9933 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9934 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9935 | } |
| 9936 | wmi_event = param_buf->fixed_param; |
| 9937 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 9938 | evt_args = param_buf->diag_events_logs_list; |
| 9939 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9940 | 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] | 9941 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9942 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9943 | } |
| 9944 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9945 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9946 | __func__, num_of_diag_events_logs); |
| 9947 | |
| 9948 | /* Free any previous allocation */ |
| 9949 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9950 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9951 | |
| 9952 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9953 | 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] | 9954 | sizeof(uint32_t)); |
| 9955 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9956 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9957 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9958 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9959 | } |
| 9960 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 9961 | |
| 9962 | /* Prepare the send buffer */ |
| 9963 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 9964 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 9965 | |
| 9966 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 9967 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9968 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9969 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9970 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9971 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9972 | } |
| 9973 | |
| 9974 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 9975 | buf_ptr = (uint8_t *) cmd; |
| 9976 | |
| 9977 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9978 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 9979 | WMITLV_GET_STRUCT_TLVLEN( |
| 9980 | wmi_diag_event_log_config_fixed_param)); |
| 9981 | |
| 9982 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 9983 | |
| 9984 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 9985 | |
| 9986 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9987 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 9988 | |
| 9989 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9990 | |
| 9991 | /* Populate the events */ |
| 9992 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 9993 | /* Low freq (0) - Enable (1) the event |
| 9994 | * High freq (1) - Disable (0) the event |
| 9995 | */ |
| 9996 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 9997 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 9998 | /* Set the event ID */ |
| 9999 | WMI_DIAG_ID_SET(cmd_args[i], |
| 10000 | WMI_DIAG_ID_GET(evt_args[i])); |
| 10001 | /* Set the type */ |
| 10002 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 10003 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10004 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10005 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 10006 | } |
| 10007 | |
| 10008 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 10009 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10010 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10011 | __func__); |
| 10012 | wmi_buf_free(buf); |
| 10013 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 10014 | * Host can still have this list |
| 10015 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10016 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10017 | } |
| 10018 | |
| 10019 | return 0; |
| 10020 | } |
| 10021 | |
| 10022 | /** |
| 10023 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 10024 | * @wmi_handle: wmi handle |
| 10025 | * @start_log: Start logging related parameters |
| 10026 | * |
| 10027 | * Send the command to the FW based on which specific logging of diag |
| 10028 | * event/log id can be started/stopped |
| 10029 | * |
| 10030 | * Return: None |
| 10031 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10032 | 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] | 10033 | struct wmi_wifi_start_log *start_log) |
| 10034 | { |
| 10035 | wmi_diag_event_log_config_fixed_param *cmd; |
| 10036 | wmi_buf_t buf; |
| 10037 | uint8_t *buf_ptr; |
| 10038 | uint32_t len, count, log_level, i; |
| 10039 | uint32_t *cmd_args; |
| 10040 | uint32_t total_len; |
| 10041 | count = 0; |
| 10042 | |
| 10043 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10044 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10045 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10046 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10047 | } |
| 10048 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 10049 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 10050 | */ |
| 10051 | total_len = 0; |
| 10052 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 10053 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 10054 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 10055 | total_len++; |
| 10056 | } |
| 10057 | |
| 10058 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10059 | (total_len * sizeof(uint32_t)); |
| 10060 | |
| 10061 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10062 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10063 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10064 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10065 | } |
| 10066 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 10067 | buf_ptr = (uint8_t *) cmd; |
| 10068 | |
| 10069 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10070 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 10071 | WMITLV_GET_STRUCT_TLVLEN( |
| 10072 | wmi_diag_event_log_config_fixed_param)); |
| 10073 | |
| 10074 | cmd->num_of_diag_events_logs = total_len; |
| 10075 | |
| 10076 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 10077 | |
| 10078 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10079 | (total_len * sizeof(uint32_t))); |
| 10080 | |
| 10081 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10082 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10083 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10084 | log_level = 1; |
| 10085 | else |
| 10086 | log_level = 0; |
| 10087 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10088 | 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] | 10089 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 10090 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 10091 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 10092 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 10093 | |
| 10094 | WMI_DIAG_ID_SET(cmd_args[count], |
| 10095 | WMI_DIAG_ID_GET(val)); |
| 10096 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 10097 | WMI_DIAG_TYPE_GET(val)); |
| 10098 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 10099 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10100 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10101 | count++; |
| 10102 | } |
| 10103 | } |
| 10104 | |
| 10105 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10106 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10107 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10108 | __func__); |
| 10109 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10110 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10111 | } |
| 10112 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10113 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10114 | } |
| 10115 | |
| 10116 | /** |
| 10117 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 10118 | * @wmi_handle: WMI handle |
| 10119 | * |
| 10120 | * This function is used to send the flush command to the FW, |
| 10121 | * that will flush the fw logs that are residue in the FW |
| 10122 | * |
| 10123 | * Return: None |
| 10124 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10125 | 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] | 10126 | { |
| 10127 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 10128 | wmi_buf_t buf; |
| 10129 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10130 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10131 | |
| 10132 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10133 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10134 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10135 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10136 | } |
| 10137 | |
| 10138 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 10139 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10140 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 10141 | WMITLV_GET_STRUCT_TLVLEN( |
| 10142 | wmi_debug_mesg_flush_fixed_param)); |
| 10143 | cmd->reserved0 = 0; |
| 10144 | |
| 10145 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10146 | buf, |
| 10147 | len, |
| 10148 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10149 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10150 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10151 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10152 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10153 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10154 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10155 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10156 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10157 | } |
| 10158 | |
| 10159 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10160 | * 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] | 10161 | * @wmi_handle: wmi handle |
| 10162 | * @msg: PCL structure containing the PCL and the number of channels |
| 10163 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10164 | * 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] | 10165 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 10166 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 10167 | * to migrate to a new channel without host driver involvement. An example of |
| 10168 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 10169 | * manage the channel selection without firmware involvement. |
| 10170 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10171 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 10172 | * channel list. The weights corresponds to the channels sent in |
| 10173 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 10174 | * weightage compared to the non PCL channels. |
| 10175 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10176 | * Return: Success if the cmd is sent successfully to the firmware |
| 10177 | */ |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10178 | QDF_STATUS send_pdev_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10179 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10180 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10181 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10182 | wmi_buf_t buf; |
| 10183 | uint8_t *buf_ptr; |
| 10184 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10185 | uint32_t chan_len; |
| 10186 | |
| 10187 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10188 | |
| 10189 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10190 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10191 | |
| 10192 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10193 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10194 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10195 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10196 | } |
| 10197 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10198 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10199 | buf_ptr = (uint8_t *) cmd; |
| 10200 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10201 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 10202 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10203 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10204 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 10205 | cmd->num_chan = chan_len; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10206 | WMI_LOGI("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10207 | |
| 10208 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10209 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10210 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10211 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10212 | for (i = 0; i < chan_len ; i++) { |
| 10213 | cmd_args[i] = msg->weighed_valid_list[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10214 | WMI_LOGI("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10215 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10216 | } |
| 10217 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10218 | WMI_PDEV_SET_PCL_CMDID)) { |
| 10219 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10220 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10221 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10222 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10223 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10224 | } |
| 10225 | |
| 10226 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10227 | * 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] | 10228 | * @wmi_handle: wmi handle |
| 10229 | * @msg: Structure containing the following parameters |
| 10230 | * |
| 10231 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 10232 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 10233 | * |
| 10234 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 10235 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 10236 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 10237 | * |
| 10238 | * Return: Success if the cmd is sent successfully to the firmware |
| 10239 | */ |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10240 | 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] | 10241 | uint32_t hw_mode_index) |
| 10242 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10243 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10244 | wmi_buf_t buf; |
| 10245 | uint32_t len; |
| 10246 | |
| 10247 | len = sizeof(*cmd); |
| 10248 | |
| 10249 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10250 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10251 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10252 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10253 | } |
| 10254 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10255 | 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] | 10256 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10257 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 10258 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 10259 | |
| 10260 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10261 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10262 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10263 | |
| 10264 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10265 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 10266 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10267 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10268 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10269 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10270 | } |
| 10271 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10272 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10273 | } |
| 10274 | |
| 10275 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10276 | * 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] | 10277 | * @wmi_handle: wmi handle |
| 10278 | * @msg: Dual MAC config parameters |
| 10279 | * |
| 10280 | * Configures WLAN firmware with the dual MAC features |
| 10281 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10282 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10283 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 10284 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10285 | 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] | 10286 | struct wmi_dual_mac_config *msg) |
| 10287 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10288 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10289 | wmi_buf_t buf; |
| 10290 | uint32_t len; |
| 10291 | |
| 10292 | len = sizeof(*cmd); |
| 10293 | |
| 10294 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10295 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10296 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10297 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10298 | } |
| 10299 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10300 | 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] | 10301 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10302 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10303 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10304 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 10305 | |
| 10306 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10307 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 10308 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10309 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10310 | __func__, msg->scan_config, msg->fw_mode_config); |
| 10311 | |
| 10312 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10313 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 10314 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10315 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10316 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10317 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10318 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10319 | } |
| 10320 | |
| 10321 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10322 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 10323 | * @wmi_handle: wmi handle |
| 10324 | * @offload_req: offload request |
| 10325 | * @buf_ptr: buffer pointer |
| 10326 | * |
| 10327 | * To fill ARP offload data to firmware |
| 10328 | * when target goes to wow mode. |
| 10329 | * |
| 10330 | * Return: None |
| 10331 | */ |
| 10332 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10333 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10334 | { |
| 10335 | |
| 10336 | int i; |
| 10337 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
| 10338 | bool enable_or_disable = offload_req->enableOrDisable; |
| 10339 | |
| 10340 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10341 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 10342 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10343 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 10344 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 10345 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 10346 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 10347 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 10348 | |
| 10349 | /* Fill data for ARP and NS in the first tupple for LA */ |
| 10350 | if ((enable_or_disable & WMI_OFFLOAD_ENABLE) && (i == 0)) { |
| 10351 | /* Copy the target ip addr and flags */ |
| 10352 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 10353 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
| 10354 | offload_req->params.hostIpv4Addr, |
| 10355 | WMI_IPV4_ADDR_LEN); |
| 10356 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
| 10357 | offload_req->params.hostIpv4Addr); |
| 10358 | } |
| 10359 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 10360 | } |
| 10361 | } |
| 10362 | |
| 10363 | #ifdef WLAN_NS_OFFLOAD |
| 10364 | /** |
| 10365 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 10366 | * @wmi|_handle: wmi handle |
| 10367 | * @offload_req: offload request |
| 10368 | * @buf_ptr: buffer pointer |
| 10369 | * |
| 10370 | * To fill NS offload data to firmware |
| 10371 | * when target goes to wow mode. |
| 10372 | * |
| 10373 | * Return: None |
| 10374 | */ |
| 10375 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10376 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10377 | { |
| 10378 | |
| 10379 | int i; |
| 10380 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 10381 | struct ns_offload_req_params ns_req; |
| 10382 | |
| 10383 | ns_req = offload_req->nsOffloadInfo; |
| 10384 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10385 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 10386 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10387 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 10388 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 10389 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 10390 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 10391 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 10392 | |
| 10393 | /* |
| 10394 | * Fill data only for NS offload in the first ARP tuple for LA |
| 10395 | */ |
| 10396 | if ((offload_req->enableOrDisable & WMI_OFFLOAD_ENABLE)) { |
| 10397 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 10398 | /* Copy the target/solicitation/remote ip addr */ |
| 10399 | if (ns_req.targetIPv6AddrValid[i]) |
| 10400 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
| 10401 | &ns_req.targetIPv6Addr[i], |
| 10402 | sizeof(WMI_IPV6_ADDR)); |
| 10403 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
| 10404 | &ns_req.selfIPv6Addr[i], |
| 10405 | sizeof(WMI_IPV6_ADDR)); |
| 10406 | if (ns_req.target_ipv6_addr_ac_type[i]) { |
| 10407 | ns_tuple->flags |= |
| 10408 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 10409 | } |
| 10410 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
| 10411 | i, &ns_req.selfIPv6Addr[i], |
| 10412 | &ns_req.targetIPv6Addr[i]); |
| 10413 | |
| 10414 | /* target MAC is optional, check if it is valid, |
| 10415 | * if this is not valid, the target will use the known |
| 10416 | * local MAC address rather than the tuple |
| 10417 | */ |
| 10418 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 10419 | ns_req.self_macaddr.bytes, |
| 10420 | &ns_tuple->target_mac); |
| 10421 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 10422 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 10423 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 10424 | } |
| 10425 | } |
| 10426 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 10427 | } |
| 10428 | } |
| 10429 | |
| 10430 | |
| 10431 | /** |
| 10432 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 10433 | * @wmi: wmi handle |
| 10434 | * @offload_req: offload request |
| 10435 | * @buf_ptr: buffer pointer |
| 10436 | * |
| 10437 | * To fill extended NS offload extended data to firmware |
| 10438 | * when target goes to wow mode. |
| 10439 | * |
| 10440 | * Return: None |
| 10441 | */ |
| 10442 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
| 10443 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10444 | { |
| 10445 | int i; |
| 10446 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 10447 | uint32_t count, num_ns_ext_tuples; |
| 10448 | struct ns_offload_req_params ns_req; |
| 10449 | |
| 10450 | ns_req = offload_req->nsOffloadInfo; |
| 10451 | count = offload_req->num_ns_offload_count; |
| 10452 | num_ns_ext_tuples = offload_req->num_ns_offload_count - |
| 10453 | WMI_MAX_NS_OFFLOADS; |
| 10454 | |
| 10455 | /* Populate extended NS offload tuples */ |
| 10456 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10457 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 10458 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10459 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 10460 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 10461 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 10462 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 10463 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 10464 | |
| 10465 | /* |
| 10466 | * Fill data only for NS offload in the first ARP tuple for LA |
| 10467 | */ |
| 10468 | if ((offload_req->enableOrDisable & WMI_OFFLOAD_ENABLE)) { |
| 10469 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 10470 | /* Copy the target/solicitation/remote ip addr */ |
| 10471 | if (ns_req.targetIPv6AddrValid[i]) |
| 10472 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
| 10473 | &ns_req.targetIPv6Addr[i], |
| 10474 | sizeof(WMI_IPV6_ADDR)); |
| 10475 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
| 10476 | &ns_req.selfIPv6Addr[i], |
| 10477 | sizeof(WMI_IPV6_ADDR)); |
| 10478 | if (ns_req.target_ipv6_addr_ac_type[i]) { |
| 10479 | ns_tuple->flags |= |
| 10480 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 10481 | } |
| 10482 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
| 10483 | i, &ns_req.selfIPv6Addr[i], |
| 10484 | &ns_req.targetIPv6Addr[i]); |
| 10485 | |
| 10486 | /* target MAC is optional, check if it is valid, |
| 10487 | * if this is not valid, the target will use the |
| 10488 | * known local MAC address rather than the tuple |
| 10489 | */ |
| 10490 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 10491 | ns_req.self_macaddr.bytes, |
| 10492 | &ns_tuple->target_mac); |
| 10493 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 10494 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 10495 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 10496 | } |
| 10497 | } |
| 10498 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 10499 | } |
| 10500 | } |
| 10501 | #else |
| 10502 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10503 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10504 | { |
| 10505 | return; |
| 10506 | } |
| 10507 | |
| 10508 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
| 10509 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10510 | { |
| 10511 | return; |
| 10512 | } |
| 10513 | #endif |
| 10514 | |
| 10515 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10516 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 10517 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10518 | * @arp_offload_req: arp offload request |
| 10519 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10520 | * @arp_only: flag |
| 10521 | * |
| 10522 | * To configure ARP NS off load data to firmware |
| 10523 | * when target goes to wow mode. |
| 10524 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10525 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10526 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10527 | QDF_STATUS send_enable_arp_ns_offload_cmd_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10528 | struct host_offload_req_param *arp_offload_req, |
| 10529 | struct host_offload_req_param *ns_offload_req, |
| 10530 | bool arp_only, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10531 | uint8_t vdev_id) |
| 10532 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10533 | int32_t res; |
| 10534 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10535 | A_UINT8 *buf_ptr; |
| 10536 | wmi_buf_t buf; |
| 10537 | int32_t len; |
| 10538 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 10539 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10540 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10541 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10542 | /* |
| 10543 | * TLV place holder size for array of NS tuples |
| 10544 | * TLV place holder size for array of ARP tuples |
| 10545 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10546 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 10547 | WMI_TLV_HDR_SIZE + |
| 10548 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 10549 | WMI_TLV_HDR_SIZE + |
| 10550 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10551 | |
| 10552 | /* |
| 10553 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 10554 | * extra length for extended NS offload tuples which follows ARP offload |
| 10555 | * tuples. Host needs to fill this structure in following format: |
| 10556 | * 2 NS ofload tuples |
| 10557 | * 2 ARP offload tuples |
| 10558 | * N numbers of extended NS offload tuples if HDD has given more than |
| 10559 | * 2 NS offload addresses |
| 10560 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10561 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10562 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10563 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 10564 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10565 | } |
| 10566 | |
| 10567 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10568 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10569 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10570 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10571 | } |
| 10572 | |
| 10573 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 10574 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 10575 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10576 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 10577 | WMITLV_GET_STRUCT_TLVLEN |
| 10578 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 10579 | cmd->flags = 0; |
| 10580 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10581 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10582 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10583 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10584 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10585 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10586 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 10587 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 10588 | if (num_ns_ext_tuples) |
| 10589 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10590 | |
| 10591 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10592 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 10593 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10594 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10595 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10596 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10597 | } |
| 10598 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10599 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10600 | } |
| 10601 | |
| 10602 | /** |
| 10603 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 10604 | * @wmi_handle: wmi handle |
| 10605 | * @request: SSID hotlist set request |
| 10606 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10607 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10608 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10609 | QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10610 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 10611 | struct ssid_hotlist_request_params *request) |
| 10612 | { |
| 10613 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 10614 | wmi_buf_t wmi_buf; |
| 10615 | uint32_t len; |
| 10616 | uint32_t array_size; |
| 10617 | uint8_t *buf_ptr; |
| 10618 | |
| 10619 | /* length of fixed portion */ |
| 10620 | len = sizeof(*cmd); |
| 10621 | |
| 10622 | /* length of variable portion */ |
| 10623 | array_size = |
| 10624 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 10625 | len += WMI_TLV_HDR_SIZE + array_size; |
| 10626 | |
| 10627 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10628 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10629 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10630 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10631 | } |
| 10632 | |
| 10633 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 10634 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 10635 | buf_ptr; |
| 10636 | WMITLV_SET_HDR |
| 10637 | (&cmd->tlv_header, |
| 10638 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 10639 | WMITLV_GET_STRUCT_TLVLEN |
| 10640 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 10641 | |
| 10642 | cmd->request_id = request->request_id; |
| 10643 | cmd->requestor_id = 0; |
| 10644 | cmd->vdev_id = request->session_id; |
| 10645 | cmd->table_id = 0; |
| 10646 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 10647 | cmd->total_entries = request->ssid_count; |
| 10648 | cmd->num_entries_in_page = request->ssid_count; |
| 10649 | cmd->first_entry_index = 0; |
| 10650 | |
| 10651 | buf_ptr += sizeof(*cmd); |
| 10652 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 10653 | |
| 10654 | if (request->ssid_count) { |
| 10655 | wmi_extscan_hotlist_ssid_entry *entry; |
| 10656 | int i; |
| 10657 | |
| 10658 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10659 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 10660 | for (i = 0; i < request->ssid_count; i++) { |
| 10661 | WMITLV_SET_HDR |
| 10662 | (entry, |
| 10663 | WMITLV_TAG_ARRAY_STRUC, |
| 10664 | WMITLV_GET_STRUCT_TLVLEN |
| 10665 | (wmi_extscan_hotlist_ssid_entry)); |
| 10666 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10667 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10668 | request->ssids[i].ssid.mac_ssid, |
| 10669 | request->ssids[i].ssid.length); |
| 10670 | entry->band = request->ssids[i].band; |
| 10671 | entry->min_rssi = request->ssids[i].rssi_low; |
| 10672 | entry->max_rssi = request->ssids[i].rssi_high; |
| 10673 | entry++; |
| 10674 | } |
| 10675 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 10676 | } else { |
| 10677 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 10678 | } |
| 10679 | |
| 10680 | if (wmi_unified_cmd_send |
| 10681 | (wmi_handle, wmi_buf, len, |
| 10682 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10683 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10684 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10685 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10686 | } |
| 10687 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10688 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10689 | } |
| 10690 | |
| 10691 | /** |
| 10692 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 10693 | * @wmi_handle: wmi handle |
| 10694 | * @vdev_id: vdev id |
| 10695 | * |
| 10696 | * This function sends roam synch complete event to fw. |
| 10697 | * |
| 10698 | * Return: CDF STATUS |
| 10699 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10700 | 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] | 10701 | uint8_t vdev_id) |
| 10702 | { |
| 10703 | wmi_roam_synch_complete_fixed_param *cmd; |
| 10704 | wmi_buf_t wmi_buf; |
| 10705 | uint8_t *buf_ptr; |
| 10706 | uint16_t len; |
| 10707 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 10708 | |
| 10709 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10710 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10711 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10712 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10713 | } |
| 10714 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 10715 | buf_ptr = (uint8_t *) cmd; |
| 10716 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10717 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 10718 | WMITLV_GET_STRUCT_TLVLEN |
| 10719 | (wmi_roam_synch_complete_fixed_param)); |
| 10720 | cmd->vdev_id = vdev_id; |
| 10721 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10722 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10723 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10724 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10725 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10726 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10727 | } |
| 10728 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10729 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10730 | } |
| 10731 | |
| 10732 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 10733 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 10734 | * @wmi_handle: wmi handle |
| 10735 | * @wmi_fwtest: fw test command |
| 10736 | * |
| 10737 | * This function sends fw test command to fw. |
| 10738 | * |
| 10739 | * Return: CDF STATUS |
| 10740 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 10741 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 10742 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 10743 | struct set_fwtest_params *wmi_fwtest) |
| 10744 | { |
| 10745 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 10746 | wmi_buf_t wmi_buf; |
| 10747 | uint16_t len; |
| 10748 | |
| 10749 | len = sizeof(*cmd); |
| 10750 | |
| 10751 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10752 | if (!wmi_buf) { |
| 10753 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10754 | return QDF_STATUS_E_NOMEM; |
| 10755 | } |
| 10756 | |
| 10757 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 10758 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10759 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 10760 | WMITLV_GET_STRUCT_TLVLEN( |
| 10761 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 10762 | cmd->param_id = wmi_fwtest->arg; |
| 10763 | cmd->param_value = wmi_fwtest->value; |
| 10764 | |
| 10765 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10766 | WMI_FWTEST_CMDID)) { |
| 10767 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 10768 | qdf_nbuf_free(wmi_buf); |
| 10769 | return QDF_STATUS_E_FAILURE; |
| 10770 | } |
| 10771 | |
| 10772 | return QDF_STATUS_SUCCESS; |
| 10773 | } |
| 10774 | |
| 10775 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10776 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 10777 | * @wmi_handle: wmi handle |
| 10778 | * @wmi_utest: unit test command |
| 10779 | * |
| 10780 | * This function send unit test command to fw. |
| 10781 | * |
| 10782 | * Return: CDF STATUS |
| 10783 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10784 | QDF_STATUS send_unit_test_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10785 | struct wmi_unit_test_cmd *wmi_utest) |
| 10786 | { |
| 10787 | wmi_unit_test_cmd_fixed_param *cmd; |
| 10788 | wmi_buf_t wmi_buf; |
| 10789 | uint8_t *buf_ptr; |
| 10790 | int i; |
| 10791 | uint16_t len, args_tlv_len; |
| 10792 | A_UINT32 *unit_test_cmd_args; |
| 10793 | |
| 10794 | args_tlv_len = |
| 10795 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 10796 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 10797 | |
| 10798 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10799 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10800 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10801 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10802 | } |
| 10803 | |
| 10804 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 10805 | buf_ptr = (uint8_t *) cmd; |
| 10806 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10807 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 10808 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 10809 | cmd->vdev_id = wmi_utest->vdev_id; |
| 10810 | cmd->module_id = wmi_utest->module_id; |
| 10811 | cmd->num_args = wmi_utest->num_args; |
| 10812 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 10813 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10814 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 10815 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10816 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10817 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 10818 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10819 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10820 | } |
| 10821 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10822 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10823 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10824 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10825 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10826 | } |
| 10827 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10828 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10829 | } |
| 10830 | |
| 10831 | /** |
| 10832 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 10833 | * @wmi_handle: wma handle |
| 10834 | * @roaminvoke: roam invoke command |
| 10835 | * |
| 10836 | * Send roam invoke command to fw for fastreassoc. |
| 10837 | * |
| 10838 | * Return: CDF STATUS |
| 10839 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10840 | QDF_STATUS send_roam_invoke_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10841 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 10842 | uint32_t ch_hz) |
| 10843 | { |
| 10844 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 10845 | wmi_buf_t wmi_buf; |
| 10846 | u_int8_t *buf_ptr; |
| 10847 | u_int16_t len, args_tlv_len; |
| 10848 | A_UINT32 *channel_list; |
| 10849 | wmi_mac_addr *bssid_list; |
| 10850 | |
| 10851 | /* Host sends only one channel and one bssid */ |
| 10852 | args_tlv_len = 2 * WMI_TLV_HDR_SIZE + sizeof(A_UINT32) + |
| 10853 | sizeof(wmi_mac_addr); |
| 10854 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 10855 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10856 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10857 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10858 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10859 | } |
| 10860 | |
| 10861 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 10862 | buf_ptr = (u_int8_t *) cmd; |
| 10863 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10864 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 10865 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 10866 | cmd->vdev_id = roaminvoke->vdev_id; |
| 10867 | cmd->flags = 0; |
| 10868 | cmd->roam_scan_mode = 0; |
| 10869 | cmd->roam_ap_sel_mode = 0; |
| 10870 | cmd->roam_delay = 0; |
| 10871 | cmd->num_chan = 1; |
| 10872 | cmd->num_bssid = 1; |
| 10873 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 10874 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10875 | (sizeof(u_int32_t))); |
| 10876 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 10877 | *channel_list = ch_hz; |
| 10878 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 10879 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 10880 | (sizeof(wmi_mac_addr))); |
| 10881 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 10882 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
| 10883 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10884 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10885 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10886 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10887 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10888 | } |
| 10889 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10890 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10891 | } |
| 10892 | |
| 10893 | /** |
| 10894 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 10895 | * @wmi_handle: wmi handle |
| 10896 | * @command: command |
| 10897 | * @vdev_id: vdev id |
| 10898 | * |
| 10899 | * This function set roam offload command to fw. |
| 10900 | * |
| 10901 | * Return: CDF status |
| 10902 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10903 | 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] | 10904 | uint32_t command, uint32_t vdev_id) |
| 10905 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10906 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10907 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 10908 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10909 | int len; |
| 10910 | uint8_t *buf_ptr; |
| 10911 | |
| 10912 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 10913 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10914 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10915 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 10916 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10917 | } |
| 10918 | |
| 10919 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10920 | |
| 10921 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 10922 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 10923 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 10924 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 10925 | cmd_fp->vdev_id = vdev_id; |
| 10926 | cmd_fp->command_arg = command; |
| 10927 | |
| 10928 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 10929 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10930 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10931 | 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] | 10932 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10933 | goto error; |
| 10934 | } |
| 10935 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10936 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 10937 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10938 | |
| 10939 | error: |
| 10940 | wmi_buf_free(buf); |
| 10941 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10942 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10943 | } |
| 10944 | |
| 10945 | /** |
| 10946 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 10947 | * @wmi_handle: wmi handle |
| 10948 | * @ap_profile_p: ap profile |
| 10949 | * @vdev_id: vdev id |
| 10950 | * |
| 10951 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 10952 | * |
| 10953 | * Return: CDF status |
| 10954 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10955 | 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] | 10956 | wmi_ap_profile *ap_profile_p, |
| 10957 | uint32_t vdev_id) |
| 10958 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10959 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10960 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10961 | int len; |
| 10962 | uint8_t *buf_ptr; |
| 10963 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 10964 | |
| 10965 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 10966 | |
| 10967 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10968 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10969 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 10970 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10971 | } |
| 10972 | |
| 10973 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10974 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 10975 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 10976 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 10977 | WMITLV_GET_STRUCT_TLVLEN |
| 10978 | (wmi_roam_ap_profile_fixed_param)); |
| 10979 | /* fill in threshold values */ |
| 10980 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 10981 | roam_ap_profile_fp->id = 0; |
| 10982 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 10983 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10984 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10985 | WMITLV_SET_HDR(buf_ptr, |
| 10986 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 10987 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 10988 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 10989 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10990 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10991 | 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] | 10992 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10993 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10994 | } |
| 10995 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10996 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10997 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10998 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10999 | } |
| 11000 | |
| 11001 | /** |
| 11002 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 11003 | * @wmi_handle: wmi handle |
| 11004 | * @scan_period: scan period |
| 11005 | * @scan_age: scan age |
| 11006 | * @vdev_id: vdev id |
| 11007 | * |
| 11008 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 11009 | * |
| 11010 | * Return: CDF status |
| 11011 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11012 | 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] | 11013 | uint32_t scan_period, |
| 11014 | uint32_t scan_age, |
| 11015 | uint32_t vdev_id) |
| 11016 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11017 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11018 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11019 | int len; |
| 11020 | uint8_t *buf_ptr; |
| 11021 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 11022 | |
| 11023 | /* Send scan period values */ |
| 11024 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 11025 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11026 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11027 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11028 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11029 | } |
| 11030 | |
| 11031 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11032 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 11033 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 11034 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 11035 | WMITLV_GET_STRUCT_TLVLEN |
| 11036 | (wmi_roam_scan_period_fixed_param)); |
| 11037 | /* fill in scan period values */ |
| 11038 | scan_period_fp->vdev_id = vdev_id; |
| 11039 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 11040 | scan_period_fp->roam_scan_age = scan_age; |
| 11041 | |
| 11042 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11043 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11044 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11045 | 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] | 11046 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11047 | goto error; |
| 11048 | } |
| 11049 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11050 | 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] | 11051 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11052 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11053 | error: |
| 11054 | wmi_buf_free(buf); |
| 11055 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11056 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11057 | } |
| 11058 | |
| 11059 | /** |
| 11060 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 11061 | * @wmi_handle: wmi handle |
| 11062 | * @chan_count: channel count |
| 11063 | * @chan_list: channel list |
| 11064 | * @list_type: list type |
| 11065 | * @vdev_id: vdev id |
| 11066 | * |
| 11067 | * Set roam offload channel list. |
| 11068 | * |
| 11069 | * Return: CDF status |
| 11070 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11071 | 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] | 11072 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 11073 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11074 | uint8_t list_type, uint32_t vdev_id) |
| 11075 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11076 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11077 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11078 | int len, list_tlv_len; |
| 11079 | int i; |
| 11080 | uint8_t *buf_ptr; |
| 11081 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 11082 | A_UINT32 *roam_chan_list_array; |
| 11083 | |
| 11084 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11085 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11086 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11087 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11088 | } |
| 11089 | /* Channel list is a table of 2 TLV's */ |
| 11090 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 11091 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 11092 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11093 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11094 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11095 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11096 | } |
| 11097 | |
| 11098 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11099 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 11100 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 11101 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 11102 | WMITLV_GET_STRUCT_TLVLEN |
| 11103 | (wmi_roam_chan_list_fixed_param)); |
| 11104 | chan_list_fp->vdev_id = vdev_id; |
| 11105 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 11106 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11107 | /* external app is controlling channel list */ |
| 11108 | chan_list_fp->chan_list_type = |
| 11109 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 11110 | } else { |
| 11111 | /* umac supplied occupied channel list in LFR */ |
| 11112 | chan_list_fp->chan_list_type = |
| 11113 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 11114 | } |
| 11115 | |
| 11116 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 11117 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11118 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 11119 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11120 | WMI_LOGI("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11121 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 11122 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 11123 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11124 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11125 | } |
| 11126 | |
| 11127 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11128 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11129 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11130 | 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] | 11131 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11132 | goto error; |
| 11133 | } |
| 11134 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11135 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
| 11136 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11137 | error: |
| 11138 | wmi_buf_free(buf); |
| 11139 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11140 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11141 | } |
| 11142 | |
| 11143 | /** |
| 11144 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 11145 | * @wmi_handle: wmi handle |
| 11146 | * @rssi_change_thresh: RSSI Change threshold |
| 11147 | * @bcn_rssi_weight: beacon RSSI weight |
| 11148 | * @vdev_id: vdev id |
| 11149 | * |
| 11150 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 11151 | * |
| 11152 | * Return: CDF status |
| 11153 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11154 | 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] | 11155 | uint32_t vdev_id, |
| 11156 | int32_t rssi_change_thresh, |
| 11157 | uint32_t bcn_rssi_weight, |
| 11158 | uint32_t hirssi_delay_btw_scans) |
| 11159 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11160 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11161 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11162 | int len; |
| 11163 | uint8_t *buf_ptr; |
| 11164 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 11165 | |
| 11166 | /* Send rssi change parameters */ |
| 11167 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 11168 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11169 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11170 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11171 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11172 | } |
| 11173 | |
| 11174 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11175 | rssi_change_fp = |
| 11176 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 11177 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 11178 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 11179 | WMITLV_GET_STRUCT_TLVLEN |
| 11180 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 11181 | /* fill in rssi change threshold (hysteresis) values */ |
| 11182 | rssi_change_fp->vdev_id = vdev_id; |
| 11183 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 11184 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 11185 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 11186 | |
| 11187 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11188 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11189 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11190 | 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] | 11191 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11192 | goto error; |
| 11193 | } |
| 11194 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11195 | 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] | 11196 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11197 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 11198 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11199 | error: |
| 11200 | wmi_buf_free(buf); |
| 11201 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11202 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11203 | } |
| 11204 | |
| 11205 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 11206 | * @wmi_handle: wmi handle. |
| 11207 | * @cmd: size of command structure. |
| 11208 | * @per_entry_size: per entry size. |
| 11209 | * |
| 11210 | * This utility function calculates how many hotlist entries can |
| 11211 | * fit in one page. |
| 11212 | * |
| 11213 | * Return: number of entries |
| 11214 | */ |
| 11215 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 11216 | size_t cmd_size, |
| 11217 | size_t per_entry_size) |
| 11218 | { |
| 11219 | uint32_t avail_space = 0; |
| 11220 | int num_entries = 0; |
| 11221 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 11222 | |
| 11223 | /* Calculate number of hotlist entries that can |
| 11224 | * be passed in wma message request. |
| 11225 | */ |
| 11226 | avail_space = max_msg_len - cmd_size; |
| 11227 | num_entries = avail_space / per_entry_size; |
| 11228 | return num_entries; |
| 11229 | } |
| 11230 | |
| 11231 | /** |
| 11232 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 11233 | * @wmi_handle: wmi handle |
| 11234 | * @photlist: hotlist command params |
| 11235 | * @buf_len: buffer length |
| 11236 | * |
| 11237 | * This function fills individual elements for hotlist request and |
| 11238 | * TLV for bssid entries |
| 11239 | * |
| 11240 | * Return: CDF Status. |
| 11241 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11242 | 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] | 11243 | struct ext_scan_setbssi_hotlist_params * |
| 11244 | photlist, int *buf_len) |
| 11245 | { |
| 11246 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 11247 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 11248 | struct ap_threshold_params *src_ap = photlist->ap; |
| 11249 | wmi_buf_t buf; |
| 11250 | uint8_t *buf_ptr; |
| 11251 | |
| 11252 | int j, index = 0; |
| 11253 | int cmd_len = 0; |
| 11254 | int num_entries; |
| 11255 | int min_entries = 0; |
| 11256 | int numap = photlist->numAp; |
| 11257 | int len = sizeof(*cmd); |
| 11258 | |
| 11259 | len += WMI_TLV_HDR_SIZE; |
| 11260 | cmd_len = len; |
| 11261 | |
| 11262 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 11263 | cmd_len, |
| 11264 | sizeof(*dest_hotlist)); |
| 11265 | /* setbssid hotlist expects the bssid list |
| 11266 | * to be non zero value |
| 11267 | */ |
| 11268 | if (!numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11269 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 11270 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11271 | } |
| 11272 | |
| 11273 | /* Split the hot list entry pages and send multiple command |
| 11274 | * requests if the buffer reaches the maximum request size |
| 11275 | */ |
| 11276 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11277 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11278 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 11279 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11280 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11281 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 11282 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11283 | } |
| 11284 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11285 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 11286 | buf_ptr; |
| 11287 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11288 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 11289 | WMITLV_GET_STRUCT_TLVLEN |
| 11290 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 11291 | |
| 11292 | /* Multiple requests are sent until the num_entries_in_page |
| 11293 | * matches the total_entries |
| 11294 | */ |
| 11295 | cmd->request_id = photlist->requestId; |
| 11296 | cmd->vdev_id = photlist->sessionId; |
| 11297 | cmd->total_entries = numap; |
| 11298 | cmd->mode = 1; |
| 11299 | cmd->num_entries_in_page = min_entries; |
| 11300 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 11301 | cmd->first_entry_index = index; |
| 11302 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11303 | 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] | 11304 | __func__, cmd->vdev_id, cmd->total_entries, |
| 11305 | cmd->num_entries_in_page, |
| 11306 | cmd->lost_ap_scan_count); |
| 11307 | |
| 11308 | buf_ptr += sizeof(*cmd); |
| 11309 | WMITLV_SET_HDR(buf_ptr, |
| 11310 | WMITLV_TAG_ARRAY_STRUC, |
| 11311 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 11312 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 11313 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11314 | |
| 11315 | /* Populate bssid, channel info and rssi |
| 11316 | * for the bssid's that are sent as hotlists. |
| 11317 | */ |
| 11318 | for (j = 0; j < min_entries; j++) { |
| 11319 | WMITLV_SET_HDR(dest_hotlist, |
| 11320 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 11321 | WMITLV_GET_STRUCT_TLVLEN |
| 11322 | (wmi_extscan_hotlist_entry)); |
| 11323 | |
| 11324 | dest_hotlist->min_rssi = src_ap->low; |
| 11325 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 11326 | &dest_hotlist->bssid); |
| 11327 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11328 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11329 | __func__, dest_hotlist->channel, |
| 11330 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11331 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11332 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 11333 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 11334 | dest_hotlist->bssid.mac_addr47to32); |
| 11335 | dest_hotlist++; |
| 11336 | src_ap++; |
| 11337 | } |
| 11338 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 11339 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 11340 | |
| 11341 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11342 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11343 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11344 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11345 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11346 | } |
| 11347 | index = index + min_entries; |
| 11348 | num_entries = numap - min_entries; |
| 11349 | len = cmd_len; |
| 11350 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11351 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11352 | } |
| 11353 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 11354 | /** |
| 11355 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 11356 | * @wmi_handle: wmi handle |
| 11357 | * @param: wmi power debug parameter |
| 11358 | * |
| 11359 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 11360 | * |
| 11361 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 11362 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 11363 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 11364 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 11365 | { |
| 11366 | wmi_buf_t buf = NULL; |
| 11367 | QDF_STATUS status; |
| 11368 | int len, args_tlv_len; |
| 11369 | uint8_t *buf_ptr; |
| 11370 | uint8_t i; |
| 11371 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 11372 | uint32_t *cmd_args; |
| 11373 | |
| 11374 | /* Prepare and send power debug cmd parameters */ |
| 11375 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 11376 | len = sizeof(*cmd) + args_tlv_len; |
| 11377 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11378 | if (!buf) { |
| 11379 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11380 | return QDF_STATUS_E_NOMEM; |
| 11381 | } |
| 11382 | |
| 11383 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11384 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 11385 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11386 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 11387 | WMITLV_GET_STRUCT_TLVLEN |
| 11388 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 11389 | |
| 11390 | cmd->pdev_id = param->pdev_id; |
| 11391 | cmd->module_id = param->module_id; |
| 11392 | cmd->num_args = param->num_args; |
| 11393 | buf_ptr += sizeof(*cmd); |
| 11394 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11395 | (param->num_args * sizeof(uint32_t))); |
| 11396 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11397 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 11398 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 11399 | cmd_args[i] = param->args[i]; |
| 11400 | WMI_LOGI("%d,", param->args[i]); |
| 11401 | } |
| 11402 | |
| 11403 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11404 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 11405 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11406 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 11407 | status); |
| 11408 | goto error; |
| 11409 | } |
| 11410 | |
| 11411 | return QDF_STATUS_SUCCESS; |
| 11412 | error: |
| 11413 | wmi_buf_free(buf); |
| 11414 | |
| 11415 | return status; |
| 11416 | } |
| 11417 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11418 | /** |
| 11419 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 11420 | * @wmi_handle: wmi handle |
| 11421 | * @param tgt_res_cfg: pointer to target resource configuration |
| 11422 | * @param num_mem_chunks: Number of memory chunks |
| 11423 | * @param mem_chunks: pointer to target memory chunks |
| 11424 | * |
| 11425 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11426 | */ |
| 11427 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
| 11428 | target_resource_config *tgt_res_cfg, uint8_t num_mem_chunks, |
| 11429 | struct wmi_host_mem_chunk *mem_chunks) |
| 11430 | { |
| 11431 | wmi_buf_t buf; |
| 11432 | wmi_init_cmd_fixed_param *cmd; |
| 11433 | wmi_abi_version my_vers; |
| 11434 | int num_whitelist; |
| 11435 | uint8_t *buf_ptr; |
| 11436 | wmi_resource_config *resource_cfg; |
| 11437 | wlan_host_memory_chunk *host_mem_chunks; |
| 11438 | uint32_t mem_chunk_len = 0; |
| 11439 | uint16_t idx; |
| 11440 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11441 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11442 | |
| 11443 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 11444 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 11445 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 11446 | if (!buf) { |
| 11447 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11448 | return QDF_STATUS_E_FAILURE; |
| 11449 | } |
| 11450 | |
| 11451 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11452 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 11453 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 11454 | |
| 11455 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 11456 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 11457 | + WMI_TLV_HDR_SIZE); |
| 11458 | |
| 11459 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11460 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 11461 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 11462 | |
| 11463 | wmi_copy_resource_config(resource_cfg, tgt_res_cfg); |
| 11464 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 11465 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 11466 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 11467 | |
| 11468 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 11469 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 11470 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 11471 | WMITLV_GET_STRUCT_TLVLEN |
| 11472 | (wlan_host_memory_chunk)); |
| 11473 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 11474 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 11475 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
| 11476 | qdf_print("chunk %d len %d requested ,ptr 0x%x ", |
| 11477 | idx, host_mem_chunks[idx].size, |
| 11478 | host_mem_chunks[idx].ptr); |
| 11479 | } |
| 11480 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 11481 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 11482 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 11483 | WMITLV_TAG_ARRAY_STRUC, |
| 11484 | (sizeof(wlan_host_memory_chunk) * |
| 11485 | num_mem_chunks)); |
| 11486 | |
| 11487 | num_whitelist = sizeof(version_whitelist) / |
| 11488 | sizeof(wmi_whitelist_version_info); |
| 11489 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 11490 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 11491 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 11492 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 11493 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 11494 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 11495 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11496 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11497 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 11498 | &my_vers, |
| 11499 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 11500 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11501 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11502 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 11503 | __func__, |
| 11504 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 11505 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 11506 | cmd->host_abi_vers.abi_version_ns_0, |
| 11507 | cmd->host_abi_vers.abi_version_ns_1, |
| 11508 | cmd->host_abi_vers.abi_version_ns_2, |
| 11509 | cmd->host_abi_vers.abi_version_ns_3); |
| 11510 | |
| 11511 | /* Save version sent from host - |
| 11512 | * Will be used to check ready event |
| 11513 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11514 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11515 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 11516 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11517 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11518 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 11519 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 11520 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 11521 | ret); |
| 11522 | wmi_buf_free(buf); |
| 11523 | } |
| 11524 | return ret; |
| 11525 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11526 | } |
| 11527 | |
| 11528 | /** |
| 11529 | * save_service_bitmap_tlv() - save service bitmap |
| 11530 | * @wmi_handle: wmi handle |
| 11531 | * @param evt_buf: pointer to event buffer |
| 11532 | * |
| 11533 | * Return: None |
| 11534 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 11535 | #ifndef CONFIG_MCL |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 11536 | static |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11537 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11538 | { |
| 11539 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11540 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11541 | |
| 11542 | qdf_mem_copy(wmi_handle->wmi_service_bitmap, |
| 11543 | param_buf->wmi_service_bitmap, |
| 11544 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
| 11545 | } |
| 11546 | #else |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame^] | 11547 | static |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11548 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11549 | { |
| 11550 | return; |
| 11551 | } |
| 11552 | |
| 11553 | #endif |
| 11554 | |
| 11555 | /** |
| 11556 | * is_service_enabled_tlv() - Check if service enabled |
| 11557 | * @param wmi_handle: wmi handle |
| 11558 | * @param service_id: service identifier |
| 11559 | * |
| 11560 | * Return: 1 enabled, 0 disabled |
| 11561 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 11562 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11563 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 11564 | uint32_t service_id) |
| 11565 | { |
| 11566 | return WMI_SERVICE_IS_ENABLED(wmi_handle->wmi_service_bitmap, |
| 11567 | service_id); |
| 11568 | } |
| 11569 | #else |
| 11570 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 11571 | uint32_t service_id) |
| 11572 | { |
| 11573 | return false; |
| 11574 | } |
| 11575 | #endif |
| 11576 | |
| 11577 | /** |
| 11578 | * extract_service_ready_tlv() - extract service ready event |
| 11579 | * @wmi_handle: wmi handle |
| 11580 | * @param evt_buf: pointer to received event buffer |
| 11581 | * @param cap: pointer to hold target capability information extracted from even |
| 11582 | * |
| 11583 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11584 | */ |
| 11585 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
| 11586 | void *evt_buf, target_capability_info *cap) |
| 11587 | { |
| 11588 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11589 | wmi_service_ready_event_fixed_param *ev; |
| 11590 | |
| 11591 | |
| 11592 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11593 | |
| 11594 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11595 | if (!ev) { |
| 11596 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11597 | return QDF_STATUS_E_FAILURE; |
| 11598 | } |
| 11599 | |
| 11600 | cap->phy_capability = ev->phy_capability; |
| 11601 | cap->max_frag_entry = ev->max_frag_entry; |
| 11602 | cap->num_rf_chains = ev->num_rf_chains; |
| 11603 | cap->ht_cap_info = ev->ht_cap_info; |
| 11604 | cap->vht_cap_info = ev->vht_cap_info; |
| 11605 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 11606 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 11607 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 11608 | cap->sys_cap_info = ev->sys_cap_info; |
| 11609 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 11610 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 11611 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 11612 | cap->max_supported_macs = ev->max_supported_macs; |
| 11613 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 11614 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 11615 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 11616 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 11617 | |
| 11618 | return QDF_STATUS_SUCCESS; |
| 11619 | } |
| 11620 | |
| 11621 | /** |
| 11622 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 11623 | * @wmi_handle: wmi handle |
| 11624 | * @param evt_buf: Pointer to event buffer |
| 11625 | * @param cap: pointer to hold HAL reg capabilities |
| 11626 | * |
| 11627 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11628 | */ |
| 11629 | static QDF_STATUS extract_hal_reg_cap_tlv(wmi_unified_t wmi_handle, |
| 11630 | void *evt_buf, TARGET_HAL_REG_CAPABILITIES *cap) |
| 11631 | { |
| 11632 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11633 | |
| 11634 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11635 | |
| 11636 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 11637 | sizeof(uint32_t)), |
| 11638 | sizeof(TARGET_HAL_REG_CAPABILITIES)); |
| 11639 | |
| 11640 | return QDF_STATUS_SUCCESS; |
| 11641 | } |
| 11642 | |
| 11643 | /** |
| 11644 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 11645 | * @wmi_handle: wmi handle |
| 11646 | * @param evt_buf: pointer to event buffer |
| 11647 | * @param num_entries: pointer to hold number of entries requested |
| 11648 | * |
| 11649 | * Return: Number of entries requested |
| 11650 | */ |
| 11651 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 11652 | void *evt_buf, uint8_t *num_entries) |
| 11653 | { |
| 11654 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11655 | wmi_service_ready_event_fixed_param *ev; |
| 11656 | |
| 11657 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11658 | |
| 11659 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11660 | if (!ev) { |
| 11661 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11662 | return NULL; |
| 11663 | } |
| 11664 | |
| 11665 | *num_entries = ev->num_mem_reqs; |
| 11666 | |
| 11667 | return (host_mem_req *)param_buf->mem_reqs; |
| 11668 | } |
| 11669 | |
| 11670 | /** |
| 11671 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 11672 | * ready function |
| 11673 | * @wmi_handle: wmi handle |
| 11674 | * @param evt_buf: pointer to event buffer |
| 11675 | * |
| 11676 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11677 | */ |
| 11678 | static QDF_STATUS |
| 11679 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11680 | { |
| 11681 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11682 | wmi_service_ready_event_fixed_param *ev; |
| 11683 | |
| 11684 | |
| 11685 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11686 | |
| 11687 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11688 | if (!ev) { |
| 11689 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11690 | return QDF_STATUS_E_FAILURE; |
| 11691 | } |
| 11692 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11693 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11694 | /*Save fw version from service ready message */ |
| 11695 | /*This will be used while sending INIT message */ |
| 11696 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 11697 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11698 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11699 | return QDF_STATUS_SUCCESS; |
| 11700 | } |
| 11701 | |
| 11702 | /** |
| 11703 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 11704 | * @wmi_handle: wmi handle |
| 11705 | * @param evt_buf: Pointer to event buffer |
| 11706 | * |
| 11707 | * Return: ready status |
| 11708 | */ |
| 11709 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 11710 | void *evt_buf) |
| 11711 | { |
| 11712 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 11713 | wmi_ready_event_fixed_param *ev = NULL; |
| 11714 | |
| 11715 | |
| 11716 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 11717 | ev = param_buf->fixed_param; |
| 11718 | |
| 11719 | qdf_print("%s:%d\n", __func__, ev->status); |
| 11720 | |
| 11721 | return ev->status; |
| 11722 | } |
| 11723 | |
| 11724 | /** |
| 11725 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 11726 | * @wmi_handle: wmi handle |
| 11727 | * @param evt_buf: pointer to event buffer |
| 11728 | * @param macaddr: Pointer to hold MAC address |
| 11729 | * |
| 11730 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11731 | */ |
| 11732 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 11733 | void *evt_buf, uint8_t *macaddr) |
| 11734 | { |
| 11735 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 11736 | wmi_ready_event_fixed_param *ev = NULL; |
| 11737 | |
| 11738 | |
| 11739 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 11740 | ev = param_buf->fixed_param; |
| 11741 | |
| 11742 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 11743 | |
| 11744 | return QDF_STATUS_SUCCESS; |
| 11745 | } |
| 11746 | |
| 11747 | /** |
| 11748 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 11749 | * @wmi_handle: wmi handle |
| 11750 | * @param evt_buf: pointer to event buffer |
| 11751 | * |
| 11752 | * Return: length |
| 11753 | */ |
| 11754 | static uint8_t *extract_dbglog_data_len_tlv(wmi_unified_t wmi_handle, |
| 11755 | void *evt_buf, uint16_t *len) |
| 11756 | { |
| 11757 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 11758 | |
| 11759 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 11760 | |
| 11761 | *len = param_buf->num_bufp; |
| 11762 | |
| 11763 | return param_buf->bufp; |
| 11764 | } |
| 11765 | |
| 11766 | /** |
| 11767 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 11768 | * @wmi_handle: wmi handle |
| 11769 | * @param evt_buf: pointer to event buffer |
| 11770 | * @param vdev_rsp: Pointer to hold vdev response |
| 11771 | * |
| 11772 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11773 | */ |
| 11774 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 11775 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 11776 | { |
| 11777 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 11778 | wmi_vdev_start_response_event_fixed_param *ev; |
| 11779 | |
| 11780 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 11781 | if (!param_buf) { |
| 11782 | qdf_print("Invalid start response event buffer\n"); |
| 11783 | return QDF_STATUS_E_INVAL; |
| 11784 | } |
| 11785 | |
| 11786 | ev = param_buf->fixed_param; |
| 11787 | if (!ev) { |
| 11788 | qdf_print("Invalid start response event buffer\n"); |
| 11789 | return QDF_STATUS_E_INVAL; |
| 11790 | } |
| 11791 | |
| 11792 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 11793 | |
| 11794 | vdev_rsp->vdev_id = ev->vdev_id; |
| 11795 | vdev_rsp->requestor_id = ev->requestor_id; |
| 11796 | vdev_rsp->resp_type = ev->resp_type; |
| 11797 | vdev_rsp->status = ev->status; |
| 11798 | vdev_rsp->chain_mask = ev->chain_mask; |
| 11799 | vdev_rsp->smps_mode = ev->smps_mode; |
| 11800 | vdev_rsp->mac_id = ev->mac_id; |
| 11801 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 11802 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 11803 | |
| 11804 | return QDF_STATUS_SUCCESS; |
| 11805 | } |
| 11806 | |
| 11807 | /** |
| 11808 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset update param |
| 11809 | * @wmi_handle: wmi handle |
| 11810 | * @param evt_buf: pointer to event buffer |
| 11811 | * @param vdev_map: Pointer to hold vdev map |
| 11812 | * @param tbttoffset_list: Pointer to tbtt offset list |
| 11813 | * |
| 11814 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11815 | */ |
| 11816 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 11817 | void *evt_buf, uint32_t *vdev_map, uint32_t **tbttoffset_list) |
| 11818 | { |
| 11819 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 11820 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 11821 | |
| 11822 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 11823 | if (!param_buf) { |
| 11824 | qdf_print("Invalid tbtt update event buffer\n"); |
| 11825 | return QDF_STATUS_E_INVAL; |
| 11826 | } |
| 11827 | tbtt_offset_event = param_buf->fixed_param; |
| 11828 | |
| 11829 | *vdev_map = tbtt_offset_event->vdev_map; |
| 11830 | *tbttoffset_list = param_buf->tbttoffset_list; |
| 11831 | |
| 11832 | return QDF_STATUS_SUCCESS; |
| 11833 | } |
| 11834 | |
| 11835 | /** |
| 11836 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 11837 | * @wmi_handle: wmi handle |
| 11838 | * @param evt_buf: pointer to event buffer |
| 11839 | * @param hdr: Pointer to hold header |
| 11840 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 11841 | * |
| 11842 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11843 | */ |
| 11844 | static QDF_STATUS extract_mgmt_rx_params_tlv(wmi_unified_t wmi_handle, |
| 11845 | void *evt_buf, wmi_host_mgmt_rx_hdr *hdr, uint8_t **bufp) |
| 11846 | { |
| 11847 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 11848 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 11849 | |
| 11850 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 11851 | if (!param_tlvs) { |
| 11852 | WMI_LOGE("Get NULL point message from FW"); |
| 11853 | return QDF_STATUS_E_INVAL; |
| 11854 | } |
| 11855 | |
| 11856 | ev_hdr = param_tlvs->hdr; |
| 11857 | if (!hdr) { |
| 11858 | WMI_LOGE("Rx event is NULL"); |
| 11859 | return QDF_STATUS_E_INVAL; |
| 11860 | } |
| 11861 | |
| 11862 | |
| 11863 | hdr->channel = ev_hdr->channel; |
| 11864 | hdr->snr = ev_hdr->snr; |
| 11865 | hdr->rate = ev_hdr->rate; |
| 11866 | hdr->phy_mode = ev_hdr->phy_mode; |
| 11867 | hdr->buf_len = ev_hdr->buf_len; |
| 11868 | hdr->status = ev_hdr->status; |
| 11869 | hdr->flags = ev_hdr->flags; |
| 11870 | hdr->rssi = ev_hdr->rssi; |
| 11871 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 11872 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 11873 | |
| 11874 | *bufp = param_tlvs->bufp; |
| 11875 | |
| 11876 | return QDF_STATUS_SUCCESS; |
| 11877 | } |
| 11878 | |
| 11879 | /** |
| 11880 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 11881 | * @wmi_handle: wmi handle |
| 11882 | * @param evt_buf: pointer to event buffer |
| 11883 | * @param vdev_id: Pointer to hold vdev identifier |
| 11884 | * |
| 11885 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11886 | */ |
| 11887 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 11888 | void *evt_buf, uint32_t *vdev_id) |
| 11889 | { |
| 11890 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 11891 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 11892 | |
| 11893 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 11894 | if (!param_buf) { |
| 11895 | WMI_LOGE("Invalid event buffer"); |
| 11896 | return QDF_STATUS_E_INVAL; |
| 11897 | } |
| 11898 | resp_event = param_buf->fixed_param; |
| 11899 | *vdev_id = resp_event->vdev_id; |
| 11900 | |
| 11901 | return QDF_STATUS_SUCCESS; |
| 11902 | } |
| 11903 | |
| 11904 | /** |
| 11905 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 11906 | * @wmi_handle: wmi handle |
| 11907 | * @param evt_buf: pointer to event buffer |
| 11908 | * @param param: Pointer to hold roam param |
| 11909 | * |
| 11910 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11911 | */ |
| 11912 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 11913 | void *evt_buf, wmi_host_roam_event *param) |
| 11914 | { |
| 11915 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 11916 | wmi_roam_event_fixed_param *evt; |
| 11917 | |
| 11918 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 11919 | if (!param_buf) { |
| 11920 | WMI_LOGE("Invalid roam event buffer"); |
| 11921 | return QDF_STATUS_E_INVAL; |
| 11922 | } |
| 11923 | |
| 11924 | evt = param_buf->fixed_param; |
| 11925 | qdf_mem_zero(param, sizeof(*param)); |
| 11926 | |
| 11927 | param->vdev_id = evt->vdev_id; |
| 11928 | param->reason = evt->reason; |
| 11929 | param->rssi = evt->rssi; |
| 11930 | |
| 11931 | return QDF_STATUS_SUCCESS; |
| 11932 | } |
| 11933 | |
| 11934 | /** |
| 11935 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 11936 | * @wmi_handle: wmi handle |
| 11937 | * @param evt_buf: pointer to event buffer |
| 11938 | * @param param: Pointer to hold vdev scan param |
| 11939 | * |
| 11940 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11941 | */ |
| 11942 | static QDF_STATUS extract_vdev_scan_ev_param_tlv(wmi_unified_t wmi_handle, |
| 11943 | void *evt_buf, wmi_host_scan_event *param) |
| 11944 | { |
| 11945 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 11946 | wmi_scan_event_fixed_param *evt = NULL; |
| 11947 | |
| 11948 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 11949 | evt = param_buf->fixed_param; |
| 11950 | |
| 11951 | qdf_mem_zero(param, sizeof(*param)); |
| 11952 | switch (evt->event) { |
| 11953 | case WMI_SCAN_EVENT_STARTED: |
| 11954 | param->event = WMI_HOST_SCAN_EVENT_STARTED; |
| 11955 | break; |
| 11956 | case WMI_SCAN_EVENT_COMPLETED: |
| 11957 | param->event = WMI_HOST_SCAN_EVENT_COMPLETED; |
| 11958 | break; |
| 11959 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
| 11960 | param->event = WMI_HOST_SCAN_EVENT_BSS_CHANNEL; |
| 11961 | break; |
| 11962 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
| 11963 | param->event = WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL; |
| 11964 | break; |
| 11965 | case WMI_SCAN_EVENT_DEQUEUED: |
| 11966 | param->event = WMI_HOST_SCAN_EVENT_DEQUEUED; |
| 11967 | break; |
| 11968 | case WMI_SCAN_EVENT_PREEMPTED: |
| 11969 | param->event = WMI_HOST_SCAN_EVENT_PREEMPTED; |
| 11970 | break; |
| 11971 | case WMI_SCAN_EVENT_START_FAILED: |
| 11972 | param->event = WMI_HOST_SCAN_EVENT_START_FAILED; |
| 11973 | break; |
| 11974 | case WMI_SCAN_EVENT_RESTARTED: |
| 11975 | param->event = WMI_HOST_SCAN_EVENT_RESTARTED; |
| 11976 | break; |
| 11977 | case WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
| 11978 | param->event = WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 11979 | break; |
| 11980 | case WMI_SCAN_EVENT_MAX: |
| 11981 | default: |
| 11982 | param->event = WMI_HOST_SCAN_EVENT_MAX; |
| 11983 | break; |
| 11984 | }; |
| 11985 | |
| 11986 | switch (evt->reason) { |
| 11987 | case WMI_SCAN_REASON_NONE: |
| 11988 | param->reason = WMI_HOST_SCAN_REASON_NONE; |
| 11989 | break; |
| 11990 | case WMI_SCAN_REASON_COMPLETED: |
| 11991 | param->reason = WMI_HOST_SCAN_REASON_COMPLETED; |
| 11992 | break; |
| 11993 | case WMI_SCAN_REASON_CANCELLED: |
| 11994 | param->reason = WMI_HOST_SCAN_REASON_CANCELLED; |
| 11995 | break; |
| 11996 | case WMI_SCAN_REASON_PREEMPTED: |
| 11997 | param->reason = WMI_HOST_SCAN_REASON_PREEMPTED; |
| 11998 | break; |
| 11999 | case WMI_SCAN_REASON_TIMEDOUT: |
| 12000 | param->reason = WMI_HOST_SCAN_REASON_TIMEDOUT; |
| 12001 | break; |
| 12002 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
| 12003 | param->reason = WMI_HOST_SCAN_REASON_INTERNAL_FAILURE; |
| 12004 | break; |
| 12005 | case WMI_SCAN_REASON_MAX: |
| 12006 | default: |
| 12007 | param->reason = WMI_HOST_SCAN_REASON_MAX; |
| 12008 | break; |
| 12009 | }; |
| 12010 | |
| 12011 | param->channel_freq = evt->channel_freq; |
| 12012 | param->requestor = evt->requestor; |
| 12013 | param->scan_id = evt->scan_id; |
| 12014 | param->vdev_id = evt->vdev_id; |
| 12015 | |
| 12016 | return QDF_STATUS_SUCCESS; |
| 12017 | } |
| 12018 | |
| 12019 | /** |
| 12020 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 12021 | * @wmi_handle: wmi handle |
| 12022 | * @param evt_buf: pointer to event buffer |
| 12023 | * @param param: Pointer to hold MGMT TX completion params |
| 12024 | * |
| 12025 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12026 | */ |
| 12027 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 12028 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 12029 | { |
| 12030 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 12031 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 12032 | |
| 12033 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 12034 | evt_buf; |
| 12035 | if (!param_buf) { |
| 12036 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 12037 | return QDF_STATUS_E_INVAL; |
| 12038 | } |
| 12039 | cmpl_params = param_buf->fixed_param; |
| 12040 | |
| 12041 | param->desc_id = cmpl_params->desc_id; |
| 12042 | param->status = cmpl_params->status; |
| 12043 | |
| 12044 | return QDF_STATUS_SUCCESS; |
| 12045 | } |
| 12046 | |
| 12047 | /** |
| 12048 | * extract_swba_vdev_map_tlv() - extract swba vdev map from event |
| 12049 | * @wmi_handle: wmi handle |
| 12050 | * @param evt_buf: pointer to event buffer |
| 12051 | * @param vdev_map: Pointer to hold vdev map |
| 12052 | * |
| 12053 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12054 | */ |
| 12055 | static QDF_STATUS extract_swba_vdev_map_tlv(wmi_unified_t wmi_handle, |
| 12056 | void *evt_buf, uint32_t *vdev_map) |
| 12057 | { |
| 12058 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12059 | wmi_host_swba_event_fixed_param *swba_event; |
| 12060 | |
| 12061 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12062 | if (!param_buf) { |
| 12063 | WMI_LOGE("Invalid swba event buffer"); |
| 12064 | return QDF_STATUS_E_INVAL; |
| 12065 | } |
| 12066 | swba_event = param_buf->fixed_param; |
| 12067 | *vdev_map = swba_event->vdev_map; |
| 12068 | |
| 12069 | return QDF_STATUS_SUCCESS; |
| 12070 | } |
| 12071 | |
| 12072 | /** |
| 12073 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 12074 | * @wmi_handle: wmi handle |
| 12075 | * @param evt_buf: pointer to event buffer |
| 12076 | * @param idx: Index to bcn info |
| 12077 | * @param tim_info: Pointer to hold tim info |
| 12078 | * |
| 12079 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12080 | */ |
| 12081 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 12082 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 12083 | { |
| 12084 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12085 | wmi_tim_info *tim_info_ev; |
| 12086 | |
| 12087 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12088 | if (!param_buf) { |
| 12089 | WMI_LOGE("Invalid swba event buffer"); |
| 12090 | return QDF_STATUS_E_INVAL; |
| 12091 | } |
| 12092 | |
| 12093 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 12094 | |
| 12095 | tim_info->tim_len = tim_info_ev->tim_len; |
| 12096 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 12097 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 12098 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 12099 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 12100 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
| 12101 | |
| 12102 | return QDF_STATUS_SUCCESS; |
| 12103 | } |
| 12104 | |
| 12105 | /** |
| 12106 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 12107 | * @wmi_handle: wmi handle |
| 12108 | * @param evt_buf: pointer to event buffer |
| 12109 | * @param idx: Index to bcn info |
| 12110 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 12111 | * |
| 12112 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12113 | */ |
| 12114 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 12115 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 12116 | { |
| 12117 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12118 | wmi_p2p_noa_info *p2p_noa_info; |
| 12119 | uint8_t i = 0; |
| 12120 | |
| 12121 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12122 | if (!param_buf) { |
| 12123 | WMI_LOGE("Invalid swba event buffer"); |
| 12124 | return QDF_STATUS_E_INVAL; |
| 12125 | } |
| 12126 | |
| 12127 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 12128 | |
| 12129 | p2p_desc->modified = false; |
| 12130 | p2p_desc->num_descriptors = 0; |
| 12131 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 12132 | p2p_desc->modified = true; |
| 12133 | p2p_desc->index = |
| 12134 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 12135 | p2p_desc->oppPS = |
| 12136 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 12137 | p2p_desc->ctwindow = |
| 12138 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 12139 | p2p_desc->num_descriptors = |
| 12140 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 12141 | (p2p_noa_info); |
| 12142 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 12143 | p2p_desc->noa_descriptors[i].type_count = |
| 12144 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 12145 | type_count; |
| 12146 | p2p_desc->noa_descriptors[i].duration = |
| 12147 | p2p_noa_info->noa_descriptors[i].duration; |
| 12148 | p2p_desc->noa_descriptors[i].interval = |
| 12149 | p2p_noa_info->noa_descriptors[i].interval; |
| 12150 | p2p_desc->noa_descriptors[i].start_time = |
| 12151 | p2p_noa_info->noa_descriptors[i].start_time; |
| 12152 | } |
| 12153 | } |
| 12154 | |
| 12155 | return QDF_STATUS_SUCCESS; |
| 12156 | } |
| 12157 | |
| 12158 | /** |
| 12159 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 12160 | * @wmi_handle: wmi handle |
| 12161 | * @param evt_buf: pointer to event buffer |
| 12162 | * @param ev: Pointer to hold peer param |
| 12163 | * |
| 12164 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12165 | */ |
| 12166 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 12167 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 12168 | { |
| 12169 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 12170 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 12171 | |
| 12172 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 12173 | kickout_event = param_buf->fixed_param; |
| 12174 | |
| 12175 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 12176 | ev->peer_macaddr); |
| 12177 | |
| 12178 | ev->reason = kickout_event->reason; |
| 12179 | ev->rssi = kickout_event->rssi; |
| 12180 | |
| 12181 | return QDF_STATUS_SUCCESS; |
| 12182 | } |
| 12183 | |
| 12184 | /** |
| 12185 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 12186 | * @wmi_handle: wmi handle |
| 12187 | * @param evt_buf: pointer to event buffer |
| 12188 | * @param stats_param: Pointer to hold stats count |
| 12189 | * |
| 12190 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12191 | */ |
| 12192 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 12193 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 12194 | { |
| 12195 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12196 | wmi_stats_event_fixed_param *ev; |
| 12197 | |
| 12198 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12199 | |
| 12200 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12201 | if (!ev) { |
| 12202 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 12203 | return QDF_STATUS_E_FAILURE; |
| 12204 | } |
| 12205 | |
| 12206 | switch (ev->stats_id) { |
| 12207 | case WMI_REQUEST_PEER_STAT: |
| 12208 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 12209 | break; |
| 12210 | |
| 12211 | case WMI_REQUEST_AP_STAT: |
| 12212 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 12213 | break; |
| 12214 | |
| 12215 | case WMI_REQUEST_PDEV_STAT: |
| 12216 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 12217 | break; |
| 12218 | |
| 12219 | case WMI_REQUEST_VDEV_STAT: |
| 12220 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 12221 | break; |
| 12222 | |
| 12223 | case WMI_REQUEST_BCNFLT_STAT: |
| 12224 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 12225 | break; |
| 12226 | |
| 12227 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 12228 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 12229 | break; |
| 12230 | |
| 12231 | default: |
| 12232 | stats_param->stats_id = 0; |
| 12233 | break; |
| 12234 | |
| 12235 | } |
| 12236 | |
| 12237 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 12238 | stats_param->num_pdev_ext_stats = 0; |
| 12239 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 12240 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 12241 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 12242 | stats_param->num_chan_stats = ev->num_chan_stats; |
| 12243 | |
| 12244 | return QDF_STATUS_SUCCESS; |
| 12245 | } |
| 12246 | |
| 12247 | /** |
| 12248 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 12249 | * @wmi_handle: wmi handle |
| 12250 | * @param evt_buf: pointer to event buffer |
| 12251 | * @param index: Index into pdev stats |
| 12252 | * @param pdev_stats: Pointer to hold pdev stats |
| 12253 | * |
| 12254 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12255 | */ |
| 12256 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 12257 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 12258 | { |
| 12259 | return QDF_STATUS_SUCCESS; |
| 12260 | } |
| 12261 | |
| 12262 | /** |
| 12263 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 12264 | * @wmi_handle: wmi handle |
| 12265 | * @param evt_buf: pointer to event buffer |
| 12266 | * @param index: Index into extended pdev stats |
| 12267 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 12268 | * |
| 12269 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12270 | */ |
| 12271 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 12272 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 12273 | { |
| 12274 | return QDF_STATUS_SUCCESS; |
| 12275 | } |
| 12276 | |
| 12277 | /** |
| 12278 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 12279 | * @wmi_handle: wmi handle |
| 12280 | * @param evt_buf: pointer to event buffer |
| 12281 | * @param index: Index into vdev stats |
| 12282 | * @param vdev_stats: Pointer to hold vdev stats |
| 12283 | * |
| 12284 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12285 | */ |
| 12286 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 12287 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 12288 | { |
| 12289 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12290 | wmi_stats_event_fixed_param *ev_param; |
| 12291 | uint8_t *data; |
| 12292 | |
| 12293 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12294 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12295 | data = (uint8_t *) param_buf->data; |
| 12296 | |
| 12297 | if (index < ev_param->num_vdev_stats) { |
| 12298 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 12299 | ((ev_param->num_pdev_stats) * |
| 12300 | sizeof(wmi_pdev_stats)) + |
| 12301 | (index * sizeof(wmi_vdev_stats))); |
| 12302 | |
| 12303 | vdev_stats->vdev_id = ev->vdev_id; |
| 12304 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 12305 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 12306 | |
| 12307 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 12308 | sizeof(ev->tx_frm_cnt)); |
| 12309 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 12310 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 12311 | ev->multiple_retry_cnt, |
| 12312 | sizeof(ev->multiple_retry_cnt)); |
| 12313 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 12314 | sizeof(ev->fail_cnt)); |
| 12315 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 12316 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 12317 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 12318 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 12319 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 12320 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 12321 | sizeof(ev->tx_rate_history)); |
| 12322 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 12323 | sizeof(ev->bcn_rssi_history)); |
| 12324 | |
| 12325 | } |
| 12326 | |
| 12327 | return QDF_STATUS_SUCCESS; |
| 12328 | } |
| 12329 | |
| 12330 | /** |
| 12331 | * extract_peer_stats_tlv() - extract peer stats from event |
| 12332 | * @wmi_handle: wmi handle |
| 12333 | * @param evt_buf: pointer to event buffer |
| 12334 | * @param index: Index into peer stats |
| 12335 | * @param peer_stats: Pointer to hold peer stats |
| 12336 | * |
| 12337 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12338 | */ |
| 12339 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 12340 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 12341 | { |
| 12342 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12343 | wmi_stats_event_fixed_param *ev_param; |
| 12344 | uint8_t *data; |
| 12345 | |
| 12346 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12347 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12348 | data = (uint8_t *) param_buf->data; |
| 12349 | |
| 12350 | if (index < ev_param->num_peer_stats) { |
| 12351 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 12352 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 12353 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 12354 | (index * sizeof(wmi_peer_stats))); |
| 12355 | |
| 12356 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 12357 | |
| 12358 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 12359 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 12360 | |
| 12361 | peer_stats->peer_rssi = ev->peer_rssi; |
| 12362 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 12363 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 12364 | } |
| 12365 | |
| 12366 | return QDF_STATUS_SUCCESS; |
| 12367 | } |
| 12368 | |
| 12369 | /** |
| 12370 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 12371 | * @wmi_handle: wmi handle |
| 12372 | * @param evt_buf: pointer to event buffer |
| 12373 | * @param index: Index into bcn fault stats |
| 12374 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 12375 | * |
| 12376 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12377 | */ |
| 12378 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 12379 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 12380 | { |
| 12381 | return QDF_STATUS_SUCCESS; |
| 12382 | } |
| 12383 | |
| 12384 | /** |
| 12385 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 12386 | * @wmi_handle: wmi handle |
| 12387 | * @param evt_buf: pointer to event buffer |
| 12388 | * @param index: Index into extended peer stats |
| 12389 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 12390 | * |
| 12391 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12392 | */ |
| 12393 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 12394 | void *evt_buf, uint32_t index, |
| 12395 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 12396 | { |
| 12397 | return QDF_STATUS_SUCCESS; |
| 12398 | } |
| 12399 | |
| 12400 | /** |
| 12401 | * extract_chan_stats_tlv() - extract chan stats from event |
| 12402 | * @wmi_handle: wmi handle |
| 12403 | * @param evt_buf: pointer to event buffer |
| 12404 | * @param index: Index into chan stats |
| 12405 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 12406 | * |
| 12407 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12408 | */ |
| 12409 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 12410 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 12411 | { |
| 12412 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12413 | wmi_stats_event_fixed_param *ev_param; |
| 12414 | uint8_t *data; |
| 12415 | |
| 12416 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12417 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12418 | data = (uint8_t *) param_buf->data; |
| 12419 | |
| 12420 | if (index < ev_param->num_chan_stats) { |
| 12421 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 12422 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 12423 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 12424 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 12425 | (index * sizeof(wmi_chan_stats))); |
| 12426 | |
| 12427 | |
| 12428 | /* Non-TLV doesnt have num_chan_stats */ |
| 12429 | chan_stats->chan_mhz = ev->chan_mhz; |
| 12430 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 12431 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 12432 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 12433 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 12434 | } |
| 12435 | |
| 12436 | return QDF_STATUS_SUCCESS; |
| 12437 | } |
| 12438 | |
| 12439 | /** |
| 12440 | * extract_profile_ctx_tlv() - extract profile context from event |
| 12441 | * @wmi_handle: wmi handle |
| 12442 | * @param evt_buf: pointer to event buffer |
| 12443 | * @idx: profile stats index to extract |
| 12444 | * @param profile_ctx: Pointer to hold profile context |
| 12445 | * |
| 12446 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12447 | */ |
| 12448 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 12449 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 12450 | { |
| 12451 | return QDF_STATUS_SUCCESS; |
| 12452 | } |
| 12453 | |
| 12454 | /** |
| 12455 | * extract_profile_data_tlv() - extract profile data from event |
| 12456 | * @wmi_handle: wmi handle |
| 12457 | * @param evt_buf: pointer to event buffer |
| 12458 | * @param profile_data: Pointer to hold profile data |
| 12459 | * |
| 12460 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12461 | */ |
| 12462 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 12463 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 12464 | { |
| 12465 | |
| 12466 | return QDF_STATUS_SUCCESS; |
| 12467 | } |
| 12468 | |
| 12469 | /** |
| 12470 | * extract_chan_info_event_tlv() - extract chan information from event |
| 12471 | * @wmi_handle: wmi handle |
| 12472 | * @param evt_buf: pointer to event buffer |
| 12473 | * @param chan_info: Pointer to hold chan information |
| 12474 | * |
| 12475 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12476 | */ |
| 12477 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 12478 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 12479 | { |
| 12480 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 12481 | wmi_chan_info_event_fixed_param *ev; |
| 12482 | |
| 12483 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 12484 | |
| 12485 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 12486 | if (!ev) { |
| 12487 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 12488 | return QDF_STATUS_E_FAILURE; |
| 12489 | } |
| 12490 | |
| 12491 | chan_info->err_code = ev->err_code; |
| 12492 | chan_info->freq = ev->freq; |
| 12493 | chan_info->cmd_flags = ev->cmd_flags; |
| 12494 | chan_info->noise_floor = ev->noise_floor; |
| 12495 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 12496 | chan_info->cycle_count = ev->cycle_count; |
| 12497 | |
| 12498 | return QDF_STATUS_SUCCESS; |
| 12499 | } |
| 12500 | |
| 12501 | /** |
| 12502 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 12503 | * from event |
| 12504 | * @wmi_handle: wmi handle |
| 12505 | * @param evt_buf: pointer to event buffer |
| 12506 | * @param ch_hopping: Pointer to hold channel hopping param |
| 12507 | * |
| 12508 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12509 | */ |
| 12510 | static QDF_STATUS extract_channel_hopping_event_tlv(wmi_unified_t wmi_handle, |
| 12511 | void *evt_buf, wmi_host_pdev_channel_hopping_event *chan_info) |
| 12512 | { |
| 12513 | return QDF_STATUS_SUCCESS; |
| 12514 | } |
| 12515 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 12516 | /** |
| 12517 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 12518 | * from event |
| 12519 | * @wmi_handle: wmi handle |
| 12520 | * @param evt_buf: pointer to event buffer |
| 12521 | * @param param: Pointer to hold evt buf |
| 12522 | * |
| 12523 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12524 | */ |
| 12525 | static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle, |
| 12526 | uint8_t *event, struct wmi_host_service_ext_param *param) |
| 12527 | { |
| 12528 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12529 | wmi_service_ready_ext_event_fixed_param *ev; |
| 12530 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12531 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 12532 | |
| 12533 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12534 | if (!param_buf) |
| 12535 | return -EINVAL; |
| 12536 | |
| 12537 | ev = param_buf->fixed_param; |
| 12538 | if (!ev) |
| 12539 | return -EINVAL; |
| 12540 | |
| 12541 | /* Move this to host based bitmap */ |
| 12542 | param->default_conc_scan_config_bits = |
| 12543 | ev->default_conc_scan_config_bits; |
| 12544 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 12545 | param->he_cap_info = ev->he_cap_info; |
| 12546 | param->mpdu_density = ev->mpdu_density; |
| 12547 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 12548 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 12549 | |
| 12550 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12551 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 12552 | |
| 12553 | reg_caps = param_buf->soc_hal_reg_caps; |
| 12554 | param->num_phy = reg_caps->num_phy; |
| 12555 | |
| 12556 | return QDF_STATUS_SUCCESS; |
| 12557 | } |
| 12558 | |
| 12559 | /** |
| 12560 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 12561 | * extract HW mode cap from service ready event |
| 12562 | * @wmi_handle: wmi handle |
| 12563 | * @param evt_buf: pointer to event buffer |
| 12564 | * @param param: Pointer to hold evt buf |
| 12565 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 12566 | * |
| 12567 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12568 | */ |
| 12569 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 12570 | wmi_unified_t wmi_handle, |
| 12571 | uint8_t *event, uint8_t hw_mode_idx, |
| 12572 | struct wmi_host_hw_mode_caps *param) |
| 12573 | { |
| 12574 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12575 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12576 | |
| 12577 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12578 | if (!param_buf) |
| 12579 | return -EINVAL; |
| 12580 | |
| 12581 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12582 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
| 12583 | return -EINVAL; |
| 12584 | |
| 12585 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 12586 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 12587 | |
| 12588 | return QDF_STATUS_SUCCESS; |
| 12589 | } |
| 12590 | |
| 12591 | /** |
| 12592 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 12593 | * extract MAC phy cap from service ready event |
| 12594 | * @wmi_handle: wmi handle |
| 12595 | * @param evt_buf: pointer to event buffer |
| 12596 | * @param param: Pointer to hold evt buf |
| 12597 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 12598 | * |
| 12599 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12600 | */ |
| 12601 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 12602 | wmi_unified_t wmi_handle, |
| 12603 | uint8_t *event, uint8_t hw_mode_idx, |
| 12604 | struct wmi_host_mac_phy_caps *param) |
| 12605 | { |
| 12606 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12607 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12608 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
| 12609 | |
| 12610 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12611 | if (!param_buf) |
| 12612 | return -EINVAL; |
| 12613 | |
| 12614 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12615 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
| 12616 | return -EINVAL; |
| 12617 | |
| 12618 | mac_phy_caps = ¶m_buf->mac_phy_caps[hw_mode_idx]; |
| 12619 | |
| 12620 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
| 12621 | param->pdev_id = mac_phy_caps->pdev_id; |
| 12622 | param->phy_id = mac_phy_caps->phy_id; |
| 12623 | param->supports_11b = mac_phy_caps->supports_11b; |
| 12624 | param->supports_11g = mac_phy_caps->supports_11g; |
| 12625 | param->supports_11a = mac_phy_caps->supports_11a; |
| 12626 | param->supports_11n = mac_phy_caps->supports_11n; |
| 12627 | param->supports_11ac = mac_phy_caps->supports_11ac; |
| 12628 | param->supports_11ax = mac_phy_caps->supports_11ax; |
| 12629 | |
| 12630 | param->supported_bands = mac_phy_caps->supported_bands; |
| 12631 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 12632 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 12633 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 12634 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 12635 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 12636 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 12637 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 12638 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 12639 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 12640 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 12641 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 12642 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 12643 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 12644 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 12645 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 12646 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 12647 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
| 12648 | |
| 12649 | return QDF_STATUS_SUCCESS; |
| 12650 | } |
| 12651 | |
| 12652 | /** |
| 12653 | * extract_reg_cap_service_ready_ext_tlv() - |
| 12654 | * extract REG cap from service ready event |
| 12655 | * @wmi_handle: wmi handle |
| 12656 | * @param evt_buf: pointer to event buffer |
| 12657 | * @param param: Pointer to hold evt buf |
| 12658 | * @param phy_idx: phy idx should be less than num_mode |
| 12659 | * |
| 12660 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12661 | */ |
| 12662 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 12663 | wmi_unified_t wmi_handle, |
| 12664 | uint8_t *event, uint8_t phy_idx, |
| 12665 | struct WMI_HOST_HAL_REG_CAPABILITIES_EXT *param) |
| 12666 | { |
| 12667 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12668 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 12669 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 12670 | |
| 12671 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12672 | if (!param_buf) |
| 12673 | return -EINVAL; |
| 12674 | |
| 12675 | reg_caps = param_buf->soc_hal_reg_caps; |
| 12676 | if (phy_idx >= reg_caps->num_phy) |
| 12677 | return -EINVAL; |
| 12678 | |
| 12679 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 12680 | |
| 12681 | param->phy_id = ext_reg_cap->phy_id; |
| 12682 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 12683 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 12684 | param->regcap1 = ext_reg_cap->regcap1; |
| 12685 | param->regcap2 = ext_reg_cap->regcap2; |
| 12686 | param->wireless_modes = ext_reg_cap->wireless_modes; |
| 12687 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 12688 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 12689 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 12690 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 12691 | |
| 12692 | return QDF_STATUS_SUCCESS; |
| 12693 | } |
| 12694 | |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 12695 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12696 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 12697 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 12698 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12699 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12700 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12701 | return false; |
| 12702 | } |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 12703 | #endif |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12704 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12705 | struct wmi_ops tlv_ops = { |
| 12706 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 12707 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 12708 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 12709 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 12710 | .send_hidden_ssid_vdev_restart_cmd = |
| 12711 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12712 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 12713 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 12714 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12715 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12716 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12717 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 12718 | .send_peer_rx_reorder_queue_setup_cmd = |
| 12719 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 12720 | .send_peer_rx_reorder_queue_remove_cmd = |
| 12721 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12722 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 12723 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 12724 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 12725 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 12726 | .send_resume_cmd = send_resume_cmd_tlv, |
| 12727 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 12728 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 12729 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 12730 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 12731 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 12732 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 12733 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 12734 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
| 12735 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12736 | #ifndef CONFIG_MCL |
| 12737 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
| 12738 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12739 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 12740 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 12741 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 12742 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12743 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
| 12744 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 12745 | .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] | 12746 | .send_set_sta_uapsd_auto_trig_cmd = |
| 12747 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12748 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 12749 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 12750 | .send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv, |
| 12751 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 12752 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 12753 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 12754 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 12755 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 12756 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 12757 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 12758 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 12759 | .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] | 12760 | .send_ocb_start_timing_advert_cmd = |
| 12761 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 12762 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 12763 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 12764 | .send_set_mcc_channel_time_latency_cmd = |
| 12765 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 12766 | .send_set_mcc_channel_time_quota_cmd = |
| 12767 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 12768 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 12769 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 12770 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12771 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 12772 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 12773 | .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] | 12774 | .send_probe_rsp_tmpl_send_cmd = |
| 12775 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 12776 | .send_p2p_go_set_beacon_ie_cmd = |
| 12777 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 12778 | .send_setup_install_key_cmd = |
| 12779 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12780 | .send_set_gateway_params_cmd = |
| 12781 | send_set_gateway_params_cmd_tlv, |
| 12782 | .send_set_rssi_monitoring_cmd = |
| 12783 | send_set_rssi_monitoring_cmd_tlv, |
| 12784 | .send_scan_probe_setoui_cmd = |
| 12785 | send_scan_probe_setoui_cmd_tlv, |
| 12786 | .send_reset_passpoint_network_list_cmd = |
| 12787 | send_reset_passpoint_network_list_cmd_tlv, |
| 12788 | .send_set_passpoint_network_list_cmd = |
| 12789 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 12790 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 12791 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
| 12792 | .send_roam_scan_filter_cmd = |
| 12793 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12794 | .send_set_epno_network_list_cmd = |
| 12795 | send_set_epno_network_list_cmd_tlv, |
| 12796 | .send_ipa_offload_control_cmd = |
| 12797 | send_ipa_offload_control_cmd_tlv, |
| 12798 | .send_extscan_get_capabilities_cmd = |
| 12799 | send_extscan_get_capabilities_cmd_tlv, |
| 12800 | .send_extscan_get_cached_results_cmd = |
| 12801 | send_extscan_get_cached_results_cmd_tlv, |
| 12802 | .send_extscan_stop_change_monitor_cmd = |
| 12803 | send_extscan_stop_change_monitor_cmd_tlv, |
| 12804 | .send_extscan_start_change_monitor_cmd = |
| 12805 | send_extscan_start_change_monitor_cmd_tlv, |
| 12806 | .send_extscan_stop_hotlist_monitor_cmd = |
| 12807 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 12808 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 12809 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 12810 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 12811 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 12812 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12813 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12814 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12815 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12816 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 12817 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 12818 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 12819 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 12820 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12821 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 12822 | .send_snr_cmd = send_snr_cmd_tlv, |
| 12823 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12824 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12825 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 12826 | .send_lphb_config_tcp_params_cmd = send_lphb_config_tcp_params_cmd_tlv, |
| 12827 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 12828 | .send_lphb_config_udp_pkt_filter_cmd = |
| 12829 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
| 12830 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 12831 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 12832 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12833 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
| 12834 | .send_process_update_edca_param_cmd = |
| 12835 | send_process_update_edca_param_cmd_tlv, |
| 12836 | .send_roam_scan_offload_mode_cmd = |
| 12837 | send_roam_scan_offload_mode_cmd_tlv, |
| 12838 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 12839 | .send_roam_scan_offload_ap_profile_cmd = |
| 12840 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 12841 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12842 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 12843 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12844 | #ifdef FEATURE_WLAN_RA_FILTERING |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12845 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12846 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12847 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 12848 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
| 12849 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 12850 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12851 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 12852 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 12853 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 12854 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 12855 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 12856 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 12857 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
| 12858 | .send_enable_disable_packet_filter_cmd = |
| 12859 | send_enable_disable_packet_filter_cmd_tlv, |
| 12860 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
| 12861 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
| 12862 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 12863 | .send_process_gtk_offload_getinfo_cmd = |
| 12864 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 12865 | .send_process_add_periodic_tx_ptrn_cmd = |
| 12866 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 12867 | .send_process_del_periodic_tx_ptrn_cmd = |
| 12868 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 12869 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 12870 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 12871 | .send_set_app_type2_params_in_fw_cmd = |
| 12872 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 12873 | .send_set_auto_shutdown_timer_cmd = |
| 12874 | send_set_auto_shutdown_timer_cmd_tlv, |
| 12875 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 12876 | .send_process_dhcpserver_offload_cmd = |
| 12877 | send_process_dhcpserver_offload_cmd_tlv, |
| 12878 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 12879 | .send_process_ch_avoid_update_cmd = |
| 12880 | send_process_ch_avoid_update_cmd_tlv, |
| 12881 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 12882 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 12883 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 12884 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 12885 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 12886 | .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] | 12887 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12888 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 12889 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12890 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12891 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12892 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12893 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12894 | .send_set_base_macaddr_indicate_cmd = |
| 12895 | send_set_base_macaddr_indicate_cmd_tlv, |
| 12896 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 12897 | .send_enable_specific_fw_logs_cmd = |
| 12898 | send_enable_specific_fw_logs_cmd_tlv, |
| 12899 | .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] | 12900 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12901 | .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] | 12902 | .send_pdev_set_dual_mac_config_cmd = |
| 12903 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12904 | .send_enable_arp_ns_offload_cmd = |
| 12905 | send_enable_arp_ns_offload_cmd_tlv, |
| 12906 | .send_app_type1_params_in_fw_cmd = |
| 12907 | send_app_type1_params_in_fw_cmd_tlv, |
| 12908 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 12909 | .send_process_roam_synch_complete_cmd = |
| 12910 | send_process_roam_synch_complete_cmd_tlv, |
| 12911 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 12912 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 12913 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12914 | .send_roam_scan_offload_scan_period_cmd = |
| 12915 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 12916 | .send_roam_scan_offload_chan_list_cmd = |
| 12917 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 12918 | .send_roam_scan_offload_rssi_change_cmd = |
| 12919 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 12920 | .send_get_buf_extscan_hotlist_cmd = |
| 12921 | send_get_buf_extscan_hotlist_cmd_tlv, |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 12922 | .send_adapt_dwelltime_params_cmd = |
| 12923 | send_adapt_dwelltime_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12924 | .init_cmd_send = init_cmd_send_tlv, |
| 12925 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 12926 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 12927 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 12928 | .save_service_bitmap = save_service_bitmap_tlv, |
| 12929 | .is_service_enabled = is_service_enabled_tlv, |
| 12930 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 12931 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 12932 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
| 12933 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 12934 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 12935 | .extract_tbttoffset_update_params = |
| 12936 | extract_tbttoffset_update_params_tlv, |
| 12937 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 12938 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 12939 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 12940 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
| 12941 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
| 12942 | .extract_swba_vdev_map = extract_swba_vdev_map_tlv, |
| 12943 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 12944 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
| 12945 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 12946 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 12947 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 12948 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 12949 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 12950 | .extract_peer_stats = extract_peer_stats_tlv, |
| 12951 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 12952 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 12953 | .extract_chan_stats = extract_chan_stats_tlv, |
| 12954 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 12955 | .extract_profile_data = extract_profile_data_tlv, |
| 12956 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 12957 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 12958 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 12959 | .send_encrypt_decrypt_send_cmd = |
| 12960 | send_encrypt_decrypt_send_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 12961 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 12962 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 12963 | .extract_hw_mode_cap_service_ready_ext = |
| 12964 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 12965 | .extract_mac_phy_cap_service_ready_ext = |
| 12966 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 12967 | .extract_reg_cap_service_ready_ext = |
| 12968 | extract_reg_cap_service_ready_ext_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12969 | }; |
| 12970 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 12971 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12972 | /** |
| 12973 | * populate_tlv_service() - populates wmi services |
| 12974 | * |
| 12975 | * @param wmi_service: Pointer to hold wmi_service |
| 12976 | * Return: None |
| 12977 | */ |
| 12978 | static void populate_tlv_service(uint32_t *wmi_service) |
| 12979 | { |
| 12980 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
| 12981 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 12982 | wmi_service[wmi_service_roam_scan_offload] = |
| 12983 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 12984 | wmi_service[wmi_service_bcn_miss_offload] = |
| 12985 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 12986 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 12987 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 12988 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 12989 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 12990 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 12991 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 12992 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 12993 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 12994 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 12995 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 12996 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 12997 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 12998 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 12999 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 13000 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 13001 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 13002 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 13003 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 13004 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 13005 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 13006 | wmi_service[wmi_service_packet_power_save] = |
| 13007 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 13008 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 13009 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 13010 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 13011 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 13012 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 13013 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 13014 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 13015 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 13016 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 13017 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 13018 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 13019 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 13020 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 13021 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 13022 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 13023 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 13024 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 13025 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 13026 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 13027 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 13028 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 13029 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 13030 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 13031 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 13032 | wmi_service[wmi_service_lte_ant_share_support] = |
| 13033 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 13034 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 13035 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 13036 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 13037 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 13038 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 13039 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 13040 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 13041 | wmi_service[wmi_service_bcn_txrate_override] = |
| 13042 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 13043 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 13044 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 13045 | wmi_service[wmi_service_estimate_linkspeed] = |
| 13046 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 13047 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 13048 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 13049 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 13050 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 13051 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 13052 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 13053 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 13054 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 13055 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 13056 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 13057 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 13058 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 13059 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 13060 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 13061 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 13062 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 13063 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 13064 | wmi_service[wmi_service_sap_auth_offload] = |
| 13065 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 13066 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 13067 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 13068 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 13069 | wmi_service[wmi_service_ap_arpns_offload] = |
| 13070 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 13071 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 13072 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 13073 | wmi_service[wmi_service_packet_filter_offload] = |
| 13074 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 13075 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 13076 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 13077 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 13078 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 13079 | |
| 13080 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 13081 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 13082 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 13083 | WMI_SERVICE_UNAVAILABLE; |
| 13084 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 13085 | WMI_SERVICE_UNAVAILABLE; |
| 13086 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 13087 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
| 13088 | wmi_service[wmi_service_atf] = WMI_SERVICE_UNAVAILABLE; |
| 13089 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 13090 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 13091 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 13092 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 13093 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 13094 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 13095 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 13096 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
| 13097 | |
| 13098 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 13099 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 13100 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 13101 | WMI_SERVICE_UNAVAILABLE; |
| 13102 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 13103 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 13104 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 13105 | } |
| 13106 | |
| 13107 | /** |
| 13108 | * populate_tlv_event_id() - populates wmi event ids |
| 13109 | * |
| 13110 | * @param event_ids: Pointer to hold event ids |
| 13111 | * Return: None |
| 13112 | */ |
| 13113 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 13114 | { |
| 13115 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 13116 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 13117 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 13118 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 13119 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 13120 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 13121 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 13122 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 13123 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 13124 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 13125 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 13126 | event_ids[wmi_service_ready_ext_event_id] = |
| 13127 | WMI_SERVICE_READY_EXT_EVENTID; |
| 13128 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 13129 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 13130 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 13131 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 13132 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 13133 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 13134 | |
| 13135 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 13136 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 13137 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 13138 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 13139 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 13140 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 13141 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 13142 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
| 13143 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 13144 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 13145 | event_ids[wmi_tbttoffset_update_event_id] = |
| 13146 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
| 13147 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 13148 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 13149 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 13150 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 13151 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 13152 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 13153 | |
| 13154 | event_ids[wmi_tx_delba_complete_event_id] = |
| 13155 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 13156 | event_ids[wmi_tx_addba_complete_event_id] = |
| 13157 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 13158 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 13159 | |
| 13160 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 13161 | |
| 13162 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 13163 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 13164 | |
| 13165 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 13166 | |
| 13167 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 13168 | |
| 13169 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
| 13170 | |
| 13171 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 13172 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 13173 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 13174 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 13175 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 13176 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 13177 | |
| 13178 | event_ids[wmi_rtt_meas_report_event_id] = |
| 13179 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 13180 | event_ids[wmi_tsf_meas_report_event_id] = |
| 13181 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 13182 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 13183 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 13184 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 13185 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 13186 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 13187 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 13188 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 13189 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 13190 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 13191 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 13192 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 13193 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 13194 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 13195 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 13196 | |
| 13197 | event_ids[wmi_gtk_offload_status_event_id] = |
| 13198 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 13199 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 13200 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 13201 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 13202 | |
| 13203 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 13204 | |
| 13205 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 13206 | |
| 13207 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 13208 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 13209 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 13210 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 13211 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 13212 | event_ids[wmi_wlan_profile_data_event_id] = |
| 13213 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 13214 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 13215 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 13216 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 13217 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 13218 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 13219 | |
| 13220 | event_ids[wmi_diag_container_event_id] = |
| 13221 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 13222 | |
| 13223 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 13224 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 13225 | |
| 13226 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 13227 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 13228 | |
| 13229 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 13230 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 13231 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 13232 | |
| 13233 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 13234 | |
| 13235 | /** Set OCB Sched Response, deprecated */ |
| 13236 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 13237 | |
| 13238 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 13239 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 13240 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 13241 | |
| 13242 | /* GPIO Event */ |
| 13243 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 13244 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 13245 | |
| 13246 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 13247 | event_ids[wmi_rfkill_state_change_event_id] = |
| 13248 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 13249 | |
| 13250 | /* TDLS Event */ |
| 13251 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 13252 | |
| 13253 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 13254 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 13255 | event_ids[wmi_batch_scan_result_event_id] = |
| 13256 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 13257 | /* OEM Event */ |
| 13258 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 13259 | event_ids[wmi_oem_meas_report_event_id] = |
| 13260 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 13261 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 13262 | |
| 13263 | /* NAN Event */ |
| 13264 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 13265 | |
| 13266 | /* LPI Event */ |
| 13267 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 13268 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 13269 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 13270 | |
| 13271 | /* ExtScan events */ |
| 13272 | event_ids[wmi_extscan_start_stop_event_id] = |
| 13273 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 13274 | event_ids[wmi_extscan_operation_event_id] = |
| 13275 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 13276 | event_ids[wmi_extscan_table_usage_event_id] = |
| 13277 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 13278 | event_ids[wmi_extscan_cached_results_event_id] = |
| 13279 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 13280 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 13281 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 13282 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 13283 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 13284 | event_ids[wmi_extscan_capabilities_event_id] = |
| 13285 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 13286 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 13287 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 13288 | |
| 13289 | /* mDNS offload events */ |
| 13290 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 13291 | |
| 13292 | /* SAP Authentication offload events */ |
| 13293 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 13294 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 13295 | |
| 13296 | /** Out-of-context-of-bss (OCB) events */ |
| 13297 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 13298 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 13299 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 13300 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 13301 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 13302 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 13303 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 13304 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 13305 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 13306 | /* System-On-Chip events */ |
| 13307 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 13308 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 13309 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 13310 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 13311 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 13312 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
| 13313 | } |
| 13314 | |
| 13315 | /** |
| 13316 | * populate_pdev_param_tlv() - populates pdev params |
| 13317 | * |
| 13318 | * @param pdev_param: Pointer to hold pdev params |
| 13319 | * Return: None |
| 13320 | */ |
| 13321 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 13322 | { |
| 13323 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 13324 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 13325 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 13326 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 13327 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 13328 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 13329 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 13330 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 13331 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 13332 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 13333 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 13334 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 13335 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 13336 | pdev_param[wmi_pdev_param_protection_mode] = |
| 13337 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 13338 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 13339 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 13340 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 13341 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 13342 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 13343 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 13344 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 13345 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 13346 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 13347 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 13348 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 13349 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 13350 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 13351 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 13352 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 13353 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 13354 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 13355 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 13356 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 13357 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 13358 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 13359 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 13360 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 13361 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 13362 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 13363 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 13364 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 13365 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 13366 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 13367 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 13368 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 13369 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 13370 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 13371 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 13372 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 13373 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 13374 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 13375 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 13376 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 13377 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 13378 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 13379 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 13380 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 13381 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 13382 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 13383 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 13384 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 13385 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 13386 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 13387 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 13388 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 13389 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 13390 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 13391 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 13392 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 13393 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 13394 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 13395 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 13396 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 13397 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 13398 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 13399 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 13400 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 13401 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 13402 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 13403 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 13404 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 13405 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 13406 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 13407 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 13408 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 13409 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 13410 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 13411 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 13412 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 13413 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 13414 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 13415 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 13416 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 13417 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 13418 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 13419 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 13420 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 13421 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 13422 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 13423 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 13424 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 13425 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 13426 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 13427 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 13428 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 13429 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 13430 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 13431 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 13432 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 13433 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 13434 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 13435 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 13436 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 13437 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 13438 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 13439 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 13440 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 13441 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 13442 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 13443 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 13444 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 13445 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 13446 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 13447 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 13448 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 13449 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 13450 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 13451 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 13452 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 13453 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 13454 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
| 13455 | pdev_param[wmi_pdev_param_rx_filter] = WMI_UNAVAILABLE_PARAM; |
| 13456 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = WMI_UNAVAILABLE_PARAM; |
| 13457 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = WMI_UNAVAILABLE_PARAM; |
| 13458 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_UNAVAILABLE_PARAM; |
| 13459 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
| 13460 | WMI_UNAVAILABLE_PARAM; |
| 13461 | pdev_param[wmi_pdev_param_proxy_sta_mode] = WMI_UNAVAILABLE_PARAM; |
| 13462 | pdev_param[wmi_pdev_param_mu_group_policy] = WMI_UNAVAILABLE_PARAM; |
| 13463 | pdev_param[wmi_pdev_param_noise_detection] = WMI_UNAVAILABLE_PARAM; |
| 13464 | pdev_param[wmi_pdev_param_noise_threshold] = WMI_UNAVAILABLE_PARAM; |
| 13465 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_UNAVAILABLE_PARAM; |
| 13466 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = WMI_UNAVAILABLE_PARAM; |
| 13467 | pdev_param[wmi_pdev_param_atf_strict_sch] = WMI_UNAVAILABLE_PARAM; |
| 13468 | pdev_param[wmi_pdev_param_atf_sched_duration] = WMI_UNAVAILABLE_PARAM; |
| 13469 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_UNAVAILABLE_PARAM; |
| 13470 | pdev_param[wmi_pdev_param_sensitivity_level] = WMI_UNAVAILABLE_PARAM; |
| 13471 | pdev_param[wmi_pdev_param_signed_txpower_2g] = WMI_UNAVAILABLE_PARAM; |
| 13472 | pdev_param[wmi_pdev_param_signed_txpower_5g] = WMI_UNAVAILABLE_PARAM; |
| 13473 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = WMI_UNAVAILABLE_PARAM; |
| 13474 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = WMI_UNAVAILABLE_PARAM; |
| 13475 | pdev_param[wmi_pdev_param_cca_threshold] = WMI_UNAVAILABLE_PARAM; |
| 13476 | pdev_param[wmi_pdev_param_rts_fixed_rate] = WMI_UNAVAILABLE_PARAM; |
| 13477 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
| 13478 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_UNAVAILABLE_PARAM; |
| 13479 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = WMI_UNAVAILABLE_PARAM; |
| 13480 | pdev_param[wmi_pdev_param_arp_srcaddr] = WMI_UNAVAILABLE_PARAM; |
| 13481 | pdev_param[wmi_pdev_param_arp_dstaddr] = WMI_UNAVAILABLE_PARAM; |
| 13482 | pdev_param[wmi_pdev_param_txpower_decr_db] = WMI_UNAVAILABLE_PARAM; |
| 13483 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 13484 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
| 13485 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = WMI_UNAVAILABLE_PARAM; |
| 13486 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
| 13487 | WMI_UNAVAILABLE_PARAM; |
| 13488 | pdev_param[wmi_pdev_param_cust_txpower_scale] = WMI_UNAVAILABLE_PARAM; |
| 13489 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = WMI_UNAVAILABLE_PARAM; |
| 13490 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 13491 | WMI_UNAVAILABLE_PARAM; |
| 13492 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 13493 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
| 13494 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_UNAVAILABLE_PARAM; |
| 13495 | pdev_param[wmi_pdev_param_block_interbss] = WMI_UNAVAILABLE_PARAM; |
| 13496 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
| 13497 | WMI_UNAVAILABLE_PARAM; |
| 13498 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 13499 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
| 13500 | WMI_UNAVAILABLE_PARAM; |
| 13501 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 13502 | pdev_param[wmi_pdev_param_en_stats] = WMI_UNAVAILABLE_PARAM; |
| 13503 | } |
| 13504 | |
| 13505 | /** |
| 13506 | * populate_vdev_param_tlv() - populates vdev params |
| 13507 | * |
| 13508 | * @param vdev_param: Pointer to hold vdev params |
| 13509 | * Return: None |
| 13510 | */ |
| 13511 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 13512 | { |
| 13513 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 13514 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 13515 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 13516 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 13517 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 13518 | vdev_param[wmi_vdev_param_listen_interval] = |
| 13519 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 13520 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 13521 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 13522 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 13523 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 13524 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 13525 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 13526 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 13527 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 13528 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 13529 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 13530 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 13531 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 13532 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 13533 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 13534 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 13535 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 13536 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 13537 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 13538 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 13539 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 13540 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 13541 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 13542 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 13543 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 13544 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 13545 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 13546 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 13547 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 13548 | vdev_param[wmi_vdev_param_protection_mode] = |
| 13549 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 13550 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 13551 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 13552 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 13553 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 13554 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 13555 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 13556 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 13557 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 13558 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 13559 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 13560 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 13561 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 13562 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 13563 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 13564 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 13565 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 13566 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 13567 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 13568 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 13569 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 13570 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 13571 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 13572 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 13573 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 13574 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 13575 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 13576 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 13577 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 13578 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 13579 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 13580 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 13581 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 13582 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 13583 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 13584 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 13585 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 13586 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 13587 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 13588 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 13589 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 13590 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 13591 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 13592 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 13593 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 13594 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 13595 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 13596 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 13597 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 13598 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 13599 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 13600 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 13601 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 13602 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 13603 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 13604 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 13605 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 13606 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 13607 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 13608 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 13609 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 13610 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 13611 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 13612 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 13613 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 13614 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 13615 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 13616 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 13617 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 13618 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 13619 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 13620 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 13621 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 13622 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 13623 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 13624 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 13625 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 13626 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 13627 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 13628 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 13629 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 13630 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 13631 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 13632 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 13633 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 13634 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 13635 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 13636 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 13637 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
| 13638 | } |
| 13639 | #endif |
| 13640 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13641 | /** |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13642 | * wmi_tlv_attach() - Attach TLV APIs |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13643 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13644 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13645 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 13646 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13647 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
| 13648 | { |
| 13649 | wmi_handle->ops = &tlv_ops; |
| 13650 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 13651 | wmi_handle->log_info.buf_offset_command = 2; |
| 13652 | wmi_handle->log_info.buf_offset_event = 4; |
| 13653 | wmi_handle->log_info.is_management_record = |
| 13654 | is_management_record_tlv; |
| 13655 | #endif |
| 13656 | populate_tlv_service(wmi_handle->services); |
| 13657 | populate_tlv_events_id(wmi_handle->wmi_events); |
| 13658 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 13659 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 13660 | } |
| 13661 | #else |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13662 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13663 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13664 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 13665 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 13666 | wmi_handle->log_info.buf_offset_command = 2; |
| 13667 | wmi_handle->log_info.buf_offset_event = 4; |
| 13668 | wmi_handle->log_info.is_management_record = |
| 13669 | is_management_record_tlv; |
| 13670 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13671 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13672 | #endif |