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 | */ |
| 732 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 733 | struct rx_reorder_queue_setup_params *param) |
| 734 | { |
| 735 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 736 | wmi_buf_t buf; |
| 737 | int32_t len = sizeof(*cmd); |
| 738 | |
| 739 | buf = wmi_buf_alloc(wmi, len); |
| 740 | if (!buf) { |
| 741 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 742 | return QDF_STATUS_E_NOMEM; |
| 743 | } |
| 744 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 745 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 746 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 747 | WMITLV_GET_STRUCT_TLVLEN |
| 748 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 749 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 750 | cmd->vdev_id = param->vdev_id; |
| 751 | cmd->tid = param->tid; |
| 752 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 753 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 754 | cmd->queue_no = param->queue_no; |
| 755 | |
| 756 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 757 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 758 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 759 | __func__); |
| 760 | qdf_nbuf_free(buf); |
| 761 | return QDF_STATUS_E_FAILURE; |
| 762 | } |
| 763 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 764 | param->peer_macaddr, param->vdev_id, param->tid); |
| 765 | |
| 766 | return QDF_STATUS_SUCCESS; |
| 767 | } |
| 768 | |
| 769 | /** |
| 770 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 771 | * command to fw |
| 772 | * @wmi: wmi handle |
| 773 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 774 | * |
| 775 | * Return: 0 for success or error code |
| 776 | */ |
| 777 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 778 | struct rx_reorder_queue_remove_params *param) |
| 779 | { |
| 780 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 781 | wmi_buf_t buf; |
| 782 | int32_t len = sizeof(*cmd); |
| 783 | |
| 784 | buf = wmi_buf_alloc(wmi, len); |
| 785 | if (!buf) { |
| 786 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 787 | return QDF_STATUS_E_NOMEM; |
| 788 | } |
| 789 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 790 | wmi_buf_data(buf); |
| 791 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 792 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 793 | WMITLV_GET_STRUCT_TLVLEN |
| 794 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 795 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 796 | cmd->vdev_id = param->vdev_id; |
| 797 | cmd->tid_mask = param->peer_tid_bitmap; |
| 798 | |
| 799 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 800 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 801 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 802 | __func__); |
| 803 | qdf_nbuf_free(buf); |
| 804 | return QDF_STATUS_E_FAILURE; |
| 805 | } |
| 806 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 807 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 808 | |
| 809 | return QDF_STATUS_SUCCESS; |
| 810 | } |
| 811 | |
| 812 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 813 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 814 | * @wmi_handle: wmi handle |
| 815 | * @value: value |
| 816 | * @mac_id: mac id to have radio context |
| 817 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 818 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 819 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 820 | 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] | 821 | uint32_t value, uint8_t mac_id) |
| 822 | { |
| 823 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 824 | wmi_buf_t buf; |
| 825 | int32_t len = sizeof(*cmd); |
| 826 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 827 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 828 | |
| 829 | buf = wmi_buf_alloc(wmi_handle, len); |
| 830 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 831 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 832 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 836 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 837 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 838 | WMITLV_GET_STRUCT_TLVLEN |
| 839 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 840 | cmd->pdev_id = 0; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 841 | cmd->enable = value; |
| 842 | |
| 843 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 844 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 845 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 846 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 847 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 848 | } |
| 849 | |
| 850 | return 0; |
| 851 | } |
| 852 | |
| 853 | /** |
| 854 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 855 | * @wmi_handle: wmi handle |
| 856 | * @param: pointer to pdev_utf_params |
| 857 | * @mac_id: mac id to have radio context |
| 858 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 859 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 860 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 861 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 862 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 863 | struct pdev_utf_params *param, |
| 864 | uint8_t mac_id) |
| 865 | { |
| 866 | wmi_buf_t buf; |
| 867 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 868 | /* if param->len is 0 no data is sent, return error */ |
| 869 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 870 | static uint8_t msgref = 1; |
| 871 | uint8_t segNumber = 0, segInfo, numSegments; |
| 872 | uint16_t chunk_len, total_bytes; |
| 873 | uint8_t *bufpos; |
| 874 | struct seg_hdr_info segHdrInfo; |
| 875 | |
| 876 | bufpos = param->utf_payload; |
| 877 | total_bytes = param->len; |
| 878 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 879 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 880 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 881 | |
| 882 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 883 | numSegments++; |
| 884 | |
| 885 | while (param->len) { |
| 886 | if (param->len > MAX_WMI_UTF_LEN) |
| 887 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 888 | else |
| 889 | chunk_len = param->len; |
| 890 | |
| 891 | buf = wmi_buf_alloc(wmi_handle, |
| 892 | (chunk_len + sizeof(segHdrInfo) + |
| 893 | WMI_TLV_HDR_SIZE)); |
| 894 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 895 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 896 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 897 | } |
| 898 | |
| 899 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 900 | |
| 901 | segHdrInfo.len = total_bytes; |
| 902 | segHdrInfo.msgref = msgref; |
| 903 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 904 | segHdrInfo.segmentInfo = segInfo; |
| 905 | segHdrInfo.pad = 0; |
| 906 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 907 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 908 | " segHdrInfo.segmentInfo = %d", |
| 909 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 910 | segHdrInfo.segmentInfo); |
| 911 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 912 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 913 | "chunk len %d", __func__, total_bytes, segNumber, |
| 914 | numSegments, chunk_len); |
| 915 | |
| 916 | segNumber++; |
| 917 | |
| 918 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 919 | (chunk_len + sizeof(segHdrInfo))); |
| 920 | cmd += WMI_TLV_HDR_SIZE; |
| 921 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 922 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 923 | |
| 924 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 925 | (chunk_len + sizeof(segHdrInfo) + |
| 926 | WMI_TLV_HDR_SIZE), |
| 927 | WMI_PDEV_UTF_CMDID); |
| 928 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 929 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 930 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 931 | wmi_buf_free(buf); |
| 932 | break; |
| 933 | } |
| 934 | |
| 935 | param->len -= chunk_len; |
| 936 | bufpos += chunk_len; |
| 937 | } |
| 938 | |
| 939 | msgref++; |
| 940 | |
| 941 | return ret; |
| 942 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 943 | #ifdef CONFIG_MCL |
| 944 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 945 | uint32_t host_param) |
| 946 | { |
| 947 | return host_param; |
| 948 | } |
| 949 | #else |
| 950 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 951 | uint32_t host_param) |
| 952 | { |
| 953 | if (host_param < wmi_pdev_param_max) |
| 954 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 955 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 956 | return WMI_UNAVAILABLE_PARAM; |
| 957 | } |
| 958 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 959 | /** |
| 960 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 961 | * @wmi_handle: wmi handle |
| 962 | * @param: pointer to pdev parameter |
| 963 | * @mac_id: radio context |
| 964 | * |
| 965 | * Return: 0 on success, errno on failure |
| 966 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 967 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 968 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 969 | struct pdev_params *param, |
| 970 | uint8_t mac_id) |
| 971 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 972 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 973 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 974 | wmi_buf_t buf; |
| 975 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 976 | uint32_t pdev_param; |
| 977 | |
| 978 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 979 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 980 | WMI_LOGW("%s: Unavailable param %d\n", |
| 981 | __func__, param->param_id); |
| 982 | return QDF_STATUS_E_INVAL; |
| 983 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 984 | |
| 985 | buf = wmi_buf_alloc(wmi_handle, len); |
| 986 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 987 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 988 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 989 | } |
| 990 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 991 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 992 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 993 | WMITLV_GET_STRUCT_TLVLEN |
| 994 | (wmi_pdev_set_param_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 995 | cmd->pdev_id = 0; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 996 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 997 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 998 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 999 | param->param_value); |
| 1000 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1001 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1002 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1003 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1004 | wmi_buf_free(buf); |
| 1005 | } |
| 1006 | return ret; |
| 1007 | } |
| 1008 | |
| 1009 | /** |
| 1010 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1011 | * @param wmi_handle : handle to WMI. |
| 1012 | * @param param : pointer to hold suspend parameter |
| 1013 | * @mac_id: radio context |
| 1014 | * |
| 1015 | * Return 0 on success and -ve on failure. |
| 1016 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1017 | QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1018 | struct suspend_params *param, |
| 1019 | uint8_t mac_id) |
| 1020 | { |
| 1021 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1022 | wmi_buf_t wmibuf; |
| 1023 | uint32_t len = sizeof(*cmd); |
| 1024 | int32_t ret; |
| 1025 | |
| 1026 | /* |
| 1027 | * send the comand to Target to ignore the |
| 1028 | * PCIE reset so as to ensure that Host and target |
| 1029 | * states are in sync |
| 1030 | */ |
| 1031 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1032 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1033 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1034 | |
| 1035 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1036 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1037 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1038 | WMITLV_GET_STRUCT_TLVLEN |
| 1039 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1040 | if (param->disable_target_intr) |
| 1041 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1042 | else |
| 1043 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
| 1044 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1045 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1046 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1047 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1048 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1049 | } |
| 1050 | |
| 1051 | return ret; |
| 1052 | } |
| 1053 | |
| 1054 | /** |
| 1055 | * send_resume_cmd_tlv() - WMI resume function |
| 1056 | * @param wmi_handle : handle to WMI. |
| 1057 | * @mac_id: radio context |
| 1058 | * |
| 1059 | * Return: 0 on success and -ve on failure. |
| 1060 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1061 | QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1062 | uint8_t mac_id) |
| 1063 | { |
| 1064 | wmi_buf_t wmibuf; |
| 1065 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1066 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1067 | |
| 1068 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1069 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1070 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1071 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1072 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1073 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1074 | WMITLV_GET_STRUCT_TLVLEN |
| 1075 | (wmi_pdev_resume_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 1076 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1077 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1078 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1079 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1080 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1081 | wmi_buf_free(wmibuf); |
| 1082 | } |
| 1083 | |
| 1084 | return ret; |
| 1085 | } |
| 1086 | |
| 1087 | /** |
| 1088 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1089 | * @param wmi_handle : handle to WMI. |
| 1090 | * @param param : pointer to hold wow enable parameter |
| 1091 | * @mac_id: radio context |
| 1092 | * |
| 1093 | * Return: 0 on success and -ve on failure. |
| 1094 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1095 | QDF_STATUS send_wow_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1096 | struct wow_cmd_params *param, |
| 1097 | uint8_t mac_id) |
| 1098 | { |
| 1099 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1100 | wmi_buf_t buf; |
| 1101 | int32_t len; |
| 1102 | int32_t ret; |
| 1103 | |
| 1104 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1105 | |
| 1106 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1107 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1108 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1109 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1110 | } |
| 1111 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1112 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1113 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1114 | WMITLV_GET_STRUCT_TLVLEN |
| 1115 | (wmi_wow_enable_cmd_fixed_param)); |
| 1116 | cmd->enable = param->enable; |
| 1117 | if (param->can_suspend_link) |
| 1118 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1119 | else |
| 1120 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
| 1121 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1122 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1123 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1124 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1125 | |
| 1126 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1127 | WMI_WOW_ENABLE_CMDID); |
| 1128 | if (ret) |
| 1129 | wmi_buf_free(buf); |
| 1130 | |
| 1131 | return ret; |
| 1132 | } |
| 1133 | |
| 1134 | /** |
| 1135 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1136 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1137 | * @peer_addr: peer mac address |
| 1138 | * @param: pointer to ap_ps parameter structure |
| 1139 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1140 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1141 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1142 | 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] | 1143 | uint8_t *peer_addr, |
| 1144 | struct ap_ps_params *param) |
| 1145 | { |
| 1146 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1147 | wmi_buf_t buf; |
| 1148 | int32_t err; |
| 1149 | |
| 1150 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1151 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1152 | 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] | 1153 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1154 | } |
| 1155 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1156 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1157 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1158 | WMITLV_GET_STRUCT_TLVLEN |
| 1159 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1160 | cmd->vdev_id = param->vdev_id; |
| 1161 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1162 | cmd->param = param->param; |
| 1163 | cmd->value = param->value; |
| 1164 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1165 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1166 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1167 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1168 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1169 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1170 | } |
| 1171 | |
| 1172 | return 0; |
| 1173 | } |
| 1174 | |
| 1175 | /** |
| 1176 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1177 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1178 | * @peer_addr: peer mac address |
| 1179 | * @param: pointer to sta_ps parameter structure |
| 1180 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1181 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1182 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1183 | 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] | 1184 | struct sta_ps_params *param) |
| 1185 | { |
| 1186 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1187 | wmi_buf_t buf; |
| 1188 | int32_t len = sizeof(*cmd); |
| 1189 | |
| 1190 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1191 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1192 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1193 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1194 | } |
| 1195 | |
| 1196 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1197 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1198 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1199 | WMITLV_GET_STRUCT_TLVLEN |
| 1200 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1201 | cmd->vdev_id = param->vdev_id; |
| 1202 | cmd->param = param->param; |
| 1203 | cmd->value = param->value; |
| 1204 | |
| 1205 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1206 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1207 | 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] | 1208 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1209 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1210 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1211 | } |
| 1212 | |
| 1213 | return 0; |
| 1214 | } |
| 1215 | |
| 1216 | /** |
| 1217 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1218 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1219 | * @param: ponirt to crash inject paramter structure |
| 1220 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1221 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1222 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1223 | QDF_STATUS send_crash_inject_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1224 | struct crash_inject *param) |
| 1225 | { |
| 1226 | int32_t ret = 0; |
| 1227 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1228 | uint16_t len = sizeof(*cmd); |
| 1229 | wmi_buf_t buf; |
| 1230 | |
| 1231 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1232 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1233 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1234 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1235 | } |
| 1236 | |
| 1237 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1238 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1239 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1240 | WMITLV_GET_STRUCT_TLVLEN |
| 1241 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1242 | cmd->type = param->type; |
| 1243 | cmd->delay_time_ms = param->delay_time_ms; |
| 1244 | |
| 1245 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1246 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1247 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1248 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1249 | __func__, ret); |
| 1250 | wmi_buf_free(buf); |
| 1251 | } |
| 1252 | |
| 1253 | return ret; |
| 1254 | } |
| 1255 | |
| 1256 | /** |
| 1257 | * send_dbglog_cmd_tlv() - set debug log level |
| 1258 | * @param wmi_handle : handle to WMI. |
| 1259 | * @param param : pointer to hold dbglog level parameter |
| 1260 | * |
| 1261 | * Return: 0 on success and -ve on failure. |
| 1262 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1263 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1264 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1265 | struct dbglog_params *dbglog_param) |
| 1266 | { |
| 1267 | wmi_buf_t buf; |
| 1268 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
| 1269 | A_STATUS status = A_OK; |
| 1270 | int32_t i; |
| 1271 | int32_t len; |
| 1272 | int8_t *buf_ptr; |
| 1273 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1274 | |
| 1275 | ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
| 1276 | |
| 1277 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1278 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1279 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1280 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1281 | if (buf == NULL) |
| 1282 | return A_NO_MEMORY; |
| 1283 | |
| 1284 | configmsg = |
| 1285 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1286 | buf_ptr = (int8_t *) configmsg; |
| 1287 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1288 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1289 | WMITLV_GET_STRUCT_TLVLEN |
| 1290 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1291 | configmsg->dbg_log_param = dbglog_param->param; |
| 1292 | configmsg->value = dbglog_param->val; |
| 1293 | /* Filling in the data part of second tlv -- should |
| 1294 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1295 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1296 | sizeof |
| 1297 | (wmi_debug_log_config_cmd_fixed_param) |
| 1298 | + WMI_TLV_HDR_SIZE); |
| 1299 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1300 | WMITLV_TAG_ARRAY_UINT32, |
| 1301 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1302 | if (dbglog_param->module_id_bitmap) { |
| 1303 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1304 | module_id_bitmap_array[i] = |
| 1305 | dbglog_param->module_id_bitmap[i]; |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1310 | len, WMI_DBGLOG_CFG_CMDID); |
| 1311 | |
| 1312 | if (status != A_OK) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1313 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1314 | |
| 1315 | return status; |
| 1316 | } |
| 1317 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1318 | #ifdef CONFIG_MCL |
| 1319 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1320 | uint32_t host_param) |
| 1321 | { |
| 1322 | return host_param; |
| 1323 | } |
| 1324 | #else |
| 1325 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1326 | uint32_t host_param) |
| 1327 | { |
| 1328 | if (host_param < wmi_vdev_param_max) |
| 1329 | return wmi_handle->vdev_param[host_param]; |
| 1330 | |
| 1331 | return WMI_UNAVAILABLE_PARAM; |
| 1332 | } |
| 1333 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1334 | /** |
| 1335 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1336 | * @param wmi_handle : handle to WMI. |
| 1337 | * @param macaddr : MAC address |
| 1338 | * @param param : pointer to hold vdev set parameter |
| 1339 | * |
| 1340 | * Return: 0 on success and -ve on failure. |
| 1341 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1342 | 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] | 1343 | struct vdev_set_params *param) |
| 1344 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1345 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1346 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1347 | wmi_buf_t buf; |
| 1348 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1349 | uint32_t vdev_param; |
| 1350 | |
| 1351 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1352 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1353 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1354 | param->param_id); |
| 1355 | return QDF_STATUS_E_INVAL; |
| 1356 | |
| 1357 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1358 | |
| 1359 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1360 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1361 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1362 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1363 | } |
| 1364 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1365 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1366 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1367 | WMITLV_GET_STRUCT_TLVLEN |
| 1368 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1369 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1370 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1371 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1372 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1373 | param->if_id, param->param_id, param->param_value); |
| 1374 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1375 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1376 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1377 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1378 | wmi_buf_free(buf); |
| 1379 | } |
| 1380 | |
| 1381 | return ret; |
| 1382 | } |
| 1383 | |
| 1384 | /** |
| 1385 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1386 | * @param wmi_handle : handle to WMI. |
| 1387 | * @param macaddr : MAC address |
| 1388 | * @param param : pointer to hold stats request parameter |
| 1389 | * |
| 1390 | * Return: 0 on success and -ve on failure. |
| 1391 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1392 | QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1393 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1394 | struct stats_request_params *param) |
| 1395 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1396 | int32_t ret; |
| 1397 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1398 | wmi_buf_t buf; |
| 1399 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1400 | |
| 1401 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1402 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1403 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1404 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1405 | } |
| 1406 | |
| 1407 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1408 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1409 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1410 | WMITLV_GET_STRUCT_TLVLEN |
| 1411 | (wmi_request_stats_cmd_fixed_param)); |
| 1412 | cmd->stats_id = param->stats_id; |
| 1413 | cmd->vdev_id = param->vdev_id; |
| 1414 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1415 | WMI_REQUEST_STATS_CMDID); |
| 1416 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1417 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1418 | wmi_buf_free(buf); |
| 1419 | } |
| 1420 | |
| 1421 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1422 | } |
| 1423 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1424 | #ifdef CONFIG_WIN |
| 1425 | /** |
| 1426 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1427 | * @param wmi_handle : handle to WMI. |
| 1428 | * @param macaddr : MAC address |
| 1429 | * @param param : pointer to hold stats request parameter |
| 1430 | * |
| 1431 | * Return: 0 on success and -ve on failure. |
| 1432 | */ |
| 1433 | QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1434 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT) |
| 1435 | { |
| 1436 | return 0; |
| 1437 | } |
| 1438 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1439 | /** |
| 1440 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1441 | * @param wmi_handle : handle to WMI. |
| 1442 | * @param macaddr : MAC address |
| 1443 | * @param param : pointer to hold stats request parameter |
| 1444 | * |
| 1445 | * Return: 0 on success and -ve on failure. |
| 1446 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1447 | 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] | 1448 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1449 | struct packet_enable_params *param) |
| 1450 | { |
| 1451 | return 0; |
| 1452 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1453 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1454 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1455 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1456 | /** |
| 1457 | * send_beacon_send_cmd_tlv() - WMI beacon send function |
| 1458 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1459 | * @param param : pointer to hold beacon send cmd parameter |
| 1460 | * |
| 1461 | * Return: 0 on success and -ve on failure. |
| 1462 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1463 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1464 | struct beacon_params *param) |
| 1465 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1466 | int32_t ret; |
| 1467 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1468 | wmi_bcn_prb_info *bcn_prb_info; |
| 1469 | wmi_buf_t wmi_buf; |
| 1470 | uint8_t *buf_ptr; |
| 1471 | uint32_t wmi_buf_len; |
| 1472 | |
| 1473 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1474 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1475 | param->tmpl_len_aligned; |
| 1476 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1477 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1478 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1479 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1480 | } |
| 1481 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1482 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1483 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1484 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1485 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1486 | cmd->vdev_id = param->vdev_id; |
| 1487 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1488 | cmd->buf_len = param->tmpl_len; |
| 1489 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1490 | |
| 1491 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1492 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1493 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1494 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1495 | bcn_prb_info->caps = 0; |
| 1496 | bcn_prb_info->erp = 0; |
| 1497 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1498 | |
| 1499 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1500 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1501 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1502 | |
| 1503 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1504 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1505 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1506 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1507 | wmi_buf_free(wmi_buf); |
| 1508 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1509 | return 0; |
| 1510 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1511 | #else |
| 1512 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1513 | struct beacon_params *param) |
| 1514 | { |
| 1515 | return 0; |
| 1516 | } |
| 1517 | |
| 1518 | /** |
| 1519 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1520 | * @param wmi_handle : handle to WMI. |
| 1521 | * @param param : pointer to hold beacon send cmd parameter |
| 1522 | * |
| 1523 | * Return: 0 on success and -ve on failure. |
| 1524 | */ |
| 1525 | QDF_STATUS send_beacon_tmpl_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1526 | struct beacon_tmpl_params *param) |
| 1527 | { |
| 1528 | int32_t ret; |
| 1529 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1530 | wmi_bcn_prb_info *bcn_prb_info; |
| 1531 | wmi_buf_t wmi_buf; |
| 1532 | uint8_t *buf_ptr; |
| 1533 | uint32_t wmi_buf_len; |
| 1534 | |
| 1535 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1536 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1537 | param->tmpl_len_aligned; |
| 1538 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1539 | if (!wmi_buf) { |
| 1540 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1541 | return QDF_STATUS_E_NOMEM; |
| 1542 | } |
| 1543 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1544 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1545 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1546 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1547 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1548 | cmd->vdev_id = param->vdev_id; |
| 1549 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1550 | cmd->buf_len = param->tmpl_len; |
| 1551 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1552 | |
| 1553 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1554 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1555 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1556 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1557 | bcn_prb_info->caps = 0; |
| 1558 | bcn_prb_info->erp = 0; |
| 1559 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1560 | |
| 1561 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1562 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1563 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1564 | |
| 1565 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1566 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1567 | if (ret) { |
| 1568 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1569 | wmi_buf_free(wmi_buf); |
| 1570 | } |
| 1571 | return 0; |
| 1572 | } |
| 1573 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1574 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1575 | #ifdef CONFIG_MCL |
| 1576 | static inline void copy_peer_flags_tlv( |
| 1577 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1578 | struct peer_assoc_params *param) |
| 1579 | { |
| 1580 | cmd->peer_flags = param->peer_flags; |
| 1581 | } |
| 1582 | #else |
| 1583 | static inline void copy_peer_flags_tlv( |
| 1584 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1585 | struct peer_assoc_params *param) |
| 1586 | { |
| 1587 | /* |
| 1588 | * The target only needs a subset of the flags maintained in the host. |
| 1589 | * Just populate those flags and send it down |
| 1590 | */ |
| 1591 | cmd->peer_flags = 0; |
| 1592 | |
| 1593 | /* |
| 1594 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1595 | */ |
| 1596 | if (param->is_wme_set) { |
| 1597 | |
| 1598 | if (param->qos_flag) |
| 1599 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1600 | if (param->apsd_flag) |
| 1601 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1602 | if (param->ht_flag) |
| 1603 | cmd->peer_flags |= WMI_PEER_HT; |
| 1604 | if (param->bw_40) |
| 1605 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1606 | if (param->bw_80) |
| 1607 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1608 | if (param->bw_160) |
| 1609 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1610 | |
| 1611 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1612 | * for HT as well |
| 1613 | **/ |
| 1614 | if (param->stbc_flag) |
| 1615 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1616 | |
| 1617 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1618 | * for HT as well |
| 1619 | **/ |
| 1620 | if (param->ldpc_flag) |
| 1621 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1622 | |
| 1623 | if (param->static_mimops_flag) |
| 1624 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1625 | if (param->dynamic_mimops_flag) |
| 1626 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1627 | if (param->spatial_mux_flag) |
| 1628 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1629 | if (param->vht_flag) |
| 1630 | cmd->peer_flags |= WMI_PEER_VHT; |
| 1631 | } |
| 1632 | /* |
| 1633 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1634 | * (during re-association). |
| 1635 | * Authorization will be done for these modes on key installation. |
| 1636 | */ |
| 1637 | if (param->auth_flag) |
| 1638 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1639 | if (param->need_ptk_4_way) |
| 1640 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1641 | else |
| 1642 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1643 | if (param->need_gtk_2_way) |
| 1644 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1645 | /* safe mode bypass the 4-way handshake */ |
| 1646 | if (param->safe_mode_enabled) |
| 1647 | cmd->peer_flags &= |
| 1648 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1649 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1650 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1651 | * it |
| 1652 | * if (param->amsdu_disable) Add after FW support |
| 1653 | **/ |
| 1654 | |
| 1655 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1656 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1657 | * iwpriv |
| 1658 | **/ |
| 1659 | if (param->peer_ht_rates.num_rates == 0) |
| 1660 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1661 | } |
| 1662 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1663 | /** |
| 1664 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1665 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1666 | * @param param : pointer to peer assoc parameter |
| 1667 | * |
| 1668 | * Return: 0 on success and -ve on failure. |
| 1669 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1670 | QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1671 | struct peer_assoc_params *param) |
| 1672 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1673 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1674 | wmi_vht_rate_set *mcs; |
| 1675 | wmi_buf_t buf; |
| 1676 | int32_t len; |
| 1677 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1678 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1679 | uint32_t peer_legacy_rates_align; |
| 1680 | uint32_t peer_ht_rates_align; |
| 1681 | |
| 1682 | |
| 1683 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1684 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1685 | |
| 1686 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1687 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1688 | WMI_TLV_HDR_SIZE + |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1689 | (peer_ht_rates_align * sizeof(uint8_t)) + |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1690 | sizeof(wmi_vht_rate_set); |
| 1691 | |
| 1692 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1693 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1694 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1695 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1696 | } |
| 1697 | |
| 1698 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1699 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1700 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1701 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1702 | WMITLV_GET_STRUCT_TLVLEN |
| 1703 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1704 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1705 | cmd->vdev_id = param->vdev_id; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1706 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1707 | sizeof(param->peer_macaddr)); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1708 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1709 | cmd->peer_associd = param->peer_associd; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1710 | copy_peer_flags_tlv(cmd, param); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1711 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1712 | cmd->peer_caps = param->peer_caps; |
| 1713 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1714 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1715 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1716 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1717 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1718 | cmd->peer_phymode = param->peer_phymode; |
| 1719 | |
| 1720 | /* Update peer legacy rate information */ |
| 1721 | buf_ptr += sizeof(*cmd); |
| 1722 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1723 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1724 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1725 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1726 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1727 | param->peer_legacy_rates.num_rates); |
| 1728 | |
| 1729 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1730 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1731 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1732 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1733 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1734 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1735 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1736 | param->peer_ht_rates.num_rates); |
| 1737 | |
| 1738 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1739 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1740 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 1741 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 1742 | |
| 1743 | cmd->peer_nss = param->peer_nss; |
| 1744 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 1745 | if (param->vht_capable) { |
| 1746 | mcs->rx_max_rate = param->rx_max_rate; |
| 1747 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 1748 | mcs->tx_max_rate = param->tx_max_rate; |
| 1749 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 1750 | } |
| 1751 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1752 | 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] | 1753 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 1754 | "nss %d phymode %d peer_mpdu_density %d " |
| 1755 | "cmd->peer_vht_caps %x", __func__, |
| 1756 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 1757 | cmd->peer_rate_caps, cmd->peer_caps, |
| 1758 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 1759 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 1760 | cmd->peer_mpdu_density, |
| 1761 | cmd->peer_vht_caps); |
| 1762 | |
| 1763 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1764 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1765 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1766 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1767 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1768 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1769 | } |
| 1770 | |
| 1771 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1772 | } |
| 1773 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1774 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 1775 | */ |
| 1776 | #ifdef CONFIG_MCL |
| 1777 | static inline void copy_scan_notify_ev_flags( |
| 1778 | wmi_start_scan_cmd_fixed_param * cmd, |
| 1779 | struct scan_start_params *params) |
| 1780 | { |
| 1781 | cmd->notify_scan_events = params->notify_scan_events; |
| 1782 | cmd->scan_ctrl_flags = params->scan_ctrl_flags; |
| 1783 | } |
| 1784 | #else |
| 1785 | static inline void copy_scan_notify_ev_flags( |
| 1786 | wmi_start_scan_cmd_fixed_param * cmd, |
| 1787 | struct scan_start_params *params) |
| 1788 | { |
| 1789 | cmd->notify_scan_events = WMI_SCAN_EVENT_STARTED | |
| 1790 | WMI_SCAN_EVENT_COMPLETED | |
| 1791 | WMI_SCAN_EVENT_BSS_CHANNEL | |
| 1792 | WMI_SCAN_EVENT_FOREIGN_CHANNEL | |
| 1793 | WMI_SCAN_EVENT_DEQUEUED |
| 1794 | ; |
| 1795 | cmd->scan_ctrl_flags = params->scan_ctrl_flags; |
| 1796 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
| 1797 | |
| 1798 | if (params->is_phy_error) |
| 1799 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
| 1800 | } |
| 1801 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1802 | /** |
| 1803 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 1804 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1805 | * @param param : pointer to hold scan start cmd parameter |
| 1806 | * |
| 1807 | * Return: 0 on success and -ve on failure. |
| 1808 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1809 | QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1810 | struct scan_start_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1811 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1812 | int32_t ret = 0; |
| 1813 | int32_t i; |
| 1814 | wmi_buf_t wmi_buf; |
| 1815 | wmi_start_scan_cmd_fixed_param *cmd; |
| 1816 | uint8_t *buf_ptr; |
| 1817 | uint32_t *tmp_ptr; |
| 1818 | wmi_ssid *ssid = NULL; |
| 1819 | wmi_mac_addr *bssid; |
| 1820 | int len = sizeof(*cmd); |
| 1821 | |
| 1822 | /* Length TLV placeholder for array of uint32_t */ |
| 1823 | len += WMI_TLV_HDR_SIZE; |
| 1824 | /* calculate the length of buffer required */ |
| 1825 | if (params->num_chan) |
| 1826 | len += params->num_chan * sizeof(uint32_t); |
| 1827 | |
| 1828 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 1829 | len += WMI_TLV_HDR_SIZE; |
| 1830 | if (params->num_ssids) |
| 1831 | len += params->num_ssids * sizeof(wmi_ssid); |
| 1832 | |
| 1833 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 1834 | len += WMI_TLV_HDR_SIZE; |
| 1835 | len += sizeof(wmi_mac_addr); |
| 1836 | |
| 1837 | /* Length TLV placeholder for array of bytes */ |
| 1838 | len += WMI_TLV_HDR_SIZE; |
| 1839 | if (params->ie_len) |
| 1840 | len += roundup(params->ie_len, sizeof(uint32_t)); |
| 1841 | |
| 1842 | /* Allocate the memory */ |
| 1843 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1844 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1845 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1846 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1847 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1848 | } |
| 1849 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1850 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 1851 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1852 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 1853 | WMITLV_GET_STRUCT_TLVLEN |
| 1854 | (wmi_start_scan_cmd_fixed_param)); |
| 1855 | |
| 1856 | cmd->scan_id = params->scan_id; |
| 1857 | cmd->scan_req_id = params->scan_req_id; |
| 1858 | cmd->vdev_id = params->vdev_id; |
| 1859 | cmd->scan_priority = params->scan_priority; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1860 | copy_scan_notify_ev_flags(cmd, params); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1861 | cmd->dwell_time_active = params->dwell_time_active; |
| 1862 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 1863 | cmd->min_rest_time = params->min_rest_time; |
| 1864 | cmd->max_rest_time = params->max_rest_time; |
| 1865 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 1866 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 1867 | cmd->idle_time = params->idle_time; |
| 1868 | cmd->max_scan_time = params->max_scan_time; |
| 1869 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1870 | cmd->burst_duration = params->burst_duration; |
| 1871 | cmd->num_chan = params->num_chan; |
| 1872 | cmd->num_bssid = params->num_bssid; |
| 1873 | cmd->num_ssids = params->num_ssids; |
| 1874 | cmd->ie_len = params->ie_len; |
| 1875 | cmd->n_probes = params->n_probes; |
| 1876 | buf_ptr += sizeof(*cmd); |
| 1877 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1878 | for (i = 0; i < params->num_chan; ++i) |
| 1879 | tmp_ptr[i] = params->chan_list[i]; |
| 1880 | |
| 1881 | WMITLV_SET_HDR(buf_ptr, |
| 1882 | WMITLV_TAG_ARRAY_UINT32, |
| 1883 | (params->num_chan * sizeof(uint32_t))); |
| 1884 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 1885 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1886 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1887 | goto error; |
| 1888 | } |
| 1889 | |
| 1890 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1891 | (params->num_ssids * sizeof(wmi_ssid))); |
| 1892 | |
| 1893 | if (params->num_ssids) { |
| 1894 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1895 | for (i = 0; i < params->num_ssids; ++i) { |
| 1896 | ssid->ssid_len = params->ssid[i].length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1897 | qdf_mem_copy(ssid->ssid, params->ssid[i].mac_ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1898 | params->ssid[i].length); |
| 1899 | ssid++; |
| 1900 | } |
| 1901 | } |
| 1902 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 1903 | |
| 1904 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1905 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 1906 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1907 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->mac_add_bytes, bssid); |
| 1908 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_bssid * sizeof(wmi_mac_addr)); |
| 1909 | |
| 1910 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, params->ie_len_with_pad); |
| 1911 | if (params->ie_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1912 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1913 | (uint8_t *) params->ie_base + |
| 1914 | (params->uie_fieldOffset), params->ie_len); |
| 1915 | } |
| 1916 | buf_ptr += WMI_TLV_HDR_SIZE + params->ie_len_with_pad; |
| 1917 | |
| 1918 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 1919 | len, WMI_START_SCAN_CMDID); |
| 1920 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1921 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1922 | wmi_buf_free(wmi_buf); |
| 1923 | } |
| 1924 | return ret; |
| 1925 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1926 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1927 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1928 | } |
| 1929 | |
| 1930 | /** |
| 1931 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 1932 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1933 | * @param param : pointer to hold scan start cmd parameter |
| 1934 | * |
| 1935 | * Return: 0 on success and -ve on failure. |
| 1936 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1937 | QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1938 | struct scan_stop_params *param) |
| 1939 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1940 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 1941 | int ret; |
| 1942 | int len = sizeof(*cmd); |
| 1943 | wmi_buf_t wmi_buf; |
| 1944 | |
| 1945 | /* Allocate the memory */ |
| 1946 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1947 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1948 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1949 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1950 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1951 | goto error; |
| 1952 | } |
| 1953 | |
| 1954 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 1955 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1956 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 1957 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 1958 | cmd->vdev_id = param->vdev_id; |
| 1959 | cmd->requestor = param->requestor; |
| 1960 | cmd->scan_id = param->scan_id; |
| 1961 | /* stop the scan with the corresponding scan_id */ |
| 1962 | cmd->req_type = param->req_type; |
| 1963 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 1964 | len, WMI_STOP_SCAN_CMDID); |
| 1965 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1966 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1967 | wmi_buf_free(wmi_buf); |
| 1968 | } |
| 1969 | |
| 1970 | error: |
| 1971 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1972 | } |
| 1973 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1974 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1975 | /** |
| 1976 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 1977 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1978 | * @param param : pointer to hold scan channel list parameter |
| 1979 | * |
| 1980 | * Return: 0 on success and -ve on failure. |
| 1981 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1982 | 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] | 1983 | struct scan_chan_list_params *chan_list) |
| 1984 | { |
| 1985 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1986 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1987 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1988 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1989 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 1990 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1991 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 1992 | |
| 1993 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 1994 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1995 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1996 | WMI_LOGE("Failed to allocate memory"); |
| 1997 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1998 | goto end; |
| 1999 | } |
| 2000 | |
| 2001 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2002 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2003 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2004 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2005 | WMITLV_GET_STRUCT_TLVLEN |
| 2006 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2007 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2008 | 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] | 2009 | |
| 2010 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2011 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2012 | WMITLV_TAG_ARRAY_STRUC, |
| 2013 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2014 | chan_info = (wmi_channel_param *) |
| 2015 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2016 | tchan_info = chan_list->chan_info; |
| 2017 | |
| 2018 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2019 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2020 | WMITLV_TAG_STRUC_wmi_channel, |
| 2021 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2022 | chan_info->mhz = tchan_info->mhz; |
| 2023 | chan_info->band_center_freq1 = |
| 2024 | tchan_info->band_center_freq1; |
| 2025 | chan_info->band_center_freq2 = |
| 2026 | tchan_info->band_center_freq2; |
| 2027 | chan_info->info = tchan_info->info; |
| 2028 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2029 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2030 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2031 | |
| 2032 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2033 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2034 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2035 | tchan_info++; |
| 2036 | chan_info++; |
| 2037 | } |
| 2038 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2039 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2040 | WMI_SCAN_CHAN_LIST_CMDID); |
| 2041 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2042 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2043 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2044 | wmi_buf_free(buf); |
| 2045 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2046 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2047 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2048 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2049 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2050 | #else |
| 2051 | QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle, |
| 2052 | struct scan_chan_list_params *chan_list) |
| 2053 | { |
| 2054 | wmi_buf_t buf; |
| 2055 | QDF_STATUS qdf_status; |
| 2056 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2057 | int i; |
| 2058 | uint8_t *buf_ptr; |
| 2059 | wmi_channel *chan_info; |
| 2060 | struct channel_param *tchan_info; |
| 2061 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2062 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2063 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2064 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2065 | if (!buf) { |
| 2066 | WMI_LOGE("Failed to allocate memory"); |
| 2067 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2068 | goto end; |
| 2069 | } |
| 2070 | |
| 2071 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2072 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2073 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2074 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2075 | WMITLV_GET_STRUCT_TLVLEN |
| 2076 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2077 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2078 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2079 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2080 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2081 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2082 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2083 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2084 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2085 | tchan_info = &(chan_list->ch_param[0]); |
| 2086 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2087 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2088 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2089 | WMITLV_TAG_STRUC_wmi_channel, |
| 2090 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2091 | chan_info->mhz = tchan_info->mhz; |
| 2092 | chan_info->band_center_freq1 = |
| 2093 | tchan_info->cfreq1; |
| 2094 | chan_info->band_center_freq2 = |
| 2095 | tchan_info->cfreq2; |
| 2096 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2097 | if (tchan_info->is_chan_passive) |
| 2098 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2099 | WMI_CHAN_FLAG_PASSIVE); |
| 2100 | |
| 2101 | if (tchan_info->allow_vht) |
| 2102 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2103 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2104 | else if (tchan_info->allow_ht) |
| 2105 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2106 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2107 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2108 | tchan_info->phy_mode); |
| 2109 | |
| 2110 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2111 | * after FW support |
| 2112 | */ |
| 2113 | |
| 2114 | /* also fill in power information */ |
| 2115 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2116 | tchan_info->minpower); |
| 2117 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2118 | tchan_info->maxpower); |
| 2119 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2120 | tchan_info->maxregpower); |
| 2121 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2122 | tchan_info->antennamax); |
| 2123 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2124 | tchan_info->reg_class_id); |
| 2125 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2126 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2127 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2128 | tchan_info++; |
| 2129 | chan_info++; |
| 2130 | } |
| 2131 | |
| 2132 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2133 | WMI_SCAN_CHAN_LIST_CMDID); |
| 2134 | |
| 2135 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2136 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2137 | wmi_buf_free(buf); |
| 2138 | } |
| 2139 | |
| 2140 | end: |
| 2141 | return qdf_status; |
| 2142 | } |
| 2143 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2144 | /** |
| 2145 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2146 | * @wmi_handle : handle to WMI. |
| 2147 | * @param : pointer to hold mgmt cmd parameter |
| 2148 | * |
| 2149 | * Return: 0 on success and -ve on failure. |
| 2150 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2151 | QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2152 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2153 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2154 | wmi_buf_t buf; |
| 2155 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2156 | int32_t cmd_len; |
| 2157 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2158 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2159 | uint8_t *bufp; |
| 2160 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2161 | mgmt_tx_dl_frm_len; |
| 2162 | |
| 2163 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 2164 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 2165 | |
| 2166 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2167 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2168 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2169 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2170 | } |
| 2171 | |
| 2172 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2173 | bufp = (uint8_t *) cmd; |
| 2174 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2175 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2176 | WMITLV_GET_STRUCT_TLVLEN |
| 2177 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2178 | |
| 2179 | cmd->vdev_id = param->vdev_id; |
| 2180 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2181 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2182 | cmd->chanfreq = param->chanfreq; |
| 2183 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2184 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2185 | sizeof(uint32_t))); |
| 2186 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2187 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2188 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2189 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2190 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 2191 | #if defined(HELIUMPLUS_PADDR64) |
| 2192 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2193 | #endif |
| 2194 | cmd->frame_len = param->frm_len; |
| 2195 | cmd->buf_len = bufp_len; |
| 2196 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2197 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2198 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2199 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2200 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2201 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2202 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2203 | goto err1; |
| 2204 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2205 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2206 | |
| 2207 | err1: |
| 2208 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2209 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2210 | } |
| 2211 | |
| 2212 | /** |
| 2213 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2214 | * @wmi_handle: wmi handle |
| 2215 | * @param_value: parameter value |
| 2216 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2217 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2218 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2219 | 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] | 2220 | uint32_t param_value) |
| 2221 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2222 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2223 | wmi_modem_power_state_cmd_param *cmd; |
| 2224 | wmi_buf_t buf; |
| 2225 | uint16_t len = sizeof(*cmd); |
| 2226 | |
| 2227 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2228 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2229 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2230 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2231 | } |
| 2232 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2233 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2234 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2235 | WMITLV_GET_STRUCT_TLVLEN |
| 2236 | (wmi_modem_power_state_cmd_param)); |
| 2237 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2238 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2239 | param_value); |
| 2240 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2241 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2242 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2243 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2244 | wmi_buf_free(buf); |
| 2245 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2246 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2247 | return ret; |
| 2248 | } |
| 2249 | |
| 2250 | /** |
| 2251 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2252 | * @wmi_handle: wmi handle |
| 2253 | * @vdev_id: vdev id |
| 2254 | * @val: value |
| 2255 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2256 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2257 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2258 | 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] | 2259 | uint32_t vdev_id, uint8_t val) |
| 2260 | { |
| 2261 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2262 | wmi_buf_t buf; |
| 2263 | int32_t len = sizeof(*cmd); |
| 2264 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2265 | 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] | 2266 | |
| 2267 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2268 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2269 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2270 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2271 | } |
| 2272 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2273 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2274 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2275 | WMITLV_GET_STRUCT_TLVLEN |
| 2276 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2277 | cmd->vdev_id = vdev_id; |
| 2278 | if (val) |
| 2279 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2280 | else |
| 2281 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2282 | |
| 2283 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2284 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2285 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2286 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2287 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2288 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2289 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2290 | return 0; |
| 2291 | } |
| 2292 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2293 | /** |
| 2294 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2295 | * @wmi_handle: wmi handle |
| 2296 | * @vdev_id: vdev id |
| 2297 | * @value: value |
| 2298 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2299 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2300 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2301 | QDF_STATUS send_set_mimops_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2302 | uint8_t vdev_id, int value) |
| 2303 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2304 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2305 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2306 | wmi_buf_t buf; |
| 2307 | uint16_t len = sizeof(*cmd); |
| 2308 | |
| 2309 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2310 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2311 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2312 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2313 | } |
| 2314 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2315 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2316 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2317 | WMITLV_GET_STRUCT_TLVLEN |
| 2318 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2319 | |
| 2320 | cmd->vdev_id = vdev_id; |
| 2321 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2322 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2323 | * to SM power save values defined in the specification. |
| 2324 | * Make sure to send the right mapping. |
| 2325 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2326 | switch (value) { |
| 2327 | case 0: |
| 2328 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 2329 | break; |
| 2330 | case 1: |
| 2331 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 2332 | break; |
| 2333 | case 2: |
| 2334 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 2335 | break; |
| 2336 | case 3: |
| 2337 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 2338 | break; |
| 2339 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2340 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 2341 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2342 | } |
| 2343 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2344 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2345 | |
| 2346 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2347 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2348 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2349 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2350 | wmi_buf_free(buf); |
| 2351 | } |
| 2352 | |
| 2353 | return ret; |
| 2354 | } |
| 2355 | |
| 2356 | /** |
| 2357 | * send_set_smps_params_cmd_tlv() - set smps params |
| 2358 | * @wmi_handle: wmi handle |
| 2359 | * @vdev_id: vdev id |
| 2360 | * @value: value |
| 2361 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2362 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2363 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2364 | 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] | 2365 | int value) |
| 2366 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2367 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2368 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 2369 | wmi_buf_t buf; |
| 2370 | uint16_t len = sizeof(*cmd); |
| 2371 | |
| 2372 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2373 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2374 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2375 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2376 | } |
| 2377 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 2378 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2379 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 2380 | WMITLV_GET_STRUCT_TLVLEN |
| 2381 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 2382 | |
| 2383 | cmd->vdev_id = vdev_id; |
| 2384 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 2385 | cmd->param = |
| 2386 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 2387 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2388 | 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] | 2389 | cmd->param); |
| 2390 | |
| 2391 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2392 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2393 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2394 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2395 | wmi_buf_free(buf); |
| 2396 | } |
| 2397 | |
| 2398 | return ret; |
| 2399 | } |
| 2400 | |
| 2401 | /** |
| 2402 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 2403 | * @wmi_handle: wmi handle |
| 2404 | * @noa: p2p power save parameters |
| 2405 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2406 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2407 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2408 | 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] | 2409 | struct p2p_ps_params *noa) |
| 2410 | { |
| 2411 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 2412 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 2413 | wmi_buf_t buf; |
| 2414 | uint8_t *buf_ptr; |
| 2415 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2416 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2417 | uint32_t duration; |
| 2418 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2419 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2420 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 2421 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2422 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2423 | WMI_LOGE("Failed to allocate memory"); |
| 2424 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2425 | goto end; |
| 2426 | } |
| 2427 | |
| 2428 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2429 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 2430 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2431 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 2432 | WMITLV_GET_STRUCT_TLVLEN |
| 2433 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 2434 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 2435 | cmd->vdev_id = noa->session_id; |
| 2436 | cmd->enable = (duration) ? true : false; |
| 2437 | cmd->num_noa = 1; |
| 2438 | |
| 2439 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 2440 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 2441 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 2442 | sizeof |
| 2443 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 2444 | + WMI_TLV_HDR_SIZE); |
| 2445 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 2446 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 2447 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 2448 | noa_discriptor->type_count = noa->count; |
| 2449 | noa_discriptor->duration = duration; |
| 2450 | noa_discriptor->interval = noa->interval; |
| 2451 | noa_discriptor->start_time = 0; |
| 2452 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2453 | 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] | 2454 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 2455 | noa->interval); |
| 2456 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2457 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2458 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2459 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2460 | wmi_buf_free(buf); |
| 2461 | } |
| 2462 | |
| 2463 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2464 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2465 | return status; |
| 2466 | } |
| 2467 | |
| 2468 | |
| 2469 | /** |
| 2470 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 2471 | * @wmi_handle: wmi handle |
| 2472 | * @noa: p2p opp power save parameters |
| 2473 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2474 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2475 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2476 | 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] | 2477 | struct p2p_ps_params *oppps) |
| 2478 | { |
| 2479 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 2480 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2481 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2482 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2483 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2484 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2485 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2486 | WMI_LOGE("Failed to allocate memory"); |
| 2487 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2488 | goto end; |
| 2489 | } |
| 2490 | |
| 2491 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 2492 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2493 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 2494 | WMITLV_GET_STRUCT_TLVLEN |
| 2495 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 2496 | cmd->vdev_id = oppps->session_id; |
| 2497 | if (oppps->ctwindow) |
| 2498 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 2499 | |
| 2500 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2501 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2502 | cmd->vdev_id, oppps->ctwindow); |
| 2503 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 2504 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2505 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2506 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2507 | wmi_buf_free(buf); |
| 2508 | } |
| 2509 | |
| 2510 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2511 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2512 | return status; |
| 2513 | } |
| 2514 | |
| 2515 | /** |
| 2516 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 2517 | * @wmi_handle: wmi handle |
| 2518 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2519 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2520 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2521 | QDF_STATUS send_get_temperature_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2522 | { |
| 2523 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 2524 | wmi_buf_t wmi_buf; |
| 2525 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 2526 | uint8_t *buf_ptr; |
| 2527 | |
| 2528 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2529 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 2530 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2531 | } |
| 2532 | |
| 2533 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2534 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2535 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2536 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2537 | } |
| 2538 | |
| 2539 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2540 | |
| 2541 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 2542 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2543 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 2544 | WMITLV_GET_STRUCT_TLVLEN |
| 2545 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 2546 | |
| 2547 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 2548 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2549 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2550 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2551 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2552 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2553 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2554 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2555 | } |
| 2556 | |
| 2557 | /** |
| 2558 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 2559 | * @wmi_handle: wmi handle |
| 2560 | * @vdevid: vdev id |
| 2561 | * @peer_addr: peer mac address |
| 2562 | * @auto_triggerparam: auto trigger parameters |
| 2563 | * @num_ac: number of access category |
| 2564 | * |
| 2565 | * This function sets the trigger |
| 2566 | * uapsd params such as service interval, delay interval |
| 2567 | * and suspend interval which will be used by the firmware |
| 2568 | * to send trigger frames periodically when there is no |
| 2569 | * traffic on the transmit side. |
| 2570 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2571 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2572 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2573 | 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] | 2574 | struct sta_uapsd_trig_params *param) |
| 2575 | { |
| 2576 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2577 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2578 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 2579 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 2580 | uint32_t i; |
| 2581 | wmi_buf_t buf; |
| 2582 | uint8_t *buf_ptr; |
| 2583 | |
| 2584 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2585 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2586 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2587 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2588 | } |
| 2589 | |
| 2590 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2591 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 2592 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2593 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 2594 | WMITLV_GET_STRUCT_TLVLEN |
| 2595 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 2596 | cmd->vdev_id = param->vdevid; |
| 2597 | cmd->num_ac = param->num_ac; |
| 2598 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 2599 | |
| 2600 | /* TLV indicating array of structures to follow */ |
| 2601 | buf_ptr += sizeof(*cmd); |
| 2602 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 2603 | |
| 2604 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2605 | qdf_mem_copy(buf_ptr, param->auto_triggerparam, param_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2606 | |
| 2607 | /* |
| 2608 | * Update tag and length for uapsd auto trigger params (this will take |
| 2609 | * care of updating tag and length if it is not pre-filled by caller). |
| 2610 | */ |
| 2611 | for (i = 0; i < param->num_ac; i++) { |
| 2612 | WMITLV_SET_HDR((buf_ptr + |
| 2613 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 2614 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 2615 | WMITLV_GET_STRUCT_TLVLEN |
| 2616 | (wmi_sta_uapsd_auto_trig_param)); |
| 2617 | } |
| 2618 | |
| 2619 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2620 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2621 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2622 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2623 | wmi_buf_free(buf); |
| 2624 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2625 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2626 | return ret; |
| 2627 | } |
| 2628 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2629 | /** |
| 2630 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 2631 | * @wmi_handle: pointer to the wmi handle |
| 2632 | * @utc: pointer to the UTC time struct |
| 2633 | * |
| 2634 | * Return: 0 on succes |
| 2635 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2636 | 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] | 2637 | struct ocb_utc_param *utc) |
| 2638 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2639 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2640 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 2641 | uint8_t *buf_ptr; |
| 2642 | uint32_t len, i; |
| 2643 | wmi_buf_t buf; |
| 2644 | |
| 2645 | len = sizeof(*cmd); |
| 2646 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2647 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2648 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2649 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2650 | } |
| 2651 | |
| 2652 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2653 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 2654 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2655 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 2656 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 2657 | cmd->vdev_id = utc->vdev_id; |
| 2658 | |
| 2659 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 2660 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 2661 | |
| 2662 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 2663 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 2664 | |
| 2665 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2666 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2667 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2668 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2669 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2670 | } |
| 2671 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2672 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2673 | } |
| 2674 | |
| 2675 | /** |
| 2676 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 2677 | * frames on a channel |
| 2678 | * @wmi_handle: pointer to the wmi handle |
| 2679 | * @timing_advert: pointer to the timing advertisement struct |
| 2680 | * |
| 2681 | * Return: 0 on succes |
| 2682 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2683 | 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] | 2684 | struct ocb_timing_advert_param *timing_advert) |
| 2685 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2686 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2687 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 2688 | uint8_t *buf_ptr; |
| 2689 | uint32_t len, len_template; |
| 2690 | wmi_buf_t buf; |
| 2691 | |
| 2692 | len = sizeof(*cmd) + |
| 2693 | WMI_TLV_HDR_SIZE; |
| 2694 | |
| 2695 | len_template = timing_advert->template_length; |
| 2696 | /* Add padding to the template if needed */ |
| 2697 | if (len_template % 4 != 0) |
| 2698 | len_template += 4 - (len_template % 4); |
| 2699 | len += len_template; |
| 2700 | |
| 2701 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2702 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2703 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2704 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2705 | } |
| 2706 | |
| 2707 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2708 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 2709 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2710 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 2711 | WMITLV_GET_STRUCT_TLVLEN( |
| 2712 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 2713 | cmd->vdev_id = timing_advert->vdev_id; |
| 2714 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 2715 | cmd->channel_freq = timing_advert->chan_freq; |
| 2716 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 2717 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 2718 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 2719 | buf_ptr += sizeof(*cmd); |
| 2720 | |
| 2721 | /* Add the timing advert template */ |
| 2722 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2723 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2724 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2725 | (uint8_t *)timing_advert->template_value, |
| 2726 | timing_advert->template_length); |
| 2727 | |
| 2728 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2729 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2730 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2731 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2732 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2733 | } |
| 2734 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2735 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2736 | } |
| 2737 | |
| 2738 | /** |
| 2739 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 2740 | * on a channel |
| 2741 | * @wmi_handle: pointer to the wmi handle |
| 2742 | * @timing_advert: pointer to the timing advertisement struct |
| 2743 | * |
| 2744 | * Return: 0 on succes |
| 2745 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2746 | 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] | 2747 | struct ocb_timing_advert_param *timing_advert) |
| 2748 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2749 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2750 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 2751 | uint8_t *buf_ptr; |
| 2752 | uint32_t len; |
| 2753 | wmi_buf_t buf; |
| 2754 | |
| 2755 | len = sizeof(*cmd); |
| 2756 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2757 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2758 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2759 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2760 | } |
| 2761 | |
| 2762 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2763 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 2764 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2765 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 2766 | WMITLV_GET_STRUCT_TLVLEN( |
| 2767 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 2768 | cmd->vdev_id = timing_advert->vdev_id; |
| 2769 | cmd->channel_freq = timing_advert->chan_freq; |
| 2770 | |
| 2771 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2772 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2773 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2774 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2775 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2776 | } |
| 2777 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2778 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2779 | } |
| 2780 | |
| 2781 | /** |
| 2782 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 2783 | * @wmi_handle: pointer to the wmi handle |
| 2784 | * @request: pointer to the request |
| 2785 | * |
| 2786 | * Return: 0 on succes |
| 2787 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2788 | 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] | 2789 | uint8_t vdev_id) |
| 2790 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2791 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2792 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 2793 | uint8_t *buf_ptr; |
| 2794 | wmi_buf_t buf; |
| 2795 | int32_t len; |
| 2796 | |
| 2797 | len = sizeof(*cmd); |
| 2798 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2799 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2800 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2801 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2802 | } |
| 2803 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2804 | |
| 2805 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2806 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2807 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2808 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 2809 | WMITLV_GET_STRUCT_TLVLEN( |
| 2810 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 2811 | cmd->vdev_id = vdev_id; |
| 2812 | |
| 2813 | /* Send the WMI command */ |
| 2814 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2815 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 2816 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2817 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2818 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2819 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2820 | } |
| 2821 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2822 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2823 | } |
| 2824 | |
| 2825 | /** |
| 2826 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 2827 | * @wmi_handle: pointer to the wmi handle |
| 2828 | * @get_stats_param: pointer to the dcc stats |
| 2829 | * |
| 2830 | * Return: 0 on succes |
| 2831 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2832 | 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] | 2833 | struct dcc_get_stats_param *get_stats_param) |
| 2834 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2835 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2836 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 2837 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 2838 | wmi_buf_t buf; |
| 2839 | uint8_t *buf_ptr; |
| 2840 | uint32_t len; |
| 2841 | uint32_t i; |
| 2842 | |
| 2843 | /* Validate the input */ |
| 2844 | if (get_stats_param->request_array_len != |
| 2845 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2846 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2847 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2848 | } |
| 2849 | |
| 2850 | /* Allocate memory for the WMI command */ |
| 2851 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 2852 | get_stats_param->request_array_len; |
| 2853 | |
| 2854 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2855 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2856 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2857 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2858 | } |
| 2859 | |
| 2860 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2861 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2862 | |
| 2863 | /* Populate the WMI command */ |
| 2864 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 2865 | buf_ptr += sizeof(*cmd); |
| 2866 | |
| 2867 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2868 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 2869 | WMITLV_GET_STRUCT_TLVLEN( |
| 2870 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 2871 | cmd->vdev_id = get_stats_param->vdev_id; |
| 2872 | cmd->num_channels = get_stats_param->channel_count; |
| 2873 | |
| 2874 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2875 | get_stats_param->request_array_len); |
| 2876 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2877 | |
| 2878 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2879 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2880 | get_stats_param->request_array_len); |
| 2881 | for (i = 0; i < cmd->num_channels; i++) |
| 2882 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 2883 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 2884 | WMITLV_GET_STRUCT_TLVLEN( |
| 2885 | wmi_dcc_channel_stats_request)); |
| 2886 | |
| 2887 | /* Send the WMI command */ |
| 2888 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2889 | WMI_DCC_GET_STATS_CMDID); |
| 2890 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2891 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2892 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2893 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2894 | } |
| 2895 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2896 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2897 | } |
| 2898 | |
| 2899 | /** |
| 2900 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 2901 | * @wmi_handle: pointer to the wmi handle |
| 2902 | * @vdev_id: vdev id |
| 2903 | * @dcc_stats_bitmap: dcc status bitmap |
| 2904 | * |
| 2905 | * Return: 0 on succes |
| 2906 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2907 | 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] | 2908 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 2909 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2910 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2911 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 2912 | wmi_buf_t buf; |
| 2913 | uint8_t *buf_ptr; |
| 2914 | uint32_t len; |
| 2915 | |
| 2916 | /* Allocate memory for the WMI command */ |
| 2917 | len = sizeof(*cmd); |
| 2918 | |
| 2919 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2920 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2921 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2922 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2923 | } |
| 2924 | |
| 2925 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2926 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2927 | |
| 2928 | /* Populate the WMI command */ |
| 2929 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 2930 | |
| 2931 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2932 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 2933 | WMITLV_GET_STRUCT_TLVLEN( |
| 2934 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 2935 | cmd->vdev_id = vdev_id; |
| 2936 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 2937 | |
| 2938 | /* Send the WMI command */ |
| 2939 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2940 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2941 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2942 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2943 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2944 | } |
| 2945 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2946 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2947 | } |
| 2948 | |
| 2949 | /** |
| 2950 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 2951 | * @wmi_handle: pointer to the wmi handle |
| 2952 | * @update_ndl_param: pointer to the request parameters |
| 2953 | * |
| 2954 | * Return: 0 on success |
| 2955 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2956 | 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] | 2957 | struct dcc_update_ndl_param *update_ndl_param) |
| 2958 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2959 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2960 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 2961 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 2962 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 2963 | uint32_t active_state_count; |
| 2964 | wmi_buf_t buf; |
| 2965 | uint8_t *buf_ptr; |
| 2966 | uint32_t len; |
| 2967 | uint32_t i; |
| 2968 | |
| 2969 | /* validate the input */ |
| 2970 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 2971 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2972 | WMI_LOGE(FL("Invalid parameter")); |
| 2973 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2974 | } |
| 2975 | active_state_count = 0; |
| 2976 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 2977 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 2978 | active_state_count += |
| 2979 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 2980 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 2981 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2982 | WMI_LOGE(FL("Invalid parameter")); |
| 2983 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2984 | } |
| 2985 | |
| 2986 | /* Allocate memory for the WMI command */ |
| 2987 | len = sizeof(*cmd) + |
| 2988 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 2989 | WMI_TLV_HDR_SIZE + |
| 2990 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 2991 | |
| 2992 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2993 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2994 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2995 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2996 | } |
| 2997 | |
| 2998 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2999 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3000 | |
| 3001 | /* Populate the WMI command */ |
| 3002 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3003 | buf_ptr += sizeof(*cmd); |
| 3004 | |
| 3005 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3006 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3007 | WMITLV_GET_STRUCT_TLVLEN( |
| 3008 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3009 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3010 | cmd->num_channel = update_ndl_param->channel_count; |
| 3011 | |
| 3012 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3013 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3014 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3015 | |
| 3016 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3017 | 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] | 3018 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3019 | for (i = 0; i < cmd->num_channel; i++) |
| 3020 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3021 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3022 | WMITLV_GET_STRUCT_TLVLEN( |
| 3023 | wmi_dcc_ndl_chan)); |
| 3024 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3025 | |
| 3026 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3027 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3028 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3029 | |
| 3030 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3031 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3032 | update_ndl_param->dcc_ndl_active_state_list, |
| 3033 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3034 | for (i = 0; i < active_state_count; i++) { |
| 3035 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3036 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3037 | WMITLV_GET_STRUCT_TLVLEN( |
| 3038 | wmi_dcc_ndl_active_state_config)); |
| 3039 | } |
| 3040 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3041 | |
| 3042 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3043 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3044 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3045 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3046 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3047 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3048 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3049 | } |
| 3050 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3051 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3052 | } |
| 3053 | |
| 3054 | /** |
| 3055 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3056 | * @wmi_handle: pointer to the wmi handle |
| 3057 | * @config: the OCB configuration |
| 3058 | * |
| 3059 | * Return: 0 on success |
| 3060 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3061 | 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] | 3062 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3063 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3064 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3065 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3066 | wmi_channel *chan; |
| 3067 | wmi_ocb_channel *ocb_chan; |
| 3068 | wmi_qos_parameter *qos_param; |
| 3069 | wmi_dcc_ndl_chan *ndl_chan; |
| 3070 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3071 | wmi_ocb_schedule_element *sched_elem; |
| 3072 | uint8_t *buf_ptr; |
| 3073 | wmi_buf_t buf; |
| 3074 | int32_t len; |
| 3075 | int32_t i, j, active_state_count; |
| 3076 | |
| 3077 | /* |
| 3078 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3079 | * states. Validate dcc_ndl_active_state_list_len. |
| 3080 | */ |
| 3081 | active_state_count = 0; |
| 3082 | if (config->dcc_ndl_chan_list_len) { |
| 3083 | if (!config->dcc_ndl_chan_list || |
| 3084 | config->dcc_ndl_chan_list_len != |
| 3085 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3086 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3087 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3088 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3089 | } |
| 3090 | |
| 3091 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3092 | i < config->channel_count; ++i, ++ndl_chan) |
| 3093 | active_state_count += |
| 3094 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3095 | |
| 3096 | if (active_state_count) { |
| 3097 | if (!config->dcc_ndl_active_state_list || |
| 3098 | config->dcc_ndl_active_state_list_len != |
| 3099 | active_state_count * |
| 3100 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3101 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3102 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3103 | } |
| 3104 | } |
| 3105 | } |
| 3106 | |
| 3107 | len = sizeof(*cmd) + |
| 3108 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3109 | sizeof(wmi_channel) + |
| 3110 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3111 | sizeof(wmi_ocb_channel) + |
| 3112 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3113 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3114 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3115 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3116 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3117 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3118 | sizeof(wmi_ocb_schedule_element); |
| 3119 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3120 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3121 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3122 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3123 | } |
| 3124 | |
| 3125 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3126 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3127 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3128 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3129 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3130 | cmd->vdev_id = config->session_id; |
| 3131 | cmd->channel_count = config->channel_count; |
| 3132 | cmd->schedule_size = config->schedule_size; |
| 3133 | cmd->flags = config->flags; |
| 3134 | buf_ptr += sizeof(*cmd); |
| 3135 | |
| 3136 | /* Add the wmi_channel info */ |
| 3137 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3138 | config->channel_count*sizeof(wmi_channel)); |
| 3139 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3140 | for (i = 0; i < config->channel_count; i++) { |
| 3141 | chan = (wmi_channel *)buf_ptr; |
| 3142 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3143 | WMITLV_TAG_STRUC_wmi_channel, |
| 3144 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3145 | chan->mhz = config->channels[i].chan_freq; |
| 3146 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3147 | chan->band_center_freq2 = 0; |
| 3148 | chan->info = 0; |
| 3149 | |
| 3150 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3151 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3152 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3153 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3154 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3155 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3156 | config->channels[i].antenna_max); |
| 3157 | |
| 3158 | if (config->channels[i].bandwidth < 10) |
| 3159 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3160 | else if (config->channels[i].bandwidth < 20) |
| 3161 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3162 | buf_ptr += sizeof(*chan); |
| 3163 | } |
| 3164 | |
| 3165 | /* Add the wmi_ocb_channel info */ |
| 3166 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3167 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3168 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3169 | for (i = 0; i < config->channel_count; i++) { |
| 3170 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3171 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3172 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 3173 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 3174 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 3175 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 3176 | config->channels[i].mac_address.bytes, |
| 3177 | &ocb_chan->mac_address); |
| 3178 | buf_ptr += sizeof(*ocb_chan); |
| 3179 | } |
| 3180 | |
| 3181 | /* Add the wmi_qos_parameter info */ |
| 3182 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3183 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 3184 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3185 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 3186 | for (i = 0; i < config->channel_count; i++) { |
| 3187 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 3188 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 3189 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 3190 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 3191 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 3192 | qos_param->aifsn = |
| 3193 | config->channels[i].qos_params[j].aifsn; |
| 3194 | qos_param->cwmin = |
| 3195 | config->channels[i].qos_params[j].cwmin; |
| 3196 | qos_param->cwmax = |
| 3197 | config->channels[i].qos_params[j].cwmax; |
| 3198 | buf_ptr += sizeof(*qos_param); |
| 3199 | } |
| 3200 | } |
| 3201 | |
| 3202 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 3203 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3204 | config->dcc_ndl_chan_list_len); |
| 3205 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3206 | if (config->dcc_ndl_chan_list_len) { |
| 3207 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3208 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3209 | config->dcc_ndl_chan_list_len); |
| 3210 | for (i = 0; i < config->channel_count; i++) |
| 3211 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 3212 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3213 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 3214 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 3215 | } |
| 3216 | |
| 3217 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 3218 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 3219 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 3220 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3221 | if (active_state_count) { |
| 3222 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3223 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3224 | config->dcc_ndl_active_state_list, |
| 3225 | active_state_count * sizeof(*ndl_active_config)); |
| 3226 | for (i = 0; i < active_state_count; ++i) |
| 3227 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 3228 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3229 | WMITLV_GET_STRUCT_TLVLEN( |
| 3230 | wmi_dcc_ndl_active_state_config)); |
| 3231 | buf_ptr += active_state_count * |
| 3232 | sizeof(*ndl_active_config); |
| 3233 | } |
| 3234 | |
| 3235 | /* Add the wmi_ocb_schedule_element info */ |
| 3236 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3237 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 3238 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3239 | for (i = 0; i < config->schedule_size; i++) { |
| 3240 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 3241 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 3242 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 3243 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 3244 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 3245 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 3246 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 3247 | buf_ptr += sizeof(*sched_elem); |
| 3248 | } |
| 3249 | |
| 3250 | |
| 3251 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3252 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3253 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3254 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3255 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3256 | } |
| 3257 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3258 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3259 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3260 | |
| 3261 | /** |
| 3262 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 3263 | * @wmi_handle: wmi handle |
| 3264 | * @mcc_adaptive_scheduler: enable/disable |
| 3265 | * |
| 3266 | * This function enable/disable mcc adaptive scheduler in fw. |
| 3267 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3268 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3269 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3270 | QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3271 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 3272 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3273 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3274 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3275 | wmi_buf_t buf = 0; |
| 3276 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 3277 | uint16_t len = |
| 3278 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 3279 | |
| 3280 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3281 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3282 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 3283 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3284 | } |
| 3285 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 3286 | wmi_buf_data(buf); |
| 3287 | |
| 3288 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3289 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 3290 | WMITLV_GET_STRUCT_TLVLEN |
| 3291 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 3292 | cmd->enable = mcc_adaptive_scheduler; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3293 | cmd->pdev_id = pdev_id; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3294 | |
| 3295 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3296 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3297 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3298 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3299 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3300 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3301 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3302 | |
| 3303 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3304 | } |
| 3305 | |
| 3306 | /** |
| 3307 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 3308 | * @wmi: wmi handle |
| 3309 | * @mcc_channel: mcc channel |
| 3310 | * @mcc_channel_time_latency: MCC channel time latency. |
| 3311 | * |
| 3312 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 3313 | * channel of it and channel number. The info is provided run time using |
| 3314 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 3315 | * |
| 3316 | * Return: CDF status |
| 3317 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3318 | 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] | 3319 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 3320 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3321 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3322 | wmi_buf_t buf = 0; |
| 3323 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 3324 | uint16_t len = 0; |
| 3325 | uint8_t *buf_ptr = NULL; |
| 3326 | wmi_resmgr_chan_latency chan_latency; |
| 3327 | /* Note: we only support MCC time latency for a single channel */ |
| 3328 | uint32_t num_channels = 1; |
| 3329 | uint32_t chan1_freq = mcc_channel_freq; |
| 3330 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 3331 | |
| 3332 | |
| 3333 | /* If 0ms latency is provided, then FW will set to a default. |
| 3334 | * Otherwise, latency must be at least 30ms. |
| 3335 | */ |
| 3336 | if ((latency_chan1 > 0) && |
| 3337 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3338 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3339 | "Minimum is 30ms (or 0 to use default value by " |
| 3340 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3341 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3342 | } |
| 3343 | |
| 3344 | /* Set WMI CMD for channel time latency here */ |
| 3345 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 3346 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 3347 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 3348 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3349 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3350 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3351 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3352 | } |
| 3353 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3354 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 3355 | wmi_buf_data(buf); |
| 3356 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 3357 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 3358 | WMITLV_GET_STRUCT_TLVLEN |
| 3359 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 3360 | cmdTL->num_chans = num_channels; |
| 3361 | /* Update channel time latency information for home channel(s) */ |
| 3362 | buf_ptr += sizeof(*cmdTL); |
| 3363 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3364 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 3365 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3366 | chan_latency.chan_mhz = chan1_freq; |
| 3367 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3368 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3369 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3370 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3371 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3372 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3373 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3374 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3375 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3376 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3377 | |
| 3378 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3379 | } |
| 3380 | |
| 3381 | /** |
| 3382 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 3383 | * @wmi: wmi handle |
| 3384 | * @adapter_1_chan_number: adapter 1 channel number |
| 3385 | * @adapter_1_quota: adapter 1 quota |
| 3386 | * @adapter_2_chan_number: adapter 2 channel number |
| 3387 | * |
| 3388 | * Return: CDF status |
| 3389 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3390 | 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] | 3391 | uint32_t adapter_1_chan_freq, |
| 3392 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 3393 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3394 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3395 | wmi_buf_t buf = 0; |
| 3396 | uint16_t len = 0; |
| 3397 | uint8_t *buf_ptr = NULL; |
| 3398 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 3399 | wmi_resmgr_chan_time_quota chan_quota; |
| 3400 | uint32_t quota_chan1 = adapter_1_quota; |
| 3401 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 3402 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 3403 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 3404 | uint32_t num_channels = 2; |
| 3405 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 3406 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 3407 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3408 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3409 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 3410 | chan1_freq, quota_chan1, chan2_freq, |
| 3411 | quota_chan2); |
| 3412 | |
| 3413 | /* |
| 3414 | * Perform sanity check on time quota values provided. |
| 3415 | */ |
| 3416 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 3417 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3418 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3419 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3420 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3421 | } |
| 3422 | /* Set WMI CMD for channel time quota here */ |
| 3423 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 3424 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 3425 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 3426 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3427 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3428 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3429 | QDF_ASSERT(0); |
| 3430 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3431 | } |
| 3432 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3433 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 3434 | wmi_buf_data(buf); |
| 3435 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 3436 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 3437 | WMITLV_GET_STRUCT_TLVLEN |
| 3438 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 3439 | cmdTQ->num_chans = num_channels; |
| 3440 | |
| 3441 | /* Update channel time quota information for home channel(s) */ |
| 3442 | buf_ptr += sizeof(*cmdTQ); |
| 3443 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3444 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 3445 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3446 | chan_quota.chan_mhz = chan1_freq; |
| 3447 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3448 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3449 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 3450 | buf_ptr += sizeof(chan_quota); |
| 3451 | chan_quota.chan_mhz = chan2_freq; |
| 3452 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3453 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3454 | |
| 3455 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3456 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3457 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3458 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3459 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3460 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3461 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3462 | |
| 3463 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3464 | } |
| 3465 | |
| 3466 | /** |
| 3467 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 3468 | * @wmi_handle: Pointer to wmi handle |
| 3469 | * @thermal_info: Thermal command information |
| 3470 | * |
| 3471 | * This function sends the thermal management command |
| 3472 | * to the firmware |
| 3473 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3474 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3475 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3476 | 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] | 3477 | struct thermal_cmd_params *thermal_info) |
| 3478 | { |
| 3479 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 3480 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3481 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3482 | uint32_t len = 0; |
| 3483 | |
| 3484 | len = sizeof(*cmd); |
| 3485 | |
| 3486 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3487 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3488 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3489 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3490 | } |
| 3491 | |
| 3492 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 3493 | |
| 3494 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3495 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 3496 | WMITLV_GET_STRUCT_TLVLEN |
| 3497 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 3498 | |
| 3499 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 3500 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 3501 | cmd->enable = thermal_info->thermal_enable; |
| 3502 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3503 | 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] | 3504 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 3505 | |
| 3506 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3507 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3508 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3509 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3510 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3511 | } |
| 3512 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3513 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3514 | } |
| 3515 | |
| 3516 | |
| 3517 | /** |
| 3518 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3519 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3520 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 3521 | * |
| 3522 | * This function sends down the LRO configuration parameters to |
| 3523 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 3524 | * seed values for the toeplitz hash generation |
| 3525 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3526 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3527 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3528 | QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3529 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 3530 | { |
| 3531 | wmi_lro_info_cmd_fixed_param *cmd; |
| 3532 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3533 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3534 | |
| 3535 | |
| 3536 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3537 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3538 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3539 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3540 | } |
| 3541 | |
| 3542 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 3543 | |
| 3544 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3545 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 3546 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 3547 | |
| 3548 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 3549 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 3550 | wmi_lro_cmd->tcp_flag); |
| 3551 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 3552 | wmi_lro_cmd->tcp_flag_mask); |
| 3553 | cmd->toeplitz_hash_ipv4_0_3 = |
| 3554 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 3555 | cmd->toeplitz_hash_ipv4_4_7 = |
| 3556 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 3557 | cmd->toeplitz_hash_ipv4_8_11 = |
| 3558 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 3559 | cmd->toeplitz_hash_ipv4_12_15 = |
| 3560 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 3561 | cmd->toeplitz_hash_ipv4_16 = |
| 3562 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 3563 | |
| 3564 | cmd->toeplitz_hash_ipv6_0_3 = |
| 3565 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 3566 | cmd->toeplitz_hash_ipv6_4_7 = |
| 3567 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 3568 | cmd->toeplitz_hash_ipv6_8_11 = |
| 3569 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 3570 | cmd->toeplitz_hash_ipv6_12_15 = |
| 3571 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 3572 | cmd->toeplitz_hash_ipv6_16_19 = |
| 3573 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 3574 | cmd->toeplitz_hash_ipv6_20_23 = |
| 3575 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 3576 | cmd->toeplitz_hash_ipv6_24_27 = |
| 3577 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 3578 | cmd->toeplitz_hash_ipv6_28_31 = |
| 3579 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 3580 | cmd->toeplitz_hash_ipv6_32_35 = |
| 3581 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 3582 | cmd->toeplitz_hash_ipv6_36_39 = |
| 3583 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 3584 | cmd->toeplitz_hash_ipv6_40 = |
| 3585 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 3586 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3587 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3588 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 3589 | |
| 3590 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 3591 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3592 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3593 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3594 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3595 | } |
| 3596 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3597 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3598 | } |
| 3599 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3600 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3601 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 3602 | * @wmi_handle: Pointer to wmi handle |
| 3603 | * @rate_report_params: Pointer to peer rate report parameters |
| 3604 | * |
| 3605 | * |
| 3606 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 3607 | */ |
| 3608 | QDF_STATUS send_peer_rate_report_cmd_tlv(wmi_unified_t wmi_handle, |
| 3609 | struct wmi_peer_rate_report_params *rate_report_params) |
| 3610 | { |
| 3611 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 3612 | wmi_buf_t buf = NULL; |
| 3613 | QDF_STATUS status = 0; |
| 3614 | uint32_t len = 0; |
| 3615 | uint32_t i, j; |
| 3616 | |
| 3617 | len = sizeof(*cmd); |
| 3618 | |
| 3619 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3620 | if (!buf) { |
| 3621 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 3622 | return QDF_STATUS_E_FAILURE; |
| 3623 | } |
| 3624 | |
| 3625 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 3626 | wmi_buf_data(buf); |
| 3627 | |
| 3628 | WMITLV_SET_HDR( |
| 3629 | &cmd->tlv_header, |
| 3630 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 3631 | WMITLV_GET_STRUCT_TLVLEN( |
| 3632 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 3633 | |
| 3634 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 3635 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 3636 | cmd->report_timer_period = rate_report_params->timer_period; |
| 3637 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 3638 | cmd->cond_per_phy[i].val_cond_flags = |
| 3639 | rate_report_params->report_per_phy[i].cond_flags; |
| 3640 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 3641 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 3642 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 3643 | rate_report_params->report_per_phy[i].delta.percent; |
| 3644 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 3645 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 3646 | rate_report_params->report_per_phy[i]. |
| 3647 | report_rate_threshold[j]; |
| 3648 | } |
| 3649 | } |
| 3650 | |
| 3651 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 3652 | cmd->enable_rate_report, |
| 3653 | cmd->report_backoff_time, cmd->report_timer_period); |
| 3654 | |
| 3655 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3656 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 3657 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3658 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3659 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 3660 | __func__); |
| 3661 | } |
| 3662 | return status; |
| 3663 | } |
| 3664 | |
| 3665 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3666 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 3667 | * @wmi_handle: wmi handle |
| 3668 | * @param: bcn ll cmd parameter |
| 3669 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3670 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3671 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3672 | 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] | 3673 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 3674 | { |
| 3675 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 3676 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3677 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3678 | |
| 3679 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3680 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3681 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3682 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3683 | } |
| 3684 | |
| 3685 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 3686 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3687 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 3688 | WMITLV_GET_STRUCT_TLVLEN |
| 3689 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 3690 | cmd->vdev_id = param->vdev_id; |
| 3691 | cmd->data_len = param->data_len; |
| 3692 | cmd->frame_ctrl = param->frame_ctrl; |
| 3693 | cmd->frag_ptr = param->frag_ptr; |
| 3694 | cmd->dtim_flag = param->dtim_flag; |
| 3695 | |
| 3696 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 3697 | WMI_PDEV_SEND_BCN_CMDID); |
| 3698 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3699 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3700 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3701 | wmi_buf_free(wmi_buf); |
| 3702 | } |
| 3703 | |
| 3704 | return ret; |
| 3705 | } |
| 3706 | |
| 3707 | /** |
| 3708 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 3709 | * @wmi_handle: wmi handle |
| 3710 | * @vdev_id: vdev id |
| 3711 | * @max_retries: max retries |
| 3712 | * @retry_interval: retry interval |
| 3713 | * This function sets sta query related parameters in fw. |
| 3714 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3715 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3716 | */ |
| 3717 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3718 | 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] | 3719 | uint8_t vdev_id, uint32_t max_retries, |
| 3720 | uint32_t retry_interval) |
| 3721 | { |
| 3722 | wmi_buf_t buf; |
| 3723 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 3724 | int len; |
| 3725 | |
| 3726 | len = sizeof(*cmd); |
| 3727 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3728 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3729 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3730 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3731 | } |
| 3732 | |
| 3733 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 3734 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3735 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 3736 | WMITLV_GET_STRUCT_TLVLEN |
| 3737 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 3738 | |
| 3739 | |
| 3740 | cmd->vdev_id = vdev_id; |
| 3741 | cmd->sa_query_max_retry_count = max_retries; |
| 3742 | cmd->sa_query_retry_interval = retry_interval; |
| 3743 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3744 | 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] | 3745 | vdev_id, retry_interval, max_retries); |
| 3746 | |
| 3747 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3748 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3749 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3750 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3751 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3752 | } |
| 3753 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3754 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3755 | return 0; |
| 3756 | } |
| 3757 | |
| 3758 | /** |
| 3759 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 3760 | * @wmi_handle: wmi handle |
| 3761 | * @params: sta keep alive parameter |
| 3762 | * |
| 3763 | * This function sets keep alive related parameters in fw. |
| 3764 | * |
| 3765 | * Return: CDF status |
| 3766 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3767 | 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] | 3768 | struct sta_params *params) |
| 3769 | { |
| 3770 | wmi_buf_t buf; |
| 3771 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 3772 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 3773 | uint8_t *buf_ptr; |
| 3774 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3775 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3776 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3777 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3778 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3779 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 3780 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3781 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3782 | WMI_LOGE("wmi_buf_alloc failed"); |
| 3783 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3784 | } |
| 3785 | |
| 3786 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 3787 | buf_ptr = (uint8_t *) cmd; |
| 3788 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3789 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 3790 | WMITLV_GET_STRUCT_TLVLEN |
| 3791 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 3792 | cmd->interval = params->timeperiod; |
| 3793 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 3794 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3795 | 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] | 3796 | params->timeperiod, params->method); |
| 3797 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 3798 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 3799 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 3800 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 3801 | |
| 3802 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 3803 | if ((NULL == params->hostv4addr) || |
| 3804 | (NULL == params->destv4addr) || |
| 3805 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3806 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3807 | "destv4addr:%p destmac:%p ", __func__, |
| 3808 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3809 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3810 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3811 | } |
| 3812 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3813 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3814 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3815 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3816 | WMI_IPV4_ADDR_LEN); |
| 3817 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 3818 | } else { |
| 3819 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 3820 | } |
| 3821 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3822 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3823 | WMI_STA_KEEPALIVE_CMDID); |
| 3824 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3825 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3826 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3827 | } |
| 3828 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3829 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3830 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3831 | } |
| 3832 | |
| 3833 | /** |
| 3834 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 3835 | * @wmi_handle: wmi handle |
| 3836 | * @if_id: vdev id |
| 3837 | * @gtx_info: GTX config params |
| 3838 | * |
| 3839 | * This function set GTX related params in firmware. |
| 3840 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3841 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3842 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3843 | 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] | 3844 | struct wmi_gtx_config *gtx_info) |
| 3845 | { |
| 3846 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 3847 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3848 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3849 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3850 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3851 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3852 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3853 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3854 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3855 | } |
| 3856 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 3857 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3858 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 3859 | WMITLV_GET_STRUCT_TLVLEN |
| 3860 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 3861 | cmd->vdev_id = if_id; |
| 3862 | |
| 3863 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 3864 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 3865 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 3866 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 3867 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 3868 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 3869 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 3870 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 3871 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3872 | 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] | 3873 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 3874 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 3875 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 3876 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 3877 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3878 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3879 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3880 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 3881 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 3882 | wmi_buf_free(buf); |
| 3883 | } |
| 3884 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3885 | } |
| 3886 | |
| 3887 | /** |
| 3888 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 3889 | * @wmi_handle: wmi handle |
| 3890 | * @edca_params: edca parameters |
| 3891 | * |
| 3892 | * This function updates EDCA parameters to the target |
| 3893 | * |
| 3894 | * Return: CDF Status |
| 3895 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3896 | 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] | 3897 | uint8_t vdev_id, |
| 3898 | wmi_wmm_vparams gwmm_param[WMI_MAX_NUM_AC]) |
| 3899 | { |
| 3900 | uint8_t *buf_ptr; |
| 3901 | wmi_buf_t buf; |
| 3902 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
| 3903 | wmi_wmm_vparams *wmm_param, *twmm_param; |
| 3904 | int len = sizeof(*cmd); |
| 3905 | int ac; |
| 3906 | |
| 3907 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3908 | |
| 3909 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3910 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3911 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3912 | } |
| 3913 | |
| 3914 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3915 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 3916 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3917 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3918 | WMITLV_GET_STRUCT_TLVLEN |
| 3919 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 3920 | cmd->vdev_id = vdev_id; |
| 3921 | |
| 3922 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 3923 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
| 3924 | twmm_param = (wmi_wmm_vparams *) (&gwmm_param[ac]); |
| 3925 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 3926 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3927 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 3928 | wmm_param->cwmin = twmm_param->cwmin; |
| 3929 | wmm_param->cwmax = twmm_param->cwmax; |
| 3930 | wmm_param->aifs = twmm_param->aifs; |
| 3931 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 3932 | wmm_param->acm = twmm_param->acm; |
| 3933 | wmm_param->no_ack = twmm_param->no_ack; |
| 3934 | } |
| 3935 | |
| 3936 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3937 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 3938 | goto fail; |
| 3939 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3940 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3941 | |
| 3942 | fail: |
| 3943 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3944 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 3945 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3946 | } |
| 3947 | |
| 3948 | /** |
| 3949 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 3950 | * @wmi_handle: wmi handle |
| 3951 | * @vdev_id: vdev id |
| 3952 | * @probe_rsp_info: probe response info |
| 3953 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3954 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3955 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3956 | 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] | 3957 | uint8_t vdev_id, |
| 3958 | struct wmi_probe_resp_params *probe_rsp_info, |
| 3959 | uint8_t *frm) |
| 3960 | { |
| 3961 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 3962 | wmi_bcn_prb_info *bcn_prb_info; |
| 3963 | wmi_buf_t wmi_buf; |
| 3964 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 3965 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3966 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3967 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3968 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3969 | |
| 3970 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 3971 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 3972 | |
| 3973 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 3974 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 3975 | tmpl_len_aligned; |
| 3976 | |
| 3977 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3978 | 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] | 3979 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3980 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3981 | } |
| 3982 | |
| 3983 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 3984 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3985 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3986 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3987 | } |
| 3988 | |
| 3989 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3990 | |
| 3991 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 3992 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3993 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 3994 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 3995 | cmd->vdev_id = vdev_id; |
| 3996 | cmd->buf_len = tmpl_len; |
| 3997 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 3998 | |
| 3999 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4000 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4001 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4002 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4003 | bcn_prb_info->caps = 0; |
| 4004 | bcn_prb_info->erp = 0; |
| 4005 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4006 | |
| 4007 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4008 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4009 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4010 | |
| 4011 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4012 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4013 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4014 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4015 | wmi_buf_free(wmi_buf); |
| 4016 | } |
| 4017 | |
| 4018 | return ret; |
| 4019 | } |
| 4020 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4021 | #ifdef FEATURE_WLAN_WAPI |
| 4022 | #define WPI_IV_LEN 16 |
| 4023 | |
| 4024 | /** |
| 4025 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4026 | * |
| 4027 | * @dest_tx: destination address of tsc key counter |
| 4028 | * @src_tx: source address of tsc key counter |
| 4029 | * @dest_rx: destination address of rsc key counter |
| 4030 | * @src_rx: source address of rsc key counter |
| 4031 | * |
| 4032 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4033 | * |
| 4034 | * Return: None |
| 4035 | * |
| 4036 | */ |
| 4037 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4038 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4039 | { |
| 4040 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4041 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4042 | } |
| 4043 | #else |
| 4044 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4045 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4046 | { |
| 4047 | return; |
| 4048 | } |
| 4049 | #endif |
| 4050 | |
| 4051 | /** |
| 4052 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4053 | * @wmi_handle: wmi handle |
| 4054 | * @key_params: key parameters |
| 4055 | * |
| 4056 | * This function fills structure from information |
| 4057 | * passed in key_params. |
| 4058 | * |
| 4059 | * Return: QDF_STATUS_SUCCESS - success |
| 4060 | * QDF_STATUS_E_FAILURE - failure |
| 4061 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4062 | */ |
| 4063 | QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle, |
| 4064 | struct set_key_params *key_params) |
| 4065 | { |
| 4066 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4067 | wmi_buf_t buf; |
| 4068 | uint8_t *buf_ptr; |
| 4069 | uint32_t len; |
| 4070 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4071 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4072 | |
| 4073 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4074 | WMI_TLV_HDR_SIZE; |
| 4075 | |
| 4076 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4077 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4078 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4079 | return QDF_STATUS_E_NOMEM; |
| 4080 | } |
| 4081 | |
| 4082 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4083 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4084 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4085 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4086 | WMITLV_GET_STRUCT_TLVLEN |
| 4087 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4088 | cmd->vdev_id = key_params->vdev_id; |
| 4089 | cmd->key_ix = key_params->key_idx; |
| 4090 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4091 | cmd->key_flags |= key_params->key_flags; |
| 4092 | cmd->key_cipher = key_params->key_cipher; |
| 4093 | if ((key_params->key_txmic_len) && |
| 4094 | (key_params->key_rxmic_len)) { |
| 4095 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4096 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4097 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4098 | #ifdef FEATURE_WLAN_WAPI |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4099 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4100 | key_params->tx_iv, |
| 4101 | cmd->wpi_key_rsc_counter, |
| 4102 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4103 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4104 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4105 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4106 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4107 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4108 | qdf_mem_copy((void *)key_data, |
| 4109 | (const void *)key_params->key_data, key_params->key_len); |
| 4110 | cmd->key_len = key_params->key_len; |
| 4111 | |
| 4112 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4113 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4114 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4115 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4116 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4117 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4118 | } |
| 4119 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4120 | /** |
| 4121 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 4122 | * @wmi_handle: wmi handle |
| 4123 | * @params: encrypt/decrypt params |
| 4124 | * |
| 4125 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4126 | */ |
| 4127 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 4128 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 4129 | { |
| 4130 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 4131 | wmi_buf_t wmi_buf; |
| 4132 | uint8_t *buf_ptr; |
| 4133 | QDF_STATUS ret; |
| 4134 | uint32_t len; |
| 4135 | |
| 4136 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 4137 | |
| 4138 | len = sizeof(*cmd) + |
| 4139 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 4140 | WMI_TLV_HDR_SIZE; |
| 4141 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4142 | if (!wmi_buf) { |
| 4143 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 4144 | __func__); |
| 4145 | return QDF_STATUS_E_NOMEM; |
| 4146 | } |
| 4147 | |
| 4148 | buf_ptr = wmi_buf_data(wmi_buf); |
| 4149 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 4150 | |
| 4151 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4152 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 4153 | WMITLV_GET_STRUCT_TLVLEN( |
| 4154 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 4155 | |
| 4156 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 4157 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 4158 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 4159 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 4160 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 4161 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 4162 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 4163 | |
| 4164 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 4165 | encrypt_decrypt_params->key_len); |
| 4166 | |
| 4167 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 4168 | MAX_MAC_HEADER_LEN); |
| 4169 | |
| 4170 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 4171 | |
| 4172 | if (cmd->data_len) { |
| 4173 | buf_ptr += sizeof(*cmd); |
| 4174 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4175 | roundup(encrypt_decrypt_params->data_len, |
| 4176 | sizeof(A_UINT32))); |
| 4177 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4178 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 4179 | encrypt_decrypt_params->data_len); |
| 4180 | } |
| 4181 | |
| 4182 | /* This conversion is to facilitate data to FW in little endian */ |
| 4183 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 4184 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 4185 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 4186 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 4187 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 4188 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 4189 | |
| 4190 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4191 | wmi_buf, len, |
| 4192 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 4193 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4194 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 4195 | wmi_buf_free(wmi_buf); |
| 4196 | } |
| 4197 | |
| 4198 | return ret; |
| 4199 | } |
| 4200 | |
| 4201 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4202 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4203 | /** |
| 4204 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 4205 | * @wmi_handle: wmi handle |
| 4206 | * @vdev_id: vdev id |
| 4207 | * @p2p_ie: p2p IE |
| 4208 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4209 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4210 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4211 | 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] | 4212 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 4213 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4214 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4215 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 4216 | wmi_buf_t wmi_buf; |
| 4217 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 4218 | uint8_t *buf_ptr; |
| 4219 | |
| 4220 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 4221 | |
| 4222 | /* More than one P2P IE may be included in a single frame. |
| 4223 | If multiple P2P IEs are present, the complete P2P attribute |
| 4224 | data consists of the concatenation of the P2P Attribute |
| 4225 | fields of the P2P IEs. The P2P Attributes field of each |
| 4226 | P2P IE may be any length up to the maximum (251 octets). |
| 4227 | In this case host sends one P2P IE to firmware so the length |
| 4228 | should not exceed more than 251 bytes |
| 4229 | */ |
| 4230 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4231 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4232 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4233 | } |
| 4234 | |
| 4235 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 4236 | |
| 4237 | wmi_buf_len = |
| 4238 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 4239 | WMI_TLV_HDR_SIZE; |
| 4240 | |
| 4241 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4242 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4243 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4244 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4245 | } |
| 4246 | |
| 4247 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4248 | |
| 4249 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 4250 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4251 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 4252 | WMITLV_GET_STRUCT_TLVLEN |
| 4253 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 4254 | cmd->vdev_id = vdev_id; |
| 4255 | cmd->ie_buf_len = ie_len; |
| 4256 | |
| 4257 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 4258 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 4259 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4260 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4261 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4262 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4263 | |
| 4264 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4265 | wmi_buf, wmi_buf_len, |
| 4266 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4267 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4268 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4269 | wmi_buf_free(wmi_buf); |
| 4270 | } |
| 4271 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4272 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4273 | return ret; |
| 4274 | } |
| 4275 | |
| 4276 | /** |
| 4277 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 4278 | * @wmi_handle: wmi handle |
| 4279 | * @req: gateway parameter update request structure |
| 4280 | * |
| 4281 | * This function reads the incoming @req and fill in the destination |
| 4282 | * WMI structure and sends down the gateway configs down to the firmware |
| 4283 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4284 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4285 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4286 | 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] | 4287 | struct gateway_update_req_param *req) |
| 4288 | { |
| 4289 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 4290 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4291 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4292 | int len = sizeof(*cmd); |
| 4293 | |
| 4294 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4295 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4296 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4297 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4298 | } |
| 4299 | |
| 4300 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 4301 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4302 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 4303 | WMITLV_GET_STRUCT_TLVLEN( |
| 4304 | wmi_roam_subnet_change_config_fixed_param)); |
| 4305 | |
| 4306 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4307 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 4308 | QDF_IPV4_ADDR_SIZE); |
| 4309 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 4310 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4311 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 4312 | &cmd->inet_gw_mac_addr); |
| 4313 | cmd->max_retries = req->max_retries; |
| 4314 | cmd->timeout = req->timeout; |
| 4315 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 4316 | cmd->flag = 0; |
| 4317 | if (req->ipv4_addr_type) |
| 4318 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 4319 | |
| 4320 | if (req->ipv6_addr_type) |
| 4321 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 4322 | |
| 4323 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4324 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4325 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4326 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4327 | ret); |
| 4328 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4329 | } |
| 4330 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4331 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4332 | } |
| 4333 | |
| 4334 | /** |
| 4335 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 4336 | * @wmi_handle: wmi handle |
| 4337 | * @req: rssi monitoring request structure |
| 4338 | * |
| 4339 | * This function reads the incoming @req and fill in the destination |
| 4340 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 4341 | * |
| 4342 | * Return: 0 on success; error number otherwise |
| 4343 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4344 | 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] | 4345 | struct rssi_monitor_param *req) |
| 4346 | { |
| 4347 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 4348 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4349 | QDF_STATUS ret; |
| 4350 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4351 | |
| 4352 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4353 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4354 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4355 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4356 | } |
| 4357 | |
| 4358 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 4359 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4360 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 4361 | WMITLV_GET_STRUCT_TLVLEN( |
| 4362 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 4363 | |
| 4364 | cmd->vdev_id = req->session_id; |
| 4365 | cmd->request_id = req->request_id; |
| 4366 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 4367 | cmd->hi_rssi_reenable_histeresis = 0; |
| 4368 | cmd->min_report_interval = 0; |
| 4369 | cmd->max_num_report = 1; |
| 4370 | if (req->control) { |
| 4371 | /* enable one threshold for each min/max */ |
| 4372 | cmd->enabled_bitmap = 0x09; |
| 4373 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 4374 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 4375 | } else { |
| 4376 | cmd->enabled_bitmap = 0; |
| 4377 | cmd->low_rssi_breach_threshold[0] = 0; |
| 4378 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 4379 | } |
| 4380 | |
| 4381 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4382 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4383 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4384 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4385 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4386 | } |
| 4387 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4388 | WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4389 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4390 | } |
| 4391 | |
| 4392 | /** |
| 4393 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 4394 | * @wmi_handle: wmi handle |
| 4395 | * @psetoui: OUI parameters |
| 4396 | * |
| 4397 | * set scan probe OUI parameters in firmware |
| 4398 | * |
| 4399 | * Return: CDF status |
| 4400 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4401 | 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] | 4402 | struct scan_mac_oui *psetoui) |
| 4403 | { |
| 4404 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 4405 | wmi_buf_t wmi_buf; |
| 4406 | uint32_t len; |
| 4407 | uint8_t *buf_ptr; |
| 4408 | uint32_t *oui_buf; |
| 4409 | |
| 4410 | len = sizeof(*cmd); |
| 4411 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4412 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4413 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4414 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4415 | } |
| 4416 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4417 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 4418 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4419 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 4420 | WMITLV_GET_STRUCT_TLVLEN |
| 4421 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 4422 | |
| 4423 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4424 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4425 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 4426 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4427 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4428 | cmd->prob_req_oui); |
| 4429 | |
| 4430 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4431 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4432 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4433 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4434 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4435 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4436 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4437 | } |
| 4438 | |
| 4439 | /** |
| 4440 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 4441 | * @wmi_handle: wmi handle |
| 4442 | * @req: passpoint network request structure |
| 4443 | * |
| 4444 | * This function sends down WMI command with network id set to wildcard id. |
| 4445 | * firmware shall clear all the config entries |
| 4446 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4447 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4448 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4449 | 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] | 4450 | struct wifi_passpoint_req_param *req) |
| 4451 | { |
| 4452 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 4453 | wmi_buf_t buf; |
| 4454 | uint32_t len; |
| 4455 | int ret; |
| 4456 | |
| 4457 | len = sizeof(*cmd); |
| 4458 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4459 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4460 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4461 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4462 | } |
| 4463 | |
| 4464 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 4465 | |
| 4466 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4467 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 4468 | WMITLV_GET_STRUCT_TLVLEN( |
| 4469 | wmi_passpoint_config_cmd_fixed_param)); |
| 4470 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 4471 | |
| 4472 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4473 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 4474 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4475 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4476 | __func__); |
| 4477 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4478 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4479 | } |
| 4480 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4481 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4482 | } |
| 4483 | |
| 4484 | /** |
| 4485 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 4486 | * @wmi_handle: wmi handle |
| 4487 | * @req: passpoint network request structure |
| 4488 | * |
| 4489 | * This function reads the incoming @req and fill in the destination |
| 4490 | * WMI structure and send down the passpoint configs down to the firmware |
| 4491 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4492 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4493 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4494 | 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] | 4495 | struct wifi_passpoint_req_param *req) |
| 4496 | { |
| 4497 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 4498 | u_int8_t i, j, *bytes; |
| 4499 | wmi_buf_t buf; |
| 4500 | uint32_t len; |
| 4501 | int ret; |
| 4502 | |
| 4503 | len = sizeof(*cmd); |
| 4504 | for (i = 0; i < req->num_networks; i++) { |
| 4505 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4506 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4507 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4508 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4509 | } |
| 4510 | |
| 4511 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 4512 | wmi_buf_data(buf); |
| 4513 | |
| 4514 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4515 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 4516 | WMITLV_GET_STRUCT_TLVLEN( |
| 4517 | wmi_passpoint_config_cmd_fixed_param)); |
| 4518 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4519 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 4520 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4521 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4522 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4523 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 4524 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4525 | 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] | 4526 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 4527 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 4528 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4529 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4530 | &req->networks[i].roaming_consortium_ids[j], |
| 4531 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 4532 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4533 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4534 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4535 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4536 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 4537 | |
| 4538 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4539 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 4540 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4541 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4542 | __func__); |
| 4543 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4544 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4545 | } |
| 4546 | } |
| 4547 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4548 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4549 | } |
| 4550 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4551 | /** |
| 4552 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 4553 | * @wmi_handle: wmi handle |
| 4554 | * @scan_cmd_fp: start scan command ptr |
| 4555 | * @roam_req: roam request param |
| 4556 | * |
| 4557 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 4558 | * of WMI_ROAM_SCAN_MODE. |
| 4559 | * |
| 4560 | * Return: QDF status |
| 4561 | */ |
| 4562 | QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 4563 | wmi_start_scan_cmd_fixed_param * |
| 4564 | scan_cmd_fp, |
| 4565 | struct roam_offload_scan_params *roam_req) |
| 4566 | { |
| 4567 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4568 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4569 | int len; |
| 4570 | uint8_t *buf_ptr; |
| 4571 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4572 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4573 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4574 | int auth_mode = roam_req->auth_mode; |
| 4575 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 4576 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 4577 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 4578 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4579 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4580 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4581 | /* Need to create a buf with roam_scan command at |
| 4582 | * front and piggyback with scan command */ |
| 4583 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 4584 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4585 | (2 * WMI_TLV_HDR_SIZE) + |
| 4586 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4587 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 4588 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4589 | if (roam_req->is_roam_req_valid && |
| 4590 | roam_req->roam_offload_enabled) { |
| 4591 | len += sizeof(wmi_roam_offload_tlv_param); |
| 4592 | len += WMI_TLV_HDR_SIZE; |
| 4593 | if ((auth_mode != WMI_AUTH_NONE) && |
| 4594 | ((auth_mode != WMI_AUTH_OPEN) || |
| 4595 | (auth_mode == WMI_AUTH_OPEN && |
| 4596 | roam_req->mdid.mdie_present) || |
| 4597 | roam_req->is_ese_assoc)) { |
| 4598 | len += WMI_TLV_HDR_SIZE; |
| 4599 | if (roam_req->is_ese_assoc) |
| 4600 | len += |
| 4601 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 4602 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 4603 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 4604 | (auth_mode == WMI_AUTH_OPEN && |
| 4605 | roam_req->mdid.mdie_present)) |
| 4606 | len += |
| 4607 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 4608 | else |
| 4609 | len += |
| 4610 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 4611 | } else { |
| 4612 | len += WMI_TLV_HDR_SIZE; |
| 4613 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4614 | |
| 4615 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 4616 | + roundup(roam_req->assoc_ie_length, |
| 4617 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4618 | } else { |
| 4619 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4620 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4621 | __func__, roam_req->roam_offload_enabled); |
| 4622 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4623 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4624 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4625 | } |
| 4626 | if (roam_req->is_roam_req_valid && |
| 4627 | roam_req->roam_offload_enabled) { |
| 4628 | roam_req->mode = roam_req->mode | |
| 4629 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 4630 | } |
| 4631 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4632 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4633 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 4634 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 4635 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 4636 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4637 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4638 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4639 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4640 | return QDF_STATUS_E_NOMEM; |
| 4641 | } |
| 4642 | |
| 4643 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4644 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4645 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 4646 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 4647 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 4648 | WMITLV_GET_STRUCT_TLVLEN |
| 4649 | (wmi_roam_scan_mode_fixed_param)); |
| 4650 | |
| 4651 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 4652 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4653 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 4654 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 4655 | goto send_roam_scan_mode_cmd; |
| 4656 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4657 | /* Fill in scan parameters suitable for roaming scan */ |
| 4658 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4659 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4660 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 4661 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 4662 | /* Ensure there is no additional IEs */ |
| 4663 | scan_cmd_fp->ie_len = 0; |
| 4664 | WMITLV_SET_HDR(buf_ptr, |
| 4665 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 4666 | WMITLV_GET_STRUCT_TLVLEN |
| 4667 | (wmi_start_scan_cmd_fixed_param)); |
| 4668 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4669 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 4670 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 4671 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4672 | sizeof(wmi_roam_offload_tlv_param)); |
| 4673 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4674 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 4675 | WMITLV_SET_HDR(buf_ptr, |
| 4676 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 4677 | WMITLV_GET_STRUCT_TLVLEN |
| 4678 | (wmi_roam_offload_tlv_param)); |
| 4679 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 4680 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 4681 | roam_offload_params->select_5g_margin = |
| 4682 | roam_req->select_5ghz_margin; |
| 4683 | roam_offload_params->reassoc_failure_timeout = |
| 4684 | roam_req->reassoc_failure_timeout; |
| 4685 | |
| 4686 | /* Fill the capabilities */ |
| 4687 | roam_offload_params->capability = |
| 4688 | roam_req->roam_offload_params.capability; |
| 4689 | roam_offload_params->ht_caps_info = |
| 4690 | roam_req->roam_offload_params.ht_caps_info; |
| 4691 | roam_offload_params->ampdu_param = |
| 4692 | roam_req->roam_offload_params.ampdu_param; |
| 4693 | roam_offload_params->ht_ext_cap = |
| 4694 | roam_req->roam_offload_params.ht_ext_cap; |
| 4695 | roam_offload_params->ht_txbf = |
| 4696 | roam_req->roam_offload_params.ht_txbf; |
| 4697 | roam_offload_params->asel_cap = |
| 4698 | roam_req->roam_offload_params.asel_cap; |
| 4699 | roam_offload_params->qos_caps = |
| 4700 | roam_req->roam_offload_params.qos_caps; |
| 4701 | roam_offload_params->wmm_caps = |
| 4702 | roam_req->roam_offload_params.wmm_caps; |
| 4703 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 4704 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 4705 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 4706 | |
| 4707 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 4708 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 4709 | * they are filled in the same order.Depending on the |
| 4710 | * authentication type, the other mode TLV's are nullified |
| 4711 | * and only headers are filled.*/ |
| 4712 | if ((auth_mode != WMI_AUTH_NONE) && |
| 4713 | ((auth_mode != WMI_AUTH_OPEN) || |
| 4714 | (auth_mode == WMI_AUTH_OPEN |
| 4715 | && roam_req->mdid.mdie_present) || |
| 4716 | roam_req->is_ese_assoc)) { |
| 4717 | if (roam_req->is_ese_assoc) { |
| 4718 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4719 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4720 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 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 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 4726 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4727 | roam_offload_ese = |
| 4728 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 4729 | qdf_mem_copy(roam_offload_ese->krk, |
| 4730 | roam_req->krk, |
| 4731 | sizeof(roam_req->krk)); |
| 4732 | qdf_mem_copy(roam_offload_ese->btk, |
| 4733 | roam_req->btk, |
| 4734 | sizeof(roam_req->btk)); |
| 4735 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 4736 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 4737 | WMITLV_GET_STRUCT_TLVLEN |
| 4738 | (wmi_roam_ese_offload_tlv_param)); |
| 4739 | buf_ptr += |
| 4740 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 4741 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 4742 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 4743 | || (auth_mode == WMI_AUTH_OPEN |
| 4744 | && roam_req->mdid.mdie_present)) { |
| 4745 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4746 | 0); |
| 4747 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4748 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4749 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 4750 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4751 | roam_offload_11r = |
| 4752 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 4753 | roam_offload_11r->r0kh_id_len = |
| 4754 | roam_req->rokh_id_length; |
| 4755 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 4756 | roam_req->rokh_id, |
| 4757 | roam_offload_11r->r0kh_id_len); |
| 4758 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 4759 | roam_req->psk_pmk, |
| 4760 | sizeof(roam_req->psk_pmk)); |
| 4761 | roam_offload_11r->psk_msk_len = |
| 4762 | roam_req->pmk_len; |
| 4763 | roam_offload_11r->mdie_present = |
| 4764 | roam_req->mdid.mdie_present; |
| 4765 | roam_offload_11r->mdid = |
| 4766 | roam_req->mdid.mobility_domain; |
| 4767 | if (auth_mode == WMI_AUTH_OPEN) { |
| 4768 | /* If FT-Open ensure pmk length |
| 4769 | and r0khid len are zero */ |
| 4770 | roam_offload_11r->r0kh_id_len = 0; |
| 4771 | roam_offload_11r->psk_msk_len = 0; |
| 4772 | } |
| 4773 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 4774 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 4775 | WMITLV_GET_STRUCT_TLVLEN |
| 4776 | (wmi_roam_11r_offload_tlv_param)); |
| 4777 | buf_ptr += |
| 4778 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 4779 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4780 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4781 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4782 | } else { |
| 4783 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4784 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 4785 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4786 | roam_offload_11i = |
| 4787 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 4788 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 4789 | roam_req->okc_enabled) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4790 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 4791 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4792 | WMI_LOGE("LFR3:OKC Enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4793 | } else { |
| 4794 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 4795 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4796 | WMI_LOGE("LFR3:OKC Disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4797 | } |
| 4798 | |
| 4799 | qdf_mem_copy(roam_offload_11i->pmk, |
| 4800 | roam_req->psk_pmk, |
| 4801 | sizeof(roam_req->psk_pmk)); |
| 4802 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 4803 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 4804 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 4805 | WMITLV_GET_STRUCT_TLVLEN |
| 4806 | (wmi_roam_11i_offload_tlv_param)); |
| 4807 | buf_ptr += |
| 4808 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 4809 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4810 | 0); |
| 4811 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4812 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4813 | 0); |
| 4814 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4815 | } |
| 4816 | } else { |
| 4817 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4818 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4819 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 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)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4825 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4826 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4827 | |
| 4828 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4829 | sizeof(*assoc_ies)); |
| 4830 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4831 | |
| 4832 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 4833 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 4834 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 4835 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 4836 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 4837 | |
| 4838 | buf_ptr += sizeof(*assoc_ies); |
| 4839 | |
| 4840 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4841 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 4842 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4843 | |
| 4844 | if (assoc_ies->buf_len != 0) { |
| 4845 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 4846 | assoc_ies->buf_len); |
| 4847 | } |
| 4848 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4849 | } else { |
| 4850 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4851 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4852 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 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)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4861 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4862 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4863 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4864 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4865 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4866 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4867 | } |
| 4868 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4869 | |
| 4870 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4871 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4872 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4873 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4874 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4875 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 4876 | status); |
| 4877 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4878 | } |
| 4879 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4880 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4881 | } |
| 4882 | |
| 4883 | |
| 4884 | /** |
| 4885 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 4886 | * rssi threashold |
| 4887 | * @wmi_handle: wmi handle |
| 4888 | * @roam_req: Roaming request buffer |
| 4889 | * |
| 4890 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 4891 | * |
| 4892 | * Return: QDF status |
| 4893 | */ |
| 4894 | QDF_STATUS send_roam_scan_offload_rssi_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
| 4895 | struct roam_offload_scan_rssi_params *roam_req) |
| 4896 | { |
| 4897 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4898 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4899 | int len; |
| 4900 | uint8_t *buf_ptr; |
| 4901 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 4902 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 4903 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 4904 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4905 | |
| 4906 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 4907 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 4908 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 4909 | len += WMI_TLV_HDR_SIZE; |
| 4910 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 4911 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 4912 | len += sizeof(wmi_roam_dense_thres_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4913 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4914 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4915 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4916 | return QDF_STATUS_E_NOMEM; |
| 4917 | } |
| 4918 | |
| 4919 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4920 | rssi_threshold_fp = |
| 4921 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 4922 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 4923 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 4924 | WMITLV_GET_STRUCT_TLVLEN |
| 4925 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 4926 | /* fill in threshold values */ |
| 4927 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 4928 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 4929 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 4930 | rssi_threshold_fp->hirssi_scan_max_count = |
| 4931 | roam_req->hi_rssi_scan_max_count; |
| 4932 | rssi_threshold_fp->hirssi_scan_delta = |
| 4933 | roam_req->hi_rssi_scan_rssi_delta; |
| 4934 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
| 4935 | |
| 4936 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 4937 | WMITLV_SET_HDR(buf_ptr, |
| 4938 | WMITLV_TAG_ARRAY_STRUC, |
| 4939 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 4940 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4941 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 4942 | |
| 4943 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 4944 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 4945 | ext_thresholds->boost_threshold_5g = |
| 4946 | roam_req->boost_threshold_5g; |
| 4947 | |
| 4948 | ext_thresholds->boost_algorithm_5g = |
| 4949 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 4950 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 4951 | ext_thresholds->penalty_algorithm_5g = |
| 4952 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 4953 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 4954 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 4955 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 4956 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 4957 | |
| 4958 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 4959 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 4960 | WMITLV_GET_STRUCT_TLVLEN |
| 4961 | (wmi_roam_scan_extended_threshold_param)); |
| 4962 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 4963 | WMITLV_SET_HDR(buf_ptr, |
| 4964 | WMITLV_TAG_ARRAY_STRUC, |
| 4965 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 4966 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4967 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 4968 | early_stop_thresholds->roam_earlystop_thres_min = |
| 4969 | roam_req->roam_earlystop_thres_min; |
| 4970 | early_stop_thresholds->roam_earlystop_thres_max = |
| 4971 | roam_req->roam_earlystop_thres_max; |
| 4972 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 4973 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 4974 | WMITLV_GET_STRUCT_TLVLEN |
| 4975 | (wmi_roam_earlystop_rssi_thres_param)); |
| 4976 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 4977 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 4978 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4979 | sizeof(wmi_roam_dense_thres_param)); |
| 4980 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4981 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 4982 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 4983 | roam_req->dense_rssi_thresh_offset; |
| 4984 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 4985 | dense_thresholds->roam_dense_traffic_thres = |
| 4986 | roam_req->traffic_threshold; |
| 4987 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 4988 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 4989 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 4990 | WMITLV_GET_STRUCT_TLVLEN |
| 4991 | (wmi_roam_dense_thres_param)); |
| 4992 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4993 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4994 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4995 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4996 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4997 | status); |
| 4998 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4999 | } |
| 5000 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5001 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5002 | } |
| 5003 | |
| 5004 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5005 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 5006 | * configuration params |
| 5007 | * @wma_handle: wma handler |
| 5008 | * @dwelltime_params: pointer to dwelltime_params |
| 5009 | * |
| 5010 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 5011 | */ |
| 5012 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5013 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 5014 | { |
| 5015 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 5016 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 5017 | wmi_buf_t buf; |
| 5018 | uint8_t *buf_ptr; |
| 5019 | int32_t err; |
| 5020 | int len; |
| 5021 | |
| 5022 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5023 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5024 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 5025 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5026 | if (!buf) { |
| 5027 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 5028 | __func__); |
| 5029 | return QDF_STATUS_E_NOMEM; |
| 5030 | } |
| 5031 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5032 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 5033 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 5034 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 5035 | WMITLV_GET_STRUCT_TLVLEN |
| 5036 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 5037 | |
| 5038 | dwell_param->enable = dwelltime_params->is_enabled; |
| 5039 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5040 | WMITLV_SET_HDR(buf_ptr, |
| 5041 | WMITLV_TAG_ARRAY_STRUC, |
| 5042 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5043 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5044 | |
| 5045 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 5046 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5047 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 5048 | WMITLV_GET_STRUCT_TLVLEN( |
| 5049 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5050 | |
| 5051 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 5052 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 5053 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 5054 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 5055 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 5056 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 5057 | if (err) { |
| 5058 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 5059 | wmi_buf_free(buf); |
| 5060 | return QDF_STATUS_E_FAILURE; |
| 5061 | } |
| 5062 | |
| 5063 | return QDF_STATUS_SUCCESS; |
| 5064 | } |
| 5065 | |
| 5066 | |
| 5067 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5068 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 5069 | * @wmi_handle: wmi handle |
| 5070 | * @roam_req: Request which contains the filters |
| 5071 | * |
| 5072 | * There are filters such as whitelist, blacklist and preferred |
| 5073 | * list that need to be applied to the scan results to form the |
| 5074 | * probable candidates for roaming. |
| 5075 | * |
| 5076 | * Return: Return success upon succesfully passing the |
| 5077 | * parameters to the firmware, otherwise failure. |
| 5078 | */ |
| 5079 | QDF_STATUS send_roam_scan_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 5080 | struct roam_scan_filter_params *roam_req) |
| 5081 | { |
| 5082 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5083 | QDF_STATUS status; |
| 5084 | uint32_t i; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5085 | uint32_t len; |
| 5086 | uint8_t *buf_ptr; |
| 5087 | wmi_roam_filter_fixed_param *roam_filter; |
| 5088 | uint8_t *bssid_src_ptr = NULL; |
| 5089 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 5090 | wmi_ssid *ssid_ptr = NULL; |
| 5091 | uint32_t *bssid_preferred_factor_ptr = NULL; |
| 5092 | |
| 5093 | len = sizeof(wmi_roam_filter_fixed_param); |
| 5094 | len += WMI_TLV_HDR_SIZE; |
| 5095 | len += roam_req->len; |
| 5096 | |
| 5097 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5098 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5099 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5100 | return QDF_STATUS_E_NOMEM; |
| 5101 | } |
| 5102 | |
| 5103 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 5104 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 5105 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 5106 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 5107 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 5108 | /* fill in fixed values */ |
| 5109 | roam_filter->vdev_id = roam_req->session_id; |
| 5110 | roam_filter->flags = 0; |
| 5111 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 5112 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 5113 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 5114 | roam_filter->num_bssid_preferred_list = |
| 5115 | roam_req->num_bssid_preferred_list; |
| 5116 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 5117 | |
| 5118 | WMITLV_SET_HDR((buf_ptr), |
| 5119 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5120 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 5121 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 5122 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5123 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 5124 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 5125 | bssid_src_ptr += ATH_MAC_LEN; |
| 5126 | bssid_dst_ptr++; |
| 5127 | } |
| 5128 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5129 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 5130 | WMITLV_SET_HDR((buf_ptr), |
| 5131 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5132 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 5133 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5134 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 5135 | qdf_mem_copy(&ssid_ptr->ssid, |
| 5136 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 5137 | roam_req->ssid_allowed_list[i].length); |
| 5138 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 5139 | ssid_ptr++; |
| 5140 | } |
| 5141 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 5142 | sizeof(wmi_ssid)); |
| 5143 | WMITLV_SET_HDR((buf_ptr), |
| 5144 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5145 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 5146 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 5147 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5148 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5149 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 5150 | (wmi_mac_addr *)bssid_dst_ptr); |
| 5151 | bssid_src_ptr += ATH_MAC_LEN; |
| 5152 | bssid_dst_ptr++; |
| 5153 | } |
| 5154 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5155 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 5156 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 5157 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 5158 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5159 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5160 | *bssid_preferred_factor_ptr = |
| 5161 | roam_req->bssid_favored_factor[i]; |
| 5162 | bssid_preferred_factor_ptr++; |
| 5163 | } |
| 5164 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5165 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 5166 | |
| 5167 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5168 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5169 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5170 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5171 | status); |
| 5172 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5173 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5174 | |
| 5175 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5176 | } |
| 5177 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5178 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 5179 | * @wmi_handle: wmi handle |
| 5180 | * @req: epno config params request structure |
| 5181 | * |
| 5182 | * This function reads the incoming epno config request structure |
| 5183 | * and constructs the WMI message to the firmware. |
| 5184 | * |
| 5185 | * Returns: 0 on success, error number otherwise |
| 5186 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5187 | 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] | 5188 | struct wifi_enhanched_pno_params *req) |
| 5189 | { |
| 5190 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 5191 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5192 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5193 | u_int8_t i, *buf_ptr; |
| 5194 | wmi_buf_t buf; |
| 5195 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5196 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5197 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5198 | /* Fixed Params */ |
| 5199 | len = sizeof(*cmd); |
| 5200 | if (req->num_networks) { |
| 5201 | /* TLV place holder for array of structures |
| 5202 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 5203 | */ |
| 5204 | len += WMI_TLV_HDR_SIZE; |
| 5205 | len += (sizeof(nlo_configured_parameters) |
| 5206 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 5207 | /* TLV for array of uint32 channel_list */ |
| 5208 | len += WMI_TLV_HDR_SIZE; |
| 5209 | /* TLV for nlo_channel_prediction_cfg */ |
| 5210 | len += WMI_TLV_HDR_SIZE; |
| 5211 | /* TLV for candidate score params */ |
| 5212 | len += sizeof(enlo_candidate_score_params); |
| 5213 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5214 | |
| 5215 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5216 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5217 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5218 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5219 | } |
| 5220 | |
| 5221 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5222 | |
| 5223 | buf_ptr = (u_int8_t *) cmd; |
| 5224 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5225 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5226 | WMITLV_GET_STRUCT_TLVLEN( |
| 5227 | wmi_nlo_config_cmd_fixed_param)); |
| 5228 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5229 | |
| 5230 | /* set flag to reset if num of networks are 0 */ |
| 5231 | cmd->flags = (req->num_networks == 0 ? |
| 5232 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5233 | |
| 5234 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 5235 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5236 | 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] | 5237 | WMI_LOGD("SSID count: %d flags: %d", |
| 5238 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5239 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5240 | /* Fill nlo_config only when num_networks are non zero */ |
| 5241 | if (cmd->no_of_ssids) { |
| 5242 | /* Fill networks */ |
| 5243 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5244 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 5245 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5246 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5247 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 5248 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 5249 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 5250 | WMITLV_TAG_ARRAY_BYTE, |
| 5251 | WMITLV_GET_STRUCT_TLVLEN( |
| 5252 | nlo_configured_parameters)); |
| 5253 | /* Copy ssid and it's length */ |
| 5254 | nlo_list[i].ssid.valid = true; |
| 5255 | nlo_list[i].ssid.ssid.ssid_len = |
| 5256 | req->networks[i].ssid.length; |
| 5257 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 5258 | req->networks[i].ssid.mac_ssid, |
| 5259 | nlo_list[i].ssid.ssid.ssid_len); |
| 5260 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 5261 | nlo_list[i].ssid.ssid.ssid_len, |
| 5262 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 5263 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5264 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5265 | /* Copy pno flags */ |
| 5266 | nlo_list[i].bcast_nw_type.valid = true; |
| 5267 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 5268 | req->networks[i].flags; |
| 5269 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5270 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 5271 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5272 | /* Copy auth bit field */ |
| 5273 | nlo_list[i].auth_type.valid = true; |
| 5274 | nlo_list[i].auth_type.auth_type = |
| 5275 | req->networks[i].auth_bit_field; |
| 5276 | WMI_LOGD("Auth bit field (%u)", |
| 5277 | nlo_list[i].auth_type.auth_type); |
| 5278 | } |
| 5279 | |
| 5280 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 5281 | /* Fill the channel list */ |
| 5282 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 5283 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5284 | |
| 5285 | /* Fill prediction_param */ |
| 5286 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5287 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5288 | |
| 5289 | /* Fill epno candidate score params */ |
| 5290 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 5291 | WMITLV_SET_HDR(buf_ptr, |
| 5292 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 5293 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 5294 | cand_score_params->min5GHz_rssi = |
| 5295 | req->min_5ghz_rssi; |
| 5296 | cand_score_params->min24GHz_rssi = |
| 5297 | req->min_24ghz_rssi; |
| 5298 | cand_score_params->initial_score_max = |
| 5299 | req->initial_score_max; |
| 5300 | cand_score_params->current_connection_bonus = |
| 5301 | req->current_connection_bonus; |
| 5302 | cand_score_params->same_network_bonus = |
| 5303 | req->same_network_bonus; |
| 5304 | cand_score_params->secure_bonus = |
| 5305 | req->secure_bonus; |
| 5306 | cand_score_params->band5GHz_bonus = |
| 5307 | req->band_5ghz_bonus; |
| 5308 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5309 | } |
| 5310 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5311 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5312 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5313 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5314 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5315 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5316 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5317 | } |
| 5318 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5319 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5320 | req->session_id); |
| 5321 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5322 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5323 | } |
| 5324 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5325 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5326 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 5327 | * @wmi_handle: wmi handle |
| 5328 | * @ipa_offload: ipa offload control parameter |
| 5329 | * |
| 5330 | * Returns: 0 on success, error number otherwise |
| 5331 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5332 | 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] | 5333 | struct ipa_offload_control_params *ipa_offload) |
| 5334 | { |
| 5335 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 5336 | wmi_buf_t wmi_buf; |
| 5337 | uint32_t len; |
| 5338 | u_int8_t *buf_ptr; |
| 5339 | |
| 5340 | len = sizeof(*cmd); |
| 5341 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5342 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5343 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 5344 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5345 | } |
| 5346 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5347 | WMI_LOGE("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5348 | ipa_offload->offload_type, ipa_offload->enable); |
| 5349 | |
| 5350 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 5351 | |
| 5352 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 5353 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5354 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 5355 | WMITLV_GET_STRUCT_TLVLEN( |
| 5356 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 5357 | |
| 5358 | cmd->offload_type = ipa_offload->offload_type; |
| 5359 | cmd->vdev_id = ipa_offload->vdev_id; |
| 5360 | cmd->enable = ipa_offload->enable; |
| 5361 | |
| 5362 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5363 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5364 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5365 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5366 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5367 | } |
| 5368 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5369 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5370 | } |
| 5371 | |
| 5372 | /** |
| 5373 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 5374 | * @wmi_handle: wmi handle |
| 5375 | * @pgetcapab: get capabilities params |
| 5376 | * |
| 5377 | * This function send request to fw to get extscan capabilities. |
| 5378 | * |
| 5379 | * Return: CDF status |
| 5380 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5381 | 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] | 5382 | struct extscan_capabilities_params *pgetcapab) |
| 5383 | { |
| 5384 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 5385 | wmi_buf_t wmi_buf; |
| 5386 | uint32_t len; |
| 5387 | uint8_t *buf_ptr; |
| 5388 | |
| 5389 | len = sizeof(*cmd); |
| 5390 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5391 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5392 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5393 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5394 | } |
| 5395 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5396 | |
| 5397 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 5398 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5399 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 5400 | WMITLV_GET_STRUCT_TLVLEN |
| 5401 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 5402 | |
| 5403 | cmd->request_id = pgetcapab->request_id; |
| 5404 | |
| 5405 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5406 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5407 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5408 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5409 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5410 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5411 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5412 | } |
| 5413 | |
| 5414 | /** |
| 5415 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 5416 | * @wmi_handle: wmi handle |
| 5417 | * @pcached_results: cached results parameters |
| 5418 | * |
| 5419 | * This function send request to fw to get cached results. |
| 5420 | * |
| 5421 | * Return: CDF status |
| 5422 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5423 | 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] | 5424 | struct extscan_cached_result_params *pcached_results) |
| 5425 | { |
| 5426 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 5427 | wmi_buf_t wmi_buf; |
| 5428 | uint32_t len; |
| 5429 | uint8_t *buf_ptr; |
| 5430 | |
| 5431 | len = sizeof(*cmd); |
| 5432 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5433 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5434 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5435 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5436 | } |
| 5437 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5438 | |
| 5439 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 5440 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5441 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 5442 | WMITLV_GET_STRUCT_TLVLEN |
| 5443 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 5444 | |
| 5445 | cmd->request_id = pcached_results->request_id; |
| 5446 | cmd->vdev_id = pcached_results->session_id; |
| 5447 | cmd->control_flags = pcached_results->flush; |
| 5448 | |
| 5449 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5450 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5451 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5452 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5453 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5454 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5455 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5456 | } |
| 5457 | |
| 5458 | /** |
| 5459 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 5460 | * @wmi_handle: wmi handle |
| 5461 | * @reset_req: Reset change request params |
| 5462 | * |
| 5463 | * This function sends stop change monitor request to fw. |
| 5464 | * |
| 5465 | * Return: CDF status |
| 5466 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5467 | 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] | 5468 | struct extscan_capabilities_reset_params *reset_req) |
| 5469 | { |
| 5470 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 5471 | wmi_buf_t wmi_buf; |
| 5472 | uint32_t len; |
| 5473 | uint8_t *buf_ptr; |
| 5474 | int change_list = 0; |
| 5475 | |
| 5476 | len = sizeof(*cmd); |
| 5477 | |
| 5478 | /* reset significant change tlv is set to 0 */ |
| 5479 | len += WMI_TLV_HDR_SIZE; |
| 5480 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 5481 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5482 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5483 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5484 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5485 | } |
| 5486 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5487 | |
| 5488 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 5489 | buf_ptr; |
| 5490 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5491 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 5492 | WMITLV_GET_STRUCT_TLVLEN |
| 5493 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 5494 | |
| 5495 | cmd->request_id = reset_req->request_id; |
| 5496 | cmd->vdev_id = reset_req->session_id; |
| 5497 | cmd->mode = 0; |
| 5498 | |
| 5499 | buf_ptr += sizeof(*cmd); |
| 5500 | WMITLV_SET_HDR(buf_ptr, |
| 5501 | WMITLV_TAG_ARRAY_STRUC, |
| 5502 | change_list * |
| 5503 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5504 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 5505 | sizeof |
| 5506 | (wmi_extscan_wlan_change_bssid_param)); |
| 5507 | |
| 5508 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5509 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5510 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5511 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5512 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5513 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5514 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5515 | } |
| 5516 | |
| 5517 | /** |
| 5518 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 5519 | * @wmi_handle: wmi handle |
| 5520 | * @psigchange: change monitor request params |
| 5521 | * @buf: wmi buffer |
| 5522 | * @buf_len: buffer length |
| 5523 | * |
| 5524 | * This function fills elements of change monitor request buffer. |
| 5525 | * |
| 5526 | * Return: CDF status |
| 5527 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5528 | 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] | 5529 | struct extscan_set_sig_changereq_params |
| 5530 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 5531 | { |
| 5532 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 5533 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 5534 | uint8_t *buf_ptr; |
| 5535 | int j; |
| 5536 | int len = sizeof(*cmd); |
| 5537 | int numap = psigchange->num_ap; |
| 5538 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 5539 | |
| 5540 | if (!numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5541 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 5542 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5543 | } |
| 5544 | len += WMI_TLV_HDR_SIZE; |
| 5545 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 5546 | |
| 5547 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 5548 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5549 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5550 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5551 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5552 | } |
| 5553 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 5554 | cmd = |
| 5555 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 5556 | buf_ptr; |
| 5557 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5558 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 5559 | WMITLV_GET_STRUCT_TLVLEN |
| 5560 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 5561 | |
| 5562 | cmd->request_id = psigchange->request_id; |
| 5563 | cmd->vdev_id = psigchange->session_id; |
| 5564 | cmd->total_entries = numap; |
| 5565 | cmd->mode = 1; |
| 5566 | cmd->num_entries_in_page = numap; |
| 5567 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 5568 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 5569 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 5570 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 5571 | |
| 5572 | buf_ptr += sizeof(*cmd); |
| 5573 | WMITLV_SET_HDR(buf_ptr, |
| 5574 | WMITLV_TAG_ARRAY_STRUC, |
| 5575 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5576 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 5577 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5578 | |
| 5579 | for (j = 0; j < numap; j++) { |
| 5580 | WMITLV_SET_HDR(dest_chglist, |
| 5581 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 5582 | WMITLV_GET_STRUCT_TLVLEN |
| 5583 | (wmi_extscan_wlan_change_bssid_param)); |
| 5584 | |
| 5585 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 5586 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 5587 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 5588 | &dest_chglist->bssid); |
| 5589 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5590 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5591 | dest_chglist->lower_rssi_limit); |
| 5592 | dest_chglist++; |
| 5593 | src_ap++; |
| 5594 | } |
| 5595 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5596 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5597 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5598 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5599 | } |
| 5600 | |
| 5601 | /** |
| 5602 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 5603 | * @wmi_handle: wmi handle |
| 5604 | * @psigchange: change monitor request params |
| 5605 | * |
| 5606 | * This function sends start change monitor request to fw. |
| 5607 | * |
| 5608 | * Return: CDF status |
| 5609 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5610 | 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] | 5611 | struct extscan_set_sig_changereq_params * |
| 5612 | psigchange) |
| 5613 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5614 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5615 | wmi_buf_t buf; |
| 5616 | int len; |
| 5617 | |
| 5618 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5619 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5620 | psigchange, &buf, |
| 5621 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5622 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 5623 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5624 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5625 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5626 | } |
| 5627 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5628 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 5629 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5630 | } |
| 5631 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5632 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5633 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5634 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5635 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5636 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5637 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5638 | } |
| 5639 | |
| 5640 | /** |
| 5641 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 5642 | * @wmi_handle: wmi handle |
| 5643 | * @photlist_reset: hotlist reset params |
| 5644 | * |
| 5645 | * This function configures hotlist monitor to stop in fw. |
| 5646 | * |
| 5647 | * Return: CDF status |
| 5648 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5649 | 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] | 5650 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 5651 | { |
| 5652 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 5653 | wmi_buf_t wmi_buf; |
| 5654 | uint32_t len; |
| 5655 | uint8_t *buf_ptr; |
| 5656 | int hotlist_entries = 0; |
| 5657 | |
| 5658 | len = sizeof(*cmd); |
| 5659 | |
| 5660 | /* reset bssid hotlist with tlv set to 0 */ |
| 5661 | len += WMI_TLV_HDR_SIZE; |
| 5662 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 5663 | |
| 5664 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5665 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5666 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5667 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5668 | } |
| 5669 | |
| 5670 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5671 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 5672 | buf_ptr; |
| 5673 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5674 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 5675 | WMITLV_GET_STRUCT_TLVLEN |
| 5676 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 5677 | |
| 5678 | cmd->request_id = photlist_reset->request_id; |
| 5679 | cmd->vdev_id = photlist_reset->session_id; |
| 5680 | cmd->mode = 0; |
| 5681 | |
| 5682 | buf_ptr += sizeof(*cmd); |
| 5683 | WMITLV_SET_HDR(buf_ptr, |
| 5684 | WMITLV_TAG_ARRAY_STRUC, |
| 5685 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 5686 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5687 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 5688 | |
| 5689 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5690 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5691 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5692 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5693 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5694 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5695 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5696 | } |
| 5697 | |
| 5698 | /** |
| 5699 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 5700 | * @wmi_handle: wmi handle |
| 5701 | * @pstopcmd: stop scan command request params |
| 5702 | * |
| 5703 | * This function sends stop extscan request to fw. |
| 5704 | * |
| 5705 | * Return: CDF Status. |
| 5706 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5707 | QDF_STATUS send_stop_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5708 | struct extscan_stop_req_params *pstopcmd) |
| 5709 | { |
| 5710 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 5711 | wmi_buf_t wmi_buf; |
| 5712 | uint32_t len; |
| 5713 | uint8_t *buf_ptr; |
| 5714 | |
| 5715 | len = sizeof(*cmd); |
| 5716 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5717 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5718 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5719 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5720 | } |
| 5721 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5722 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 5723 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5724 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 5725 | WMITLV_GET_STRUCT_TLVLEN |
| 5726 | (wmi_extscan_stop_cmd_fixed_param)); |
| 5727 | |
| 5728 | cmd->request_id = pstopcmd->request_id; |
| 5729 | cmd->vdev_id = pstopcmd->session_id; |
| 5730 | |
| 5731 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5732 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5733 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5734 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5735 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5736 | } |
| 5737 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5738 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5739 | } |
| 5740 | |
| 5741 | /** |
| 5742 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 5743 | * @wmi_handle: wmi handle |
| 5744 | * @pstart: scan command request params |
| 5745 | * @buf: event buffer |
| 5746 | * @buf_len: length of buffer |
| 5747 | * |
| 5748 | * This function fills individual elements of extscan request and |
| 5749 | * TLV for buckets, channel list. |
| 5750 | * |
| 5751 | * Return: CDF Status. |
| 5752 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5753 | 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] | 5754 | struct wifi_scan_cmd_req_params *pstart, |
| 5755 | wmi_buf_t *buf, int *buf_len) |
| 5756 | { |
| 5757 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 5758 | wmi_extscan_bucket *dest_blist; |
| 5759 | wmi_extscan_bucket_channel *dest_clist; |
| 5760 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 5761 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 5762 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 5763 | |
| 5764 | uint8_t *buf_ptr; |
| 5765 | int i, k, count = 0; |
| 5766 | int len = sizeof(*cmd); |
| 5767 | int nbuckets = pstart->numBuckets; |
| 5768 | int nchannels = 0; |
| 5769 | |
| 5770 | /* These TLV's are are NULL by default */ |
| 5771 | uint32_t ie_len_with_pad = 0; |
| 5772 | int num_ssid = 0; |
| 5773 | int num_bssid = 0; |
| 5774 | int ie_len = 0; |
| 5775 | |
| 5776 | uint32_t base_period = pstart->basePeriod; |
| 5777 | |
| 5778 | /* TLV placeholder for ssid_list (NULL) */ |
| 5779 | len += WMI_TLV_HDR_SIZE; |
| 5780 | len += num_ssid * sizeof(wmi_ssid); |
| 5781 | |
| 5782 | /* TLV placeholder for bssid_list (NULL) */ |
| 5783 | len += WMI_TLV_HDR_SIZE; |
| 5784 | len += num_bssid * sizeof(wmi_mac_addr); |
| 5785 | |
| 5786 | /* TLV placeholder for ie_data (NULL) */ |
| 5787 | len += WMI_TLV_HDR_SIZE; |
| 5788 | len += ie_len * sizeof(uint32_t); |
| 5789 | |
| 5790 | /* TLV placeholder for bucket */ |
| 5791 | len += WMI_TLV_HDR_SIZE; |
| 5792 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 5793 | |
| 5794 | /* TLV channel placeholder */ |
| 5795 | len += WMI_TLV_HDR_SIZE; |
| 5796 | for (i = 0; i < nbuckets; i++) { |
| 5797 | nchannels += src_bucket->numChannels; |
| 5798 | src_bucket++; |
| 5799 | } |
| 5800 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5801 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5802 | __func__, nbuckets, nchannels); |
| 5803 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 5804 | /* Allocate the memory */ |
| 5805 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 5806 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5807 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5808 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5809 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5810 | } |
| 5811 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 5812 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 5813 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5814 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 5815 | WMITLV_GET_STRUCT_TLVLEN |
| 5816 | (wmi_extscan_start_cmd_fixed_param)); |
| 5817 | |
| 5818 | cmd->request_id = pstart->requestId; |
| 5819 | cmd->vdev_id = pstart->sessionId; |
| 5820 | cmd->base_period = pstart->basePeriod; |
| 5821 | cmd->num_buckets = nbuckets; |
| 5822 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 5823 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5824 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5825 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5826 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5827 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5828 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 5829 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5830 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 5831 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 5832 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5833 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 5834 | |
| 5835 | /* The max dwell time is retrieved from the first channel |
| 5836 | * of the first bucket and kept common for all channels. |
| 5837 | */ |
| 5838 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 5839 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 5840 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 5841 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 5842 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 5843 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 5844 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 5845 | |
| 5846 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5847 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5848 | cmd->probe_delay = 0; |
| 5849 | cmd->probe_spacing_time = 0; |
| 5850 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5851 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 5852 | WMI_SCAN_ADD_CCK_RATES | |
| 5853 | WMI_SCAN_ADD_OFDM_RATES | |
| 5854 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 5855 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5856 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 5857 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 5858 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5859 | cmd->num_ssids = 0; |
| 5860 | cmd->num_bssid = 0; |
| 5861 | cmd->ie_len = 0; |
| 5862 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 5863 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 5864 | |
| 5865 | buf_ptr += sizeof(*cmd); |
| 5866 | WMITLV_SET_HDR(buf_ptr, |
| 5867 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5868 | num_ssid * sizeof(wmi_ssid)); |
| 5869 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 5870 | |
| 5871 | WMITLV_SET_HDR(buf_ptr, |
| 5872 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5873 | num_bssid * sizeof(wmi_mac_addr)); |
| 5874 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 5875 | |
| 5876 | ie_len_with_pad = 0; |
| 5877 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5878 | ie_len_with_pad); |
| 5879 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 5880 | |
| 5881 | WMITLV_SET_HDR(buf_ptr, |
| 5882 | WMITLV_TAG_ARRAY_STRUC, |
| 5883 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 5884 | dest_blist = (wmi_extscan_bucket *) |
| 5885 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5886 | src_bucket = pstart->buckets; |
| 5887 | |
| 5888 | /* Retrieve scanning information from each bucket and |
| 5889 | * channels and send it to the target |
| 5890 | */ |
| 5891 | for (i = 0; i < nbuckets; i++) { |
| 5892 | WMITLV_SET_HDR(dest_blist, |
| 5893 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 5894 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 5895 | |
| 5896 | dest_blist->bucket_id = src_bucket->bucket; |
| 5897 | dest_blist->base_period_multiplier = |
| 5898 | src_bucket->period / base_period; |
| 5899 | dest_blist->min_period = src_bucket->period; |
| 5900 | dest_blist->max_period = src_bucket->max_period; |
| 5901 | dest_blist->exp_backoff = src_bucket->exponent; |
| 5902 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 5903 | dest_blist->channel_band = src_bucket->band; |
| 5904 | dest_blist->num_channels = src_bucket->numChannels; |
| 5905 | dest_blist->notify_extscan_events = 0; |
| 5906 | |
| 5907 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 5908 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 5909 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 5910 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5911 | |
| 5912 | if (src_bucket->reportEvents & |
| 5913 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 5914 | dest_blist->forwarding_flags = |
| 5915 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 5916 | dest_blist->notify_extscan_events |= |
| 5917 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 5918 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 5919 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 5920 | } else { |
| 5921 | dest_blist->forwarding_flags = |
| 5922 | WMI_EXTSCAN_NO_FORWARDING; |
| 5923 | } |
| 5924 | |
| 5925 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 5926 | dest_blist->configuration_flags = 0; |
| 5927 | else |
| 5928 | dest_blist->configuration_flags = |
| 5929 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 5930 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5931 | 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] | 5932 | __func__, dest_blist->notify_extscan_events, |
| 5933 | dest_blist->configuration_flags, |
| 5934 | dest_blist->forwarding_flags); |
| 5935 | |
| 5936 | dest_blist->min_dwell_time_active = |
| 5937 | src_bucket->min_dwell_time_active; |
| 5938 | dest_blist->max_dwell_time_active = |
| 5939 | src_bucket->max_dwell_time_active; |
| 5940 | dest_blist->min_dwell_time_passive = |
| 5941 | src_bucket->min_dwell_time_passive; |
| 5942 | dest_blist->max_dwell_time_passive = |
| 5943 | src_bucket->max_dwell_time_passive; |
| 5944 | src_channel = src_bucket->channels; |
| 5945 | |
| 5946 | /* save the channel info to later populate |
| 5947 | * the channel TLV |
| 5948 | */ |
| 5949 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 5950 | save_channel[count++].channel = src_channel->channel; |
| 5951 | src_channel++; |
| 5952 | } |
| 5953 | dest_blist++; |
| 5954 | src_bucket++; |
| 5955 | } |
| 5956 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 5957 | WMITLV_SET_HDR(buf_ptr, |
| 5958 | WMITLV_TAG_ARRAY_STRUC, |
| 5959 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 5960 | dest_clist = (wmi_extscan_bucket_channel *) |
| 5961 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5962 | |
| 5963 | /* Active or passive scan is based on the bucket dwell time |
| 5964 | * and channel specific active,passive scans are not |
| 5965 | * supported yet |
| 5966 | */ |
| 5967 | for (i = 0; i < nchannels; i++) { |
| 5968 | WMITLV_SET_HDR(dest_clist, |
| 5969 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 5970 | WMITLV_GET_STRUCT_TLVLEN |
| 5971 | (wmi_extscan_bucket_channel)); |
| 5972 | dest_clist->channel = save_channel[i].channel; |
| 5973 | dest_clist++; |
| 5974 | } |
| 5975 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5976 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 5977 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5978 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5979 | } |
| 5980 | |
| 5981 | /** |
| 5982 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 5983 | * @wmi_handle: wmi handle |
| 5984 | * @pstart: scan command request params |
| 5985 | * |
| 5986 | * This function sends start extscan request to fw. |
| 5987 | * |
| 5988 | * Return: CDF Status. |
| 5989 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5990 | QDF_STATUS send_start_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5991 | struct wifi_scan_cmd_req_params *pstart) |
| 5992 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5993 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5994 | wmi_buf_t buf; |
| 5995 | int len; |
| 5996 | |
| 5997 | /* Fill individual elements of extscan request and |
| 5998 | * TLV for buckets, channel list. |
| 5999 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6000 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6001 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6002 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6003 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 6004 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6005 | } |
| 6006 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6007 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6008 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6009 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6010 | } |
| 6011 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 6012 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6013 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6014 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6015 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6016 | } |
| 6017 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6018 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6019 | } |
| 6020 | |
| 6021 | /** |
| 6022 | * send_plm_stop_cmd_tlv() - plm stop request |
| 6023 | * @wmi_handle: wmi handle |
| 6024 | * @plm: plm request parameters |
| 6025 | * |
| 6026 | * This function request FW to stop PLM. |
| 6027 | * |
| 6028 | * Return: CDF status |
| 6029 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6030 | QDF_STATUS send_plm_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6031 | const struct plm_req_params *plm) |
| 6032 | { |
| 6033 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 6034 | int32_t len; |
| 6035 | wmi_buf_t buf; |
| 6036 | uint8_t *buf_ptr; |
| 6037 | int ret; |
| 6038 | |
| 6039 | len = sizeof(*cmd); |
| 6040 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6041 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6042 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6043 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6044 | } |
| 6045 | |
| 6046 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 6047 | |
| 6048 | buf_ptr = (uint8_t *) cmd; |
| 6049 | |
| 6050 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6051 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 6052 | WMITLV_GET_STRUCT_TLVLEN |
| 6053 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 6054 | |
| 6055 | cmd->vdev_id = plm->session_id; |
| 6056 | |
| 6057 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6058 | 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] | 6059 | |
| 6060 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6061 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 6062 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6063 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6064 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6065 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6066 | } |
| 6067 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6068 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6069 | } |
| 6070 | |
| 6071 | /** |
| 6072 | * send_plm_start_cmd_tlv() - plm start request |
| 6073 | * @wmi_handle: wmi handle |
| 6074 | * @plm: plm request parameters |
| 6075 | * |
| 6076 | * This function request FW to start PLM. |
| 6077 | * |
| 6078 | * Return: CDF status |
| 6079 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6080 | QDF_STATUS send_plm_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6081 | const struct plm_req_params *plm, |
| 6082 | uint32_t *gchannel_list) |
| 6083 | { |
| 6084 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 6085 | uint32_t *channel_list; |
| 6086 | int32_t len; |
| 6087 | wmi_buf_t buf; |
| 6088 | uint8_t *buf_ptr; |
| 6089 | uint8_t count; |
| 6090 | int ret; |
| 6091 | |
| 6092 | /* TLV place holder for channel_list */ |
| 6093 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 6094 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 6095 | |
| 6096 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6097 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6098 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6099 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6100 | } |
| 6101 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 6102 | |
| 6103 | buf_ptr = (uint8_t *) cmd; |
| 6104 | |
| 6105 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6106 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 6107 | WMITLV_GET_STRUCT_TLVLEN |
| 6108 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 6109 | |
| 6110 | cmd->vdev_id = plm->session_id; |
| 6111 | |
| 6112 | cmd->meas_token = plm->meas_token; |
| 6113 | cmd->dialog_token = plm->diag_token; |
| 6114 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6115 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6116 | cmd->off_duration = plm->meas_duration; |
| 6117 | cmd->burst_cycle = plm->burst_len; |
| 6118 | cmd->tx_power = plm->desired_tx_pwr; |
| 6119 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 6120 | cmd->num_chans = plm->plm_num_ch; |
| 6121 | |
| 6122 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 6123 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6124 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 6125 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 6126 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 6127 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 6128 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 6129 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 6130 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 6131 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6132 | |
| 6133 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6134 | (cmd->num_chans * sizeof(uint32_t))); |
| 6135 | |
| 6136 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6137 | if (cmd->num_chans) { |
| 6138 | channel_list = (uint32_t *) buf_ptr; |
| 6139 | for (count = 0; count < cmd->num_chans; count++) { |
| 6140 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6141 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6142 | channel_list[count] = |
| 6143 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6144 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6145 | } |
| 6146 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 6147 | } |
| 6148 | |
| 6149 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6150 | WMI_VDEV_PLMREQ_START_CMDID); |
| 6151 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6152 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6153 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6154 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6155 | } |
| 6156 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6157 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6158 | } |
| 6159 | |
| 6160 | /** |
| 6161 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 6162 | * @wmi_handle: wmi handle |
| 6163 | * @vdev_id: vdev id |
| 6164 | * |
| 6165 | * This function request FW to stop ongoing PNO operation. |
| 6166 | * |
| 6167 | * Return: CDF status |
| 6168 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6169 | 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] | 6170 | { |
| 6171 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6172 | int32_t len = sizeof(*cmd); |
| 6173 | wmi_buf_t buf; |
| 6174 | uint8_t *buf_ptr; |
| 6175 | int ret; |
| 6176 | |
| 6177 | /* |
| 6178 | * TLV place holder for array of structures nlo_configured_parameters |
| 6179 | * TLV place holder for array of uint32_t channel_list |
| 6180 | * TLV place holder for chnl prediction cfg |
| 6181 | */ |
| 6182 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6183 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6184 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6185 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6186 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6187 | } |
| 6188 | |
| 6189 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6190 | buf_ptr = (uint8_t *) cmd; |
| 6191 | |
| 6192 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6193 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6194 | WMITLV_GET_STRUCT_TLVLEN |
| 6195 | (wmi_nlo_config_cmd_fixed_param)); |
| 6196 | |
| 6197 | cmd->vdev_id = vdev_id; |
| 6198 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 6199 | buf_ptr += sizeof(*cmd); |
| 6200 | |
| 6201 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6202 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6203 | |
| 6204 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6205 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6206 | |
| 6207 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6208 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6209 | |
| 6210 | |
| 6211 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6212 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6213 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6214 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6215 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6216 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6217 | } |
| 6218 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6219 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6220 | } |
| 6221 | |
| 6222 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6223 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 6224 | * @buf_ptr: Buffer passed by upper layers |
| 6225 | * @pno: Buffer to be sent to the firmware |
| 6226 | * |
| 6227 | * Copy the PNO Channel prediction configuration parameters |
| 6228 | * passed by the upper layers to a WMI format TLV and send it |
| 6229 | * down to the firmware. |
| 6230 | * |
| 6231 | * Return: None |
| 6232 | */ |
| 6233 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 6234 | struct pno_scan_req_params *pno) |
| 6235 | { |
| 6236 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 6237 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 6238 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 6239 | WMITLV_TAG_ARRAY_BYTE, |
| 6240 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6241 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6242 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 6243 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 6244 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 6245 | channel_prediction_cfg->full_scan_period_ms = |
| 6246 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6247 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6248 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 6249 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 6250 | channel_prediction_cfg->enable, |
| 6251 | channel_prediction_cfg->top_k_num, |
| 6252 | channel_prediction_cfg->stationary_threshold, |
| 6253 | channel_prediction_cfg->full_scan_period_ms); |
| 6254 | } |
| 6255 | |
| 6256 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6257 | * send_pno_start_cmd_tlv() - PNO start request |
| 6258 | * @wmi_handle: wmi handle |
| 6259 | * @pno: PNO request |
| 6260 | * |
| 6261 | * This function request FW to start PNO request. |
| 6262 | * Request: CDF status |
| 6263 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6264 | QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6265 | struct pno_scan_req_params *pno, |
| 6266 | uint32_t *gchannel_freq_list) |
| 6267 | { |
| 6268 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6269 | nlo_configured_parameters *nlo_list; |
| 6270 | uint32_t *channel_list; |
| 6271 | int32_t len; |
| 6272 | wmi_buf_t buf; |
| 6273 | uint8_t *buf_ptr; |
| 6274 | uint8_t i; |
| 6275 | int ret; |
| 6276 | |
| 6277 | /* |
| 6278 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 6279 | * TLV place holder for array of uint32_t channel_list |
| 6280 | * TLV place holder for chnnl prediction cfg |
| 6281 | */ |
| 6282 | len = sizeof(*cmd) + |
| 6283 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6284 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6285 | len += sizeof(uint32_t) * QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6286 | WMI_NLO_MAX_CHAN); |
| 6287 | len += sizeof(nlo_configured_parameters) * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6288 | QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6289 | len += sizeof(nlo_channel_prediction_cfg); |
| 6290 | |
| 6291 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6292 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6293 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6294 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6295 | } |
| 6296 | |
| 6297 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6298 | |
| 6299 | buf_ptr = (uint8_t *) cmd; |
| 6300 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6301 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6302 | WMITLV_GET_STRUCT_TLVLEN |
| 6303 | (wmi_nlo_config_cmd_fixed_param)); |
| 6304 | cmd->vdev_id = pno->sessionId; |
| 6305 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 6306 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6307 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6308 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
| 6309 | pno->pnoscan_adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6310 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6311 | /* Current FW does not support min-max range for dwell time */ |
| 6312 | cmd->active_dwell_time = pno->active_max_time; |
| 6313 | cmd->passive_dwell_time = pno->passive_max_time; |
| 6314 | |
| 6315 | /* Copy scan interval */ |
| 6316 | cmd->fast_scan_period = pno->fast_scan_period; |
| 6317 | cmd->slow_scan_period = pno->slow_scan_period; |
| 6318 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6319 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6320 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6321 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6322 | |
| 6323 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6324 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6325 | cmd->no_of_ssids = QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
| 6326 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6327 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6328 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6329 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6330 | |
| 6331 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6332 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6333 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6334 | WMITLV_TAG_ARRAY_BYTE, |
| 6335 | WMITLV_GET_STRUCT_TLVLEN |
| 6336 | (nlo_configured_parameters)); |
| 6337 | /* Copy ssid and it's length */ |
| 6338 | nlo_list[i].ssid.valid = true; |
| 6339 | nlo_list[i].ssid.ssid.ssid_len = pno->aNetworks[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6340 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6341 | pno->aNetworks[i].ssid.mac_ssid, |
| 6342 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6343 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6344 | nlo_list[i].ssid.ssid.ssid_len, |
| 6345 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 6346 | nlo_list[i].ssid.ssid.ssid_len); |
| 6347 | |
| 6348 | /* Copy rssi threshold */ |
| 6349 | if (pno->aNetworks[i].rssiThreshold && |
| 6350 | pno->aNetworks[i].rssiThreshold > WMI_RSSI_THOLD_DEFAULT) { |
| 6351 | nlo_list[i].rssi_cond.valid = true; |
| 6352 | nlo_list[i].rssi_cond.rssi = |
| 6353 | pno->aNetworks[i].rssiThreshold; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6354 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6355 | nlo_list[i].rssi_cond.rssi); |
| 6356 | } |
| 6357 | nlo_list[i].bcast_nw_type.valid = true; |
| 6358 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6359 | pno->aNetworks[i].bcastNetwType; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6360 | WMI_LOGI("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6361 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6362 | } |
| 6363 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6364 | |
| 6365 | /* Copy channel info */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6366 | cmd->num_of_channels = QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6367 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6368 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6369 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6370 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 6371 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6372 | |
| 6373 | channel_list = (uint32_t *) buf_ptr; |
| 6374 | for (i = 0; i < cmd->num_of_channels; i++) { |
| 6375 | channel_list[i] = pno->aNetworks[0].aChannels[i]; |
| 6376 | |
| 6377 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
| 6378 | channel_list[i] = gchannel_freq_list[i]; |
| 6379 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6380 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6381 | } |
| 6382 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 6383 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6384 | sizeof(nlo_channel_prediction_cfg)); |
| 6385 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6386 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6387 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6388 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 6389 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 6390 | */ |
| 6391 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6392 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6393 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6394 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6395 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6396 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6397 | } |
| 6398 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6399 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6400 | } |
| 6401 | |
| 6402 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 6403 | * @wmi_handle: wmi handle |
| 6404 | * @msg: message |
| 6405 | * @is_add_ts: is addts required |
| 6406 | * |
| 6407 | * This function sets ric request element for 11r roaming. |
| 6408 | * |
| 6409 | * Return: CDF status |
| 6410 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6411 | 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] | 6412 | void *msg, uint8_t is_add_ts) |
| 6413 | { |
| 6414 | wmi_ric_request_fixed_param *cmd; |
| 6415 | wmi_ric_tspec *tspec_param; |
| 6416 | wmi_buf_t buf; |
| 6417 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6418 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6419 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 6420 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 6421 | |
| 6422 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6423 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6424 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6425 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6426 | } |
| 6427 | |
| 6428 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6429 | |
| 6430 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 6431 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6432 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 6433 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 6434 | if (is_add_ts) |
| 6435 | cmd->vdev_id = ((struct add_ts_param *) msg)->sessionId; |
| 6436 | else |
| 6437 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 6438 | cmd->num_ric_request = 1; |
| 6439 | cmd->is_add_ric = is_add_ts; |
| 6440 | |
| 6441 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 6442 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 6443 | |
| 6444 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6445 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 6446 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 6447 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 6448 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 6449 | |
| 6450 | if (is_add_ts) |
| 6451 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6452 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6453 | else |
| 6454 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6455 | #endif |
| 6456 | if (ptspecIE) { |
| 6457 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6458 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6459 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 6460 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6461 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6462 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 6463 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6464 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 6465 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6466 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 6467 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 6468 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 6469 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 6470 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 6471 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 6472 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 6473 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 6474 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 6475 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 6476 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 6477 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 6478 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 6479 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 6480 | tspec_param->medium_time = 0; |
| 6481 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6482 | 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] | 6483 | |
| 6484 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6485 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6486 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6487 | __func__); |
| 6488 | if (is_add_ts) |
| 6489 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6490 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6491 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6492 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6493 | } |
| 6494 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6495 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6496 | } |
| 6497 | |
| 6498 | /** |
| 6499 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 6500 | * @wmi_handle: wmi handle |
| 6501 | * @clear_req: ll stats clear request command params |
| 6502 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6503 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6504 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6505 | 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] | 6506 | const struct ll_stats_clear_params *clear_req, |
| 6507 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6508 | { |
| 6509 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 6510 | int32_t len; |
| 6511 | wmi_buf_t buf; |
| 6512 | uint8_t *buf_ptr; |
| 6513 | int ret; |
| 6514 | |
| 6515 | len = sizeof(*cmd); |
| 6516 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6517 | |
| 6518 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6519 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6520 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6521 | } |
| 6522 | |
| 6523 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6524 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6525 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 6526 | |
| 6527 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6528 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 6529 | WMITLV_GET_STRUCT_TLVLEN |
| 6530 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 6531 | |
| 6532 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 6533 | cmd->vdev_id = clear_req->sta_id; |
| 6534 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 6535 | |
| 6536 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 6537 | &cmd->peer_macaddr); |
| 6538 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6539 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 6540 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 6541 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 6542 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 6543 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6544 | cmd->peer_macaddr); */ |
| 6545 | |
| 6546 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6547 | WMI_CLEAR_LINK_STATS_CMDID); |
| 6548 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6549 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6550 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6551 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6552 | } |
| 6553 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6554 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 6555 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6556 | } |
| 6557 | |
| 6558 | /** |
| 6559 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 6560 | * @wmi_handle: wmi handle |
| 6561 | * @setReq: ll stats set request command params |
| 6562 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6563 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6564 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6565 | 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] | 6566 | const struct ll_stats_set_params *set_req) |
| 6567 | { |
| 6568 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 6569 | int32_t len; |
| 6570 | wmi_buf_t buf; |
| 6571 | uint8_t *buf_ptr; |
| 6572 | int ret; |
| 6573 | |
| 6574 | len = sizeof(*cmd); |
| 6575 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6576 | |
| 6577 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6578 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6579 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6580 | } |
| 6581 | |
| 6582 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6583 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6584 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 6585 | |
| 6586 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6587 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 6588 | WMITLV_GET_STRUCT_TLVLEN |
| 6589 | (wmi_start_link_stats_cmd_fixed_param)); |
| 6590 | |
| 6591 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 6592 | cmd->aggressive_statistics_gathering = |
| 6593 | set_req->aggressive_statistics_gathering; |
| 6594 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6595 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 6596 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 6597 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6598 | |
| 6599 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6600 | WMI_START_LINK_STATS_CMDID); |
| 6601 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6602 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6603 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6604 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6605 | } |
| 6606 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6607 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6608 | } |
| 6609 | |
| 6610 | /** |
| 6611 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 6612 | * @wmi_handle:wmi handle |
| 6613 | * @get_req:ll stats get request command params |
| 6614 | * @addr: mac address |
| 6615 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6616 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6617 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6618 | 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] | 6619 | const struct ll_stats_get_params *get_req, |
| 6620 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6621 | { |
| 6622 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 6623 | int32_t len; |
| 6624 | wmi_buf_t buf; |
| 6625 | uint8_t *buf_ptr; |
| 6626 | int ret; |
| 6627 | |
| 6628 | len = sizeof(*cmd); |
| 6629 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6630 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 6631 | if (!buf) { |
| 6632 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 6633 | return QDF_STATUS_E_NOMEM; |
| 6634 | } |
| 6635 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6636 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6637 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6638 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 6639 | |
| 6640 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6641 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 6642 | WMITLV_GET_STRUCT_TLVLEN |
| 6643 | (wmi_request_link_stats_cmd_fixed_param)); |
| 6644 | |
| 6645 | cmd->request_id = get_req->req_id; |
| 6646 | cmd->stats_type = get_req->param_id_mask; |
| 6647 | cmd->vdev_id = get_req->sta_id; |
| 6648 | |
| 6649 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 6650 | &cmd->peer_macaddr); |
| 6651 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6652 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
| 6653 | WMI_LOGD("Request ID : %d", cmd->request_id); |
| 6654 | WMI_LOGD("Stats Type : %d", cmd->stats_type); |
| 6655 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 6656 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6657 | |
| 6658 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6659 | WMI_REQUEST_LINK_STATS_CMDID); |
| 6660 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6661 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6662 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6663 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6664 | } |
| 6665 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6666 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6667 | } |
| 6668 | |
| 6669 | /** |
| 6670 | * send_get_stats_cmd_tlv() - get stats request |
| 6671 | * @wmi_handle: wmi handle |
| 6672 | * @get_stats_param: stats params |
| 6673 | * @addr: mac address |
| 6674 | * |
| 6675 | * Return: CDF status |
| 6676 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6677 | QDF_STATUS send_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6678 | struct pe_stats_req *get_stats_param, |
| 6679 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6680 | { |
| 6681 | wmi_buf_t buf; |
| 6682 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6683 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6684 | |
| 6685 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6686 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6687 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 6688 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6689 | } |
| 6690 | |
| 6691 | |
| 6692 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6693 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6694 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6695 | WMITLV_GET_STRUCT_TLVLEN |
| 6696 | (wmi_request_stats_cmd_fixed_param)); |
| 6697 | cmd->stats_id = |
| 6698 | WMI_REQUEST_PEER_STAT | WMI_REQUEST_PDEV_STAT | |
Himanshu Agarwal | c9fc2a3 | 2016-07-21 14:46:58 +0530 | [diff] [blame] | 6699 | WMI_REQUEST_VDEV_STAT | WMI_REQUEST_RSSI_PER_CHAIN_STAT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6700 | cmd->vdev_id = get_stats_param->session_id; |
| 6701 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6702 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6703 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6704 | WMI_REQUEST_STATS_CMDID)) { |
| 6705 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6706 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6707 | __func__); |
| 6708 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6709 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6710 | } |
| 6711 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6712 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6713 | |
| 6714 | } |
| 6715 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6716 | /** |
| 6717 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 6718 | * @wmi_handle: wmi handle |
| 6719 | * @rssi_req: get RSSI request |
| 6720 | * |
| 6721 | * Return: CDF status |
| 6722 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6723 | QDF_STATUS send_snr_request_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6724 | { |
| 6725 | wmi_buf_t buf; |
| 6726 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6727 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6728 | |
| 6729 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6730 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6731 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6732 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6733 | } |
| 6734 | |
| 6735 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6736 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6737 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6738 | WMITLV_GET_STRUCT_TLVLEN |
| 6739 | (wmi_request_stats_cmd_fixed_param)); |
| 6740 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 6741 | if (wmi_unified_cmd_send |
| 6742 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6743 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6744 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6745 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6746 | } |
| 6747 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6748 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6749 | } |
| 6750 | |
| 6751 | /** |
| 6752 | * send_snr_cmd_tlv() - get RSSI from fw |
| 6753 | * @wmi_handle: wmi handle |
| 6754 | * @vdev_id: vdev id |
| 6755 | * |
| 6756 | * Return: CDF status |
| 6757 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6758 | 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] | 6759 | { |
| 6760 | wmi_buf_t buf; |
| 6761 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6762 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6763 | |
| 6764 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6765 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6766 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6767 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6768 | } |
| 6769 | |
| 6770 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6771 | cmd->vdev_id = vdev_id; |
| 6772 | |
| 6773 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6774 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6775 | WMITLV_GET_STRUCT_TLVLEN |
| 6776 | (wmi_request_stats_cmd_fixed_param)); |
| 6777 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 6778 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6779 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6780 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6781 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6782 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6783 | } |
| 6784 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6785 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6786 | } |
| 6787 | |
| 6788 | /** |
| 6789 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 6790 | * @wmi_handle: wmi handle |
| 6791 | * @link_status: get link params |
| 6792 | * |
| 6793 | * Return: CDF status |
| 6794 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6795 | 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] | 6796 | struct link_status_params *link_status) |
| 6797 | { |
| 6798 | wmi_buf_t buf; |
| 6799 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6800 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6801 | |
| 6802 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6803 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6804 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6805 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6806 | } |
| 6807 | |
| 6808 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6809 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6810 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6811 | WMITLV_GET_STRUCT_TLVLEN |
| 6812 | (wmi_request_stats_cmd_fixed_param)); |
| 6813 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 6814 | cmd->vdev_id = link_status->session_id; |
| 6815 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6816 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6817 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6818 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6819 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6820 | } |
| 6821 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6822 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6823 | } |
| 6824 | |
| 6825 | #ifdef FEATURE_WLAN_LPHB |
| 6826 | |
| 6827 | /** |
| 6828 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 6829 | * @wmi_handle: wmi handle |
| 6830 | * @lphb_conf_req: configuration info |
| 6831 | * |
| 6832 | * Return: CDF status |
| 6833 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6834 | 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] | 6835 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 6836 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6837 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6838 | wmi_buf_t buf = NULL; |
| 6839 | uint8_t *buf_ptr; |
| 6840 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 6841 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 6842 | |
| 6843 | |
| 6844 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6845 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6846 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6847 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6848 | } |
| 6849 | |
| 6850 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6851 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 6852 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 6853 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 6854 | WMITLV_GET_STRUCT_TLVLEN |
| 6855 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 6856 | |
| 6857 | /* fill in values */ |
| 6858 | hb_enable_fp->vdev_id = params->session; |
| 6859 | hb_enable_fp->enable = params->enable; |
| 6860 | hb_enable_fp->item = params->item; |
| 6861 | hb_enable_fp->session = params->session; |
| 6862 | |
| 6863 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6864 | len, WMI_HB_SET_ENABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6865 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6866 | 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] | 6867 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6868 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6869 | } |
| 6870 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6871 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6872 | } |
| 6873 | |
| 6874 | /** |
| 6875 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 6876 | * @wmi_handle: wmi handle |
| 6877 | * @lphb_conf_req: lphb config request |
| 6878 | * |
| 6879 | * Return: CDF status |
| 6880 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6881 | 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] | 6882 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 6883 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6884 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6885 | wmi_buf_t buf = NULL; |
| 6886 | uint8_t *buf_ptr; |
| 6887 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 6888 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 6889 | |
| 6890 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6891 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6892 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6893 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6894 | } |
| 6895 | |
| 6896 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6897 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 6898 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 6899 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 6900 | WMITLV_GET_STRUCT_TLVLEN |
| 6901 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 6902 | |
| 6903 | /* fill in values */ |
| 6904 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 6905 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 6906 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 6907 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 6908 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 6909 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 6910 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 6911 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 6912 | hb_tcp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6913 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6914 | &lphb_conf_req->gateway_mac, |
| 6915 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 6916 | |
| 6917 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6918 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6919 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6920 | 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] | 6921 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 6922 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6923 | } |
| 6924 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6925 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6926 | } |
| 6927 | |
| 6928 | /** |
| 6929 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 6930 | * @wmi_handle: wmi handle |
| 6931 | * @lphb_conf_req: lphb config request |
| 6932 | * |
| 6933 | * Return: CDF status |
| 6934 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6935 | 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] | 6936 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 6937 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6938 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6939 | wmi_buf_t buf = NULL; |
| 6940 | uint8_t *buf_ptr; |
| 6941 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 6942 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 6943 | |
| 6944 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6945 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6946 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6947 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6948 | } |
| 6949 | |
| 6950 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6951 | hb_tcp_filter_fp = |
| 6952 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 6953 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 6954 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 6955 | WMITLV_GET_STRUCT_TLVLEN |
| 6956 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 6957 | |
| 6958 | /* fill in values */ |
| 6959 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 6960 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 6961 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 6962 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 6963 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 6964 | (void *)&g_hb_tcp_filter_fp->filter, |
| 6965 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 6966 | |
| 6967 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6968 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6969 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6970 | 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] | 6971 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 6972 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6973 | } |
| 6974 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6975 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6976 | } |
| 6977 | |
| 6978 | /** |
| 6979 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 6980 | * @wmi_handle: wmi handle |
| 6981 | * @lphb_conf_req: lphb config request |
| 6982 | * |
| 6983 | * Return: CDF status |
| 6984 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6985 | 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] | 6986 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 6987 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6988 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6989 | wmi_buf_t buf = NULL; |
| 6990 | uint8_t *buf_ptr; |
| 6991 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 6992 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 6993 | |
| 6994 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6995 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6996 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6997 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6998 | } |
| 6999 | |
| 7000 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7001 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 7002 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 7003 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 7004 | WMITLV_GET_STRUCT_TLVLEN |
| 7005 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 7006 | |
| 7007 | /* fill in values */ |
| 7008 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7009 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 7010 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 7011 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 7012 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 7013 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 7014 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 7015 | hb_udp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7016 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7017 | &lphb_conf_req->gateway_mac, |
| 7018 | sizeof(lphb_conf_req->gateway_mac)); |
| 7019 | |
| 7020 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7021 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7022 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7023 | 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] | 7024 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7025 | wmi_buf_free(buf); |
| 7026 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7027 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7028 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7029 | } |
| 7030 | |
| 7031 | /** |
| 7032 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 7033 | * @wmi_handle: wmi handle |
| 7034 | * @lphb_conf_req: lphb config request |
| 7035 | * |
| 7036 | * Return: CDF status |
| 7037 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7038 | 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] | 7039 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 7040 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7041 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7042 | wmi_buf_t buf = NULL; |
| 7043 | uint8_t *buf_ptr; |
| 7044 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 7045 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 7046 | |
| 7047 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7048 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7049 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7050 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7051 | } |
| 7052 | |
| 7053 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7054 | hb_udp_filter_fp = |
| 7055 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 7056 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 7057 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 7058 | WMITLV_GET_STRUCT_TLVLEN |
| 7059 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 7060 | |
| 7061 | /* fill in values */ |
| 7062 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7063 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 7064 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 7065 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 7066 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 7067 | (void *)&lphb_conf_req->filter, |
| 7068 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 7069 | |
| 7070 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7071 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7072 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7073 | 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] | 7074 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7075 | wmi_buf_free(buf); |
| 7076 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7077 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7078 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7079 | } |
| 7080 | #endif /* FEATURE_WLAN_LPHB */ |
| 7081 | |
| 7082 | /** |
| 7083 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 7084 | * @wmi_handle: wmi handle |
| 7085 | * @ta_dhcp_ind: DHCP indication parameter |
| 7086 | * |
| 7087 | * Return: CDF Status |
| 7088 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7089 | 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] | 7090 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 7091 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7092 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7093 | wmi_buf_t buf = NULL; |
| 7094 | uint8_t *buf_ptr; |
| 7095 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 7096 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 7097 | |
| 7098 | |
| 7099 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7100 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7101 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7102 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7103 | } |
| 7104 | |
| 7105 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7106 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 7107 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 7108 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 7109 | WMITLV_GET_STRUCT_TLVLEN |
| 7110 | (wmi_peer_set_param_cmd_fixed_param)); |
| 7111 | |
| 7112 | /* fill in values */ |
| 7113 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 7114 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 7115 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7116 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7117 | &ta_dhcp_ind->peer_macaddr, |
| 7118 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 7119 | |
| 7120 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7121 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7122 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7123 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7124 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7125 | wmi_buf_free(buf); |
| 7126 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7127 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7128 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7129 | } |
| 7130 | |
| 7131 | /** |
| 7132 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 7133 | * @wmi_handle: wmi handle |
| 7134 | * @pLinkSpeed: link speed info |
| 7135 | * |
| 7136 | * Return: CDF status |
| 7137 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7138 | 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] | 7139 | wmi_mac_addr peer_macaddr) |
| 7140 | { |
| 7141 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 7142 | wmi_buf_t wmi_buf; |
| 7143 | uint32_t len; |
| 7144 | uint8_t *buf_ptr; |
| 7145 | |
| 7146 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 7147 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7148 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7149 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7150 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7151 | } |
| 7152 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7153 | |
| 7154 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 7155 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7156 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 7157 | WMITLV_GET_STRUCT_TLVLEN |
| 7158 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 7159 | |
| 7160 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7161 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7162 | &peer_macaddr, |
| 7163 | sizeof(peer_macaddr)); |
| 7164 | |
| 7165 | |
| 7166 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7167 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7168 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7169 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7170 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7171 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7172 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7173 | } |
| 7174 | |
| 7175 | /** |
| 7176 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 7177 | * @wmi_handle: wmi handler |
| 7178 | * @egap_params: pointer to egap_params |
| 7179 | * |
| 7180 | * Return: 0 for success, otherwise appropriate error code |
| 7181 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7182 | 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] | 7183 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 7184 | { |
| 7185 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 7186 | wmi_buf_t buf; |
| 7187 | int32_t err; |
| 7188 | |
| 7189 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7190 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7191 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 7192 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7193 | } |
| 7194 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 7195 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7196 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 7197 | WMITLV_GET_STRUCT_TLVLEN( |
| 7198 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 7199 | |
| 7200 | cmd->enable = egap_params->enable; |
| 7201 | cmd->inactivity_time = egap_params->inactivity_time; |
| 7202 | cmd->wait_time = egap_params->wait_time; |
| 7203 | cmd->flags = egap_params->flags; |
| 7204 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7205 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 7206 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7207 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7208 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7209 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7210 | } |
| 7211 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7212 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7213 | } |
| 7214 | |
| 7215 | /** |
| 7216 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 7217 | * @wmi_handl: wmi handle |
| 7218 | * @cmd: Profiling command index |
| 7219 | * @value1: parameter1 value |
| 7220 | * @value2: parameter2 value |
| 7221 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7222 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7223 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7224 | QDF_STATUS send_fw_profiling_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7225 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 7226 | { |
| 7227 | wmi_buf_t buf; |
| 7228 | int32_t len = 0; |
| 7229 | int ret; |
| 7230 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 7231 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 7232 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 7233 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 7234 | |
| 7235 | switch (cmd) { |
| 7236 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 7237 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 7238 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7239 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7240 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7241 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7242 | } |
| 7243 | prof_trig_cmd = |
| 7244 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 7245 | wmi_buf_data(buf); |
| 7246 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 7247 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 7248 | WMITLV_GET_STRUCT_TLVLEN |
| 7249 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 7250 | prof_trig_cmd->enable = value1; |
| 7251 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7252 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 7253 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7254 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7255 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7256 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7257 | return ret; |
| 7258 | } |
| 7259 | break; |
| 7260 | |
| 7261 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 7262 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 7263 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7264 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7265 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7266 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7267 | } |
| 7268 | profile_getdata_cmd = |
| 7269 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 7270 | wmi_buf_data(buf); |
| 7271 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 7272 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 7273 | WMITLV_GET_STRUCT_TLVLEN |
| 7274 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 7275 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7276 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 7277 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7278 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7279 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7280 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7281 | return ret; |
| 7282 | } |
| 7283 | break; |
| 7284 | |
| 7285 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 7286 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 7287 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7288 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7289 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7290 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7291 | } |
| 7292 | hist_intvl_cmd = |
| 7293 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 7294 | wmi_buf_data(buf); |
| 7295 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 7296 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 7297 | WMITLV_GET_STRUCT_TLVLEN |
| 7298 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 7299 | hist_intvl_cmd->profile_id = value1; |
| 7300 | hist_intvl_cmd->value = value2; |
| 7301 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7302 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 7303 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7304 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7305 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7306 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7307 | return ret; |
| 7308 | } |
| 7309 | break; |
| 7310 | |
| 7311 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 7312 | len = |
| 7313 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 7314 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7315 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7316 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7317 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7318 | } |
| 7319 | profile_enable_cmd = |
| 7320 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 7321 | wmi_buf_data(buf); |
| 7322 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 7323 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 7324 | WMITLV_GET_STRUCT_TLVLEN |
| 7325 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 7326 | profile_enable_cmd->profile_id = value1; |
| 7327 | profile_enable_cmd->enable = value2; |
| 7328 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7329 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 7330 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7331 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7332 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7333 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7334 | return ret; |
| 7335 | } |
| 7336 | break; |
| 7337 | |
| 7338 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7339 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7340 | break; |
| 7341 | } |
| 7342 | |
| 7343 | return 0; |
| 7344 | } |
| 7345 | |
| 7346 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 7347 | /** |
| 7348 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 7349 | * @wmi_handle: wmi handle |
| 7350 | * @vdev_id: vdev id |
| 7351 | * |
| 7352 | * Return: CDF status |
| 7353 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7354 | 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] | 7355 | uint8_t vdev_id, uint8_t default_pattern, |
| 7356 | uint16_t rate_limit_interval) |
| 7357 | { |
| 7358 | |
| 7359 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 7360 | wmi_buf_t buf; |
| 7361 | uint8_t *buf_ptr; |
| 7362 | int32_t len; |
| 7363 | int ret; |
| 7364 | |
| 7365 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 7366 | WMI_TLV_HDR_SIZE + |
| 7367 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 7368 | WMI_TLV_HDR_SIZE + |
| 7369 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 7370 | WMI_TLV_HDR_SIZE + |
| 7371 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 7372 | WMI_TLV_HDR_SIZE + |
| 7373 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 7374 | WMI_TLV_HDR_SIZE + |
| 7375 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 7376 | |
| 7377 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7378 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7379 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7380 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7381 | } |
| 7382 | |
| 7383 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7384 | buf_ptr = (uint8_t *) cmd; |
| 7385 | |
| 7386 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7387 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 7388 | WMITLV_GET_STRUCT_TLVLEN |
| 7389 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 7390 | cmd->vdev_id = vdev_id; |
| 7391 | cmd->pattern_id = default_pattern, |
| 7392 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 7393 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 7394 | |
| 7395 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 7396 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7397 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7398 | |
| 7399 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 7400 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7401 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7402 | |
| 7403 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 7404 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7405 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7406 | |
| 7407 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 7408 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7409 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7410 | |
| 7411 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 7412 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7413 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7414 | |
| 7415 | /* Fill TLV for ra_ratelimit_interval. */ |
| 7416 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 7417 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7418 | |
| 7419 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 7420 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7421 | 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] | 7422 | rate_limit_interval, vdev_id); |
| 7423 | |
| 7424 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7425 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 7426 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7427 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7428 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7429 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7430 | } |
| 7431 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7432 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7433 | |
| 7434 | } |
| 7435 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 7436 | |
| 7437 | /** |
| 7438 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 7439 | * @wmi_handle: wmi handle |
| 7440 | * @vdev_id: vdev id |
| 7441 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7442 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7443 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7444 | 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] | 7445 | { |
| 7446 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 7447 | wmi_buf_t buf; |
| 7448 | int32_t len = sizeof(*cmd); |
| 7449 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7450 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7451 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7452 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7453 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7454 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7455 | } |
| 7456 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 7457 | wmi_buf_data(buf); |
| 7458 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7459 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 7460 | WMITLV_GET_STRUCT_TLVLEN |
| 7461 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 7462 | cmd->vdev_id = vdev_id; |
| 7463 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 7464 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7465 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7466 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7467 | __func__); |
| 7468 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7469 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7470 | } |
| 7471 | |
| 7472 | return 0; |
| 7473 | } |
| 7474 | |
| 7475 | /** |
| 7476 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 7477 | * @wmi_handle: wmi handle |
| 7478 | * @vdev_id: vdev id |
| 7479 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7480 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7481 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7482 | 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] | 7483 | uint8_t vdev_id) |
| 7484 | { |
| 7485 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 7486 | wmi_buf_t buf; |
| 7487 | int32_t len = sizeof(*cmd); |
| 7488 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7489 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7490 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7491 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7492 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7493 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7494 | } |
| 7495 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 7496 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7497 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 7498 | WMITLV_GET_STRUCT_TLVLEN |
| 7499 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 7500 | cmd->vdev_id = vdev_id; |
| 7501 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 7502 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7503 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7504 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7505 | __func__); |
| 7506 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7507 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7508 | } |
| 7509 | |
| 7510 | return 0; |
| 7511 | } |
| 7512 | |
| 7513 | /** |
| 7514 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 7515 | * @wmi_handle: wmi handle |
| 7516 | * @startOemDataReq: start request params |
| 7517 | * |
| 7518 | * Return: CDF status |
| 7519 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7520 | 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] | 7521 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7522 | uint8_t *data) |
| 7523 | { |
| 7524 | wmi_buf_t buf; |
| 7525 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7526 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7527 | |
| 7528 | buf = wmi_buf_alloc(wmi_handle, |
| 7529 | (data_len + WMI_TLV_HDR_SIZE)); |
| 7530 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7531 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 7532 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7533 | } |
| 7534 | |
| 7535 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 7536 | |
| 7537 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 7538 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7539 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7540 | data_len); |
| 7541 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7542 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7543 | data_len); |
| 7544 | |
| 7545 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 7546 | (data_len + |
| 7547 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 7548 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7549 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7550 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7551 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7552 | } |
| 7553 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7554 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7555 | } |
| 7556 | |
| 7557 | /** |
| 7558 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 7559 | * @wmi_handle: wmi handle |
| 7560 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 7561 | * |
| 7562 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 7563 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 7564 | * to firmware based on phyerr filtering |
| 7565 | * offload status. |
| 7566 | * |
| 7567 | * Return: 1 success, 0 failure |
| 7568 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7569 | QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7570 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 7571 | bool dfs_phyerr_filter_offload) |
| 7572 | { |
| 7573 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 7574 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 7575 | wmi_buf_t buf; |
| 7576 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7577 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7578 | |
| 7579 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 7580 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7581 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7582 | __func__); |
| 7583 | len = sizeof(*disable_phyerr_offload_cmd); |
| 7584 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7585 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7586 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7587 | return 0; |
| 7588 | } |
| 7589 | disable_phyerr_offload_cmd = |
| 7590 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 7591 | wmi_buf_data(buf); |
| 7592 | |
| 7593 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 7594 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 7595 | WMITLV_GET_STRUCT_TLVLEN |
| 7596 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 7597 | |
| 7598 | /* |
| 7599 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 7600 | * to the firmware to disable the phyerror |
| 7601 | * filtering offload. |
| 7602 | */ |
| 7603 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7604 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7605 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7606 | 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] | 7607 | __func__, ret); |
| 7608 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7609 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7610 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7611 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7612 | __func__); |
| 7613 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7614 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7615 | __func__); |
| 7616 | |
| 7617 | len = sizeof(*enable_phyerr_offload_cmd); |
| 7618 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7619 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7620 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7621 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7622 | } |
| 7623 | |
| 7624 | enable_phyerr_offload_cmd = |
| 7625 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 7626 | wmi_buf_data(buf); |
| 7627 | |
| 7628 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 7629 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 7630 | WMITLV_GET_STRUCT_TLVLEN |
| 7631 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 7632 | |
| 7633 | /* |
| 7634 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 7635 | * to the firmware to enable the phyerror |
| 7636 | * filtering offload. |
| 7637 | */ |
| 7638 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7639 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 7640 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7641 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7642 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7643 | __func__, ret); |
| 7644 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7645 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7646 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7647 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7648 | __func__); |
| 7649 | } |
| 7650 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7651 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7652 | } |
| 7653 | |
| 7654 | #if !defined(REMOVE_PKT_LOG) |
| 7655 | /** |
| 7656 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 7657 | * @wmi_handle: wmi handle |
| 7658 | * @pktlog_event: pktlog event |
| 7659 | * @cmd_id: pktlog cmd id |
| 7660 | * |
| 7661 | * Return: CDF status |
| 7662 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7663 | 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] | 7664 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7665 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7666 | { |
| 7667 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 7668 | WMI_CMD_ID CMD_ID; |
| 7669 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 7670 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 7671 | int len = 0; |
| 7672 | wmi_buf_t buf; |
| 7673 | |
| 7674 | PKTLOG_EVENT = pktlog_event; |
| 7675 | CMD_ID = cmd_id; |
| 7676 | |
| 7677 | switch (CMD_ID) { |
| 7678 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 7679 | len = sizeof(*cmd); |
| 7680 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7681 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7682 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7683 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7684 | } |
| 7685 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 7686 | wmi_buf_data(buf); |
| 7687 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7688 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 7689 | WMITLV_GET_STRUCT_TLVLEN |
| 7690 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 7691 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7692 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 7693 | : WMI_PKTLOG_ENABLE_AUTO; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7694 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7695 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7696 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7697 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7698 | goto wmi_send_failed; |
| 7699 | } |
| 7700 | break; |
| 7701 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 7702 | len = sizeof(*disable_cmd); |
| 7703 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7704 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7705 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7706 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7707 | } |
| 7708 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 7709 | wmi_buf_data(buf); |
| 7710 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 7711 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 7712 | WMITLV_GET_STRUCT_TLVLEN |
| 7713 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7714 | disable_cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7715 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7716 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7717 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7718 | goto wmi_send_failed; |
| 7719 | } |
| 7720 | break; |
| 7721 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7722 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7723 | break; |
| 7724 | } |
| 7725 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7726 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7727 | |
| 7728 | wmi_send_failed: |
| 7729 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7730 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7731 | } |
| 7732 | #endif /* REMOVE_PKT_LOG */ |
| 7733 | |
| 7734 | /** |
| 7735 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 7736 | * @wmi_handle: wmi handle |
| 7737 | * @vdev_id: vdev id |
| 7738 | * @bitmap: Event bitmap |
| 7739 | * @enable: enable/disable |
| 7740 | * |
| 7741 | * Return: CDF status |
| 7742 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7743 | 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] | 7744 | uint32_t vdev_id, |
| 7745 | uint32_t bitmap, |
| 7746 | bool enable) |
| 7747 | { |
| 7748 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 7749 | uint16_t len; |
| 7750 | wmi_buf_t buf; |
| 7751 | int ret; |
| 7752 | |
| 7753 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 7754 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7755 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7756 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7757 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7758 | } |
| 7759 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 7760 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7761 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 7762 | WMITLV_GET_STRUCT_TLVLEN |
| 7763 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 7764 | cmd->vdev_id = vdev_id; |
| 7765 | cmd->is_add = enable; |
| 7766 | cmd->event_bitmap = bitmap; |
| 7767 | |
| 7768 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7769 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 7770 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7771 | WMI_LOGE("Failed to config wow wakeup event"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7772 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7773 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7774 | } |
| 7775 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7776 | WMI_LOGD("Wakeup pattern 0x%x %s in fw", bitmap, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7777 | enable ? "enabled" : "disabled"); |
| 7778 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7779 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7780 | } |
| 7781 | |
| 7782 | /** |
| 7783 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 7784 | * @wmi_handle: wmi handle |
| 7785 | * @vdev_id: vdev id |
| 7786 | * @ptrn_id: pattern id |
| 7787 | * @ptrn: pattern |
| 7788 | * @ptrn_len: pattern length |
| 7789 | * @ptrn_offset: pattern offset |
| 7790 | * @mask: mask |
| 7791 | * @mask_len: mask length |
| 7792 | * @user: true for user configured pattern and false for default pattern |
| 7793 | * @default_patterns: default patterns |
| 7794 | * |
| 7795 | * Return: CDF status |
| 7796 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7797 | 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] | 7798 | uint8_t vdev_id, uint8_t ptrn_id, |
| 7799 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 7800 | uint8_t ptrn_offset, const uint8_t *mask, |
| 7801 | uint8_t mask_len, bool user, |
| 7802 | uint8_t default_patterns) |
| 7803 | { |
| 7804 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 7805 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 7806 | wmi_buf_t buf; |
| 7807 | uint8_t *buf_ptr; |
| 7808 | int32_t len; |
| 7809 | int ret; |
| 7810 | |
| 7811 | |
| 7812 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 7813 | WMI_TLV_HDR_SIZE + |
| 7814 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 7815 | WMI_TLV_HDR_SIZE + |
| 7816 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 7817 | WMI_TLV_HDR_SIZE + |
| 7818 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 7819 | WMI_TLV_HDR_SIZE + |
| 7820 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 7821 | WMI_TLV_HDR_SIZE + |
| 7822 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 7823 | |
| 7824 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7825 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7826 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7827 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7828 | } |
| 7829 | |
| 7830 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7831 | buf_ptr = (uint8_t *) cmd; |
| 7832 | |
| 7833 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7834 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 7835 | WMITLV_GET_STRUCT_TLVLEN |
| 7836 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 7837 | cmd->vdev_id = vdev_id; |
| 7838 | cmd->pattern_id = ptrn_id; |
| 7839 | |
| 7840 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 7841 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 7842 | |
| 7843 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7844 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 7845 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7846 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 7847 | |
| 7848 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 7849 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 7850 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 7851 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7852 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 7853 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7854 | |
| 7855 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 7856 | bitmap_pattern->pattern_len = ptrn_len; |
| 7857 | |
| 7858 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 7859 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 7860 | |
| 7861 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 7862 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 7863 | |
| 7864 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 7865 | bitmap_pattern->pattern_id = ptrn_id; |
| 7866 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7867 | 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] | 7868 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 7869 | bitmap_pattern->pattern_offset, user); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7870 | #ifdef CONFIG_MCL |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7871 | WMI_LOGI("Pattern : "); |
| 7872 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7873 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 7874 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7875 | WMI_LOGI("Mask : "); |
| 7876 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7877 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7878 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7879 | |
| 7880 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 7881 | |
| 7882 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 7883 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7884 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7885 | |
| 7886 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 7887 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7888 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7889 | |
| 7890 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 7891 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7892 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7893 | |
| 7894 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 7895 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7896 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7897 | |
| 7898 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 7899 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 7900 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7901 | *(A_UINT32 *) buf_ptr = 0; |
| 7902 | |
| 7903 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7904 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 7905 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7906 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7907 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7908 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7909 | } |
| 7910 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7911 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7912 | } |
| 7913 | |
| 7914 | /** |
| 7915 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 7916 | * @wmi_handle: wmi handle |
| 7917 | * @ptrn_id: pattern id |
| 7918 | * @vdev_id: vdev id |
| 7919 | * |
| 7920 | * Return: CDF status |
| 7921 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7922 | 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] | 7923 | uint8_t vdev_id) |
| 7924 | { |
| 7925 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 7926 | wmi_buf_t buf; |
| 7927 | int32_t len; |
| 7928 | int ret; |
| 7929 | |
| 7930 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 7931 | |
| 7932 | |
| 7933 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7934 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7935 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7936 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7937 | } |
| 7938 | |
| 7939 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7940 | |
| 7941 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7942 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 7943 | WMITLV_GET_STRUCT_TLVLEN( |
| 7944 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 7945 | cmd->vdev_id = vdev_id; |
| 7946 | cmd->pattern_id = ptrn_id; |
| 7947 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 7948 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7949 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7950 | cmd->pattern_id, vdev_id); |
| 7951 | |
| 7952 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7953 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 7954 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7955 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7956 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7957 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7958 | } |
| 7959 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7960 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7961 | } |
| 7962 | |
| 7963 | /** |
| 7964 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 7965 | * @wmi_handle: wmi handle |
| 7966 | * |
| 7967 | * Sends host wakeup indication to FW. On receiving this indication, |
| 7968 | * FW will come out of WOW. |
| 7969 | * |
| 7970 | * Return: CDF status |
| 7971 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7972 | 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] | 7973 | { |
| 7974 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 7975 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7976 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7977 | int32_t len; |
| 7978 | int ret; |
| 7979 | |
| 7980 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 7981 | |
| 7982 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7983 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7984 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7985 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7986 | } |
| 7987 | |
| 7988 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 7989 | wmi_buf_data(buf); |
| 7990 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7991 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 7992 | WMITLV_GET_STRUCT_TLVLEN |
| 7993 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 7994 | |
| 7995 | |
| 7996 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7997 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 7998 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7999 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8000 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8001 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8002 | } |
| 8003 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8004 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8005 | } |
| 8006 | |
| 8007 | /** |
| 8008 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8009 | * @wmi_handle: wmi handle |
| 8010 | * @msg: delts params |
| 8011 | * |
| 8012 | * Return: CDF status |
| 8013 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8014 | 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] | 8015 | uint8_t ac) |
| 8016 | { |
| 8017 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8018 | wmi_buf_t buf; |
| 8019 | int32_t len = sizeof(*cmd); |
| 8020 | |
| 8021 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8022 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8023 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8024 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8025 | } |
| 8026 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8027 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8028 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8029 | WMITLV_GET_STRUCT_TLVLEN |
| 8030 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8031 | cmd->vdev_id = vdev_id; |
| 8032 | cmd->ac = ac; |
| 8033 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8034 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8035 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8036 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8037 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8038 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8039 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8040 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8041 | } |
| 8042 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8043 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8044 | } |
| 8045 | |
| 8046 | /** |
| 8047 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8048 | * @wmi_handle: handle to wmi |
| 8049 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8050 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8051 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8052 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8053 | * active flow. |
| 8054 | * |
| 8055 | * Return: CDF status |
| 8056 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8057 | QDF_STATUS send_aggr_qos_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8058 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8059 | { |
| 8060 | int i = 0; |
| 8061 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8062 | wmi_buf_t buf; |
| 8063 | int32_t len = sizeof(*cmd); |
| 8064 | |
| 8065 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 8066 | /* if flow in this AC is active */ |
| 8067 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 8068 | /* |
| 8069 | * as per implementation of wma_add_ts_req() we |
| 8070 | * are not waiting any response from firmware so |
| 8071 | * apart from sending ADDTS to firmware just send |
| 8072 | * success to upper layers |
| 8073 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8074 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8075 | |
| 8076 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8077 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8078 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8079 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8080 | } |
| 8081 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 8082 | wmi_buf_data(buf); |
| 8083 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8084 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8085 | WMITLV_GET_STRUCT_TLVLEN |
| 8086 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8087 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 8088 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 8089 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8090 | traffic.userPrio); |
| 8091 | cmd->medium_time_us = |
| 8092 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 8093 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8094 | 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] | 8095 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 8096 | cmd->medium_time_us, cmd->downgrade_type); |
| 8097 | if (wmi_unified_cmd_send |
| 8098 | (wmi_handle, buf, len, |
| 8099 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8100 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8101 | __func__); |
| 8102 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8103 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8104 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8105 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8106 | } |
| 8107 | } |
| 8108 | } |
| 8109 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8110 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8111 | } |
| 8112 | |
| 8113 | /** |
| 8114 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 8115 | * @wmi_handle: wmi handle |
| 8116 | * @msg: ADDTS params |
| 8117 | * |
| 8118 | * Return: CDF status |
| 8119 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8120 | QDF_STATUS send_add_ts_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8121 | struct add_ts_param *msg) |
| 8122 | { |
| 8123 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8124 | wmi_buf_t buf; |
| 8125 | int32_t len = sizeof(*cmd); |
| 8126 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8127 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8128 | |
| 8129 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8130 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8131 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8132 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8133 | } |
| 8134 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8135 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8136 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8137 | WMITLV_GET_STRUCT_TLVLEN |
| 8138 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8139 | cmd->vdev_id = msg->sme_session_id; |
| 8140 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 8141 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 8142 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8143 | 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] | 8144 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 8145 | cmd->downgrade_type, __func__, __LINE__); |
| 8146 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8147 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8148 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 8149 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8150 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8151 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8152 | } |
| 8153 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8154 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8155 | } |
| 8156 | |
| 8157 | /** |
| 8158 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter in target |
| 8159 | * @wmi_handle: wmi handle |
| 8160 | * @vdev_id: vdev id |
| 8161 | * @enable: Flag to enable/disable packet filter |
| 8162 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8163 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8164 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8165 | 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] | 8166 | uint8_t vdev_id, bool enable) |
| 8167 | { |
| 8168 | int32_t len; |
| 8169 | int ret = 0; |
| 8170 | wmi_buf_t buf; |
| 8171 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 8172 | |
| 8173 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 8174 | |
| 8175 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8176 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8177 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8178 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8179 | } |
| 8180 | |
| 8181 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 8182 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8183 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 8184 | WMITLV_GET_STRUCT_TLVLEN( |
| 8185 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 8186 | |
| 8187 | cmd->vdev_id = vdev_id; |
| 8188 | if (enable) |
| 8189 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 8190 | else |
| 8191 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 8192 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8193 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8194 | __func__, cmd->enable, vdev_id); |
| 8195 | |
| 8196 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8197 | WMI_PACKET_FILTER_ENABLE_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8198 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8199 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8200 | wmi_buf_free(buf); |
| 8201 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8202 | |
| 8203 | return ret; |
| 8204 | } |
| 8205 | |
| 8206 | /** |
| 8207 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 8208 | * @wmi_handle: wmi handle |
| 8209 | * @vdev_id: vdev id |
| 8210 | * @rcv_filter_param: Packet filter parameters |
| 8211 | * @filter_id: Filter id |
| 8212 | * @enable: Flag to add/delete packet filter configuration |
| 8213 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8214 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8215 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8216 | 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] | 8217 | uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param, |
| 8218 | uint8_t filter_id, bool enable) |
| 8219 | { |
| 8220 | int len, i; |
| 8221 | int err = 0; |
| 8222 | wmi_buf_t buf; |
| 8223 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 8224 | |
| 8225 | |
| 8226 | /* allocate the memory */ |
| 8227 | len = sizeof(*cmd); |
| 8228 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8229 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8230 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8231 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8232 | } |
| 8233 | |
| 8234 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 8235 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8236 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 8237 | WMITLV_GET_STRUCT_TLVLEN |
| 8238 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 8239 | |
| 8240 | cmd->vdev_id = vdev_id; |
| 8241 | cmd->filter_id = filter_id; |
| 8242 | if (enable) |
| 8243 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 8244 | else |
| 8245 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 8246 | |
| 8247 | if (enable) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8248 | cmd->num_params = QDF_MIN( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8249 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 8250 | rcv_filter_param->numFieldParams); |
| 8251 | cmd->filter_type = rcv_filter_param->filterType; |
| 8252 | cmd->coalesce_time = rcv_filter_param->coalesceTime; |
| 8253 | |
| 8254 | for (i = 0; i < cmd->num_params; i++) { |
| 8255 | cmd->paramsData[i].proto_type = |
| 8256 | rcv_filter_param->paramsData[i].protocolLayer; |
| 8257 | cmd->paramsData[i].cmp_type = |
| 8258 | rcv_filter_param->paramsData[i].cmpFlag; |
| 8259 | cmd->paramsData[i].data_length = |
| 8260 | rcv_filter_param->paramsData[i].dataLength; |
| 8261 | cmd->paramsData[i].data_offset = |
| 8262 | rcv_filter_param->paramsData[i].dataOffset; |
| 8263 | memcpy(&cmd->paramsData[i].compareData, |
| 8264 | rcv_filter_param->paramsData[i].compareData, |
| 8265 | sizeof(cmd->paramsData[i].compareData)); |
| 8266 | memcpy(&cmd->paramsData[i].dataMask, |
| 8267 | rcv_filter_param->paramsData[i].dataMask, |
| 8268 | sizeof(cmd->paramsData[i].dataMask)); |
| 8269 | } |
| 8270 | } |
| 8271 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8272 | 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] | 8273 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 8274 | /* send the command along with data */ |
| 8275 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8276 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 8277 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8278 | WMI_LOGE("Failed to send pkt_filter cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8279 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8280 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8281 | } |
| 8282 | |
| 8283 | |
| 8284 | return 0; |
| 8285 | } |
| 8286 | |
| 8287 | /** |
| 8288 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 8289 | * @wmi_handle: wmi handle |
| 8290 | * @vdev_id: vdev id |
| 8291 | * @multicastAddr: mcast address |
| 8292 | * @clearList: clear list flag |
| 8293 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8294 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8295 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8296 | 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] | 8297 | uint8_t vdev_id, |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8298 | struct qdf_mac_addr multicast_addr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8299 | bool clearList) |
| 8300 | { |
| 8301 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 8302 | wmi_buf_t buf; |
| 8303 | int err; |
| 8304 | |
| 8305 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8306 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8307 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8308 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8309 | } |
| 8310 | |
| 8311 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8312 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8313 | |
| 8314 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8315 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 8316 | WMITLV_GET_STRUCT_TLVLEN |
| 8317 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 8318 | cmd->action = |
| 8319 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 8320 | cmd->vdev_id = vdev_id; |
| 8321 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame^] | 8322 | |
| 8323 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 8324 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 8325 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8326 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 8327 | sizeof(*cmd), |
| 8328 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 8329 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8330 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8331 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8332 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8333 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8334 | |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame^] | 8335 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8336 | } |
| 8337 | |
| 8338 | /** |
| 8339 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 8340 | * @wmi_handle: wmi handle |
| 8341 | * @vdev_id: vdev id |
| 8342 | * @params: GTK offload parameters |
| 8343 | * |
| 8344 | * Return: CDF status |
| 8345 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8346 | 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] | 8347 | struct gtk_offload_params *params, |
| 8348 | bool enable_offload, |
| 8349 | uint32_t gtk_offload_opcode) |
| 8350 | { |
| 8351 | int len; |
| 8352 | wmi_buf_t buf; |
| 8353 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8354 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8355 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8356 | WMI_LOGD("%s Enter", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8357 | |
| 8358 | len = sizeof(*cmd); |
| 8359 | |
| 8360 | /* alloc wmi buffer */ |
| 8361 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8362 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8363 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 8364 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8365 | goto out; |
| 8366 | } |
| 8367 | |
| 8368 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 8369 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8370 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 8371 | WMITLV_GET_STRUCT_TLVLEN |
| 8372 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 8373 | |
| 8374 | cmd->vdev_id = vdev_id; |
| 8375 | |
| 8376 | /* Request target to enable GTK offload */ |
Siddarth Poddar | 9500f2e | 2016-04-01 17:45:06 +0530 | [diff] [blame] | 8377 | if (enable_offload == WMI_GTK_OFFLOAD_ENABLE) { |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8378 | cmd->flags = gtk_offload_opcode; |
| 8379 | |
| 8380 | /* Copy the keys and replay counter */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8381 | qdf_mem_copy(cmd->KCK, params->aKCK, WMI_GTK_OFFLOAD_KCK_BYTES); |
| 8382 | qdf_mem_copy(cmd->KEK, params->aKEK, WMI_GTK_OFFLOAD_KEK_BYTES); |
| 8383 | qdf_mem_copy(cmd->replay_counter, ¶ms->ullKeyReplayCounter, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8384 | GTK_REPLAY_COUNTER_BYTES); |
| 8385 | } else { |
| 8386 | cmd->flags = gtk_offload_opcode; |
| 8387 | } |
| 8388 | |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame^] | 8389 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 8390 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8391 | /* send the wmi command */ |
| 8392 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8393 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8394 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8395 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8396 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8397 | } |
| 8398 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8399 | out: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8400 | WMI_LOGD("%s Exit", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8401 | return status; |
| 8402 | } |
| 8403 | |
| 8404 | /** |
| 8405 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 8406 | * @wmi_handle: wmi handle |
| 8407 | * @params: GTK offload params |
| 8408 | * |
| 8409 | * Return: CDF status |
| 8410 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8411 | 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] | 8412 | uint8_t vdev_id, |
| 8413 | uint64_t offload_req_opcode) |
| 8414 | { |
| 8415 | int len; |
| 8416 | wmi_buf_t buf; |
| 8417 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8418 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8419 | |
| 8420 | len = sizeof(*cmd); |
| 8421 | |
| 8422 | /* alloc wmi buffer */ |
| 8423 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8424 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8425 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 8426 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8427 | goto out; |
| 8428 | } |
| 8429 | |
| 8430 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 8431 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8432 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 8433 | WMITLV_GET_STRUCT_TLVLEN |
| 8434 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 8435 | |
| 8436 | /* Request for GTK offload status */ |
| 8437 | cmd->flags = offload_req_opcode; |
| 8438 | cmd->vdev_id = vdev_id; |
| 8439 | |
| 8440 | /* send the wmi command */ |
| 8441 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8442 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8443 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8444 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8445 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8446 | } |
| 8447 | |
| 8448 | out: |
| 8449 | return status; |
| 8450 | } |
| 8451 | |
| 8452 | /** |
| 8453 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 8454 | * @wmi_handle: wmi handle |
| 8455 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 8456 | * |
| 8457 | * Retrun: CDF status |
| 8458 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8459 | 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] | 8460 | struct periodic_tx_pattern * |
| 8461 | pAddPeriodicTxPtrnParams, |
| 8462 | uint8_t vdev_id) |
| 8463 | { |
| 8464 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8465 | wmi_buf_t wmi_buf; |
| 8466 | uint32_t len; |
| 8467 | uint8_t *buf_ptr; |
| 8468 | uint32_t ptrn_len, ptrn_len_aligned; |
| 8469 | int j; |
| 8470 | |
| 8471 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8472 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 8473 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 8474 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 8475 | |
| 8476 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8477 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8478 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8479 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8480 | } |
| 8481 | |
| 8482 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8483 | |
| 8484 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 8485 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8486 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8487 | WMITLV_GET_STRUCT_TLVLEN |
| 8488 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8489 | |
| 8490 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8491 | cmd->vdev_id = vdev_id; |
| 8492 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 8493 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 8494 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8495 | |
| 8496 | /* Pattern info */ |
| 8497 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8498 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 8499 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8500 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8501 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8502 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8503 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8504 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8505 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8506 | |
| 8507 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8508 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8509 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8510 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8511 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8512 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8513 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8514 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8515 | } |
| 8516 | |
| 8517 | /** |
| 8518 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 8519 | * @wmi_handle: wmi handle |
| 8520 | * @vdev_id: vdev id |
| 8521 | * @pattern_id: pattern id |
| 8522 | * |
| 8523 | * Retrun: CDF status |
| 8524 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8525 | 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] | 8526 | uint8_t vdev_id, |
| 8527 | uint8_t pattern_id) |
| 8528 | { |
| 8529 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8530 | wmi_buf_t wmi_buf; |
| 8531 | uint32_t len = |
| 8532 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8533 | |
| 8534 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8535 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8536 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8537 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8538 | } |
| 8539 | |
| 8540 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 8541 | wmi_buf_data(wmi_buf); |
| 8542 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8543 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8544 | WMITLV_GET_STRUCT_TLVLEN |
| 8545 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8546 | |
| 8547 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8548 | cmd->vdev_id = vdev_id; |
| 8549 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8550 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8551 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8552 | |
| 8553 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8554 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8555 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8556 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8557 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8558 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8559 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8560 | } |
| 8561 | |
| 8562 | /** |
| 8563 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 8564 | * @wmi_handle: wmi handle |
| 8565 | * @preq: stats ext params |
| 8566 | * |
| 8567 | * Return: CDF status |
| 8568 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8569 | 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] | 8570 | struct stats_ext_params *preq) |
| 8571 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8572 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8573 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 8574 | wmi_buf_t buf; |
| 8575 | uint16_t len; |
| 8576 | uint8_t *buf_ptr; |
| 8577 | |
| 8578 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 8579 | |
| 8580 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8581 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8582 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8583 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8584 | } |
| 8585 | |
| 8586 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8587 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 8588 | |
| 8589 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8590 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 8591 | WMITLV_GET_STRUCT_TLVLEN |
| 8592 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 8593 | cmd->vdev_id = preq->vdev_id; |
| 8594 | cmd->data_len = preq->request_data_len; |
| 8595 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8596 | 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] | 8597 | __func__, preq->request_data_len, preq->vdev_id); |
| 8598 | |
| 8599 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 8600 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 8601 | |
| 8602 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8603 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8604 | |
| 8605 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8606 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8607 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8608 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8609 | ret); |
| 8610 | wmi_buf_free(buf); |
| 8611 | } |
| 8612 | |
| 8613 | return ret; |
| 8614 | } |
| 8615 | |
| 8616 | /** |
| 8617 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 8618 | * @wmi_handle: wmi handle |
| 8619 | * @params: ext wow params |
| 8620 | * |
| 8621 | * Return:0 for success or error code |
| 8622 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8623 | 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] | 8624 | struct ext_wow_params *params) |
| 8625 | { |
| 8626 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 8627 | wmi_buf_t buf; |
| 8628 | int32_t len; |
| 8629 | int ret; |
| 8630 | |
| 8631 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 8632 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8633 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8634 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8635 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8636 | } |
| 8637 | |
| 8638 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8639 | |
| 8640 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8641 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 8642 | WMITLV_GET_STRUCT_TLVLEN |
| 8643 | (wmi_extwow_enable_cmd_fixed_param)); |
| 8644 | |
| 8645 | cmd->vdev_id = params->vdev_id; |
| 8646 | cmd->type = params->type; |
| 8647 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 8648 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8649 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8650 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 8651 | |
| 8652 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8653 | WMI_EXTWOW_ENABLE_CMDID); |
| 8654 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8655 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8656 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8657 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8658 | } |
| 8659 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8660 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8661 | |
| 8662 | } |
| 8663 | |
| 8664 | /** |
| 8665 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 8666 | * @wmi_handle: wmi handle |
| 8667 | * @app_type1_params: app type1 params |
| 8668 | * |
| 8669 | * Return: CDF status |
| 8670 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8671 | 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] | 8672 | struct app_type1_params *app_type1_params) |
| 8673 | { |
| 8674 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 8675 | wmi_buf_t buf; |
| 8676 | int32_t len; |
| 8677 | int ret; |
| 8678 | |
| 8679 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 8680 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8681 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8682 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8683 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8684 | } |
| 8685 | |
| 8686 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 8687 | wmi_buf_data(buf); |
| 8688 | |
| 8689 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8690 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 8691 | WMITLV_GET_STRUCT_TLVLEN |
| 8692 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 8693 | |
| 8694 | cmd->vdev_id = app_type1_params->vdev_id; |
| 8695 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 8696 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8697 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8698 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8699 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8700 | cmd->passwd_len = app_type1_params->pass_length; |
| 8701 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8702 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8703 | "identification_id %.8s id_length %u " |
| 8704 | "password %.16s pass_length %u", |
| 8705 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 8706 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 8707 | |
| 8708 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8709 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 8710 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8711 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8712 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8713 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8714 | } |
| 8715 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8716 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8717 | } |
| 8718 | |
| 8719 | /** |
| 8720 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 8721 | * @wmi_handle: wmi handle |
| 8722 | * @appType2Params: app type2 params |
| 8723 | * |
| 8724 | * Return: CDF status |
| 8725 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8726 | 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] | 8727 | struct app_type2_params *appType2Params) |
| 8728 | { |
| 8729 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 8730 | wmi_buf_t buf; |
| 8731 | int32_t len; |
| 8732 | int ret; |
| 8733 | |
| 8734 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 8735 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8736 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8737 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8738 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8739 | } |
| 8740 | |
| 8741 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 8742 | wmi_buf_data(buf); |
| 8743 | |
| 8744 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8745 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 8746 | WMITLV_GET_STRUCT_TLVLEN |
| 8747 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 8748 | |
| 8749 | cmd->vdev_id = appType2Params->vdev_id; |
| 8750 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8751 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8752 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 8753 | |
| 8754 | cmd->ip_id = appType2Params->ip_id; |
| 8755 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 8756 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 8757 | |
| 8758 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 8759 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 8760 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 8761 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 8762 | |
| 8763 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 8764 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 8765 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 8766 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 8767 | |
| 8768 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 8769 | &cmd->gateway_mac); |
| 8770 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 8771 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 8772 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8773 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8774 | "rc4_key %.16s rc4_key_len %u " |
| 8775 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 8776 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 8777 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 8778 | "keepalive_max %u keepalive_inc %u " |
| 8779 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 8780 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 8781 | cmd->rc4_key, cmd->rc4_key_len, |
| 8782 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 8783 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 8784 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 8785 | cmd->keepalive_max, cmd->keepalive_inc, |
| 8786 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 8787 | |
| 8788 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8789 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 8790 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8791 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8792 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8793 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8794 | } |
| 8795 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8796 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8797 | |
| 8798 | } |
| 8799 | |
| 8800 | /** |
| 8801 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 8802 | * @wmi_handle: wmi handle |
| 8803 | * @timer_val: auto shutdown timer value |
| 8804 | * |
| 8805 | * Return: CDF status |
| 8806 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8807 | 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] | 8808 | uint32_t timer_val) |
| 8809 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8810 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8811 | wmi_buf_t buf = NULL; |
| 8812 | uint8_t *buf_ptr; |
| 8813 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 8814 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 8815 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8816 | 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] | 8817 | __func__, timer_val); |
| 8818 | |
| 8819 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8820 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8821 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8822 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8823 | } |
| 8824 | |
| 8825 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8826 | wmi_auto_sh_cmd = |
| 8827 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 8828 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 8829 | |
| 8830 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 8831 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 8832 | WMITLV_GET_STRUCT_TLVLEN |
| 8833 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 8834 | |
| 8835 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8836 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8837 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8838 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8839 | __func__, status); |
| 8840 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8841 | } |
| 8842 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8843 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8844 | } |
| 8845 | |
| 8846 | /** |
| 8847 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 8848 | * @wmi_handle: wmi handle |
| 8849 | * @nan_req: request data which will be non-null |
| 8850 | * |
| 8851 | * Return: CDF status |
| 8852 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8853 | QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8854 | struct nan_req_params *nan_req) |
| 8855 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8856 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8857 | wmi_nan_cmd_param *cmd; |
| 8858 | wmi_buf_t buf; |
| 8859 | uint16_t len = sizeof(*cmd); |
| 8860 | uint16_t nan_data_len, nan_data_len_aligned; |
| 8861 | uint8_t *buf_ptr; |
| 8862 | |
| 8863 | /* |
| 8864 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 8865 | * +------------+----------+-----------------------+--------------+ |
| 8866 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 8867 | * +------------+----------+-----------------------+--------------+ |
| 8868 | */ |
| 8869 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8870 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 8871 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8872 | } |
| 8873 | nan_data_len = nan_req->request_data_len; |
| 8874 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 8875 | sizeof(uint32_t)); |
| 8876 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 8877 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8878 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8879 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8880 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8881 | } |
| 8882 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8883 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 8884 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8885 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 8886 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 8887 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8888 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8889 | __func__, nan_req->request_data_len); |
| 8890 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 8891 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 8892 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8893 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8894 | |
| 8895 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8896 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8897 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8898 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8899 | __func__, ret); |
| 8900 | wmi_buf_free(buf); |
| 8901 | } |
| 8902 | |
| 8903 | return ret; |
| 8904 | } |
| 8905 | |
| 8906 | /** |
| 8907 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 8908 | * @wmi_handle: wmi handle |
| 8909 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 8910 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8911 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8912 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8913 | 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] | 8914 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 8915 | { |
| 8916 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 8917 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8918 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8919 | |
| 8920 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8921 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8922 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8923 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8924 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8925 | } |
| 8926 | |
| 8927 | 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] | 8928 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8929 | |
| 8930 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8931 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 8932 | WMITLV_GET_STRUCT_TLVLEN |
| 8933 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 8934 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 8935 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 8936 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 8937 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 8938 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8939 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8940 | sizeof(*cmd), |
| 8941 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8942 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8943 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8944 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8945 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8946 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8947 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8948 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8949 | |
| 8950 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8951 | } |
| 8952 | |
| 8953 | /** |
| 8954 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 8955 | * @wmi_handle: wmi handle |
| 8956 | * @flashing: flashing request |
| 8957 | * |
| 8958 | * Return: CDF status |
| 8959 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8960 | 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] | 8961 | struct flashing_req_params *flashing) |
| 8962 | { |
| 8963 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8964 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8965 | wmi_buf_t buf; |
| 8966 | uint8_t *buf_ptr; |
| 8967 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 8968 | |
| 8969 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8970 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8971 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8972 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8973 | } |
| 8974 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8975 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 8976 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8977 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 8978 | WMITLV_GET_STRUCT_TLVLEN |
| 8979 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 8980 | cmd->pattern_id = flashing->pattern_id; |
| 8981 | cmd->led_x0 = flashing->led_x0; |
| 8982 | cmd->led_x1 = flashing->led_x1; |
| 8983 | |
| 8984 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8985 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8986 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8987 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8988 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8989 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8990 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8991 | |
| 8992 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8993 | } |
| 8994 | |
| 8995 | /** |
| 8996 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 8997 | * @wmi_handle: wmi handle |
| 8998 | * @ch_avoid_update_req: channel avoid update params |
| 8999 | * |
| 9000 | * Return: CDF status |
| 9001 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9002 | 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] | 9003 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9004 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9005 | wmi_buf_t buf = NULL; |
| 9006 | uint8_t *buf_ptr; |
| 9007 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 9008 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 9009 | |
| 9010 | |
| 9011 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9012 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9013 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9014 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9015 | } |
| 9016 | |
| 9017 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9018 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 9019 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 9020 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 9021 | WMITLV_GET_STRUCT_TLVLEN |
| 9022 | (wmi_chan_avoid_update_cmd_param)); |
| 9023 | |
| 9024 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9025 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9026 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9027 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9028 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 9029 | " returned Error %d", status); |
| 9030 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9031 | } |
| 9032 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9033 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9034 | } |
| 9035 | |
| 9036 | /** |
| 9037 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 9038 | * @wmi_handle: wmi handle |
| 9039 | * @reg_dmn: reg domain |
| 9040 | * @regdmn2G: 2G reg domain |
| 9041 | * @regdmn5G: 5G reg domain |
| 9042 | * @ctl2G: 2G test limit |
| 9043 | * @ctl5G: 5G test limit |
| 9044 | * |
| 9045 | * Return: none |
| 9046 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9047 | 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] | 9048 | uint32_t reg_dmn, uint16_t regdmn2G, |
| 9049 | uint16_t regdmn5G, int8_t ctl2G, |
| 9050 | int8_t ctl5G) |
| 9051 | { |
| 9052 | wmi_buf_t buf; |
| 9053 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9054 | int32_t len = sizeof(*cmd); |
| 9055 | |
| 9056 | |
| 9057 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9058 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9059 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9060 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9061 | } |
| 9062 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9063 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9064 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9065 | WMITLV_GET_STRUCT_TLVLEN |
| 9066 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9067 | cmd->reg_domain = reg_dmn; |
| 9068 | cmd->reg_domain_2G = regdmn2G; |
| 9069 | cmd->reg_domain_5G = regdmn5G; |
| 9070 | cmd->conformance_test_limit_2G = ctl2G; |
| 9071 | cmd->conformance_test_limit_5G = ctl5G; |
| 9072 | |
| 9073 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9074 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9075 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9076 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9077 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9078 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9079 | } |
| 9080 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9081 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9082 | } |
| 9083 | |
| 9084 | |
| 9085 | /** |
| 9086 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 9087 | * @wmi_handle: wmi handle |
| 9088 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 9089 | * |
| 9090 | * This function sets tdls off channel mode |
| 9091 | * |
| 9092 | * Return: 0 on success; Negative errno otherwise |
| 9093 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9094 | 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] | 9095 | struct tdls_channel_switch_params *chan_switch_params) |
| 9096 | { |
| 9097 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9098 | wmi_buf_t wmi_buf; |
| 9099 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9100 | |
| 9101 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9102 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9103 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9104 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9105 | } |
| 9106 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9107 | wmi_buf_data(wmi_buf); |
| 9108 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9109 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9110 | WMITLV_GET_STRUCT_TLVLEN( |
| 9111 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9112 | |
| 9113 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9114 | &cmd->peer_macaddr); |
| 9115 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9116 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9117 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9118 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9119 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9120 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9121 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9122 | 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] | 9123 | cmd->peer_macaddr.mac_addr31to0, |
| 9124 | cmd->peer_macaddr.mac_addr47to32); |
| 9125 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9126 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9127 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9128 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9129 | ), |
| 9130 | cmd->vdev_id, |
| 9131 | cmd->offchan_mode, |
| 9132 | cmd->offchan_num, |
| 9133 | cmd->offchan_bw_bitmap, |
| 9134 | cmd->is_peer_responder, |
| 9135 | cmd->offchan_oper_class); |
| 9136 | |
| 9137 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9138 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9139 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9140 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9141 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9142 | } |
| 9143 | |
| 9144 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9145 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9146 | } |
| 9147 | |
| 9148 | /** |
| 9149 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9150 | * @wmi_handle: wmi handle |
| 9151 | * @pwmaTdlsparams: TDLS params |
| 9152 | * |
| 9153 | * Return: 0 for sucess or error code |
| 9154 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9155 | 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] | 9156 | void *tdls_param, uint8_t tdls_state) |
| 9157 | { |
| 9158 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9159 | wmi_buf_t wmi_buf; |
| 9160 | |
| 9161 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9162 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9163 | |
| 9164 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9165 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9166 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9167 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9168 | } |
| 9169 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9170 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9171 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9172 | WMITLV_GET_STRUCT_TLVLEN |
| 9173 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9174 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9175 | cmd->state = tdls_state; |
| 9176 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9177 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9178 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9179 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9180 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9181 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9182 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9183 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9184 | wmi_tdls->peer_traffic_response_timeout; |
| 9185 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9186 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9187 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9188 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9189 | cmd->teardown_notification_ms = |
| 9190 | wmi_tdls->teardown_notification_ms; |
| 9191 | cmd->tdls_peer_kickout_threshold = |
| 9192 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9193 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9194 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9195 | "notification_interval_ms: %d, " |
| 9196 | "tx_discovery_threshold: %d, " |
| 9197 | "tx_teardown_threshold: %d, " |
| 9198 | "rssi_teardown_threshold: %d, " |
| 9199 | "rssi_delta: %d, " |
| 9200 | "tdls_options: 0x%x, " |
| 9201 | "tdls_peer_traffic_ind_window: %d, " |
| 9202 | "tdls_peer_traffic_response_timeout: %d, " |
| 9203 | "tdls_puapsd_mask: 0x%x, " |
| 9204 | "tdls_puapsd_inactivity_time: %d, " |
| 9205 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9206 | "teardown_notification_ms: %d, " |
| 9207 | "tdls_peer_kickout_threshold: %d", |
| 9208 | __func__, tdls_state, cmd->state, |
| 9209 | cmd->notification_interval_ms, |
| 9210 | cmd->tx_discovery_threshold, |
| 9211 | cmd->tx_teardown_threshold, |
| 9212 | cmd->rssi_teardown_threshold, |
| 9213 | cmd->rssi_delta, |
| 9214 | cmd->tdls_options, |
| 9215 | cmd->tdls_peer_traffic_ind_window, |
| 9216 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9217 | cmd->tdls_puapsd_mask, |
| 9218 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9219 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9220 | cmd->teardown_notification_ms, |
| 9221 | cmd->tdls_peer_kickout_threshold); |
| 9222 | |
| 9223 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9224 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9225 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9226 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9227 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9228 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9229 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9230 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9231 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9232 | } |
| 9233 | |
| 9234 | /** |
| 9235 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9236 | * @wmi_handle: wmi handle |
| 9237 | * @peerStateParams: TDLS peer state params |
| 9238 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9239 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9240 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9241 | 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] | 9242 | struct tdls_peer_state_params *peerStateParams, |
| 9243 | uint32_t *ch_mhz) |
| 9244 | { |
| 9245 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9246 | wmi_tdls_peer_capabilities *peer_cap; |
| 9247 | wmi_channel *chan_info; |
| 9248 | wmi_buf_t wmi_buf; |
| 9249 | uint8_t *buf_ptr; |
| 9250 | uint32_t i; |
| 9251 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9252 | sizeof(wmi_tdls_peer_capabilities); |
| 9253 | |
| 9254 | |
| 9255 | len += WMI_TLV_HDR_SIZE + |
| 9256 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9257 | |
| 9258 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9259 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9260 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9261 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9262 | } |
| 9263 | |
| 9264 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9265 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9266 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9267 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9268 | WMITLV_GET_STRUCT_TLVLEN |
| 9269 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9270 | |
| 9271 | cmd->vdev_id = peerStateParams->vdevId; |
| 9272 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9273 | &cmd->peer_macaddr); |
| 9274 | |
| 9275 | |
| 9276 | cmd->peer_state = peerStateParams->peerState; |
| 9277 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9278 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9279 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9280 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9281 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9282 | cmd->peer_macaddr.mac_addr31to0, |
| 9283 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9284 | |
| 9285 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9286 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9287 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9288 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9289 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9290 | |
| 9291 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9292 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9293 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9294 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9295 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9296 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9297 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9298 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9299 | |
| 9300 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9301 | * but fill SP |
| 9302 | */ |
| 9303 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9304 | peerStateParams->peerCap.peerMaxSp); |
| 9305 | |
| 9306 | peer_cap->buff_sta_support = |
| 9307 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9308 | peer_cap->off_chan_support = |
| 9309 | peerStateParams->peerCap.peerOffChanSupport; |
| 9310 | peer_cap->peer_curr_operclass = |
| 9311 | peerStateParams->peerCap.peerCurrOperClass; |
| 9312 | /* self curr operclass is not being used and so pass op class for |
| 9313 | * preferred off chan in it. |
| 9314 | */ |
| 9315 | peer_cap->self_curr_operclass = |
| 9316 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 9317 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 9318 | peer_cap->peer_operclass_len = |
| 9319 | peerStateParams->peerCap.peerOperClassLen; |
| 9320 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9321 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9322 | __func__, peer_cap->peer_operclass_len); |
| 9323 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 9324 | peer_cap->peer_operclass[i] = |
| 9325 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9326 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9327 | __func__, i, peer_cap->peer_operclass[i]); |
| 9328 | } |
| 9329 | |
| 9330 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 9331 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 9332 | peer_cap->pref_offchan_bw = |
| 9333 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 9334 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9335 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9336 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 9337 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 9338 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 9339 | " %d, pref_offchan_bw: %d", |
| 9340 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 9341 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 9342 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 9343 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 9344 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 9345 | |
| 9346 | /* next fill variable size array of peer chan info */ |
| 9347 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 9348 | WMITLV_SET_HDR(buf_ptr, |
| 9349 | WMITLV_TAG_ARRAY_STRUC, |
| 9350 | sizeof(wmi_channel) * |
| 9351 | peerStateParams->peerCap.peerChanLen); |
| 9352 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9353 | |
| 9354 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 9355 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 9356 | WMITLV_TAG_STRUC_wmi_channel, |
| 9357 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 9358 | chan_info->mhz = ch_mhz[i]; |
| 9359 | chan_info->band_center_freq1 = chan_info->mhz; |
| 9360 | chan_info->band_center_freq2 = 0; |
| 9361 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9362 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9363 | |
| 9364 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 9365 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9366 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9367 | peerStateParams->peerCap.peerChan[i].chanId, |
| 9368 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 9369 | } |
| 9370 | |
| 9371 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 9372 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 9373 | else |
| 9374 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 9375 | |
| 9376 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 9377 | peerStateParams->peerCap. |
| 9378 | peerChan[i].pwr); |
| 9379 | |
| 9380 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 9381 | peerStateParams->peerCap.peerChan[i]. |
| 9382 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9383 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9384 | peerStateParams->peerCap.peerChan[i].pwr); |
| 9385 | |
| 9386 | chan_info++; |
| 9387 | } |
| 9388 | |
| 9389 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9390 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9391 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9392 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9393 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9394 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9395 | } |
| 9396 | |
| 9397 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9398 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9399 | } |
| 9400 | |
| 9401 | /* |
| 9402 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 9403 | * firmware |
| 9404 | * @wmi_handle: Pointer to wmi handle |
| 9405 | * @mem_dump_req: Pointer for mem_dump_req |
| 9406 | * |
| 9407 | * This function sends memory dump request to firmware |
| 9408 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9409 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9410 | * |
| 9411 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9412 | 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] | 9413 | struct fw_dump_req_param *mem_dump_req) |
| 9414 | { |
| 9415 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 9416 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9417 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9418 | int32_t len; |
| 9419 | wmi_buf_t buf; |
| 9420 | u_int8_t *buf_ptr; |
| 9421 | int ret, loop; |
| 9422 | |
| 9423 | /* |
| 9424 | * len = sizeof(fixed param) that includes tlv header + |
| 9425 | * tlv header for array of struc + |
| 9426 | * sizeof (each struct) |
| 9427 | */ |
| 9428 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9429 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 9430 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9431 | |
| 9432 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9433 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 9434 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9435 | } |
| 9436 | |
| 9437 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9438 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9439 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 9440 | |
| 9441 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9442 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 9443 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 9444 | |
| 9445 | cmd->request_id = mem_dump_req->request_id; |
| 9446 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 9447 | |
| 9448 | /* TLV indicating array of structures to follow */ |
| 9449 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 9450 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9451 | sizeof(wmi_fw_mem_dump) * |
| 9452 | cmd->num_fw_mem_dump_segs); |
| 9453 | |
| 9454 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9455 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 9456 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9457 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9458 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 9459 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9460 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9461 | ((uint8_t *)(mem_dump_req->segment) + |
| 9462 | loop * sizeof(*seg_req)); |
| 9463 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 9464 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 9465 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 9466 | dump_params->seg_id = seg_req->seg_id; |
| 9467 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 9468 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 9469 | dump_params->seg_length = seg_req->seg_length; |
| 9470 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 9471 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9472 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 9473 | 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] | 9474 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 9475 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9476 | 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] | 9477 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 9478 | dump_params->dest_addr_hi); |
| 9479 | dump_params++; |
| 9480 | } |
| 9481 | |
| 9482 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9483 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 9484 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9485 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9486 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9487 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9488 | } |
| 9489 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9490 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 9491 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9492 | } |
| 9493 | |
| 9494 | /* |
| 9495 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 9496 | * @wmi_handle: Pointer to WMi handle |
| 9497 | * @ie_data: Pointer for ie data |
| 9498 | * |
| 9499 | * This function sends IE information to firmware |
| 9500 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9501 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9502 | * |
| 9503 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9504 | 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] | 9505 | struct vdev_ie_info_param *ie_info) |
| 9506 | { |
| 9507 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 9508 | wmi_buf_t buf; |
| 9509 | uint8_t *buf_ptr; |
| 9510 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9511 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9512 | |
| 9513 | |
| 9514 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 9515 | /* Allocate memory for the WMI command */ |
| 9516 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 9517 | |
| 9518 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9519 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9520 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9521 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9522 | } |
| 9523 | |
| 9524 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9525 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9526 | |
| 9527 | /* Populate the WMI command */ |
| 9528 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 9529 | |
| 9530 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9531 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 9532 | WMITLV_GET_STRUCT_TLVLEN( |
| 9533 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 9534 | cmd->vdev_id = ie_info->vdev_id; |
| 9535 | cmd->ie_id = ie_info->ie_id; |
| 9536 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 9537 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9538 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9539 | 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] | 9540 | ie_info->length, ie_info->vdev_id); |
| 9541 | |
| 9542 | buf_ptr += sizeof(*cmd); |
| 9543 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 9544 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9545 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9546 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9547 | |
| 9548 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9549 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9550 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9551 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9552 | wmi_buf_free(buf); |
| 9553 | } |
| 9554 | |
| 9555 | return ret; |
| 9556 | } |
| 9557 | |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9558 | |
| 9559 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9560 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9561 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9562 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9563 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 9564 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 9565 | resource_cfg->num_offload_reorder_buffs = |
| 9566 | tgt_res_cfg->num_offload_reorder_buffs; |
| 9567 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 9568 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 9569 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 9570 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 9571 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 9572 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 9573 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 9574 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 9575 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 9576 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 9577 | resource_cfg->scan_max_pending_req = |
| 9578 | tgt_res_cfg->scan_max_pending_req; |
| 9579 | resource_cfg->bmiss_offload_max_vdev = |
| 9580 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 9581 | resource_cfg->roam_offload_max_vdev = |
| 9582 | tgt_res_cfg->roam_offload_max_vdev; |
| 9583 | resource_cfg->roam_offload_max_ap_profiles = |
| 9584 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 9585 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 9586 | resource_cfg->num_mcast_table_elems = |
| 9587 | tgt_res_cfg->num_mcast_table_elems; |
| 9588 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 9589 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 9590 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 9591 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 9592 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 9593 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 9594 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 9595 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 9596 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 9597 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 9598 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 9599 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 9600 | resource_cfg->num_tdls_conn_table_entries = |
| 9601 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 9602 | resource_cfg->beacon_tx_offload_max_vdev = |
| 9603 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 9604 | resource_cfg->num_multicast_filter_entries = |
| 9605 | tgt_res_cfg->num_multicast_filter_entries; |
| 9606 | resource_cfg->num_wow_filters = |
| 9607 | tgt_res_cfg->num_wow_filters; |
| 9608 | resource_cfg->num_keep_alive_pattern = |
| 9609 | tgt_res_cfg->num_keep_alive_pattern; |
| 9610 | resource_cfg->keep_alive_pattern_size = |
| 9611 | tgt_res_cfg->keep_alive_pattern_size; |
| 9612 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 9613 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 9614 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 9615 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 9616 | resource_cfg->wmi_send_separate = |
| 9617 | tgt_res_cfg->wmi_send_separate; |
| 9618 | resource_cfg->num_ocb_vdevs = |
| 9619 | tgt_res_cfg->num_ocb_vdevs; |
| 9620 | resource_cfg->num_ocb_channels = |
| 9621 | tgt_res_cfg->num_ocb_channels; |
| 9622 | resource_cfg->num_ocb_schedules = |
| 9623 | tgt_res_cfg->num_ocb_schedules; |
| 9624 | |
| 9625 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 9626 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9627 | /** |
| 9628 | * send_init_cmd_tlv() - wmi init command |
| 9629 | * @wmi_handle: pointer to wmi handle |
| 9630 | * @res_cfg: resource config |
| 9631 | * @num_mem_chunks: no of mem chunck |
| 9632 | * @mem_chunk: pointer to mem chunck structure |
| 9633 | * |
| 9634 | * This function sends IE information to firmware |
| 9635 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9636 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9637 | * |
| 9638 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9639 | QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9640 | wmi_resource_config *tgt_res_cfg, |
| 9641 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 9642 | bool action) |
| 9643 | { |
| 9644 | wmi_buf_t buf; |
| 9645 | wmi_init_cmd_fixed_param *cmd; |
| 9646 | wmi_abi_version my_vers; |
| 9647 | int num_whitelist; |
| 9648 | uint8_t *buf_ptr; |
| 9649 | wmi_resource_config *resource_cfg; |
| 9650 | wlan_host_memory_chunk *host_mem_chunks; |
| 9651 | uint32_t mem_chunk_len = 0; |
| 9652 | uint16_t idx; |
| 9653 | int len; |
| 9654 | int ret; |
| 9655 | |
| 9656 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 9657 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 9658 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 9659 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9660 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 9661 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9662 | } |
| 9663 | |
| 9664 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9665 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 9666 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 9667 | |
| 9668 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 9669 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 9670 | + WMI_TLV_HDR_SIZE); |
| 9671 | |
| 9672 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9673 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 9674 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 9675 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9676 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9677 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 9678 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 9679 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 9680 | |
| 9681 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 9682 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 9683 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 9684 | WMITLV_GET_STRUCT_TLVLEN |
| 9685 | (wlan_host_memory_chunk)); |
| 9686 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 9687 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 9688 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9689 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9690 | idx, host_mem_chunks[idx].size, |
| 9691 | host_mem_chunks[idx].ptr); |
| 9692 | } |
| 9693 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 9694 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 9695 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 9696 | WMITLV_TAG_ARRAY_STRUC, |
| 9697 | (sizeof(wlan_host_memory_chunk) * |
| 9698 | num_mem_chunks)); |
| 9699 | |
| 9700 | num_whitelist = sizeof(version_whitelist) / |
| 9701 | sizeof(wmi_whitelist_version_info); |
| 9702 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 9703 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 9704 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 9705 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 9706 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 9707 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9708 | #ifdef CONFIG_MCL |
| 9709 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 9710 | * 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] | 9711 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 9712 | &my_vers, |
| 9713 | &wmi_handle->fw_abi_version, |
| 9714 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9715 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9716 | 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] | 9717 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 9718 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 9719 | cmd->host_abi_vers.abi_version_ns_0, |
| 9720 | cmd->host_abi_vers.abi_version_ns_1, |
| 9721 | cmd->host_abi_vers.abi_version_ns_2, |
| 9722 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9723 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9724 | /* Save version sent from host - |
| 9725 | * Will be used to check ready event |
| 9726 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9727 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9728 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9729 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9730 | if (action) { |
| 9731 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9732 | WMI_INIT_CMDID); |
| 9733 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9734 | 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] | 9735 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9736 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9737 | } |
| 9738 | } else { |
| 9739 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 9740 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 9741 | } |
| 9742 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9743 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9744 | |
| 9745 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 9746 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9747 | /** |
| 9748 | * send_saved_init_cmd_tlv() - wmi init command |
| 9749 | * @wmi_handle: pointer to wmi handle |
| 9750 | * |
| 9751 | * This function sends IE information to firmware |
| 9752 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9753 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9754 | * |
| 9755 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9756 | QDF_STATUS send_saved_init_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9757 | { |
| 9758 | int status; |
| 9759 | |
| 9760 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 9761 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9762 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 9763 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9764 | } |
| 9765 | status = wmi_unified_cmd_send(wmi_handle, |
| 9766 | wmi_handle->saved_wmi_init_cmd.buf, |
| 9767 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 9768 | WMI_INIT_CMDID); |
| 9769 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9770 | 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] | 9771 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9772 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9773 | } |
| 9774 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 9775 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 9776 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9777 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9778 | } |
| 9779 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9780 | 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] | 9781 | { |
| 9782 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 9783 | wmi_service_ready_event_fixed_param *ev; |
| 9784 | |
| 9785 | |
| 9786 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 9787 | |
| 9788 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 9789 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9790 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9791 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9792 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9793 | /*Save fw version from service ready message */ |
| 9794 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9795 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9796 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9797 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9798 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9799 | } |
| 9800 | |
| 9801 | /** |
| 9802 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 9803 | * @wmi_handle: pointer to wmi handle |
| 9804 | * @res_cfg: resource config |
| 9805 | * @num_mem_chunks: no of mem chunck |
| 9806 | * @mem_chunk: pointer to mem chunck structure |
| 9807 | * |
| 9808 | * This function sends IE information to firmware |
| 9809 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9810 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9811 | * |
| 9812 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9813 | 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] | 9814 | void *evt_buf) |
| 9815 | { |
| 9816 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 9817 | wmi_ready_event_fixed_param *ev = NULL; |
| 9818 | |
| 9819 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 9820 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9821 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9822 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 9823 | &ev->fw_abi_vers)) { |
| 9824 | /* |
| 9825 | * Error: Our host version and the given firmware version |
| 9826 | * are incompatible. |
| 9827 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9828 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9829 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 9830 | __func__, |
| 9831 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 9832 | abi_version_0), |
| 9833 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 9834 | abi_version_0), |
| 9835 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 9836 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 9837 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 9838 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 9839 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 9840 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 9841 | ev->fw_abi_vers.abi_version_ns_0, |
| 9842 | ev->fw_abi_vers.abi_version_ns_1, |
| 9843 | ev->fw_abi_vers.abi_version_ns_2, |
| 9844 | ev->fw_abi_vers.abi_version_ns_3); |
| 9845 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9846 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9847 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9848 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9849 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9850 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9851 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9852 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9853 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9854 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9855 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9856 | |
| 9857 | /** |
| 9858 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 9859 | * @wmi_handle: wmi handle |
| 9860 | * @custom_addr: base mac address |
| 9861 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9862 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9863 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9864 | 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] | 9865 | uint8_t *custom_addr) |
| 9866 | { |
| 9867 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 9868 | wmi_buf_t buf; |
| 9869 | int err; |
| 9870 | |
| 9871 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 9872 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9873 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9874 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9875 | } |
| 9876 | |
| 9877 | 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] | 9878 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9879 | |
| 9880 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9881 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 9882 | WMITLV_GET_STRUCT_TLVLEN |
| 9883 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 9884 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 9885 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9886 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 9887 | sizeof(*cmd), |
| 9888 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 9889 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9890 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9891 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9892 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9893 | } |
| 9894 | |
| 9895 | return 0; |
| 9896 | } |
| 9897 | |
| 9898 | /** |
| 9899 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 9900 | * @handle: wmi handle |
| 9901 | * @event: Event received from FW |
| 9902 | * @len: Length of the event |
| 9903 | * |
| 9904 | * Enables the low frequency events and disables the high frequency |
| 9905 | * events. Bit 17 indicates if the event if low/high frequency. |
| 9906 | * 1 - high frequency, 0 - low frequency |
| 9907 | * |
| 9908 | * Return: 0 on successfully enabling/disabling the events |
| 9909 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9910 | 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] | 9911 | uint8_t *event, |
| 9912 | uint32_t len) |
| 9913 | { |
| 9914 | uint32_t num_of_diag_events_logs; |
| 9915 | wmi_diag_event_log_config_fixed_param *cmd; |
| 9916 | wmi_buf_t buf; |
| 9917 | uint8_t *buf_ptr; |
| 9918 | uint32_t *cmd_args, *evt_args; |
| 9919 | uint32_t buf_len, i; |
| 9920 | |
| 9921 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 9922 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 9923 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9924 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9925 | |
| 9926 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 9927 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9928 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9929 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9930 | } |
| 9931 | wmi_event = param_buf->fixed_param; |
| 9932 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 9933 | evt_args = param_buf->diag_events_logs_list; |
| 9934 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9935 | 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] | 9936 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9937 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9938 | } |
| 9939 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9940 | WMI_LOGD("%s: 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); |
| 9942 | |
| 9943 | /* Free any previous allocation */ |
| 9944 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9945 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9946 | |
| 9947 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9948 | 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] | 9949 | sizeof(uint32_t)); |
| 9950 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9951 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9952 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9953 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9954 | } |
| 9955 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 9956 | |
| 9957 | /* Prepare the send buffer */ |
| 9958 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 9959 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 9960 | |
| 9961 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 9962 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9963 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9964 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9965 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9966 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9967 | } |
| 9968 | |
| 9969 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 9970 | buf_ptr = (uint8_t *) cmd; |
| 9971 | |
| 9972 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9973 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 9974 | WMITLV_GET_STRUCT_TLVLEN( |
| 9975 | wmi_diag_event_log_config_fixed_param)); |
| 9976 | |
| 9977 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 9978 | |
| 9979 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 9980 | |
| 9981 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9982 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 9983 | |
| 9984 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9985 | |
| 9986 | /* Populate the events */ |
| 9987 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 9988 | /* Low freq (0) - Enable (1) the event |
| 9989 | * High freq (1) - Disable (0) the event |
| 9990 | */ |
| 9991 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 9992 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 9993 | /* Set the event ID */ |
| 9994 | WMI_DIAG_ID_SET(cmd_args[i], |
| 9995 | WMI_DIAG_ID_GET(evt_args[i])); |
| 9996 | /* Set the type */ |
| 9997 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 9998 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9999 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10000 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 10001 | } |
| 10002 | |
| 10003 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 10004 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10005 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10006 | __func__); |
| 10007 | wmi_buf_free(buf); |
| 10008 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 10009 | * Host can still have this list |
| 10010 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10011 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10012 | } |
| 10013 | |
| 10014 | return 0; |
| 10015 | } |
| 10016 | |
| 10017 | /** |
| 10018 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 10019 | * @wmi_handle: wmi handle |
| 10020 | * @start_log: Start logging related parameters |
| 10021 | * |
| 10022 | * Send the command to the FW based on which specific logging of diag |
| 10023 | * event/log id can be started/stopped |
| 10024 | * |
| 10025 | * Return: None |
| 10026 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10027 | 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] | 10028 | struct wmi_wifi_start_log *start_log) |
| 10029 | { |
| 10030 | wmi_diag_event_log_config_fixed_param *cmd; |
| 10031 | wmi_buf_t buf; |
| 10032 | uint8_t *buf_ptr; |
| 10033 | uint32_t len, count, log_level, i; |
| 10034 | uint32_t *cmd_args; |
| 10035 | uint32_t total_len; |
| 10036 | count = 0; |
| 10037 | |
| 10038 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10039 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10040 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10041 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10042 | } |
| 10043 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 10044 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 10045 | */ |
| 10046 | total_len = 0; |
| 10047 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 10048 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 10049 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 10050 | total_len++; |
| 10051 | } |
| 10052 | |
| 10053 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10054 | (total_len * sizeof(uint32_t)); |
| 10055 | |
| 10056 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10057 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10058 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10059 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10060 | } |
| 10061 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 10062 | buf_ptr = (uint8_t *) cmd; |
| 10063 | |
| 10064 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10065 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 10066 | WMITLV_GET_STRUCT_TLVLEN( |
| 10067 | wmi_diag_event_log_config_fixed_param)); |
| 10068 | |
| 10069 | cmd->num_of_diag_events_logs = total_len; |
| 10070 | |
| 10071 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 10072 | |
| 10073 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10074 | (total_len * sizeof(uint32_t))); |
| 10075 | |
| 10076 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10077 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10078 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10079 | log_level = 1; |
| 10080 | else |
| 10081 | log_level = 0; |
| 10082 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10083 | 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] | 10084 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 10085 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 10086 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 10087 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 10088 | |
| 10089 | WMI_DIAG_ID_SET(cmd_args[count], |
| 10090 | WMI_DIAG_ID_GET(val)); |
| 10091 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 10092 | WMI_DIAG_TYPE_GET(val)); |
| 10093 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 10094 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10095 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10096 | count++; |
| 10097 | } |
| 10098 | } |
| 10099 | |
| 10100 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10101 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10102 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10103 | __func__); |
| 10104 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10105 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10106 | } |
| 10107 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10108 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10109 | } |
| 10110 | |
| 10111 | /** |
| 10112 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 10113 | * @wmi_handle: WMI handle |
| 10114 | * |
| 10115 | * This function is used to send the flush command to the FW, |
| 10116 | * that will flush the fw logs that are residue in the FW |
| 10117 | * |
| 10118 | * Return: None |
| 10119 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10120 | 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] | 10121 | { |
| 10122 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 10123 | wmi_buf_t buf; |
| 10124 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10125 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10126 | |
| 10127 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10128 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10129 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10130 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10131 | } |
| 10132 | |
| 10133 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 10134 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10135 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 10136 | WMITLV_GET_STRUCT_TLVLEN( |
| 10137 | wmi_debug_mesg_flush_fixed_param)); |
| 10138 | cmd->reserved0 = 0; |
| 10139 | |
| 10140 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10141 | buf, |
| 10142 | len, |
| 10143 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10144 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10145 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10146 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10147 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10148 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10149 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10150 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10151 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10152 | } |
| 10153 | |
| 10154 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10155 | * 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] | 10156 | * @wmi_handle: wmi handle |
| 10157 | * @msg: PCL structure containing the PCL and the number of channels |
| 10158 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10159 | * 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] | 10160 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 10161 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 10162 | * to migrate to a new channel without host driver involvement. An example of |
| 10163 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 10164 | * manage the channel selection without firmware involvement. |
| 10165 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10166 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 10167 | * channel list. The weights corresponds to the channels sent in |
| 10168 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 10169 | * weightage compared to the non PCL channels. |
| 10170 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10171 | * Return: Success if the cmd is sent successfully to the firmware |
| 10172 | */ |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10173 | QDF_STATUS send_pdev_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10174 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10175 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10176 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10177 | wmi_buf_t buf; |
| 10178 | uint8_t *buf_ptr; |
| 10179 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10180 | uint32_t chan_len; |
| 10181 | |
| 10182 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10183 | |
| 10184 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10185 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10186 | |
| 10187 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10188 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10189 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10190 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10191 | } |
| 10192 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10193 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10194 | buf_ptr = (uint8_t *) cmd; |
| 10195 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10196 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 10197 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10198 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10199 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 10200 | cmd->num_chan = chan_len; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10201 | WMI_LOGI("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10202 | |
| 10203 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10204 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10205 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10206 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10207 | for (i = 0; i < chan_len ; i++) { |
| 10208 | cmd_args[i] = msg->weighed_valid_list[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10209 | WMI_LOGI("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10210 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10211 | } |
| 10212 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10213 | WMI_PDEV_SET_PCL_CMDID)) { |
| 10214 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10215 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10216 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10217 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10218 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10219 | } |
| 10220 | |
| 10221 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10222 | * 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] | 10223 | * @wmi_handle: wmi handle |
| 10224 | * @msg: Structure containing the following parameters |
| 10225 | * |
| 10226 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 10227 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 10228 | * |
| 10229 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 10230 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 10231 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 10232 | * |
| 10233 | * Return: Success if the cmd is sent successfully to the firmware |
| 10234 | */ |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10235 | 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] | 10236 | uint32_t hw_mode_index) |
| 10237 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10238 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10239 | wmi_buf_t buf; |
| 10240 | uint32_t len; |
| 10241 | |
| 10242 | len = sizeof(*cmd); |
| 10243 | |
| 10244 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10245 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10246 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10247 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10248 | } |
| 10249 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10250 | 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] | 10251 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10252 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 10253 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 10254 | |
| 10255 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10256 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10257 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10258 | |
| 10259 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10260 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 10261 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10262 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10263 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10264 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10265 | } |
| 10266 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10267 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10268 | } |
| 10269 | |
| 10270 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10271 | * 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] | 10272 | * @wmi_handle: wmi handle |
| 10273 | * @msg: Dual MAC config parameters |
| 10274 | * |
| 10275 | * Configures WLAN firmware with the dual MAC features |
| 10276 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10277 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10278 | */ |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10279 | 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] | 10280 | struct wmi_dual_mac_config *msg) |
| 10281 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10282 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10283 | wmi_buf_t buf; |
| 10284 | uint32_t len; |
| 10285 | |
| 10286 | len = sizeof(*cmd); |
| 10287 | |
| 10288 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10289 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10290 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10291 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10292 | } |
| 10293 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10294 | 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] | 10295 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10296 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10297 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10298 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 10299 | |
| 10300 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10301 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 10302 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10303 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10304 | __func__, msg->scan_config, msg->fw_mode_config); |
| 10305 | |
| 10306 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10307 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 10308 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10309 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10310 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10311 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10312 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10313 | } |
| 10314 | |
| 10315 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10316 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 10317 | * @wmi_handle: wmi handle |
| 10318 | * @offload_req: offload request |
| 10319 | * @buf_ptr: buffer pointer |
| 10320 | * |
| 10321 | * To fill ARP offload data to firmware |
| 10322 | * when target goes to wow mode. |
| 10323 | * |
| 10324 | * Return: None |
| 10325 | */ |
| 10326 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10327 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10328 | { |
| 10329 | |
| 10330 | int i; |
| 10331 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
| 10332 | bool enable_or_disable = offload_req->enableOrDisable; |
| 10333 | |
| 10334 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10335 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 10336 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10337 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 10338 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 10339 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 10340 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 10341 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 10342 | |
| 10343 | /* Fill data for ARP and NS in the first tupple for LA */ |
| 10344 | if ((enable_or_disable & WMI_OFFLOAD_ENABLE) && (i == 0)) { |
| 10345 | /* Copy the target ip addr and flags */ |
| 10346 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 10347 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
| 10348 | offload_req->params.hostIpv4Addr, |
| 10349 | WMI_IPV4_ADDR_LEN); |
| 10350 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
| 10351 | offload_req->params.hostIpv4Addr); |
| 10352 | } |
| 10353 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 10354 | } |
| 10355 | } |
| 10356 | |
| 10357 | #ifdef WLAN_NS_OFFLOAD |
| 10358 | /** |
| 10359 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 10360 | * @wmi|_handle: wmi handle |
| 10361 | * @offload_req: offload request |
| 10362 | * @buf_ptr: buffer pointer |
| 10363 | * |
| 10364 | * To fill NS offload data to firmware |
| 10365 | * when target goes to wow mode. |
| 10366 | * |
| 10367 | * Return: None |
| 10368 | */ |
| 10369 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10370 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10371 | { |
| 10372 | |
| 10373 | int i; |
| 10374 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 10375 | struct ns_offload_req_params ns_req; |
| 10376 | |
| 10377 | ns_req = offload_req->nsOffloadInfo; |
| 10378 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10379 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 10380 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10381 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 10382 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 10383 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 10384 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 10385 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 10386 | |
| 10387 | /* |
| 10388 | * Fill data only for NS offload in the first ARP tuple for LA |
| 10389 | */ |
| 10390 | if ((offload_req->enableOrDisable & WMI_OFFLOAD_ENABLE)) { |
| 10391 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 10392 | /* Copy the target/solicitation/remote ip addr */ |
| 10393 | if (ns_req.targetIPv6AddrValid[i]) |
| 10394 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
| 10395 | &ns_req.targetIPv6Addr[i], |
| 10396 | sizeof(WMI_IPV6_ADDR)); |
| 10397 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
| 10398 | &ns_req.selfIPv6Addr[i], |
| 10399 | sizeof(WMI_IPV6_ADDR)); |
| 10400 | if (ns_req.target_ipv6_addr_ac_type[i]) { |
| 10401 | ns_tuple->flags |= |
| 10402 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 10403 | } |
| 10404 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
| 10405 | i, &ns_req.selfIPv6Addr[i], |
| 10406 | &ns_req.targetIPv6Addr[i]); |
| 10407 | |
| 10408 | /* target MAC is optional, check if it is valid, |
| 10409 | * if this is not valid, the target will use the known |
| 10410 | * local MAC address rather than the tuple |
| 10411 | */ |
| 10412 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 10413 | ns_req.self_macaddr.bytes, |
| 10414 | &ns_tuple->target_mac); |
| 10415 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 10416 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 10417 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 10418 | } |
| 10419 | } |
| 10420 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 10421 | } |
| 10422 | } |
| 10423 | |
| 10424 | |
| 10425 | /** |
| 10426 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 10427 | * @wmi: wmi handle |
| 10428 | * @offload_req: offload request |
| 10429 | * @buf_ptr: buffer pointer |
| 10430 | * |
| 10431 | * To fill extended NS offload extended data to firmware |
| 10432 | * when target goes to wow mode. |
| 10433 | * |
| 10434 | * Return: None |
| 10435 | */ |
| 10436 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
| 10437 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10438 | { |
| 10439 | int i; |
| 10440 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 10441 | uint32_t count, num_ns_ext_tuples; |
| 10442 | struct ns_offload_req_params ns_req; |
| 10443 | |
| 10444 | ns_req = offload_req->nsOffloadInfo; |
| 10445 | count = offload_req->num_ns_offload_count; |
| 10446 | num_ns_ext_tuples = offload_req->num_ns_offload_count - |
| 10447 | WMI_MAX_NS_OFFLOADS; |
| 10448 | |
| 10449 | /* Populate extended NS offload tuples */ |
| 10450 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10451 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 10452 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10453 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 10454 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 10455 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 10456 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 10457 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 10458 | |
| 10459 | /* |
| 10460 | * Fill data only for NS offload in the first ARP tuple for LA |
| 10461 | */ |
| 10462 | if ((offload_req->enableOrDisable & WMI_OFFLOAD_ENABLE)) { |
| 10463 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 10464 | /* Copy the target/solicitation/remote ip addr */ |
| 10465 | if (ns_req.targetIPv6AddrValid[i]) |
| 10466 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
| 10467 | &ns_req.targetIPv6Addr[i], |
| 10468 | sizeof(WMI_IPV6_ADDR)); |
| 10469 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
| 10470 | &ns_req.selfIPv6Addr[i], |
| 10471 | sizeof(WMI_IPV6_ADDR)); |
| 10472 | if (ns_req.target_ipv6_addr_ac_type[i]) { |
| 10473 | ns_tuple->flags |= |
| 10474 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 10475 | } |
| 10476 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
| 10477 | i, &ns_req.selfIPv6Addr[i], |
| 10478 | &ns_req.targetIPv6Addr[i]); |
| 10479 | |
| 10480 | /* target MAC is optional, check if it is valid, |
| 10481 | * if this is not valid, the target will use the |
| 10482 | * known local MAC address rather than the tuple |
| 10483 | */ |
| 10484 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 10485 | ns_req.self_macaddr.bytes, |
| 10486 | &ns_tuple->target_mac); |
| 10487 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 10488 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 10489 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 10490 | } |
| 10491 | } |
| 10492 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 10493 | } |
| 10494 | } |
| 10495 | #else |
| 10496 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10497 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10498 | { |
| 10499 | return; |
| 10500 | } |
| 10501 | |
| 10502 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
| 10503 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10504 | { |
| 10505 | return; |
| 10506 | } |
| 10507 | #endif |
| 10508 | |
| 10509 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10510 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 10511 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10512 | * @arp_offload_req: arp offload request |
| 10513 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10514 | * @arp_only: flag |
| 10515 | * |
| 10516 | * To configure ARP NS off load data to firmware |
| 10517 | * when target goes to wow mode. |
| 10518 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10519 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10520 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10521 | 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] | 10522 | struct host_offload_req_param *arp_offload_req, |
| 10523 | struct host_offload_req_param *ns_offload_req, |
| 10524 | bool arp_only, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10525 | uint8_t vdev_id) |
| 10526 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10527 | int32_t res; |
| 10528 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10529 | A_UINT8 *buf_ptr; |
| 10530 | wmi_buf_t buf; |
| 10531 | int32_t len; |
| 10532 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 10533 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10534 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10535 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10536 | /* |
| 10537 | * TLV place holder size for array of NS tuples |
| 10538 | * TLV place holder size for array of ARP tuples |
| 10539 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10540 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 10541 | WMI_TLV_HDR_SIZE + |
| 10542 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 10543 | WMI_TLV_HDR_SIZE + |
| 10544 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10545 | |
| 10546 | /* |
| 10547 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 10548 | * extra length for extended NS offload tuples which follows ARP offload |
| 10549 | * tuples. Host needs to fill this structure in following format: |
| 10550 | * 2 NS ofload tuples |
| 10551 | * 2 ARP offload tuples |
| 10552 | * N numbers of extended NS offload tuples if HDD has given more than |
| 10553 | * 2 NS offload addresses |
| 10554 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10555 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10556 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10557 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 10558 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10559 | } |
| 10560 | |
| 10561 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10562 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10563 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10564 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10565 | } |
| 10566 | |
| 10567 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 10568 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 10569 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10570 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 10571 | WMITLV_GET_STRUCT_TLVLEN |
| 10572 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 10573 | cmd->flags = 0; |
| 10574 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10575 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10576 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10577 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10578 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10579 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10580 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 10581 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 10582 | if (num_ns_ext_tuples) |
| 10583 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10584 | |
| 10585 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10586 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 10587 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10588 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10589 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10590 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10591 | } |
| 10592 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10593 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10594 | } |
| 10595 | |
| 10596 | /** |
| 10597 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 10598 | * @wmi_handle: wmi handle |
| 10599 | * @request: SSID hotlist set request |
| 10600 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10601 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10602 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10603 | QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10604 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 10605 | struct ssid_hotlist_request_params *request) |
| 10606 | { |
| 10607 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 10608 | wmi_buf_t wmi_buf; |
| 10609 | uint32_t len; |
| 10610 | uint32_t array_size; |
| 10611 | uint8_t *buf_ptr; |
| 10612 | |
| 10613 | /* length of fixed portion */ |
| 10614 | len = sizeof(*cmd); |
| 10615 | |
| 10616 | /* length of variable portion */ |
| 10617 | array_size = |
| 10618 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 10619 | len += WMI_TLV_HDR_SIZE + array_size; |
| 10620 | |
| 10621 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10622 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10623 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10624 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10625 | } |
| 10626 | |
| 10627 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 10628 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 10629 | buf_ptr; |
| 10630 | WMITLV_SET_HDR |
| 10631 | (&cmd->tlv_header, |
| 10632 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 10633 | WMITLV_GET_STRUCT_TLVLEN |
| 10634 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 10635 | |
| 10636 | cmd->request_id = request->request_id; |
| 10637 | cmd->requestor_id = 0; |
| 10638 | cmd->vdev_id = request->session_id; |
| 10639 | cmd->table_id = 0; |
| 10640 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 10641 | cmd->total_entries = request->ssid_count; |
| 10642 | cmd->num_entries_in_page = request->ssid_count; |
| 10643 | cmd->first_entry_index = 0; |
| 10644 | |
| 10645 | buf_ptr += sizeof(*cmd); |
| 10646 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 10647 | |
| 10648 | if (request->ssid_count) { |
| 10649 | wmi_extscan_hotlist_ssid_entry *entry; |
| 10650 | int i; |
| 10651 | |
| 10652 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10653 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 10654 | for (i = 0; i < request->ssid_count; i++) { |
| 10655 | WMITLV_SET_HDR |
| 10656 | (entry, |
| 10657 | WMITLV_TAG_ARRAY_STRUC, |
| 10658 | WMITLV_GET_STRUCT_TLVLEN |
| 10659 | (wmi_extscan_hotlist_ssid_entry)); |
| 10660 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10661 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10662 | request->ssids[i].ssid.mac_ssid, |
| 10663 | request->ssids[i].ssid.length); |
| 10664 | entry->band = request->ssids[i].band; |
| 10665 | entry->min_rssi = request->ssids[i].rssi_low; |
| 10666 | entry->max_rssi = request->ssids[i].rssi_high; |
| 10667 | entry++; |
| 10668 | } |
| 10669 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 10670 | } else { |
| 10671 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 10672 | } |
| 10673 | |
| 10674 | if (wmi_unified_cmd_send |
| 10675 | (wmi_handle, wmi_buf, len, |
| 10676 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10677 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10678 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10679 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10680 | } |
| 10681 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10682 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10683 | } |
| 10684 | |
| 10685 | /** |
| 10686 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 10687 | * @wmi_handle: wmi handle |
| 10688 | * @vdev_id: vdev id |
| 10689 | * |
| 10690 | * This function sends roam synch complete event to fw. |
| 10691 | * |
| 10692 | * Return: CDF STATUS |
| 10693 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10694 | 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] | 10695 | uint8_t vdev_id) |
| 10696 | { |
| 10697 | wmi_roam_synch_complete_fixed_param *cmd; |
| 10698 | wmi_buf_t wmi_buf; |
| 10699 | uint8_t *buf_ptr; |
| 10700 | uint16_t len; |
| 10701 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 10702 | |
| 10703 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10704 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10705 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10706 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10707 | } |
| 10708 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 10709 | buf_ptr = (uint8_t *) cmd; |
| 10710 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10711 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 10712 | WMITLV_GET_STRUCT_TLVLEN |
| 10713 | (wmi_roam_synch_complete_fixed_param)); |
| 10714 | cmd->vdev_id = vdev_id; |
| 10715 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10716 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10717 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10718 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10719 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10720 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10721 | } |
| 10722 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10723 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10724 | } |
| 10725 | |
| 10726 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 10727 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 10728 | * @wmi_handle: wmi handle |
| 10729 | * @wmi_fwtest: fw test command |
| 10730 | * |
| 10731 | * This function sends fw test command to fw. |
| 10732 | * |
| 10733 | * Return: CDF STATUS |
| 10734 | */ |
| 10735 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 10736 | struct set_fwtest_params *wmi_fwtest) |
| 10737 | { |
| 10738 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 10739 | wmi_buf_t wmi_buf; |
| 10740 | uint16_t len; |
| 10741 | |
| 10742 | len = sizeof(*cmd); |
| 10743 | |
| 10744 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10745 | if (!wmi_buf) { |
| 10746 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10747 | return QDF_STATUS_E_NOMEM; |
| 10748 | } |
| 10749 | |
| 10750 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 10751 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10752 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 10753 | WMITLV_GET_STRUCT_TLVLEN( |
| 10754 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 10755 | cmd->param_id = wmi_fwtest->arg; |
| 10756 | cmd->param_value = wmi_fwtest->value; |
| 10757 | |
| 10758 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10759 | WMI_FWTEST_CMDID)) { |
| 10760 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 10761 | qdf_nbuf_free(wmi_buf); |
| 10762 | return QDF_STATUS_E_FAILURE; |
| 10763 | } |
| 10764 | |
| 10765 | return QDF_STATUS_SUCCESS; |
| 10766 | } |
| 10767 | |
| 10768 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10769 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 10770 | * @wmi_handle: wmi handle |
| 10771 | * @wmi_utest: unit test command |
| 10772 | * |
| 10773 | * This function send unit test command to fw. |
| 10774 | * |
| 10775 | * Return: CDF STATUS |
| 10776 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10777 | QDF_STATUS send_unit_test_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10778 | struct wmi_unit_test_cmd *wmi_utest) |
| 10779 | { |
| 10780 | wmi_unit_test_cmd_fixed_param *cmd; |
| 10781 | wmi_buf_t wmi_buf; |
| 10782 | uint8_t *buf_ptr; |
| 10783 | int i; |
| 10784 | uint16_t len, args_tlv_len; |
| 10785 | A_UINT32 *unit_test_cmd_args; |
| 10786 | |
| 10787 | args_tlv_len = |
| 10788 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 10789 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 10790 | |
| 10791 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10792 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10793 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10794 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10795 | } |
| 10796 | |
| 10797 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 10798 | buf_ptr = (uint8_t *) cmd; |
| 10799 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10800 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 10801 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 10802 | cmd->vdev_id = wmi_utest->vdev_id; |
| 10803 | cmd->module_id = wmi_utest->module_id; |
| 10804 | cmd->num_args = wmi_utest->num_args; |
| 10805 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 10806 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10807 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 10808 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10809 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10810 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 10811 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10812 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10813 | } |
| 10814 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10815 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10816 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10817 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10818 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10819 | } |
| 10820 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10821 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10822 | } |
| 10823 | |
| 10824 | /** |
| 10825 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 10826 | * @wmi_handle: wma handle |
| 10827 | * @roaminvoke: roam invoke command |
| 10828 | * |
| 10829 | * Send roam invoke command to fw for fastreassoc. |
| 10830 | * |
| 10831 | * Return: CDF STATUS |
| 10832 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10833 | QDF_STATUS send_roam_invoke_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10834 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 10835 | uint32_t ch_hz) |
| 10836 | { |
| 10837 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 10838 | wmi_buf_t wmi_buf; |
| 10839 | u_int8_t *buf_ptr; |
| 10840 | u_int16_t len, args_tlv_len; |
| 10841 | A_UINT32 *channel_list; |
| 10842 | wmi_mac_addr *bssid_list; |
| 10843 | |
| 10844 | /* Host sends only one channel and one bssid */ |
| 10845 | args_tlv_len = 2 * WMI_TLV_HDR_SIZE + sizeof(A_UINT32) + |
| 10846 | sizeof(wmi_mac_addr); |
| 10847 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 10848 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10849 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10850 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10851 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10852 | } |
| 10853 | |
| 10854 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 10855 | buf_ptr = (u_int8_t *) cmd; |
| 10856 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10857 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 10858 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 10859 | cmd->vdev_id = roaminvoke->vdev_id; |
| 10860 | cmd->flags = 0; |
| 10861 | cmd->roam_scan_mode = 0; |
| 10862 | cmd->roam_ap_sel_mode = 0; |
| 10863 | cmd->roam_delay = 0; |
| 10864 | cmd->num_chan = 1; |
| 10865 | cmd->num_bssid = 1; |
| 10866 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 10867 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10868 | (sizeof(u_int32_t))); |
| 10869 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 10870 | *channel_list = ch_hz; |
| 10871 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 10872 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 10873 | (sizeof(wmi_mac_addr))); |
| 10874 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 10875 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
| 10876 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10877 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10878 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10879 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10880 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10881 | } |
| 10882 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10883 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10884 | } |
| 10885 | |
| 10886 | /** |
| 10887 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 10888 | * @wmi_handle: wmi handle |
| 10889 | * @command: command |
| 10890 | * @vdev_id: vdev id |
| 10891 | * |
| 10892 | * This function set roam offload command to fw. |
| 10893 | * |
| 10894 | * Return: CDF status |
| 10895 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10896 | 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] | 10897 | uint32_t command, uint32_t vdev_id) |
| 10898 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10899 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10900 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 10901 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10902 | int len; |
| 10903 | uint8_t *buf_ptr; |
| 10904 | |
| 10905 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 10906 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10907 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10908 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 10909 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10910 | } |
| 10911 | |
| 10912 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10913 | |
| 10914 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 10915 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 10916 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 10917 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 10918 | cmd_fp->vdev_id = vdev_id; |
| 10919 | cmd_fp->command_arg = command; |
| 10920 | |
| 10921 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 10922 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10923 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10924 | 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] | 10925 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10926 | goto error; |
| 10927 | } |
| 10928 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10929 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 10930 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10931 | |
| 10932 | error: |
| 10933 | wmi_buf_free(buf); |
| 10934 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10935 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10936 | } |
| 10937 | |
| 10938 | /** |
| 10939 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 10940 | * @wmi_handle: wmi handle |
| 10941 | * @ap_profile_p: ap profile |
| 10942 | * @vdev_id: vdev id |
| 10943 | * |
| 10944 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 10945 | * |
| 10946 | * Return: CDF status |
| 10947 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10948 | 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] | 10949 | wmi_ap_profile *ap_profile_p, |
| 10950 | uint32_t vdev_id) |
| 10951 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10952 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10953 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10954 | int len; |
| 10955 | uint8_t *buf_ptr; |
| 10956 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 10957 | |
| 10958 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 10959 | |
| 10960 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10961 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10962 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 10963 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10964 | } |
| 10965 | |
| 10966 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10967 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 10968 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 10969 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 10970 | WMITLV_GET_STRUCT_TLVLEN |
| 10971 | (wmi_roam_ap_profile_fixed_param)); |
| 10972 | /* fill in threshold values */ |
| 10973 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 10974 | roam_ap_profile_fp->id = 0; |
| 10975 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 10976 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10977 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10978 | WMITLV_SET_HDR(buf_ptr, |
| 10979 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 10980 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 10981 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 10982 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10983 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10984 | 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] | 10985 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10986 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10987 | } |
| 10988 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10989 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10990 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10991 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10992 | } |
| 10993 | |
| 10994 | /** |
| 10995 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 10996 | * @wmi_handle: wmi handle |
| 10997 | * @scan_period: scan period |
| 10998 | * @scan_age: scan age |
| 10999 | * @vdev_id: vdev id |
| 11000 | * |
| 11001 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 11002 | * |
| 11003 | * Return: CDF status |
| 11004 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11005 | 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] | 11006 | uint32_t scan_period, |
| 11007 | uint32_t scan_age, |
| 11008 | uint32_t vdev_id) |
| 11009 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11010 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11011 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11012 | int len; |
| 11013 | uint8_t *buf_ptr; |
| 11014 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 11015 | |
| 11016 | /* Send scan period values */ |
| 11017 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 11018 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11019 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11020 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11021 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11022 | } |
| 11023 | |
| 11024 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11025 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 11026 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 11027 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 11028 | WMITLV_GET_STRUCT_TLVLEN |
| 11029 | (wmi_roam_scan_period_fixed_param)); |
| 11030 | /* fill in scan period values */ |
| 11031 | scan_period_fp->vdev_id = vdev_id; |
| 11032 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 11033 | scan_period_fp->roam_scan_age = scan_age; |
| 11034 | |
| 11035 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11036 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11037 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11038 | 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] | 11039 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11040 | goto error; |
| 11041 | } |
| 11042 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11043 | 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] | 11044 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11045 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11046 | error: |
| 11047 | wmi_buf_free(buf); |
| 11048 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11049 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11050 | } |
| 11051 | |
| 11052 | /** |
| 11053 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 11054 | * @wmi_handle: wmi handle |
| 11055 | * @chan_count: channel count |
| 11056 | * @chan_list: channel list |
| 11057 | * @list_type: list type |
| 11058 | * @vdev_id: vdev id |
| 11059 | * |
| 11060 | * Set roam offload channel list. |
| 11061 | * |
| 11062 | * Return: CDF status |
| 11063 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11064 | 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] | 11065 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 11066 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11067 | uint8_t list_type, uint32_t vdev_id) |
| 11068 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11069 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11070 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11071 | int len, list_tlv_len; |
| 11072 | int i; |
| 11073 | uint8_t *buf_ptr; |
| 11074 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 11075 | A_UINT32 *roam_chan_list_array; |
| 11076 | |
| 11077 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11078 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11079 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11080 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11081 | } |
| 11082 | /* Channel list is a table of 2 TLV's */ |
| 11083 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 11084 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 11085 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11086 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11087 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11088 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11089 | } |
| 11090 | |
| 11091 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11092 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 11093 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 11094 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 11095 | WMITLV_GET_STRUCT_TLVLEN |
| 11096 | (wmi_roam_chan_list_fixed_param)); |
| 11097 | chan_list_fp->vdev_id = vdev_id; |
| 11098 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 11099 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11100 | /* external app is controlling channel list */ |
| 11101 | chan_list_fp->chan_list_type = |
| 11102 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 11103 | } else { |
| 11104 | /* umac supplied occupied channel list in LFR */ |
| 11105 | chan_list_fp->chan_list_type = |
| 11106 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 11107 | } |
| 11108 | |
| 11109 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 11110 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11111 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 11112 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11113 | WMI_LOGI("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11114 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 11115 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 11116 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11117 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11118 | } |
| 11119 | |
| 11120 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11121 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11122 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11123 | 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] | 11124 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11125 | goto error; |
| 11126 | } |
| 11127 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11128 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
| 11129 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11130 | error: |
| 11131 | wmi_buf_free(buf); |
| 11132 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11133 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11134 | } |
| 11135 | |
| 11136 | /** |
| 11137 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 11138 | * @wmi_handle: wmi handle |
| 11139 | * @rssi_change_thresh: RSSI Change threshold |
| 11140 | * @bcn_rssi_weight: beacon RSSI weight |
| 11141 | * @vdev_id: vdev id |
| 11142 | * |
| 11143 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 11144 | * |
| 11145 | * Return: CDF status |
| 11146 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11147 | 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] | 11148 | uint32_t vdev_id, |
| 11149 | int32_t rssi_change_thresh, |
| 11150 | uint32_t bcn_rssi_weight, |
| 11151 | uint32_t hirssi_delay_btw_scans) |
| 11152 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11153 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11154 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11155 | int len; |
| 11156 | uint8_t *buf_ptr; |
| 11157 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 11158 | |
| 11159 | /* Send rssi change parameters */ |
| 11160 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 11161 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11162 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11163 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11164 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11165 | } |
| 11166 | |
| 11167 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11168 | rssi_change_fp = |
| 11169 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 11170 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 11171 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 11172 | WMITLV_GET_STRUCT_TLVLEN |
| 11173 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 11174 | /* fill in rssi change threshold (hysteresis) values */ |
| 11175 | rssi_change_fp->vdev_id = vdev_id; |
| 11176 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 11177 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 11178 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 11179 | |
| 11180 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11181 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11182 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11183 | 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] | 11184 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11185 | goto error; |
| 11186 | } |
| 11187 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11188 | 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] | 11189 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11190 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 11191 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11192 | error: |
| 11193 | wmi_buf_free(buf); |
| 11194 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11195 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11196 | } |
| 11197 | |
| 11198 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 11199 | * @wmi_handle: wmi handle. |
| 11200 | * @cmd: size of command structure. |
| 11201 | * @per_entry_size: per entry size. |
| 11202 | * |
| 11203 | * This utility function calculates how many hotlist entries can |
| 11204 | * fit in one page. |
| 11205 | * |
| 11206 | * Return: number of entries |
| 11207 | */ |
| 11208 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 11209 | size_t cmd_size, |
| 11210 | size_t per_entry_size) |
| 11211 | { |
| 11212 | uint32_t avail_space = 0; |
| 11213 | int num_entries = 0; |
| 11214 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 11215 | |
| 11216 | /* Calculate number of hotlist entries that can |
| 11217 | * be passed in wma message request. |
| 11218 | */ |
| 11219 | avail_space = max_msg_len - cmd_size; |
| 11220 | num_entries = avail_space / per_entry_size; |
| 11221 | return num_entries; |
| 11222 | } |
| 11223 | |
| 11224 | /** |
| 11225 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 11226 | * @wmi_handle: wmi handle |
| 11227 | * @photlist: hotlist command params |
| 11228 | * @buf_len: buffer length |
| 11229 | * |
| 11230 | * This function fills individual elements for hotlist request and |
| 11231 | * TLV for bssid entries |
| 11232 | * |
| 11233 | * Return: CDF Status. |
| 11234 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11235 | 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] | 11236 | struct ext_scan_setbssi_hotlist_params * |
| 11237 | photlist, int *buf_len) |
| 11238 | { |
| 11239 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 11240 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 11241 | struct ap_threshold_params *src_ap = photlist->ap; |
| 11242 | wmi_buf_t buf; |
| 11243 | uint8_t *buf_ptr; |
| 11244 | |
| 11245 | int j, index = 0; |
| 11246 | int cmd_len = 0; |
| 11247 | int num_entries; |
| 11248 | int min_entries = 0; |
| 11249 | int numap = photlist->numAp; |
| 11250 | int len = sizeof(*cmd); |
| 11251 | |
| 11252 | len += WMI_TLV_HDR_SIZE; |
| 11253 | cmd_len = len; |
| 11254 | |
| 11255 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 11256 | cmd_len, |
| 11257 | sizeof(*dest_hotlist)); |
| 11258 | /* setbssid hotlist expects the bssid list |
| 11259 | * to be non zero value |
| 11260 | */ |
| 11261 | if (!numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11262 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 11263 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11264 | } |
| 11265 | |
| 11266 | /* Split the hot list entry pages and send multiple command |
| 11267 | * requests if the buffer reaches the maximum request size |
| 11268 | */ |
| 11269 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11270 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11271 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 11272 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11273 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11274 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 11275 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11276 | } |
| 11277 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11278 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 11279 | buf_ptr; |
| 11280 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11281 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 11282 | WMITLV_GET_STRUCT_TLVLEN |
| 11283 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 11284 | |
| 11285 | /* Multiple requests are sent until the num_entries_in_page |
| 11286 | * matches the total_entries |
| 11287 | */ |
| 11288 | cmd->request_id = photlist->requestId; |
| 11289 | cmd->vdev_id = photlist->sessionId; |
| 11290 | cmd->total_entries = numap; |
| 11291 | cmd->mode = 1; |
| 11292 | cmd->num_entries_in_page = min_entries; |
| 11293 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 11294 | cmd->first_entry_index = index; |
| 11295 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11296 | 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] | 11297 | __func__, cmd->vdev_id, cmd->total_entries, |
| 11298 | cmd->num_entries_in_page, |
| 11299 | cmd->lost_ap_scan_count); |
| 11300 | |
| 11301 | buf_ptr += sizeof(*cmd); |
| 11302 | WMITLV_SET_HDR(buf_ptr, |
| 11303 | WMITLV_TAG_ARRAY_STRUC, |
| 11304 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 11305 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 11306 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11307 | |
| 11308 | /* Populate bssid, channel info and rssi |
| 11309 | * for the bssid's that are sent as hotlists. |
| 11310 | */ |
| 11311 | for (j = 0; j < min_entries; j++) { |
| 11312 | WMITLV_SET_HDR(dest_hotlist, |
| 11313 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 11314 | WMITLV_GET_STRUCT_TLVLEN |
| 11315 | (wmi_extscan_hotlist_entry)); |
| 11316 | |
| 11317 | dest_hotlist->min_rssi = src_ap->low; |
| 11318 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 11319 | &dest_hotlist->bssid); |
| 11320 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11321 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11322 | __func__, dest_hotlist->channel, |
| 11323 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11324 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11325 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 11326 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 11327 | dest_hotlist->bssid.mac_addr47to32); |
| 11328 | dest_hotlist++; |
| 11329 | src_ap++; |
| 11330 | } |
| 11331 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 11332 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 11333 | |
| 11334 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11335 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11336 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11337 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11338 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11339 | } |
| 11340 | index = index + min_entries; |
| 11341 | num_entries = numap - min_entries; |
| 11342 | len = cmd_len; |
| 11343 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11344 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11345 | } |
| 11346 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 11347 | /** |
| 11348 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 11349 | * @wmi_handle: wmi handle |
| 11350 | * @param: wmi power debug parameter |
| 11351 | * |
| 11352 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 11353 | * |
| 11354 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 11355 | */ |
| 11356 | QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 11357 | struct wmi_power_dbg_params *param) |
| 11358 | { |
| 11359 | wmi_buf_t buf = NULL; |
| 11360 | QDF_STATUS status; |
| 11361 | int len, args_tlv_len; |
| 11362 | uint8_t *buf_ptr; |
| 11363 | uint8_t i; |
| 11364 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 11365 | uint32_t *cmd_args; |
| 11366 | |
| 11367 | /* Prepare and send power debug cmd parameters */ |
| 11368 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 11369 | len = sizeof(*cmd) + args_tlv_len; |
| 11370 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11371 | if (!buf) { |
| 11372 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11373 | return QDF_STATUS_E_NOMEM; |
| 11374 | } |
| 11375 | |
| 11376 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11377 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 11378 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11379 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 11380 | WMITLV_GET_STRUCT_TLVLEN |
| 11381 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 11382 | |
| 11383 | cmd->pdev_id = param->pdev_id; |
| 11384 | cmd->module_id = param->module_id; |
| 11385 | cmd->num_args = param->num_args; |
| 11386 | buf_ptr += sizeof(*cmd); |
| 11387 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11388 | (param->num_args * sizeof(uint32_t))); |
| 11389 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11390 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 11391 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 11392 | cmd_args[i] = param->args[i]; |
| 11393 | WMI_LOGI("%d,", param->args[i]); |
| 11394 | } |
| 11395 | |
| 11396 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11397 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 11398 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11399 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 11400 | status); |
| 11401 | goto error; |
| 11402 | } |
| 11403 | |
| 11404 | return QDF_STATUS_SUCCESS; |
| 11405 | error: |
| 11406 | wmi_buf_free(buf); |
| 11407 | |
| 11408 | return status; |
| 11409 | } |
| 11410 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11411 | /** |
| 11412 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 11413 | * @wmi_handle: wmi handle |
| 11414 | * @param tgt_res_cfg: pointer to target resource configuration |
| 11415 | * @param num_mem_chunks: Number of memory chunks |
| 11416 | * @param mem_chunks: pointer to target memory chunks |
| 11417 | * |
| 11418 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11419 | */ |
| 11420 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
| 11421 | target_resource_config *tgt_res_cfg, uint8_t num_mem_chunks, |
| 11422 | struct wmi_host_mem_chunk *mem_chunks) |
| 11423 | { |
| 11424 | wmi_buf_t buf; |
| 11425 | wmi_init_cmd_fixed_param *cmd; |
| 11426 | wmi_abi_version my_vers; |
| 11427 | int num_whitelist; |
| 11428 | uint8_t *buf_ptr; |
| 11429 | wmi_resource_config *resource_cfg; |
| 11430 | wlan_host_memory_chunk *host_mem_chunks; |
| 11431 | uint32_t mem_chunk_len = 0; |
| 11432 | uint16_t idx; |
| 11433 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11434 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11435 | |
| 11436 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 11437 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 11438 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 11439 | if (!buf) { |
| 11440 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11441 | return QDF_STATUS_E_FAILURE; |
| 11442 | } |
| 11443 | |
| 11444 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11445 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 11446 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 11447 | |
| 11448 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 11449 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 11450 | + WMI_TLV_HDR_SIZE); |
| 11451 | |
| 11452 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11453 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 11454 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 11455 | |
| 11456 | wmi_copy_resource_config(resource_cfg, tgt_res_cfg); |
| 11457 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 11458 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 11459 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 11460 | |
| 11461 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 11462 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 11463 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 11464 | WMITLV_GET_STRUCT_TLVLEN |
| 11465 | (wlan_host_memory_chunk)); |
| 11466 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 11467 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 11468 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
| 11469 | qdf_print("chunk %d len %d requested ,ptr 0x%x ", |
| 11470 | idx, host_mem_chunks[idx].size, |
| 11471 | host_mem_chunks[idx].ptr); |
| 11472 | } |
| 11473 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 11474 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 11475 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 11476 | WMITLV_TAG_ARRAY_STRUC, |
| 11477 | (sizeof(wlan_host_memory_chunk) * |
| 11478 | num_mem_chunks)); |
| 11479 | |
| 11480 | num_whitelist = sizeof(version_whitelist) / |
| 11481 | sizeof(wmi_whitelist_version_info); |
| 11482 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 11483 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 11484 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 11485 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 11486 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 11487 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 11488 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11489 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11490 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 11491 | &my_vers, |
| 11492 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 11493 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11494 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11495 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 11496 | __func__, |
| 11497 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 11498 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 11499 | cmd->host_abi_vers.abi_version_ns_0, |
| 11500 | cmd->host_abi_vers.abi_version_ns_1, |
| 11501 | cmd->host_abi_vers.abi_version_ns_2, |
| 11502 | cmd->host_abi_vers.abi_version_ns_3); |
| 11503 | |
| 11504 | /* Save version sent from host - |
| 11505 | * Will be used to check ready event |
| 11506 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11507 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11508 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 11509 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11510 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11511 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 11512 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 11513 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 11514 | ret); |
| 11515 | wmi_buf_free(buf); |
| 11516 | } |
| 11517 | return ret; |
| 11518 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11519 | } |
| 11520 | |
| 11521 | /** |
| 11522 | * save_service_bitmap_tlv() - save service bitmap |
| 11523 | * @wmi_handle: wmi handle |
| 11524 | * @param evt_buf: pointer to event buffer |
| 11525 | * |
| 11526 | * Return: None |
| 11527 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 11528 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11529 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11530 | { |
| 11531 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11532 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11533 | |
| 11534 | qdf_mem_copy(wmi_handle->wmi_service_bitmap, |
| 11535 | param_buf->wmi_service_bitmap, |
| 11536 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
| 11537 | } |
| 11538 | #else |
| 11539 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11540 | { |
| 11541 | return; |
| 11542 | } |
| 11543 | |
| 11544 | #endif |
| 11545 | |
| 11546 | /** |
| 11547 | * is_service_enabled_tlv() - Check if service enabled |
| 11548 | * @param wmi_handle: wmi handle |
| 11549 | * @param service_id: service identifier |
| 11550 | * |
| 11551 | * Return: 1 enabled, 0 disabled |
| 11552 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 11553 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11554 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 11555 | uint32_t service_id) |
| 11556 | { |
| 11557 | return WMI_SERVICE_IS_ENABLED(wmi_handle->wmi_service_bitmap, |
| 11558 | service_id); |
| 11559 | } |
| 11560 | #else |
| 11561 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 11562 | uint32_t service_id) |
| 11563 | { |
| 11564 | return false; |
| 11565 | } |
| 11566 | #endif |
| 11567 | |
| 11568 | /** |
| 11569 | * extract_service_ready_tlv() - extract service ready event |
| 11570 | * @wmi_handle: wmi handle |
| 11571 | * @param evt_buf: pointer to received event buffer |
| 11572 | * @param cap: pointer to hold target capability information extracted from even |
| 11573 | * |
| 11574 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11575 | */ |
| 11576 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
| 11577 | void *evt_buf, target_capability_info *cap) |
| 11578 | { |
| 11579 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11580 | wmi_service_ready_event_fixed_param *ev; |
| 11581 | |
| 11582 | |
| 11583 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11584 | |
| 11585 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11586 | if (!ev) { |
| 11587 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11588 | return QDF_STATUS_E_FAILURE; |
| 11589 | } |
| 11590 | |
| 11591 | cap->phy_capability = ev->phy_capability; |
| 11592 | cap->max_frag_entry = ev->max_frag_entry; |
| 11593 | cap->num_rf_chains = ev->num_rf_chains; |
| 11594 | cap->ht_cap_info = ev->ht_cap_info; |
| 11595 | cap->vht_cap_info = ev->vht_cap_info; |
| 11596 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 11597 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 11598 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 11599 | cap->sys_cap_info = ev->sys_cap_info; |
| 11600 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 11601 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 11602 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 11603 | cap->max_supported_macs = ev->max_supported_macs; |
| 11604 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 11605 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 11606 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 11607 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 11608 | |
| 11609 | return QDF_STATUS_SUCCESS; |
| 11610 | } |
| 11611 | |
| 11612 | /** |
| 11613 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 11614 | * @wmi_handle: wmi handle |
| 11615 | * @param evt_buf: Pointer to event buffer |
| 11616 | * @param cap: pointer to hold HAL reg capabilities |
| 11617 | * |
| 11618 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11619 | */ |
| 11620 | static QDF_STATUS extract_hal_reg_cap_tlv(wmi_unified_t wmi_handle, |
| 11621 | void *evt_buf, TARGET_HAL_REG_CAPABILITIES *cap) |
| 11622 | { |
| 11623 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11624 | |
| 11625 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11626 | |
| 11627 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 11628 | sizeof(uint32_t)), |
| 11629 | sizeof(TARGET_HAL_REG_CAPABILITIES)); |
| 11630 | |
| 11631 | return QDF_STATUS_SUCCESS; |
| 11632 | } |
| 11633 | |
| 11634 | /** |
| 11635 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 11636 | * @wmi_handle: wmi handle |
| 11637 | * @param evt_buf: pointer to event buffer |
| 11638 | * @param num_entries: pointer to hold number of entries requested |
| 11639 | * |
| 11640 | * Return: Number of entries requested |
| 11641 | */ |
| 11642 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 11643 | void *evt_buf, uint8_t *num_entries) |
| 11644 | { |
| 11645 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11646 | wmi_service_ready_event_fixed_param *ev; |
| 11647 | |
| 11648 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11649 | |
| 11650 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11651 | if (!ev) { |
| 11652 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11653 | return NULL; |
| 11654 | } |
| 11655 | |
| 11656 | *num_entries = ev->num_mem_reqs; |
| 11657 | |
| 11658 | return (host_mem_req *)param_buf->mem_reqs; |
| 11659 | } |
| 11660 | |
| 11661 | /** |
| 11662 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 11663 | * ready function |
| 11664 | * @wmi_handle: wmi handle |
| 11665 | * @param evt_buf: pointer to event buffer |
| 11666 | * |
| 11667 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11668 | */ |
| 11669 | static QDF_STATUS |
| 11670 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11671 | { |
| 11672 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11673 | wmi_service_ready_event_fixed_param *ev; |
| 11674 | |
| 11675 | |
| 11676 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11677 | |
| 11678 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11679 | if (!ev) { |
| 11680 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11681 | return QDF_STATUS_E_FAILURE; |
| 11682 | } |
| 11683 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11684 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11685 | /*Save fw version from service ready message */ |
| 11686 | /*This will be used while sending INIT message */ |
| 11687 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 11688 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11689 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11690 | return QDF_STATUS_SUCCESS; |
| 11691 | } |
| 11692 | |
| 11693 | /** |
| 11694 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 11695 | * @wmi_handle: wmi handle |
| 11696 | * @param evt_buf: Pointer to event buffer |
| 11697 | * |
| 11698 | * Return: ready status |
| 11699 | */ |
| 11700 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 11701 | void *evt_buf) |
| 11702 | { |
| 11703 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 11704 | wmi_ready_event_fixed_param *ev = NULL; |
| 11705 | |
| 11706 | |
| 11707 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 11708 | ev = param_buf->fixed_param; |
| 11709 | |
| 11710 | qdf_print("%s:%d\n", __func__, ev->status); |
| 11711 | |
| 11712 | return ev->status; |
| 11713 | } |
| 11714 | |
| 11715 | /** |
| 11716 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 11717 | * @wmi_handle: wmi handle |
| 11718 | * @param evt_buf: pointer to event buffer |
| 11719 | * @param macaddr: Pointer to hold MAC address |
| 11720 | * |
| 11721 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11722 | */ |
| 11723 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 11724 | void *evt_buf, uint8_t *macaddr) |
| 11725 | { |
| 11726 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 11727 | wmi_ready_event_fixed_param *ev = NULL; |
| 11728 | |
| 11729 | |
| 11730 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 11731 | ev = param_buf->fixed_param; |
| 11732 | |
| 11733 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 11734 | |
| 11735 | return QDF_STATUS_SUCCESS; |
| 11736 | } |
| 11737 | |
| 11738 | /** |
| 11739 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 11740 | * @wmi_handle: wmi handle |
| 11741 | * @param evt_buf: pointer to event buffer |
| 11742 | * |
| 11743 | * Return: length |
| 11744 | */ |
| 11745 | static uint8_t *extract_dbglog_data_len_tlv(wmi_unified_t wmi_handle, |
| 11746 | void *evt_buf, uint16_t *len) |
| 11747 | { |
| 11748 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 11749 | |
| 11750 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 11751 | |
| 11752 | *len = param_buf->num_bufp; |
| 11753 | |
| 11754 | return param_buf->bufp; |
| 11755 | } |
| 11756 | |
| 11757 | /** |
| 11758 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 11759 | * @wmi_handle: wmi handle |
| 11760 | * @param evt_buf: pointer to event buffer |
| 11761 | * @param vdev_rsp: Pointer to hold vdev response |
| 11762 | * |
| 11763 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11764 | */ |
| 11765 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 11766 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 11767 | { |
| 11768 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 11769 | wmi_vdev_start_response_event_fixed_param *ev; |
| 11770 | |
| 11771 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 11772 | if (!param_buf) { |
| 11773 | qdf_print("Invalid start response event buffer\n"); |
| 11774 | return QDF_STATUS_E_INVAL; |
| 11775 | } |
| 11776 | |
| 11777 | ev = param_buf->fixed_param; |
| 11778 | if (!ev) { |
| 11779 | qdf_print("Invalid start response event buffer\n"); |
| 11780 | return QDF_STATUS_E_INVAL; |
| 11781 | } |
| 11782 | |
| 11783 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 11784 | |
| 11785 | vdev_rsp->vdev_id = ev->vdev_id; |
| 11786 | vdev_rsp->requestor_id = ev->requestor_id; |
| 11787 | vdev_rsp->resp_type = ev->resp_type; |
| 11788 | vdev_rsp->status = ev->status; |
| 11789 | vdev_rsp->chain_mask = ev->chain_mask; |
| 11790 | vdev_rsp->smps_mode = ev->smps_mode; |
| 11791 | vdev_rsp->mac_id = ev->mac_id; |
| 11792 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 11793 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 11794 | |
| 11795 | return QDF_STATUS_SUCCESS; |
| 11796 | } |
| 11797 | |
| 11798 | /** |
| 11799 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset update param |
| 11800 | * @wmi_handle: wmi handle |
| 11801 | * @param evt_buf: pointer to event buffer |
| 11802 | * @param vdev_map: Pointer to hold vdev map |
| 11803 | * @param tbttoffset_list: Pointer to tbtt offset list |
| 11804 | * |
| 11805 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11806 | */ |
| 11807 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 11808 | void *evt_buf, uint32_t *vdev_map, uint32_t **tbttoffset_list) |
| 11809 | { |
| 11810 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 11811 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 11812 | |
| 11813 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 11814 | if (!param_buf) { |
| 11815 | qdf_print("Invalid tbtt update event buffer\n"); |
| 11816 | return QDF_STATUS_E_INVAL; |
| 11817 | } |
| 11818 | tbtt_offset_event = param_buf->fixed_param; |
| 11819 | |
| 11820 | *vdev_map = tbtt_offset_event->vdev_map; |
| 11821 | *tbttoffset_list = param_buf->tbttoffset_list; |
| 11822 | |
| 11823 | return QDF_STATUS_SUCCESS; |
| 11824 | } |
| 11825 | |
| 11826 | /** |
| 11827 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 11828 | * @wmi_handle: wmi handle |
| 11829 | * @param evt_buf: pointer to event buffer |
| 11830 | * @param hdr: Pointer to hold header |
| 11831 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 11832 | * |
| 11833 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11834 | */ |
| 11835 | static QDF_STATUS extract_mgmt_rx_params_tlv(wmi_unified_t wmi_handle, |
| 11836 | void *evt_buf, wmi_host_mgmt_rx_hdr *hdr, uint8_t **bufp) |
| 11837 | { |
| 11838 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 11839 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 11840 | |
| 11841 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 11842 | if (!param_tlvs) { |
| 11843 | WMI_LOGE("Get NULL point message from FW"); |
| 11844 | return QDF_STATUS_E_INVAL; |
| 11845 | } |
| 11846 | |
| 11847 | ev_hdr = param_tlvs->hdr; |
| 11848 | if (!hdr) { |
| 11849 | WMI_LOGE("Rx event is NULL"); |
| 11850 | return QDF_STATUS_E_INVAL; |
| 11851 | } |
| 11852 | |
| 11853 | |
| 11854 | hdr->channel = ev_hdr->channel; |
| 11855 | hdr->snr = ev_hdr->snr; |
| 11856 | hdr->rate = ev_hdr->rate; |
| 11857 | hdr->phy_mode = ev_hdr->phy_mode; |
| 11858 | hdr->buf_len = ev_hdr->buf_len; |
| 11859 | hdr->status = ev_hdr->status; |
| 11860 | hdr->flags = ev_hdr->flags; |
| 11861 | hdr->rssi = ev_hdr->rssi; |
| 11862 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 11863 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 11864 | |
| 11865 | *bufp = param_tlvs->bufp; |
| 11866 | |
| 11867 | return QDF_STATUS_SUCCESS; |
| 11868 | } |
| 11869 | |
| 11870 | /** |
| 11871 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 11872 | * @wmi_handle: wmi handle |
| 11873 | * @param evt_buf: pointer to event buffer |
| 11874 | * @param vdev_id: Pointer to hold vdev identifier |
| 11875 | * |
| 11876 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11877 | */ |
| 11878 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 11879 | void *evt_buf, uint32_t *vdev_id) |
| 11880 | { |
| 11881 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 11882 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 11883 | |
| 11884 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 11885 | if (!param_buf) { |
| 11886 | WMI_LOGE("Invalid event buffer"); |
| 11887 | return QDF_STATUS_E_INVAL; |
| 11888 | } |
| 11889 | resp_event = param_buf->fixed_param; |
| 11890 | *vdev_id = resp_event->vdev_id; |
| 11891 | |
| 11892 | return QDF_STATUS_SUCCESS; |
| 11893 | } |
| 11894 | |
| 11895 | /** |
| 11896 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 11897 | * @wmi_handle: wmi handle |
| 11898 | * @param evt_buf: pointer to event buffer |
| 11899 | * @param param: Pointer to hold roam param |
| 11900 | * |
| 11901 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11902 | */ |
| 11903 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 11904 | void *evt_buf, wmi_host_roam_event *param) |
| 11905 | { |
| 11906 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 11907 | wmi_roam_event_fixed_param *evt; |
| 11908 | |
| 11909 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 11910 | if (!param_buf) { |
| 11911 | WMI_LOGE("Invalid roam event buffer"); |
| 11912 | return QDF_STATUS_E_INVAL; |
| 11913 | } |
| 11914 | |
| 11915 | evt = param_buf->fixed_param; |
| 11916 | qdf_mem_zero(param, sizeof(*param)); |
| 11917 | |
| 11918 | param->vdev_id = evt->vdev_id; |
| 11919 | param->reason = evt->reason; |
| 11920 | param->rssi = evt->rssi; |
| 11921 | |
| 11922 | return QDF_STATUS_SUCCESS; |
| 11923 | } |
| 11924 | |
| 11925 | /** |
| 11926 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 11927 | * @wmi_handle: wmi handle |
| 11928 | * @param evt_buf: pointer to event buffer |
| 11929 | * @param param: Pointer to hold vdev scan param |
| 11930 | * |
| 11931 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11932 | */ |
| 11933 | static QDF_STATUS extract_vdev_scan_ev_param_tlv(wmi_unified_t wmi_handle, |
| 11934 | void *evt_buf, wmi_host_scan_event *param) |
| 11935 | { |
| 11936 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 11937 | wmi_scan_event_fixed_param *evt = NULL; |
| 11938 | |
| 11939 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 11940 | evt = param_buf->fixed_param; |
| 11941 | |
| 11942 | qdf_mem_zero(param, sizeof(*param)); |
| 11943 | switch (evt->event) { |
| 11944 | case WMI_SCAN_EVENT_STARTED: |
| 11945 | param->event = WMI_HOST_SCAN_EVENT_STARTED; |
| 11946 | break; |
| 11947 | case WMI_SCAN_EVENT_COMPLETED: |
| 11948 | param->event = WMI_HOST_SCAN_EVENT_COMPLETED; |
| 11949 | break; |
| 11950 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
| 11951 | param->event = WMI_HOST_SCAN_EVENT_BSS_CHANNEL; |
| 11952 | break; |
| 11953 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
| 11954 | param->event = WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL; |
| 11955 | break; |
| 11956 | case WMI_SCAN_EVENT_DEQUEUED: |
| 11957 | param->event = WMI_HOST_SCAN_EVENT_DEQUEUED; |
| 11958 | break; |
| 11959 | case WMI_SCAN_EVENT_PREEMPTED: |
| 11960 | param->event = WMI_HOST_SCAN_EVENT_PREEMPTED; |
| 11961 | break; |
| 11962 | case WMI_SCAN_EVENT_START_FAILED: |
| 11963 | param->event = WMI_HOST_SCAN_EVENT_START_FAILED; |
| 11964 | break; |
| 11965 | case WMI_SCAN_EVENT_RESTARTED: |
| 11966 | param->event = WMI_HOST_SCAN_EVENT_RESTARTED; |
| 11967 | break; |
| 11968 | case WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
| 11969 | param->event = WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 11970 | break; |
| 11971 | case WMI_SCAN_EVENT_MAX: |
| 11972 | default: |
| 11973 | param->event = WMI_HOST_SCAN_EVENT_MAX; |
| 11974 | break; |
| 11975 | }; |
| 11976 | |
| 11977 | switch (evt->reason) { |
| 11978 | case WMI_SCAN_REASON_NONE: |
| 11979 | param->reason = WMI_HOST_SCAN_REASON_NONE; |
| 11980 | break; |
| 11981 | case WMI_SCAN_REASON_COMPLETED: |
| 11982 | param->reason = WMI_HOST_SCAN_REASON_COMPLETED; |
| 11983 | break; |
| 11984 | case WMI_SCAN_REASON_CANCELLED: |
| 11985 | param->reason = WMI_HOST_SCAN_REASON_CANCELLED; |
| 11986 | break; |
| 11987 | case WMI_SCAN_REASON_PREEMPTED: |
| 11988 | param->reason = WMI_HOST_SCAN_REASON_PREEMPTED; |
| 11989 | break; |
| 11990 | case WMI_SCAN_REASON_TIMEDOUT: |
| 11991 | param->reason = WMI_HOST_SCAN_REASON_TIMEDOUT; |
| 11992 | break; |
| 11993 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
| 11994 | param->reason = WMI_HOST_SCAN_REASON_INTERNAL_FAILURE; |
| 11995 | break; |
| 11996 | case WMI_SCAN_REASON_MAX: |
| 11997 | default: |
| 11998 | param->reason = WMI_HOST_SCAN_REASON_MAX; |
| 11999 | break; |
| 12000 | }; |
| 12001 | |
| 12002 | param->channel_freq = evt->channel_freq; |
| 12003 | param->requestor = evt->requestor; |
| 12004 | param->scan_id = evt->scan_id; |
| 12005 | param->vdev_id = evt->vdev_id; |
| 12006 | |
| 12007 | return QDF_STATUS_SUCCESS; |
| 12008 | } |
| 12009 | |
| 12010 | /** |
| 12011 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 12012 | * @wmi_handle: wmi handle |
| 12013 | * @param evt_buf: pointer to event buffer |
| 12014 | * @param param: Pointer to hold MGMT TX completion params |
| 12015 | * |
| 12016 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12017 | */ |
| 12018 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 12019 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 12020 | { |
| 12021 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 12022 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 12023 | |
| 12024 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 12025 | evt_buf; |
| 12026 | if (!param_buf) { |
| 12027 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 12028 | return QDF_STATUS_E_INVAL; |
| 12029 | } |
| 12030 | cmpl_params = param_buf->fixed_param; |
| 12031 | |
| 12032 | param->desc_id = cmpl_params->desc_id; |
| 12033 | param->status = cmpl_params->status; |
| 12034 | |
| 12035 | return QDF_STATUS_SUCCESS; |
| 12036 | } |
| 12037 | |
| 12038 | /** |
| 12039 | * extract_swba_vdev_map_tlv() - extract swba vdev map from event |
| 12040 | * @wmi_handle: wmi handle |
| 12041 | * @param evt_buf: pointer to event buffer |
| 12042 | * @param vdev_map: Pointer to hold vdev map |
| 12043 | * |
| 12044 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12045 | */ |
| 12046 | static QDF_STATUS extract_swba_vdev_map_tlv(wmi_unified_t wmi_handle, |
| 12047 | void *evt_buf, uint32_t *vdev_map) |
| 12048 | { |
| 12049 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12050 | wmi_host_swba_event_fixed_param *swba_event; |
| 12051 | |
| 12052 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12053 | if (!param_buf) { |
| 12054 | WMI_LOGE("Invalid swba event buffer"); |
| 12055 | return QDF_STATUS_E_INVAL; |
| 12056 | } |
| 12057 | swba_event = param_buf->fixed_param; |
| 12058 | *vdev_map = swba_event->vdev_map; |
| 12059 | |
| 12060 | return QDF_STATUS_SUCCESS; |
| 12061 | } |
| 12062 | |
| 12063 | /** |
| 12064 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 12065 | * @wmi_handle: wmi handle |
| 12066 | * @param evt_buf: pointer to event buffer |
| 12067 | * @param idx: Index to bcn info |
| 12068 | * @param tim_info: Pointer to hold tim info |
| 12069 | * |
| 12070 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12071 | */ |
| 12072 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 12073 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 12074 | { |
| 12075 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12076 | wmi_tim_info *tim_info_ev; |
| 12077 | |
| 12078 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12079 | if (!param_buf) { |
| 12080 | WMI_LOGE("Invalid swba event buffer"); |
| 12081 | return QDF_STATUS_E_INVAL; |
| 12082 | } |
| 12083 | |
| 12084 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 12085 | |
| 12086 | tim_info->tim_len = tim_info_ev->tim_len; |
| 12087 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 12088 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 12089 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 12090 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 12091 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
| 12092 | |
| 12093 | return QDF_STATUS_SUCCESS; |
| 12094 | } |
| 12095 | |
| 12096 | /** |
| 12097 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 12098 | * @wmi_handle: wmi handle |
| 12099 | * @param evt_buf: pointer to event buffer |
| 12100 | * @param idx: Index to bcn info |
| 12101 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 12102 | * |
| 12103 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12104 | */ |
| 12105 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 12106 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 12107 | { |
| 12108 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12109 | wmi_p2p_noa_info *p2p_noa_info; |
| 12110 | uint8_t i = 0; |
| 12111 | |
| 12112 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12113 | if (!param_buf) { |
| 12114 | WMI_LOGE("Invalid swba event buffer"); |
| 12115 | return QDF_STATUS_E_INVAL; |
| 12116 | } |
| 12117 | |
| 12118 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 12119 | |
| 12120 | p2p_desc->modified = false; |
| 12121 | p2p_desc->num_descriptors = 0; |
| 12122 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 12123 | p2p_desc->modified = true; |
| 12124 | p2p_desc->index = |
| 12125 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 12126 | p2p_desc->oppPS = |
| 12127 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 12128 | p2p_desc->ctwindow = |
| 12129 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 12130 | p2p_desc->num_descriptors = |
| 12131 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 12132 | (p2p_noa_info); |
| 12133 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 12134 | p2p_desc->noa_descriptors[i].type_count = |
| 12135 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 12136 | type_count; |
| 12137 | p2p_desc->noa_descriptors[i].duration = |
| 12138 | p2p_noa_info->noa_descriptors[i].duration; |
| 12139 | p2p_desc->noa_descriptors[i].interval = |
| 12140 | p2p_noa_info->noa_descriptors[i].interval; |
| 12141 | p2p_desc->noa_descriptors[i].start_time = |
| 12142 | p2p_noa_info->noa_descriptors[i].start_time; |
| 12143 | } |
| 12144 | } |
| 12145 | |
| 12146 | return QDF_STATUS_SUCCESS; |
| 12147 | } |
| 12148 | |
| 12149 | /** |
| 12150 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 12151 | * @wmi_handle: wmi handle |
| 12152 | * @param evt_buf: pointer to event buffer |
| 12153 | * @param ev: Pointer to hold peer param |
| 12154 | * |
| 12155 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12156 | */ |
| 12157 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 12158 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 12159 | { |
| 12160 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 12161 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 12162 | |
| 12163 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 12164 | kickout_event = param_buf->fixed_param; |
| 12165 | |
| 12166 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 12167 | ev->peer_macaddr); |
| 12168 | |
| 12169 | ev->reason = kickout_event->reason; |
| 12170 | ev->rssi = kickout_event->rssi; |
| 12171 | |
| 12172 | return QDF_STATUS_SUCCESS; |
| 12173 | } |
| 12174 | |
| 12175 | /** |
| 12176 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 12177 | * @wmi_handle: wmi handle |
| 12178 | * @param evt_buf: pointer to event buffer |
| 12179 | * @param stats_param: Pointer to hold stats count |
| 12180 | * |
| 12181 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12182 | */ |
| 12183 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 12184 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 12185 | { |
| 12186 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12187 | wmi_stats_event_fixed_param *ev; |
| 12188 | |
| 12189 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12190 | |
| 12191 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12192 | if (!ev) { |
| 12193 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 12194 | return QDF_STATUS_E_FAILURE; |
| 12195 | } |
| 12196 | |
| 12197 | switch (ev->stats_id) { |
| 12198 | case WMI_REQUEST_PEER_STAT: |
| 12199 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 12200 | break; |
| 12201 | |
| 12202 | case WMI_REQUEST_AP_STAT: |
| 12203 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 12204 | break; |
| 12205 | |
| 12206 | case WMI_REQUEST_PDEV_STAT: |
| 12207 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 12208 | break; |
| 12209 | |
| 12210 | case WMI_REQUEST_VDEV_STAT: |
| 12211 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 12212 | break; |
| 12213 | |
| 12214 | case WMI_REQUEST_BCNFLT_STAT: |
| 12215 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 12216 | break; |
| 12217 | |
| 12218 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 12219 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 12220 | break; |
| 12221 | |
| 12222 | default: |
| 12223 | stats_param->stats_id = 0; |
| 12224 | break; |
| 12225 | |
| 12226 | } |
| 12227 | |
| 12228 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 12229 | stats_param->num_pdev_ext_stats = 0; |
| 12230 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 12231 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 12232 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 12233 | stats_param->num_chan_stats = ev->num_chan_stats; |
| 12234 | |
| 12235 | return QDF_STATUS_SUCCESS; |
| 12236 | } |
| 12237 | |
| 12238 | /** |
| 12239 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 12240 | * @wmi_handle: wmi handle |
| 12241 | * @param evt_buf: pointer to event buffer |
| 12242 | * @param index: Index into pdev stats |
| 12243 | * @param pdev_stats: Pointer to hold pdev stats |
| 12244 | * |
| 12245 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12246 | */ |
| 12247 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 12248 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 12249 | { |
| 12250 | return QDF_STATUS_SUCCESS; |
| 12251 | } |
| 12252 | |
| 12253 | /** |
| 12254 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 12255 | * @wmi_handle: wmi handle |
| 12256 | * @param evt_buf: pointer to event buffer |
| 12257 | * @param index: Index into extended pdev stats |
| 12258 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 12259 | * |
| 12260 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12261 | */ |
| 12262 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 12263 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 12264 | { |
| 12265 | return QDF_STATUS_SUCCESS; |
| 12266 | } |
| 12267 | |
| 12268 | /** |
| 12269 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 12270 | * @wmi_handle: wmi handle |
| 12271 | * @param evt_buf: pointer to event buffer |
| 12272 | * @param index: Index into vdev stats |
| 12273 | * @param vdev_stats: Pointer to hold vdev stats |
| 12274 | * |
| 12275 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12276 | */ |
| 12277 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 12278 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 12279 | { |
| 12280 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12281 | wmi_stats_event_fixed_param *ev_param; |
| 12282 | uint8_t *data; |
| 12283 | |
| 12284 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12285 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12286 | data = (uint8_t *) param_buf->data; |
| 12287 | |
| 12288 | if (index < ev_param->num_vdev_stats) { |
| 12289 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 12290 | ((ev_param->num_pdev_stats) * |
| 12291 | sizeof(wmi_pdev_stats)) + |
| 12292 | (index * sizeof(wmi_vdev_stats))); |
| 12293 | |
| 12294 | vdev_stats->vdev_id = ev->vdev_id; |
| 12295 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 12296 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 12297 | |
| 12298 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 12299 | sizeof(ev->tx_frm_cnt)); |
| 12300 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 12301 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 12302 | ev->multiple_retry_cnt, |
| 12303 | sizeof(ev->multiple_retry_cnt)); |
| 12304 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 12305 | sizeof(ev->fail_cnt)); |
| 12306 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 12307 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 12308 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 12309 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 12310 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 12311 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 12312 | sizeof(ev->tx_rate_history)); |
| 12313 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 12314 | sizeof(ev->bcn_rssi_history)); |
| 12315 | |
| 12316 | } |
| 12317 | |
| 12318 | return QDF_STATUS_SUCCESS; |
| 12319 | } |
| 12320 | |
| 12321 | /** |
| 12322 | * extract_peer_stats_tlv() - extract peer stats from event |
| 12323 | * @wmi_handle: wmi handle |
| 12324 | * @param evt_buf: pointer to event buffer |
| 12325 | * @param index: Index into peer stats |
| 12326 | * @param peer_stats: Pointer to hold peer stats |
| 12327 | * |
| 12328 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12329 | */ |
| 12330 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 12331 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 12332 | { |
| 12333 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12334 | wmi_stats_event_fixed_param *ev_param; |
| 12335 | uint8_t *data; |
| 12336 | |
| 12337 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12338 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12339 | data = (uint8_t *) param_buf->data; |
| 12340 | |
| 12341 | if (index < ev_param->num_peer_stats) { |
| 12342 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 12343 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 12344 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 12345 | (index * sizeof(wmi_peer_stats))); |
| 12346 | |
| 12347 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 12348 | |
| 12349 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 12350 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 12351 | |
| 12352 | peer_stats->peer_rssi = ev->peer_rssi; |
| 12353 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 12354 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 12355 | } |
| 12356 | |
| 12357 | return QDF_STATUS_SUCCESS; |
| 12358 | } |
| 12359 | |
| 12360 | /** |
| 12361 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 12362 | * @wmi_handle: wmi handle |
| 12363 | * @param evt_buf: pointer to event buffer |
| 12364 | * @param index: Index into bcn fault stats |
| 12365 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 12366 | * |
| 12367 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12368 | */ |
| 12369 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 12370 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 12371 | { |
| 12372 | return QDF_STATUS_SUCCESS; |
| 12373 | } |
| 12374 | |
| 12375 | /** |
| 12376 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 12377 | * @wmi_handle: wmi handle |
| 12378 | * @param evt_buf: pointer to event buffer |
| 12379 | * @param index: Index into extended peer stats |
| 12380 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 12381 | * |
| 12382 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12383 | */ |
| 12384 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 12385 | void *evt_buf, uint32_t index, |
| 12386 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 12387 | { |
| 12388 | return QDF_STATUS_SUCCESS; |
| 12389 | } |
| 12390 | |
| 12391 | /** |
| 12392 | * extract_chan_stats_tlv() - extract chan stats from event |
| 12393 | * @wmi_handle: wmi handle |
| 12394 | * @param evt_buf: pointer to event buffer |
| 12395 | * @param index: Index into chan stats |
| 12396 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 12397 | * |
| 12398 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12399 | */ |
| 12400 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 12401 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 12402 | { |
| 12403 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12404 | wmi_stats_event_fixed_param *ev_param; |
| 12405 | uint8_t *data; |
| 12406 | |
| 12407 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12408 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12409 | data = (uint8_t *) param_buf->data; |
| 12410 | |
| 12411 | if (index < ev_param->num_chan_stats) { |
| 12412 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 12413 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 12414 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 12415 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 12416 | (index * sizeof(wmi_chan_stats))); |
| 12417 | |
| 12418 | |
| 12419 | /* Non-TLV doesnt have num_chan_stats */ |
| 12420 | chan_stats->chan_mhz = ev->chan_mhz; |
| 12421 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 12422 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 12423 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 12424 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 12425 | } |
| 12426 | |
| 12427 | return QDF_STATUS_SUCCESS; |
| 12428 | } |
| 12429 | |
| 12430 | /** |
| 12431 | * extract_profile_ctx_tlv() - extract profile context from event |
| 12432 | * @wmi_handle: wmi handle |
| 12433 | * @param evt_buf: pointer to event buffer |
| 12434 | * @idx: profile stats index to extract |
| 12435 | * @param profile_ctx: Pointer to hold profile context |
| 12436 | * |
| 12437 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12438 | */ |
| 12439 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 12440 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 12441 | { |
| 12442 | return QDF_STATUS_SUCCESS; |
| 12443 | } |
| 12444 | |
| 12445 | /** |
| 12446 | * extract_profile_data_tlv() - extract profile data from event |
| 12447 | * @wmi_handle: wmi handle |
| 12448 | * @param evt_buf: pointer to event buffer |
| 12449 | * @param profile_data: Pointer to hold profile data |
| 12450 | * |
| 12451 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12452 | */ |
| 12453 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 12454 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 12455 | { |
| 12456 | |
| 12457 | return QDF_STATUS_SUCCESS; |
| 12458 | } |
| 12459 | |
| 12460 | /** |
| 12461 | * extract_chan_info_event_tlv() - extract chan information from event |
| 12462 | * @wmi_handle: wmi handle |
| 12463 | * @param evt_buf: pointer to event buffer |
| 12464 | * @param chan_info: Pointer to hold chan information |
| 12465 | * |
| 12466 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12467 | */ |
| 12468 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 12469 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 12470 | { |
| 12471 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 12472 | wmi_chan_info_event_fixed_param *ev; |
| 12473 | |
| 12474 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 12475 | |
| 12476 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 12477 | if (!ev) { |
| 12478 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 12479 | return QDF_STATUS_E_FAILURE; |
| 12480 | } |
| 12481 | |
| 12482 | chan_info->err_code = ev->err_code; |
| 12483 | chan_info->freq = ev->freq; |
| 12484 | chan_info->cmd_flags = ev->cmd_flags; |
| 12485 | chan_info->noise_floor = ev->noise_floor; |
| 12486 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 12487 | chan_info->cycle_count = ev->cycle_count; |
| 12488 | |
| 12489 | return QDF_STATUS_SUCCESS; |
| 12490 | } |
| 12491 | |
| 12492 | /** |
| 12493 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 12494 | * from event |
| 12495 | * @wmi_handle: wmi handle |
| 12496 | * @param evt_buf: pointer to event buffer |
| 12497 | * @param ch_hopping: Pointer to hold channel hopping param |
| 12498 | * |
| 12499 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12500 | */ |
| 12501 | static QDF_STATUS extract_channel_hopping_event_tlv(wmi_unified_t wmi_handle, |
| 12502 | void *evt_buf, wmi_host_pdev_channel_hopping_event *chan_info) |
| 12503 | { |
| 12504 | return QDF_STATUS_SUCCESS; |
| 12505 | } |
| 12506 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 12507 | /** |
| 12508 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 12509 | * from event |
| 12510 | * @wmi_handle: wmi handle |
| 12511 | * @param evt_buf: pointer to event buffer |
| 12512 | * @param param: Pointer to hold evt buf |
| 12513 | * |
| 12514 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12515 | */ |
| 12516 | static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle, |
| 12517 | uint8_t *event, struct wmi_host_service_ext_param *param) |
| 12518 | { |
| 12519 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12520 | wmi_service_ready_ext_event_fixed_param *ev; |
| 12521 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12522 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 12523 | |
| 12524 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12525 | if (!param_buf) |
| 12526 | return -EINVAL; |
| 12527 | |
| 12528 | ev = param_buf->fixed_param; |
| 12529 | if (!ev) |
| 12530 | return -EINVAL; |
| 12531 | |
| 12532 | /* Move this to host based bitmap */ |
| 12533 | param->default_conc_scan_config_bits = |
| 12534 | ev->default_conc_scan_config_bits; |
| 12535 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 12536 | param->he_cap_info = ev->he_cap_info; |
| 12537 | param->mpdu_density = ev->mpdu_density; |
| 12538 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 12539 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 12540 | |
| 12541 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12542 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 12543 | |
| 12544 | reg_caps = param_buf->soc_hal_reg_caps; |
| 12545 | param->num_phy = reg_caps->num_phy; |
| 12546 | |
| 12547 | return QDF_STATUS_SUCCESS; |
| 12548 | } |
| 12549 | |
| 12550 | /** |
| 12551 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 12552 | * extract HW mode cap from service ready event |
| 12553 | * @wmi_handle: wmi handle |
| 12554 | * @param evt_buf: pointer to event buffer |
| 12555 | * @param param: Pointer to hold evt buf |
| 12556 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 12557 | * |
| 12558 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12559 | */ |
| 12560 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 12561 | wmi_unified_t wmi_handle, |
| 12562 | uint8_t *event, uint8_t hw_mode_idx, |
| 12563 | struct wmi_host_hw_mode_caps *param) |
| 12564 | { |
| 12565 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12566 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12567 | |
| 12568 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12569 | if (!param_buf) |
| 12570 | return -EINVAL; |
| 12571 | |
| 12572 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12573 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
| 12574 | return -EINVAL; |
| 12575 | |
| 12576 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 12577 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 12578 | |
| 12579 | return QDF_STATUS_SUCCESS; |
| 12580 | } |
| 12581 | |
| 12582 | /** |
| 12583 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 12584 | * extract MAC phy cap from service ready event |
| 12585 | * @wmi_handle: wmi handle |
| 12586 | * @param evt_buf: pointer to event buffer |
| 12587 | * @param param: Pointer to hold evt buf |
| 12588 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 12589 | * |
| 12590 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12591 | */ |
| 12592 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 12593 | wmi_unified_t wmi_handle, |
| 12594 | uint8_t *event, uint8_t hw_mode_idx, |
| 12595 | struct wmi_host_mac_phy_caps *param) |
| 12596 | { |
| 12597 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12598 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12599 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
| 12600 | |
| 12601 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12602 | if (!param_buf) |
| 12603 | return -EINVAL; |
| 12604 | |
| 12605 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12606 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
| 12607 | return -EINVAL; |
| 12608 | |
| 12609 | mac_phy_caps = ¶m_buf->mac_phy_caps[hw_mode_idx]; |
| 12610 | |
| 12611 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
| 12612 | param->pdev_id = mac_phy_caps->pdev_id; |
| 12613 | param->phy_id = mac_phy_caps->phy_id; |
| 12614 | param->supports_11b = mac_phy_caps->supports_11b; |
| 12615 | param->supports_11g = mac_phy_caps->supports_11g; |
| 12616 | param->supports_11a = mac_phy_caps->supports_11a; |
| 12617 | param->supports_11n = mac_phy_caps->supports_11n; |
| 12618 | param->supports_11ac = mac_phy_caps->supports_11ac; |
| 12619 | param->supports_11ax = mac_phy_caps->supports_11ax; |
| 12620 | |
| 12621 | param->supported_bands = mac_phy_caps->supported_bands; |
| 12622 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 12623 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 12624 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 12625 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 12626 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 12627 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 12628 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 12629 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 12630 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 12631 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 12632 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 12633 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 12634 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 12635 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 12636 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 12637 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 12638 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
| 12639 | |
| 12640 | return QDF_STATUS_SUCCESS; |
| 12641 | } |
| 12642 | |
| 12643 | /** |
| 12644 | * extract_reg_cap_service_ready_ext_tlv() - |
| 12645 | * extract REG cap from service ready event |
| 12646 | * @wmi_handle: wmi handle |
| 12647 | * @param evt_buf: pointer to event buffer |
| 12648 | * @param param: Pointer to hold evt buf |
| 12649 | * @param phy_idx: phy idx should be less than num_mode |
| 12650 | * |
| 12651 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12652 | */ |
| 12653 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 12654 | wmi_unified_t wmi_handle, |
| 12655 | uint8_t *event, uint8_t phy_idx, |
| 12656 | struct WMI_HOST_HAL_REG_CAPABILITIES_EXT *param) |
| 12657 | { |
| 12658 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12659 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 12660 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 12661 | |
| 12662 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12663 | if (!param_buf) |
| 12664 | return -EINVAL; |
| 12665 | |
| 12666 | reg_caps = param_buf->soc_hal_reg_caps; |
| 12667 | if (phy_idx >= reg_caps->num_phy) |
| 12668 | return -EINVAL; |
| 12669 | |
| 12670 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 12671 | |
| 12672 | param->phy_id = ext_reg_cap->phy_id; |
| 12673 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 12674 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 12675 | param->regcap1 = ext_reg_cap->regcap1; |
| 12676 | param->regcap2 = ext_reg_cap->regcap2; |
| 12677 | param->wireless_modes = ext_reg_cap->wireless_modes; |
| 12678 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 12679 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 12680 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 12681 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 12682 | |
| 12683 | return QDF_STATUS_SUCCESS; |
| 12684 | } |
| 12685 | |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 12686 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12687 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 12688 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 12689 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12690 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12691 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12692 | return false; |
| 12693 | } |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 12694 | #endif |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12695 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12696 | struct wmi_ops tlv_ops = { |
| 12697 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 12698 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 12699 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 12700 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 12701 | .send_hidden_ssid_vdev_restart_cmd = |
| 12702 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12703 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 12704 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 12705 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12706 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12707 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12708 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 12709 | .send_peer_rx_reorder_queue_setup_cmd = |
| 12710 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 12711 | .send_peer_rx_reorder_queue_remove_cmd = |
| 12712 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12713 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 12714 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 12715 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 12716 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 12717 | .send_resume_cmd = send_resume_cmd_tlv, |
| 12718 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 12719 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 12720 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 12721 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 12722 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 12723 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 12724 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 12725 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
| 12726 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12727 | #ifndef CONFIG_MCL |
| 12728 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
| 12729 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12730 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 12731 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 12732 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 12733 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12734 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
| 12735 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 12736 | .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] | 12737 | .send_set_sta_uapsd_auto_trig_cmd = |
| 12738 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12739 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 12740 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 12741 | .send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv, |
| 12742 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 12743 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 12744 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 12745 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 12746 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 12747 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 12748 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 12749 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 12750 | .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] | 12751 | .send_ocb_start_timing_advert_cmd = |
| 12752 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 12753 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 12754 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 12755 | .send_set_mcc_channel_time_latency_cmd = |
| 12756 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 12757 | .send_set_mcc_channel_time_quota_cmd = |
| 12758 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 12759 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 12760 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 12761 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12762 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 12763 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 12764 | .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] | 12765 | .send_probe_rsp_tmpl_send_cmd = |
| 12766 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 12767 | .send_p2p_go_set_beacon_ie_cmd = |
| 12768 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 12769 | .send_setup_install_key_cmd = |
| 12770 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12771 | .send_set_gateway_params_cmd = |
| 12772 | send_set_gateway_params_cmd_tlv, |
| 12773 | .send_set_rssi_monitoring_cmd = |
| 12774 | send_set_rssi_monitoring_cmd_tlv, |
| 12775 | .send_scan_probe_setoui_cmd = |
| 12776 | send_scan_probe_setoui_cmd_tlv, |
| 12777 | .send_reset_passpoint_network_list_cmd = |
| 12778 | send_reset_passpoint_network_list_cmd_tlv, |
| 12779 | .send_set_passpoint_network_list_cmd = |
| 12780 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 12781 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 12782 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
| 12783 | .send_roam_scan_filter_cmd = |
| 12784 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12785 | .send_set_epno_network_list_cmd = |
| 12786 | send_set_epno_network_list_cmd_tlv, |
| 12787 | .send_ipa_offload_control_cmd = |
| 12788 | send_ipa_offload_control_cmd_tlv, |
| 12789 | .send_extscan_get_capabilities_cmd = |
| 12790 | send_extscan_get_capabilities_cmd_tlv, |
| 12791 | .send_extscan_get_cached_results_cmd = |
| 12792 | send_extscan_get_cached_results_cmd_tlv, |
| 12793 | .send_extscan_stop_change_monitor_cmd = |
| 12794 | send_extscan_stop_change_monitor_cmd_tlv, |
| 12795 | .send_extscan_start_change_monitor_cmd = |
| 12796 | send_extscan_start_change_monitor_cmd_tlv, |
| 12797 | .send_extscan_stop_hotlist_monitor_cmd = |
| 12798 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 12799 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 12800 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 12801 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 12802 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 12803 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12804 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12805 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12806 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12807 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 12808 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 12809 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 12810 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 12811 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12812 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 12813 | .send_snr_cmd = send_snr_cmd_tlv, |
| 12814 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12815 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12816 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 12817 | .send_lphb_config_tcp_params_cmd = send_lphb_config_tcp_params_cmd_tlv, |
| 12818 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 12819 | .send_lphb_config_udp_pkt_filter_cmd = |
| 12820 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
| 12821 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 12822 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 12823 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12824 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
| 12825 | .send_process_update_edca_param_cmd = |
| 12826 | send_process_update_edca_param_cmd_tlv, |
| 12827 | .send_roam_scan_offload_mode_cmd = |
| 12828 | send_roam_scan_offload_mode_cmd_tlv, |
| 12829 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 12830 | .send_roam_scan_offload_ap_profile_cmd = |
| 12831 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 12832 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12833 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 12834 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12835 | #ifdef FEATURE_WLAN_RA_FILTERING |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12836 | .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] | 12837 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12838 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 12839 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
| 12840 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 12841 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12842 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 12843 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 12844 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 12845 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 12846 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 12847 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 12848 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
| 12849 | .send_enable_disable_packet_filter_cmd = |
| 12850 | send_enable_disable_packet_filter_cmd_tlv, |
| 12851 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
| 12852 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
| 12853 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 12854 | .send_process_gtk_offload_getinfo_cmd = |
| 12855 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 12856 | .send_process_add_periodic_tx_ptrn_cmd = |
| 12857 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 12858 | .send_process_del_periodic_tx_ptrn_cmd = |
| 12859 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 12860 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 12861 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 12862 | .send_set_app_type2_params_in_fw_cmd = |
| 12863 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 12864 | .send_set_auto_shutdown_timer_cmd = |
| 12865 | send_set_auto_shutdown_timer_cmd_tlv, |
| 12866 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 12867 | .send_process_dhcpserver_offload_cmd = |
| 12868 | send_process_dhcpserver_offload_cmd_tlv, |
| 12869 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 12870 | .send_process_ch_avoid_update_cmd = |
| 12871 | send_process_ch_avoid_update_cmd_tlv, |
| 12872 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 12873 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 12874 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 12875 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 12876 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 12877 | .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] | 12878 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12879 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 12880 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12881 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12882 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12883 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12884 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12885 | .send_set_base_macaddr_indicate_cmd = |
| 12886 | send_set_base_macaddr_indicate_cmd_tlv, |
| 12887 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 12888 | .send_enable_specific_fw_logs_cmd = |
| 12889 | send_enable_specific_fw_logs_cmd_tlv, |
| 12890 | .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] | 12891 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12892 | .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] | 12893 | .send_pdev_set_dual_mac_config_cmd = |
| 12894 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12895 | .send_enable_arp_ns_offload_cmd = |
| 12896 | send_enable_arp_ns_offload_cmd_tlv, |
| 12897 | .send_app_type1_params_in_fw_cmd = |
| 12898 | send_app_type1_params_in_fw_cmd_tlv, |
| 12899 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 12900 | .send_process_roam_synch_complete_cmd = |
| 12901 | send_process_roam_synch_complete_cmd_tlv, |
| 12902 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 12903 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 12904 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12905 | .send_roam_scan_offload_scan_period_cmd = |
| 12906 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 12907 | .send_roam_scan_offload_chan_list_cmd = |
| 12908 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 12909 | .send_roam_scan_offload_rssi_change_cmd = |
| 12910 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 12911 | .send_get_buf_extscan_hotlist_cmd = |
| 12912 | send_get_buf_extscan_hotlist_cmd_tlv, |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 12913 | .send_adapt_dwelltime_params_cmd = |
| 12914 | send_adapt_dwelltime_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12915 | .init_cmd_send = init_cmd_send_tlv, |
| 12916 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 12917 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 12918 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 12919 | .save_service_bitmap = save_service_bitmap_tlv, |
| 12920 | .is_service_enabled = is_service_enabled_tlv, |
| 12921 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 12922 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 12923 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
| 12924 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 12925 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 12926 | .extract_tbttoffset_update_params = |
| 12927 | extract_tbttoffset_update_params_tlv, |
| 12928 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 12929 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 12930 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 12931 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
| 12932 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
| 12933 | .extract_swba_vdev_map = extract_swba_vdev_map_tlv, |
| 12934 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 12935 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
| 12936 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 12937 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 12938 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 12939 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 12940 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 12941 | .extract_peer_stats = extract_peer_stats_tlv, |
| 12942 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 12943 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 12944 | .extract_chan_stats = extract_chan_stats_tlv, |
| 12945 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 12946 | .extract_profile_data = extract_profile_data_tlv, |
| 12947 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 12948 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 12949 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 12950 | .send_encrypt_decrypt_send_cmd = |
| 12951 | send_encrypt_decrypt_send_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 12952 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 12953 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 12954 | .extract_hw_mode_cap_service_ready_ext = |
| 12955 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 12956 | .extract_mac_phy_cap_service_ready_ext = |
| 12957 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 12958 | .extract_reg_cap_service_ready_ext = |
| 12959 | extract_reg_cap_service_ready_ext_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12960 | }; |
| 12961 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 12962 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12963 | /** |
| 12964 | * populate_tlv_service() - populates wmi services |
| 12965 | * |
| 12966 | * @param wmi_service: Pointer to hold wmi_service |
| 12967 | * Return: None |
| 12968 | */ |
| 12969 | static void populate_tlv_service(uint32_t *wmi_service) |
| 12970 | { |
| 12971 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
| 12972 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 12973 | wmi_service[wmi_service_roam_scan_offload] = |
| 12974 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 12975 | wmi_service[wmi_service_bcn_miss_offload] = |
| 12976 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 12977 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 12978 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 12979 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 12980 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 12981 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 12982 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 12983 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 12984 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 12985 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 12986 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 12987 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 12988 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 12989 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 12990 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 12991 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 12992 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 12993 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 12994 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 12995 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 12996 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 12997 | wmi_service[wmi_service_packet_power_save] = |
| 12998 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 12999 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 13000 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 13001 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 13002 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 13003 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 13004 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 13005 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 13006 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 13007 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 13008 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 13009 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 13010 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 13011 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 13012 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 13013 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 13014 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 13015 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 13016 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 13017 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 13018 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 13019 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 13020 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 13021 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 13022 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 13023 | wmi_service[wmi_service_lte_ant_share_support] = |
| 13024 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 13025 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 13026 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 13027 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 13028 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 13029 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 13030 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 13031 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 13032 | wmi_service[wmi_service_bcn_txrate_override] = |
| 13033 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 13034 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 13035 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 13036 | wmi_service[wmi_service_estimate_linkspeed] = |
| 13037 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 13038 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 13039 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 13040 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 13041 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 13042 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 13043 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 13044 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 13045 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 13046 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 13047 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 13048 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 13049 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 13050 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 13051 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 13052 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 13053 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 13054 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 13055 | wmi_service[wmi_service_sap_auth_offload] = |
| 13056 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 13057 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 13058 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 13059 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 13060 | wmi_service[wmi_service_ap_arpns_offload] = |
| 13061 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 13062 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 13063 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 13064 | wmi_service[wmi_service_packet_filter_offload] = |
| 13065 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 13066 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 13067 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 13068 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 13069 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 13070 | |
| 13071 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 13072 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 13073 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 13074 | WMI_SERVICE_UNAVAILABLE; |
| 13075 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 13076 | WMI_SERVICE_UNAVAILABLE; |
| 13077 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 13078 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
| 13079 | wmi_service[wmi_service_atf] = WMI_SERVICE_UNAVAILABLE; |
| 13080 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 13081 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 13082 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 13083 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 13084 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 13085 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 13086 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 13087 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
| 13088 | |
| 13089 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 13090 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 13091 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 13092 | WMI_SERVICE_UNAVAILABLE; |
| 13093 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 13094 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 13095 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 13096 | } |
| 13097 | |
| 13098 | /** |
| 13099 | * populate_tlv_event_id() - populates wmi event ids |
| 13100 | * |
| 13101 | * @param event_ids: Pointer to hold event ids |
| 13102 | * Return: None |
| 13103 | */ |
| 13104 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 13105 | { |
| 13106 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 13107 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 13108 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 13109 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 13110 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 13111 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 13112 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 13113 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 13114 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 13115 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 13116 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 13117 | event_ids[wmi_service_ready_ext_event_id] = |
| 13118 | WMI_SERVICE_READY_EXT_EVENTID; |
| 13119 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 13120 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 13121 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 13122 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 13123 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 13124 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 13125 | |
| 13126 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 13127 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 13128 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 13129 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 13130 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 13131 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 13132 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 13133 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
| 13134 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 13135 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 13136 | event_ids[wmi_tbttoffset_update_event_id] = |
| 13137 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
| 13138 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 13139 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 13140 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 13141 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 13142 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 13143 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 13144 | |
| 13145 | event_ids[wmi_tx_delba_complete_event_id] = |
| 13146 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 13147 | event_ids[wmi_tx_addba_complete_event_id] = |
| 13148 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 13149 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 13150 | |
| 13151 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 13152 | |
| 13153 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 13154 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 13155 | |
| 13156 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 13157 | |
| 13158 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 13159 | |
| 13160 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
| 13161 | |
| 13162 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 13163 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 13164 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 13165 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 13166 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 13167 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 13168 | |
| 13169 | event_ids[wmi_rtt_meas_report_event_id] = |
| 13170 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 13171 | event_ids[wmi_tsf_meas_report_event_id] = |
| 13172 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 13173 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 13174 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 13175 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 13176 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 13177 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 13178 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 13179 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 13180 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 13181 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 13182 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 13183 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 13184 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 13185 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 13186 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 13187 | |
| 13188 | event_ids[wmi_gtk_offload_status_event_id] = |
| 13189 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 13190 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 13191 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 13192 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 13193 | |
| 13194 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 13195 | |
| 13196 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 13197 | |
| 13198 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 13199 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 13200 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 13201 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 13202 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 13203 | event_ids[wmi_wlan_profile_data_event_id] = |
| 13204 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 13205 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 13206 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 13207 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 13208 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 13209 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 13210 | |
| 13211 | event_ids[wmi_diag_container_event_id] = |
| 13212 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 13213 | |
| 13214 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 13215 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 13216 | |
| 13217 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 13218 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 13219 | |
| 13220 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 13221 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 13222 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 13223 | |
| 13224 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 13225 | |
| 13226 | /** Set OCB Sched Response, deprecated */ |
| 13227 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 13228 | |
| 13229 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 13230 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 13231 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 13232 | |
| 13233 | /* GPIO Event */ |
| 13234 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 13235 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 13236 | |
| 13237 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 13238 | event_ids[wmi_rfkill_state_change_event_id] = |
| 13239 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 13240 | |
| 13241 | /* TDLS Event */ |
| 13242 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 13243 | |
| 13244 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 13245 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 13246 | event_ids[wmi_batch_scan_result_event_id] = |
| 13247 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 13248 | /* OEM Event */ |
| 13249 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 13250 | event_ids[wmi_oem_meas_report_event_id] = |
| 13251 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 13252 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 13253 | |
| 13254 | /* NAN Event */ |
| 13255 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 13256 | |
| 13257 | /* LPI Event */ |
| 13258 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 13259 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 13260 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 13261 | |
| 13262 | /* ExtScan events */ |
| 13263 | event_ids[wmi_extscan_start_stop_event_id] = |
| 13264 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 13265 | event_ids[wmi_extscan_operation_event_id] = |
| 13266 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 13267 | event_ids[wmi_extscan_table_usage_event_id] = |
| 13268 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 13269 | event_ids[wmi_extscan_cached_results_event_id] = |
| 13270 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 13271 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 13272 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 13273 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 13274 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 13275 | event_ids[wmi_extscan_capabilities_event_id] = |
| 13276 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 13277 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 13278 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 13279 | |
| 13280 | /* mDNS offload events */ |
| 13281 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 13282 | |
| 13283 | /* SAP Authentication offload events */ |
| 13284 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 13285 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 13286 | |
| 13287 | /** Out-of-context-of-bss (OCB) events */ |
| 13288 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 13289 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 13290 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 13291 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 13292 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 13293 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 13294 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 13295 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 13296 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 13297 | /* System-On-Chip events */ |
| 13298 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 13299 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 13300 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 13301 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 13302 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 13303 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
| 13304 | } |
| 13305 | |
| 13306 | /** |
| 13307 | * populate_pdev_param_tlv() - populates pdev params |
| 13308 | * |
| 13309 | * @param pdev_param: Pointer to hold pdev params |
| 13310 | * Return: None |
| 13311 | */ |
| 13312 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 13313 | { |
| 13314 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 13315 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 13316 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 13317 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 13318 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 13319 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 13320 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 13321 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 13322 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 13323 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 13324 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 13325 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 13326 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 13327 | pdev_param[wmi_pdev_param_protection_mode] = |
| 13328 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 13329 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 13330 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 13331 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 13332 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 13333 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 13334 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 13335 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 13336 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 13337 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 13338 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 13339 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 13340 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 13341 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 13342 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 13343 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 13344 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 13345 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 13346 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 13347 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 13348 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 13349 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 13350 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 13351 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 13352 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 13353 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 13354 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 13355 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 13356 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 13357 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 13358 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 13359 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 13360 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 13361 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 13362 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 13363 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 13364 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 13365 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 13366 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 13367 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 13368 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 13369 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 13370 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 13371 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 13372 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 13373 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 13374 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 13375 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 13376 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 13377 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 13378 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 13379 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 13380 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 13381 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 13382 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 13383 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 13384 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 13385 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 13386 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 13387 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 13388 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 13389 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 13390 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 13391 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 13392 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 13393 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 13394 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 13395 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 13396 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 13397 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 13398 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 13399 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 13400 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 13401 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 13402 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 13403 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 13404 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 13405 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 13406 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 13407 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 13408 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 13409 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 13410 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 13411 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 13412 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 13413 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 13414 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 13415 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 13416 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 13417 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 13418 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 13419 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 13420 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 13421 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 13422 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 13423 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 13424 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 13425 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 13426 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 13427 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 13428 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 13429 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 13430 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 13431 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 13432 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 13433 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 13434 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 13435 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 13436 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 13437 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 13438 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 13439 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 13440 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 13441 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 13442 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 13443 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 13444 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 13445 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
| 13446 | pdev_param[wmi_pdev_param_rx_filter] = WMI_UNAVAILABLE_PARAM; |
| 13447 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = WMI_UNAVAILABLE_PARAM; |
| 13448 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = WMI_UNAVAILABLE_PARAM; |
| 13449 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_UNAVAILABLE_PARAM; |
| 13450 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
| 13451 | WMI_UNAVAILABLE_PARAM; |
| 13452 | pdev_param[wmi_pdev_param_proxy_sta_mode] = WMI_UNAVAILABLE_PARAM; |
| 13453 | pdev_param[wmi_pdev_param_mu_group_policy] = WMI_UNAVAILABLE_PARAM; |
| 13454 | pdev_param[wmi_pdev_param_noise_detection] = WMI_UNAVAILABLE_PARAM; |
| 13455 | pdev_param[wmi_pdev_param_noise_threshold] = WMI_UNAVAILABLE_PARAM; |
| 13456 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_UNAVAILABLE_PARAM; |
| 13457 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = WMI_UNAVAILABLE_PARAM; |
| 13458 | pdev_param[wmi_pdev_param_atf_strict_sch] = WMI_UNAVAILABLE_PARAM; |
| 13459 | pdev_param[wmi_pdev_param_atf_sched_duration] = WMI_UNAVAILABLE_PARAM; |
| 13460 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_UNAVAILABLE_PARAM; |
| 13461 | pdev_param[wmi_pdev_param_sensitivity_level] = WMI_UNAVAILABLE_PARAM; |
| 13462 | pdev_param[wmi_pdev_param_signed_txpower_2g] = WMI_UNAVAILABLE_PARAM; |
| 13463 | pdev_param[wmi_pdev_param_signed_txpower_5g] = WMI_UNAVAILABLE_PARAM; |
| 13464 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = WMI_UNAVAILABLE_PARAM; |
| 13465 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = WMI_UNAVAILABLE_PARAM; |
| 13466 | pdev_param[wmi_pdev_param_cca_threshold] = WMI_UNAVAILABLE_PARAM; |
| 13467 | pdev_param[wmi_pdev_param_rts_fixed_rate] = WMI_UNAVAILABLE_PARAM; |
| 13468 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
| 13469 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_UNAVAILABLE_PARAM; |
| 13470 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = WMI_UNAVAILABLE_PARAM; |
| 13471 | pdev_param[wmi_pdev_param_arp_srcaddr] = WMI_UNAVAILABLE_PARAM; |
| 13472 | pdev_param[wmi_pdev_param_arp_dstaddr] = WMI_UNAVAILABLE_PARAM; |
| 13473 | pdev_param[wmi_pdev_param_txpower_decr_db] = WMI_UNAVAILABLE_PARAM; |
| 13474 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 13475 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
| 13476 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = WMI_UNAVAILABLE_PARAM; |
| 13477 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
| 13478 | WMI_UNAVAILABLE_PARAM; |
| 13479 | pdev_param[wmi_pdev_param_cust_txpower_scale] = WMI_UNAVAILABLE_PARAM; |
| 13480 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = WMI_UNAVAILABLE_PARAM; |
| 13481 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 13482 | WMI_UNAVAILABLE_PARAM; |
| 13483 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 13484 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
| 13485 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_UNAVAILABLE_PARAM; |
| 13486 | pdev_param[wmi_pdev_param_block_interbss] = WMI_UNAVAILABLE_PARAM; |
| 13487 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
| 13488 | WMI_UNAVAILABLE_PARAM; |
| 13489 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 13490 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
| 13491 | WMI_UNAVAILABLE_PARAM; |
| 13492 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 13493 | pdev_param[wmi_pdev_param_en_stats] = WMI_UNAVAILABLE_PARAM; |
| 13494 | } |
| 13495 | |
| 13496 | /** |
| 13497 | * populate_vdev_param_tlv() - populates vdev params |
| 13498 | * |
| 13499 | * @param vdev_param: Pointer to hold vdev params |
| 13500 | * Return: None |
| 13501 | */ |
| 13502 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 13503 | { |
| 13504 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 13505 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 13506 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 13507 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 13508 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 13509 | vdev_param[wmi_vdev_param_listen_interval] = |
| 13510 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 13511 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 13512 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 13513 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 13514 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 13515 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 13516 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 13517 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 13518 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 13519 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 13520 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 13521 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 13522 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 13523 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 13524 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 13525 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 13526 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 13527 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 13528 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 13529 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 13530 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 13531 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 13532 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 13533 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 13534 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 13535 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 13536 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 13537 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 13538 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 13539 | vdev_param[wmi_vdev_param_protection_mode] = |
| 13540 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 13541 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 13542 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 13543 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 13544 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 13545 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 13546 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 13547 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 13548 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 13549 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 13550 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 13551 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 13552 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 13553 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 13554 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 13555 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 13556 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 13557 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 13558 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 13559 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 13560 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 13561 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 13562 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 13563 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 13564 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 13565 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 13566 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 13567 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 13568 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 13569 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 13570 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 13571 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 13572 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 13573 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 13574 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 13575 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 13576 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 13577 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 13578 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 13579 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 13580 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 13581 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 13582 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 13583 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 13584 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 13585 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 13586 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 13587 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 13588 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 13589 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 13590 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 13591 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 13592 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 13593 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 13594 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 13595 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 13596 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 13597 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 13598 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 13599 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 13600 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 13601 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 13602 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 13603 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 13604 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 13605 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 13606 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 13607 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 13608 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 13609 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 13610 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 13611 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 13612 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 13613 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 13614 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 13615 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 13616 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 13617 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 13618 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 13619 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 13620 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 13621 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 13622 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 13623 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 13624 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 13625 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 13626 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 13627 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 13628 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
| 13629 | } |
| 13630 | #endif |
| 13631 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13632 | /** |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13633 | * wmi_tlv_attach() - Attach TLV APIs |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13634 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13635 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13636 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 13637 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13638 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
| 13639 | { |
| 13640 | wmi_handle->ops = &tlv_ops; |
| 13641 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 13642 | wmi_handle->log_info.buf_offset_command = 2; |
| 13643 | wmi_handle->log_info.buf_offset_event = 4; |
| 13644 | wmi_handle->log_info.is_management_record = |
| 13645 | is_management_record_tlv; |
| 13646 | #endif |
| 13647 | populate_tlv_service(wmi_handle->services); |
| 13648 | populate_tlv_events_id(wmi_handle->wmi_events); |
| 13649 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 13650 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 13651 | } |
| 13652 | #else |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13653 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13654 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13655 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 13656 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 13657 | wmi_handle->log_info.buf_offset_command = 2; |
| 13658 | wmi_handle->log_info.buf_offset_event = 4; |
| 13659 | wmi_handle->log_info.is_management_record = |
| 13660 | is_management_record_tlv; |
| 13661 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13662 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13663 | #endif |