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) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 258 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 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; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 589 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 590 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 591 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 592 | default: |
| 593 | return QDF_STATUS_E_NOSUPPORT; |
| 594 | } |
| 595 | |
| 596 | return QDF_STATUS_SUCCESS; |
| 597 | } |
| 598 | #endif |
| 599 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 600 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 601 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 602 | * @peer_addr: peer mac address |
| 603 | * @param : pointer to hold peer set parameter |
| 604 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 605 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 606 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 607 | QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 608 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 609 | struct peer_set_params *param) |
| 610 | { |
| 611 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 612 | wmi_buf_t buf; |
| 613 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 614 | uint32_t param_id; |
| 615 | |
| 616 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 617 | param->param_id) != QDF_STATUS_SUCCESS) |
| 618 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 619 | |
| 620 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 621 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 622 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 623 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 624 | } |
| 625 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 626 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 627 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 628 | WMITLV_GET_STRUCT_TLVLEN |
| 629 | (wmi_peer_set_param_cmd_fixed_param)); |
| 630 | cmd->vdev_id = param->vdev_id; |
| 631 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 632 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 633 | cmd->param_value = param->param_value; |
| 634 | err = wmi_unified_cmd_send(wmi, buf, |
| 635 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 636 | WMI_PEER_SET_PARAM_CMDID); |
| 637 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 638 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 639 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 640 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 641 | } |
| 642 | |
| 643 | return 0; |
| 644 | } |
| 645 | |
| 646 | /** |
| 647 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 648 | * @wmi: wmi handle |
| 649 | * @bssid: bssid |
| 650 | * @vdev_up_params: pointer to hold vdev up parameter |
| 651 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 652 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 653 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 654 | QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 655 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 656 | struct vdev_up_params *params) |
| 657 | { |
| 658 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 659 | wmi_buf_t buf; |
| 660 | int32_t len = sizeof(*cmd); |
| 661 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 662 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 663 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 664 | params->vdev_id, params->assoc_id, bssid); |
| 665 | buf = wmi_buf_alloc(wmi, len); |
| 666 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 667 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 668 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 669 | } |
| 670 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 671 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 672 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 673 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 674 | cmd->vdev_id = params->vdev_id; |
| 675 | cmd->vdev_assoc_id = params->assoc_id; |
| 676 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 677 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 678 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 679 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 680 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | return 0; |
| 684 | } |
| 685 | |
| 686 | /** |
| 687 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 688 | * @wmi: wmi handle |
| 689 | * @peer_addr: peer mac address |
| 690 | * @peer_type: peer type |
| 691 | * @vdev_id: vdev id |
| 692 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 693 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 694 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 695 | QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 696 | struct peer_create_params *param) |
| 697 | { |
| 698 | wmi_peer_create_cmd_fixed_param *cmd; |
| 699 | wmi_buf_t buf; |
| 700 | int32_t len = sizeof(*cmd); |
| 701 | |
| 702 | buf = wmi_buf_alloc(wmi, len); |
| 703 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 704 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 705 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 706 | } |
| 707 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 708 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 709 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 710 | WMITLV_GET_STRUCT_TLVLEN |
| 711 | (wmi_peer_create_cmd_fixed_param)); |
| 712 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 713 | cmd->peer_type = param->peer_type; |
| 714 | cmd->vdev_id = param->vdev_id; |
| 715 | |
| 716 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 717 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 718 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 719 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 720 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 721 | 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] | 722 | param->vdev_id); |
| 723 | |
| 724 | return 0; |
| 725 | } |
| 726 | |
| 727 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 728 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 729 | * command to fw |
| 730 | * @wmi: wmi handle |
| 731 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 732 | * |
| 733 | * Return: 0 for success or error code |
| 734 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 735 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 736 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 737 | struct rx_reorder_queue_setup_params *param) |
| 738 | { |
| 739 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 740 | wmi_buf_t buf; |
| 741 | int32_t len = sizeof(*cmd); |
| 742 | |
| 743 | buf = wmi_buf_alloc(wmi, len); |
| 744 | if (!buf) { |
| 745 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 746 | return QDF_STATUS_E_NOMEM; |
| 747 | } |
| 748 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 749 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 750 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 751 | WMITLV_GET_STRUCT_TLVLEN |
| 752 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 753 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 754 | cmd->vdev_id = param->vdev_id; |
| 755 | cmd->tid = param->tid; |
| 756 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 757 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 758 | cmd->queue_no = param->queue_no; |
| 759 | |
| 760 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 761 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 762 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 763 | __func__); |
| 764 | qdf_nbuf_free(buf); |
| 765 | return QDF_STATUS_E_FAILURE; |
| 766 | } |
| 767 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 768 | param->peer_macaddr, param->vdev_id, param->tid); |
| 769 | |
| 770 | return QDF_STATUS_SUCCESS; |
| 771 | } |
| 772 | |
| 773 | /** |
| 774 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 775 | * command to fw |
| 776 | * @wmi: wmi handle |
| 777 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 778 | * |
| 779 | * Return: 0 for success or error code |
| 780 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 781 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 782 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 783 | struct rx_reorder_queue_remove_params *param) |
| 784 | { |
| 785 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 786 | wmi_buf_t buf; |
| 787 | int32_t len = sizeof(*cmd); |
| 788 | |
| 789 | buf = wmi_buf_alloc(wmi, len); |
| 790 | if (!buf) { |
| 791 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 792 | return QDF_STATUS_E_NOMEM; |
| 793 | } |
| 794 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 795 | wmi_buf_data(buf); |
| 796 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 797 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 798 | WMITLV_GET_STRUCT_TLVLEN |
| 799 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 800 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 801 | cmd->vdev_id = param->vdev_id; |
| 802 | cmd->tid_mask = param->peer_tid_bitmap; |
| 803 | |
| 804 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 805 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 806 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 807 | __func__); |
| 808 | qdf_nbuf_free(buf); |
| 809 | return QDF_STATUS_E_FAILURE; |
| 810 | } |
| 811 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 812 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 813 | |
| 814 | return QDF_STATUS_SUCCESS; |
| 815 | } |
| 816 | |
| 817 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 818 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 819 | * @wmi_handle: wmi handle |
| 820 | * @value: value |
| 821 | * @mac_id: mac id to have radio context |
| 822 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 823 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 824 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 825 | 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] | 826 | uint32_t value, uint8_t mac_id) |
| 827 | { |
| 828 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 829 | wmi_buf_t buf; |
| 830 | int32_t len = sizeof(*cmd); |
| 831 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 832 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 833 | |
| 834 | buf = wmi_buf_alloc(wmi_handle, len); |
| 835 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 836 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 837 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 838 | } |
| 839 | |
| 840 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 841 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 842 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 843 | WMITLV_GET_STRUCT_TLVLEN |
| 844 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 845 | cmd->pdev_id = 0; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 846 | cmd->enable = value; |
| 847 | |
| 848 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 849 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 850 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 851 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 852 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 853 | } |
| 854 | |
| 855 | return 0; |
| 856 | } |
| 857 | |
| 858 | /** |
| 859 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 860 | * @wmi_handle: wmi handle |
| 861 | * @param: pointer to pdev_utf_params |
| 862 | * @mac_id: mac id to have radio context |
| 863 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 864 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 865 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 866 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 867 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 868 | struct pdev_utf_params *param, |
| 869 | uint8_t mac_id) |
| 870 | { |
| 871 | wmi_buf_t buf; |
| 872 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 873 | /* if param->len is 0 no data is sent, return error */ |
| 874 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 875 | static uint8_t msgref = 1; |
| 876 | uint8_t segNumber = 0, segInfo, numSegments; |
| 877 | uint16_t chunk_len, total_bytes; |
| 878 | uint8_t *bufpos; |
| 879 | struct seg_hdr_info segHdrInfo; |
| 880 | |
| 881 | bufpos = param->utf_payload; |
| 882 | total_bytes = param->len; |
| 883 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 884 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 885 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 886 | |
| 887 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 888 | numSegments++; |
| 889 | |
| 890 | while (param->len) { |
| 891 | if (param->len > MAX_WMI_UTF_LEN) |
| 892 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 893 | else |
| 894 | chunk_len = param->len; |
| 895 | |
| 896 | buf = wmi_buf_alloc(wmi_handle, |
| 897 | (chunk_len + sizeof(segHdrInfo) + |
| 898 | WMI_TLV_HDR_SIZE)); |
| 899 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 900 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 901 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 902 | } |
| 903 | |
| 904 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 905 | |
| 906 | segHdrInfo.len = total_bytes; |
| 907 | segHdrInfo.msgref = msgref; |
| 908 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 909 | segHdrInfo.segmentInfo = segInfo; |
| 910 | segHdrInfo.pad = 0; |
| 911 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 912 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 913 | " segHdrInfo.segmentInfo = %d", |
| 914 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 915 | segHdrInfo.segmentInfo); |
| 916 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 917 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 918 | "chunk len %d", __func__, total_bytes, segNumber, |
| 919 | numSegments, chunk_len); |
| 920 | |
| 921 | segNumber++; |
| 922 | |
| 923 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 924 | (chunk_len + sizeof(segHdrInfo))); |
| 925 | cmd += WMI_TLV_HDR_SIZE; |
| 926 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 927 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 928 | |
| 929 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 930 | (chunk_len + sizeof(segHdrInfo) + |
| 931 | WMI_TLV_HDR_SIZE), |
| 932 | WMI_PDEV_UTF_CMDID); |
| 933 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 934 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 935 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 936 | wmi_buf_free(buf); |
| 937 | break; |
| 938 | } |
| 939 | |
| 940 | param->len -= chunk_len; |
| 941 | bufpos += chunk_len; |
| 942 | } |
| 943 | |
| 944 | msgref++; |
| 945 | |
| 946 | return ret; |
| 947 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 948 | #ifdef CONFIG_MCL |
| 949 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 950 | uint32_t host_param) |
| 951 | { |
| 952 | return host_param; |
| 953 | } |
| 954 | #else |
| 955 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 956 | uint32_t host_param) |
| 957 | { |
| 958 | if (host_param < wmi_pdev_param_max) |
| 959 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 960 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 961 | return WMI_UNAVAILABLE_PARAM; |
| 962 | } |
| 963 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 964 | /** |
| 965 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 966 | * @wmi_handle: wmi handle |
| 967 | * @param: pointer to pdev parameter |
| 968 | * @mac_id: radio context |
| 969 | * |
| 970 | * Return: 0 on success, errno on failure |
| 971 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 972 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 973 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 974 | struct pdev_params *param, |
| 975 | uint8_t mac_id) |
| 976 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 977 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 978 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 979 | wmi_buf_t buf; |
| 980 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 981 | uint32_t pdev_param; |
| 982 | |
| 983 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 984 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 985 | WMI_LOGW("%s: Unavailable param %d\n", |
| 986 | __func__, param->param_id); |
| 987 | return QDF_STATUS_E_INVAL; |
| 988 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 989 | |
| 990 | buf = wmi_buf_alloc(wmi_handle, len); |
| 991 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 992 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 993 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 994 | } |
| 995 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 996 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 997 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 998 | WMITLV_GET_STRUCT_TLVLEN |
| 999 | (wmi_pdev_set_param_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 1000 | cmd->pdev_id = 0; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1001 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1002 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1003 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1004 | param->param_value); |
| 1005 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1006 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1007 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1008 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1009 | wmi_buf_free(buf); |
| 1010 | } |
| 1011 | return ret; |
| 1012 | } |
| 1013 | |
| 1014 | /** |
| 1015 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1016 | * @param wmi_handle : handle to WMI. |
| 1017 | * @param param : pointer to hold suspend parameter |
| 1018 | * @mac_id: radio context |
| 1019 | * |
| 1020 | * Return 0 on success and -ve on failure. |
| 1021 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1022 | QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1023 | struct suspend_params *param, |
| 1024 | uint8_t mac_id) |
| 1025 | { |
| 1026 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1027 | wmi_buf_t wmibuf; |
| 1028 | uint32_t len = sizeof(*cmd); |
| 1029 | int32_t ret; |
| 1030 | |
| 1031 | /* |
| 1032 | * send the comand to Target to ignore the |
| 1033 | * PCIE reset so as to ensure that Host and target |
| 1034 | * states are in sync |
| 1035 | */ |
| 1036 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1037 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1038 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1039 | |
| 1040 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1041 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1042 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1043 | WMITLV_GET_STRUCT_TLVLEN |
| 1044 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1045 | if (param->disable_target_intr) |
| 1046 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1047 | else |
| 1048 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
| 1049 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1050 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1051 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1052 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1053 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1054 | } |
| 1055 | |
| 1056 | return ret; |
| 1057 | } |
| 1058 | |
| 1059 | /** |
| 1060 | * send_resume_cmd_tlv() - WMI resume function |
| 1061 | * @param wmi_handle : handle to WMI. |
| 1062 | * @mac_id: radio context |
| 1063 | * |
| 1064 | * Return: 0 on success and -ve on failure. |
| 1065 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1066 | QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1067 | uint8_t mac_id) |
| 1068 | { |
| 1069 | wmi_buf_t wmibuf; |
| 1070 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1071 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1072 | |
| 1073 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1074 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1075 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1076 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1077 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1078 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1079 | WMITLV_GET_STRUCT_TLVLEN |
| 1080 | (wmi_pdev_resume_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 1081 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1082 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1083 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1084 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1085 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1086 | wmi_buf_free(wmibuf); |
| 1087 | } |
| 1088 | |
| 1089 | return ret; |
| 1090 | } |
| 1091 | |
| 1092 | /** |
| 1093 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1094 | * @param wmi_handle : handle to WMI. |
| 1095 | * @param param : pointer to hold wow enable parameter |
| 1096 | * @mac_id: radio context |
| 1097 | * |
| 1098 | * Return: 0 on success and -ve on failure. |
| 1099 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1100 | QDF_STATUS send_wow_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1101 | struct wow_cmd_params *param, |
| 1102 | uint8_t mac_id) |
| 1103 | { |
| 1104 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1105 | wmi_buf_t buf; |
| 1106 | int32_t len; |
| 1107 | int32_t ret; |
| 1108 | |
| 1109 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1110 | |
| 1111 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1112 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1113 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1114 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1115 | } |
| 1116 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1117 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1118 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1119 | WMITLV_GET_STRUCT_TLVLEN |
| 1120 | (wmi_wow_enable_cmd_fixed_param)); |
| 1121 | cmd->enable = param->enable; |
| 1122 | if (param->can_suspend_link) |
| 1123 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1124 | else |
| 1125 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1126 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1127 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1128 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1129 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1130 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1131 | |
| 1132 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1133 | WMI_WOW_ENABLE_CMDID); |
| 1134 | if (ret) |
| 1135 | wmi_buf_free(buf); |
| 1136 | |
| 1137 | return ret; |
| 1138 | } |
| 1139 | |
| 1140 | /** |
| 1141 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1142 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1143 | * @peer_addr: peer mac address |
| 1144 | * @param: pointer to ap_ps parameter structure |
| 1145 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1146 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1147 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1148 | 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] | 1149 | uint8_t *peer_addr, |
| 1150 | struct ap_ps_params *param) |
| 1151 | { |
| 1152 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1153 | wmi_buf_t buf; |
| 1154 | int32_t err; |
| 1155 | |
| 1156 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1157 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1158 | 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] | 1159 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1160 | } |
| 1161 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1162 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1163 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1164 | WMITLV_GET_STRUCT_TLVLEN |
| 1165 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1166 | cmd->vdev_id = param->vdev_id; |
| 1167 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1168 | cmd->param = param->param; |
| 1169 | cmd->value = param->value; |
| 1170 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1171 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1172 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1173 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1174 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1175 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1176 | } |
| 1177 | |
| 1178 | return 0; |
| 1179 | } |
| 1180 | |
| 1181 | /** |
| 1182 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1183 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1184 | * @peer_addr: peer mac address |
| 1185 | * @param: pointer to sta_ps parameter structure |
| 1186 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1187 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1188 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1189 | 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] | 1190 | struct sta_ps_params *param) |
| 1191 | { |
| 1192 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1193 | wmi_buf_t buf; |
| 1194 | int32_t len = sizeof(*cmd); |
| 1195 | |
| 1196 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1197 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1198 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1199 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1200 | } |
| 1201 | |
| 1202 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1203 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1204 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1205 | WMITLV_GET_STRUCT_TLVLEN |
| 1206 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1207 | cmd->vdev_id = param->vdev_id; |
| 1208 | cmd->param = param->param; |
| 1209 | cmd->value = param->value; |
| 1210 | |
| 1211 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1212 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1213 | 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] | 1214 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1215 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1216 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1217 | } |
| 1218 | |
| 1219 | return 0; |
| 1220 | } |
| 1221 | |
| 1222 | /** |
| 1223 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1224 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1225 | * @param: ponirt to crash inject paramter structure |
| 1226 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1227 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1228 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1229 | QDF_STATUS send_crash_inject_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1230 | struct crash_inject *param) |
| 1231 | { |
| 1232 | int32_t ret = 0; |
| 1233 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1234 | uint16_t len = sizeof(*cmd); |
| 1235 | wmi_buf_t buf; |
| 1236 | |
| 1237 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1238 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1239 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1240 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1241 | } |
| 1242 | |
| 1243 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1244 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1245 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1246 | WMITLV_GET_STRUCT_TLVLEN |
| 1247 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1248 | cmd->type = param->type; |
| 1249 | cmd->delay_time_ms = param->delay_time_ms; |
| 1250 | |
| 1251 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1252 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1253 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1254 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1255 | __func__, ret); |
| 1256 | wmi_buf_free(buf); |
| 1257 | } |
| 1258 | |
| 1259 | return ret; |
| 1260 | } |
| 1261 | |
| 1262 | /** |
| 1263 | * send_dbglog_cmd_tlv() - set debug log level |
| 1264 | * @param wmi_handle : handle to WMI. |
| 1265 | * @param param : pointer to hold dbglog level parameter |
| 1266 | * |
| 1267 | * Return: 0 on success and -ve on failure. |
| 1268 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1269 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1270 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1271 | struct dbglog_params *dbglog_param) |
| 1272 | { |
| 1273 | wmi_buf_t buf; |
| 1274 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
| 1275 | A_STATUS status = A_OK; |
| 1276 | int32_t i; |
| 1277 | int32_t len; |
| 1278 | int8_t *buf_ptr; |
| 1279 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1280 | |
| 1281 | ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
| 1282 | |
| 1283 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1284 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1285 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1286 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1287 | if (buf == NULL) |
| 1288 | return A_NO_MEMORY; |
| 1289 | |
| 1290 | configmsg = |
| 1291 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1292 | buf_ptr = (int8_t *) configmsg; |
| 1293 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1294 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1295 | WMITLV_GET_STRUCT_TLVLEN |
| 1296 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1297 | configmsg->dbg_log_param = dbglog_param->param; |
| 1298 | configmsg->value = dbglog_param->val; |
| 1299 | /* Filling in the data part of second tlv -- should |
| 1300 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1301 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1302 | sizeof |
| 1303 | (wmi_debug_log_config_cmd_fixed_param) |
| 1304 | + WMI_TLV_HDR_SIZE); |
| 1305 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1306 | WMITLV_TAG_ARRAY_UINT32, |
| 1307 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1308 | if (dbglog_param->module_id_bitmap) { |
| 1309 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1310 | module_id_bitmap_array[i] = |
| 1311 | dbglog_param->module_id_bitmap[i]; |
| 1312 | } |
| 1313 | } |
| 1314 | |
| 1315 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1316 | len, WMI_DBGLOG_CFG_CMDID); |
| 1317 | |
| 1318 | if (status != A_OK) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1319 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1320 | |
| 1321 | return status; |
| 1322 | } |
| 1323 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1324 | #ifdef CONFIG_MCL |
| 1325 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1326 | uint32_t host_param) |
| 1327 | { |
| 1328 | return host_param; |
| 1329 | } |
| 1330 | #else |
| 1331 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1332 | uint32_t host_param) |
| 1333 | { |
| 1334 | if (host_param < wmi_vdev_param_max) |
| 1335 | return wmi_handle->vdev_param[host_param]; |
| 1336 | |
| 1337 | return WMI_UNAVAILABLE_PARAM; |
| 1338 | } |
| 1339 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1340 | /** |
| 1341 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1342 | * @param wmi_handle : handle to WMI. |
| 1343 | * @param macaddr : MAC address |
| 1344 | * @param param : pointer to hold vdev set parameter |
| 1345 | * |
| 1346 | * Return: 0 on success and -ve on failure. |
| 1347 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1348 | 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] | 1349 | struct vdev_set_params *param) |
| 1350 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1351 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1352 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1353 | wmi_buf_t buf; |
| 1354 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1355 | uint32_t vdev_param; |
| 1356 | |
| 1357 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1358 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1359 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1360 | param->param_id); |
| 1361 | return QDF_STATUS_E_INVAL; |
| 1362 | |
| 1363 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1364 | |
| 1365 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1366 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1367 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1368 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1369 | } |
| 1370 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1371 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1372 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1373 | WMITLV_GET_STRUCT_TLVLEN |
| 1374 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1375 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1376 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1377 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1378 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1379 | param->if_id, param->param_id, param->param_value); |
| 1380 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1381 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1382 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1383 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1384 | wmi_buf_free(buf); |
| 1385 | } |
| 1386 | |
| 1387 | return ret; |
| 1388 | } |
| 1389 | |
| 1390 | /** |
| 1391 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1392 | * @param wmi_handle : handle to WMI. |
| 1393 | * @param macaddr : MAC address |
| 1394 | * @param param : pointer to hold stats request parameter |
| 1395 | * |
| 1396 | * Return: 0 on success and -ve on failure. |
| 1397 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1398 | QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1399 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1400 | struct stats_request_params *param) |
| 1401 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1402 | int32_t ret; |
| 1403 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1404 | wmi_buf_t buf; |
| 1405 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1406 | |
| 1407 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1408 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1409 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1410 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1411 | } |
| 1412 | |
| 1413 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1414 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1415 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1416 | WMITLV_GET_STRUCT_TLVLEN |
| 1417 | (wmi_request_stats_cmd_fixed_param)); |
| 1418 | cmd->stats_id = param->stats_id; |
| 1419 | cmd->vdev_id = param->vdev_id; |
| 1420 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1421 | WMI_REQUEST_STATS_CMDID); |
| 1422 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1423 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1424 | wmi_buf_free(buf); |
| 1425 | } |
| 1426 | |
| 1427 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1428 | } |
| 1429 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1430 | #ifdef CONFIG_WIN |
| 1431 | /** |
| 1432 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1433 | * @param wmi_handle : handle to WMI. |
| 1434 | * @param macaddr : MAC address |
| 1435 | * @param param : pointer to hold stats request parameter |
| 1436 | * |
| 1437 | * Return: 0 on success and -ve on failure. |
| 1438 | */ |
| 1439 | QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1440 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT) |
| 1441 | { |
| 1442 | return 0; |
| 1443 | } |
| 1444 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1445 | /** |
| 1446 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1447 | * @param wmi_handle : handle to WMI. |
| 1448 | * @param macaddr : MAC address |
| 1449 | * @param param : pointer to hold stats request parameter |
| 1450 | * |
| 1451 | * Return: 0 on success and -ve on failure. |
| 1452 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1453 | 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] | 1454 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1455 | struct packet_enable_params *param) |
| 1456 | { |
| 1457 | return 0; |
| 1458 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1459 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1460 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1461 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1462 | /** |
| 1463 | * send_beacon_send_cmd_tlv() - WMI beacon send function |
| 1464 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1465 | * @param param : pointer to hold beacon send cmd parameter |
| 1466 | * |
| 1467 | * Return: 0 on success and -ve on failure. |
| 1468 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1469 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1470 | struct beacon_params *param) |
| 1471 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1472 | int32_t ret; |
| 1473 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1474 | wmi_bcn_prb_info *bcn_prb_info; |
| 1475 | wmi_buf_t wmi_buf; |
| 1476 | uint8_t *buf_ptr; |
| 1477 | uint32_t wmi_buf_len; |
| 1478 | |
| 1479 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1480 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1481 | param->tmpl_len_aligned; |
| 1482 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1483 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1484 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1485 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1486 | } |
| 1487 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1488 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1489 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1490 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1491 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1492 | cmd->vdev_id = param->vdev_id; |
| 1493 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1494 | cmd->buf_len = param->tmpl_len; |
| 1495 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1496 | |
| 1497 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1498 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1499 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1500 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1501 | bcn_prb_info->caps = 0; |
| 1502 | bcn_prb_info->erp = 0; |
| 1503 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1504 | |
| 1505 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1506 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1507 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1508 | |
| 1509 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1510 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1511 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1512 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1513 | wmi_buf_free(wmi_buf); |
| 1514 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1515 | return 0; |
| 1516 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1517 | #else |
| 1518 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1519 | struct beacon_params *param) |
| 1520 | { |
| 1521 | return 0; |
| 1522 | } |
| 1523 | |
| 1524 | /** |
| 1525 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1526 | * @param wmi_handle : handle to WMI. |
| 1527 | * @param param : pointer to hold beacon send cmd parameter |
| 1528 | * |
| 1529 | * Return: 0 on success and -ve on failure. |
| 1530 | */ |
| 1531 | QDF_STATUS send_beacon_tmpl_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1532 | struct beacon_tmpl_params *param) |
| 1533 | { |
| 1534 | int32_t ret; |
| 1535 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1536 | wmi_bcn_prb_info *bcn_prb_info; |
| 1537 | wmi_buf_t wmi_buf; |
| 1538 | uint8_t *buf_ptr; |
| 1539 | uint32_t wmi_buf_len; |
| 1540 | |
| 1541 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1542 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1543 | param->tmpl_len_aligned; |
| 1544 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1545 | if (!wmi_buf) { |
| 1546 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1547 | return QDF_STATUS_E_NOMEM; |
| 1548 | } |
| 1549 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1550 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1551 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1552 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1553 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1554 | cmd->vdev_id = param->vdev_id; |
| 1555 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1556 | cmd->buf_len = param->tmpl_len; |
| 1557 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1558 | |
| 1559 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1560 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1561 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1562 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1563 | bcn_prb_info->caps = 0; |
| 1564 | bcn_prb_info->erp = 0; |
| 1565 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1566 | |
| 1567 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1568 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1569 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1570 | |
| 1571 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1572 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1573 | if (ret) { |
| 1574 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1575 | wmi_buf_free(wmi_buf); |
| 1576 | } |
| 1577 | return 0; |
| 1578 | } |
| 1579 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1580 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1581 | #ifdef CONFIG_MCL |
| 1582 | static inline void copy_peer_flags_tlv( |
| 1583 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1584 | struct peer_assoc_params *param) |
| 1585 | { |
| 1586 | cmd->peer_flags = param->peer_flags; |
| 1587 | } |
| 1588 | #else |
| 1589 | static inline void copy_peer_flags_tlv( |
| 1590 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1591 | struct peer_assoc_params *param) |
| 1592 | { |
| 1593 | /* |
| 1594 | * The target only needs a subset of the flags maintained in the host. |
| 1595 | * Just populate those flags and send it down |
| 1596 | */ |
| 1597 | cmd->peer_flags = 0; |
| 1598 | |
| 1599 | /* |
| 1600 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1601 | */ |
| 1602 | if (param->is_wme_set) { |
| 1603 | |
| 1604 | if (param->qos_flag) |
| 1605 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1606 | if (param->apsd_flag) |
| 1607 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1608 | if (param->ht_flag) |
| 1609 | cmd->peer_flags |= WMI_PEER_HT; |
| 1610 | if (param->bw_40) |
| 1611 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1612 | if (param->bw_80) |
| 1613 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1614 | if (param->bw_160) |
| 1615 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1616 | |
| 1617 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1618 | * for HT as well |
| 1619 | **/ |
| 1620 | if (param->stbc_flag) |
| 1621 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1622 | |
| 1623 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1624 | * for HT as well |
| 1625 | **/ |
| 1626 | if (param->ldpc_flag) |
| 1627 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1628 | |
| 1629 | if (param->static_mimops_flag) |
| 1630 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1631 | if (param->dynamic_mimops_flag) |
| 1632 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1633 | if (param->spatial_mux_flag) |
| 1634 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1635 | if (param->vht_flag) |
| 1636 | cmd->peer_flags |= WMI_PEER_VHT; |
| 1637 | } |
| 1638 | /* |
| 1639 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1640 | * (during re-association). |
| 1641 | * Authorization will be done for these modes on key installation. |
| 1642 | */ |
| 1643 | if (param->auth_flag) |
| 1644 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1645 | if (param->need_ptk_4_way) |
| 1646 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1647 | else |
| 1648 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1649 | if (param->need_gtk_2_way) |
| 1650 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1651 | /* safe mode bypass the 4-way handshake */ |
| 1652 | if (param->safe_mode_enabled) |
| 1653 | cmd->peer_flags &= |
| 1654 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1655 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1656 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1657 | * it |
| 1658 | * if (param->amsdu_disable) Add after FW support |
| 1659 | **/ |
| 1660 | |
| 1661 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1662 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1663 | * iwpriv |
| 1664 | **/ |
| 1665 | if (param->peer_ht_rates.num_rates == 0) |
| 1666 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1667 | } |
| 1668 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1669 | |
| 1670 | #ifdef CONFIG_MCL |
| 1671 | static inline void copy_peer_mac_addr_tlv( |
| 1672 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1673 | struct peer_assoc_params *param) |
| 1674 | { |
| 1675 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1676 | sizeof(param->peer_macaddr)); |
| 1677 | } |
| 1678 | #else |
| 1679 | static inline void copy_peer_mac_addr_tlv( |
| 1680 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1681 | struct peer_assoc_params *param) |
| 1682 | { |
| 1683 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 1684 | } |
| 1685 | #endif |
| 1686 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1687 | /** |
| 1688 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1689 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1690 | * @param param : pointer to peer assoc parameter |
| 1691 | * |
| 1692 | * Return: 0 on success and -ve on failure. |
| 1693 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1694 | QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1695 | struct peer_assoc_params *param) |
| 1696 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1697 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1698 | wmi_vht_rate_set *mcs; |
| 1699 | wmi_buf_t buf; |
| 1700 | int32_t len; |
| 1701 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1702 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1703 | uint32_t peer_legacy_rates_align; |
| 1704 | uint32_t peer_ht_rates_align; |
| 1705 | |
| 1706 | |
| 1707 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1708 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1709 | |
| 1710 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1711 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1712 | WMI_TLV_HDR_SIZE + |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1713 | (peer_ht_rates_align * sizeof(uint8_t)) + |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1714 | sizeof(wmi_vht_rate_set); |
| 1715 | |
| 1716 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1717 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1718 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1719 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1720 | } |
| 1721 | |
| 1722 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1723 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1724 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1725 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1726 | WMITLV_GET_STRUCT_TLVLEN |
| 1727 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1728 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1729 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1730 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1731 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1732 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1733 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1734 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1735 | copy_peer_mac_addr_tlv(cmd, param); |
| 1736 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1737 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1738 | cmd->peer_caps = param->peer_caps; |
| 1739 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1740 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1741 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1742 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1743 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1744 | cmd->peer_phymode = param->peer_phymode; |
| 1745 | |
| 1746 | /* Update peer legacy rate information */ |
| 1747 | buf_ptr += sizeof(*cmd); |
| 1748 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1749 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1750 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1751 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1752 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1753 | param->peer_legacy_rates.num_rates); |
| 1754 | |
| 1755 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1756 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1757 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1758 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1759 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1760 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1761 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1762 | param->peer_ht_rates.num_rates); |
| 1763 | |
| 1764 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1765 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1766 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 1767 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 1768 | |
| 1769 | cmd->peer_nss = param->peer_nss; |
| 1770 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 1771 | if (param->vht_capable) { |
| 1772 | mcs->rx_max_rate = param->rx_max_rate; |
| 1773 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 1774 | mcs->tx_max_rate = param->tx_max_rate; |
| 1775 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 1776 | } |
| 1777 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1778 | 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] | 1779 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 1780 | "nss %d phymode %d peer_mpdu_density %d " |
| 1781 | "cmd->peer_vht_caps %x", __func__, |
| 1782 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 1783 | cmd->peer_rate_caps, cmd->peer_caps, |
| 1784 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 1785 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 1786 | cmd->peer_mpdu_density, |
| 1787 | cmd->peer_vht_caps); |
| 1788 | |
| 1789 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1790 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1791 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1792 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1793 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1794 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1795 | } |
| 1796 | |
| 1797 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1798 | } |
| 1799 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1800 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 1801 | */ |
| 1802 | #ifdef CONFIG_MCL |
| 1803 | static inline void copy_scan_notify_ev_flags( |
| 1804 | wmi_start_scan_cmd_fixed_param * cmd, |
| 1805 | struct scan_start_params *params) |
| 1806 | { |
| 1807 | cmd->notify_scan_events = params->notify_scan_events; |
| 1808 | cmd->scan_ctrl_flags = params->scan_ctrl_flags; |
| 1809 | } |
| 1810 | #else |
| 1811 | static inline void copy_scan_notify_ev_flags( |
| 1812 | wmi_start_scan_cmd_fixed_param * cmd, |
| 1813 | struct scan_start_params *params) |
| 1814 | { |
| 1815 | cmd->notify_scan_events = WMI_SCAN_EVENT_STARTED | |
| 1816 | WMI_SCAN_EVENT_COMPLETED | |
| 1817 | WMI_SCAN_EVENT_BSS_CHANNEL | |
| 1818 | WMI_SCAN_EVENT_FOREIGN_CHANNEL | |
| 1819 | WMI_SCAN_EVENT_DEQUEUED |
| 1820 | ; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1821 | |
| 1822 | cmd->scan_ctrl_flags = (params->passive_flag) ? |
| 1823 | WMI_SCAN_FLAG_PASSIVE : 0; |
| 1824 | |
| 1825 | if (params->is_strict_pscan_en) |
| 1826 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1827 | |
| 1828 | if (params->is_phy_error) |
| 1829 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1830 | |
| 1831 | if (params->half_rate) |
| 1832 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
| 1833 | |
| 1834 | if (params->quarter_rate) |
| 1835 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
| 1836 | |
| 1837 | if (params->is_phy_error) |
| 1838 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
| 1839 | |
| 1840 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 1841 | /* add cck rates if required */ |
| 1842 | if (params->add_cck_rates) |
| 1843 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
| 1844 | /** It enables the Channel stat event indication to host */ |
| 1845 | if (params->chan_stat_enable) |
| 1846 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
| 1847 | if (params->add_bcast_probe_reqd) |
| 1848 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
| 1849 | /* off channel TX control */ |
| 1850 | if (params->offchan_tx_mgmt) |
| 1851 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
| 1852 | if (params->offchan_tx_data) |
| 1853 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1854 | } |
| 1855 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1856 | /** |
| 1857 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 1858 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1859 | * @param param : pointer to hold scan start cmd parameter |
| 1860 | * |
| 1861 | * Return: 0 on success and -ve on failure. |
| 1862 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1863 | QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1864 | struct scan_start_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1865 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1866 | int32_t ret = 0; |
| 1867 | int32_t i; |
| 1868 | wmi_buf_t wmi_buf; |
| 1869 | wmi_start_scan_cmd_fixed_param *cmd; |
| 1870 | uint8_t *buf_ptr; |
| 1871 | uint32_t *tmp_ptr; |
| 1872 | wmi_ssid *ssid = NULL; |
| 1873 | wmi_mac_addr *bssid; |
| 1874 | int len = sizeof(*cmd); |
| 1875 | |
| 1876 | /* Length TLV placeholder for array of uint32_t */ |
| 1877 | len += WMI_TLV_HDR_SIZE; |
| 1878 | /* calculate the length of buffer required */ |
| 1879 | if (params->num_chan) |
| 1880 | len += params->num_chan * sizeof(uint32_t); |
| 1881 | |
| 1882 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 1883 | len += WMI_TLV_HDR_SIZE; |
| 1884 | if (params->num_ssids) |
| 1885 | len += params->num_ssids * sizeof(wmi_ssid); |
| 1886 | |
| 1887 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 1888 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1889 | if (params->num_bssid) |
| 1890 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1891 | |
| 1892 | /* Length TLV placeholder for array of bytes */ |
| 1893 | len += WMI_TLV_HDR_SIZE; |
| 1894 | if (params->ie_len) |
| 1895 | len += roundup(params->ie_len, sizeof(uint32_t)); |
| 1896 | |
| 1897 | /* Allocate the memory */ |
| 1898 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1899 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1900 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1901 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1902 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1903 | } |
| 1904 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1905 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 1906 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1907 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 1908 | WMITLV_GET_STRUCT_TLVLEN |
| 1909 | (wmi_start_scan_cmd_fixed_param)); |
| 1910 | |
| 1911 | cmd->scan_id = params->scan_id; |
| 1912 | cmd->scan_req_id = params->scan_req_id; |
| 1913 | cmd->vdev_id = params->vdev_id; |
| 1914 | cmd->scan_priority = params->scan_priority; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1915 | copy_scan_notify_ev_flags(cmd, params); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1916 | cmd->dwell_time_active = params->dwell_time_active; |
| 1917 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 1918 | cmd->min_rest_time = params->min_rest_time; |
| 1919 | cmd->max_rest_time = params->max_rest_time; |
| 1920 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 1921 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 1922 | cmd->idle_time = params->idle_time; |
| 1923 | cmd->max_scan_time = params->max_scan_time; |
| 1924 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1925 | cmd->burst_duration = params->burst_duration; |
| 1926 | cmd->num_chan = params->num_chan; |
| 1927 | cmd->num_bssid = params->num_bssid; |
| 1928 | cmd->num_ssids = params->num_ssids; |
| 1929 | cmd->ie_len = params->ie_len; |
| 1930 | cmd->n_probes = params->n_probes; |
| 1931 | buf_ptr += sizeof(*cmd); |
| 1932 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1933 | for (i = 0; i < params->num_chan; ++i) |
| 1934 | tmp_ptr[i] = params->chan_list[i]; |
| 1935 | |
| 1936 | WMITLV_SET_HDR(buf_ptr, |
| 1937 | WMITLV_TAG_ARRAY_UINT32, |
| 1938 | (params->num_chan * sizeof(uint32_t))); |
| 1939 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 1940 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1941 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1942 | goto error; |
| 1943 | } |
| 1944 | |
| 1945 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1946 | (params->num_ssids * sizeof(wmi_ssid))); |
| 1947 | |
| 1948 | if (params->num_ssids) { |
| 1949 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1950 | for (i = 0; i < params->num_ssids; ++i) { |
| 1951 | ssid->ssid_len = params->ssid[i].length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1952 | qdf_mem_copy(ssid->ssid, params->ssid[i].mac_ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1953 | params->ssid[i].length); |
| 1954 | ssid++; |
| 1955 | } |
| 1956 | } |
| 1957 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 1958 | |
| 1959 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1960 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 1961 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1962 | #if CONFIG_MCL |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1963 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->mac_add_bytes, bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1964 | #else |
| 1965 | if (params->num_bssid) { |
| 1966 | for (i = 0; i < params->num_bssid; ++i) { |
| 1967 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->bssid_list[i], |
| 1968 | bssid); |
| 1969 | bssid++; |
| 1970 | } |
| 1971 | } |
| 1972 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1973 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_bssid * sizeof(wmi_mac_addr)); |
| 1974 | |
| 1975 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, params->ie_len_with_pad); |
| 1976 | if (params->ie_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1977 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1978 | (uint8_t *) params->ie_base + |
| 1979 | (params->uie_fieldOffset), params->ie_len); |
| 1980 | } |
| 1981 | buf_ptr += WMI_TLV_HDR_SIZE + params->ie_len_with_pad; |
| 1982 | |
| 1983 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 1984 | len, WMI_START_SCAN_CMDID); |
| 1985 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1986 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1987 | wmi_buf_free(wmi_buf); |
| 1988 | } |
| 1989 | return ret; |
| 1990 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1991 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1992 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1993 | } |
| 1994 | |
| 1995 | /** |
| 1996 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 1997 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1998 | * @param param : pointer to hold scan start cmd parameter |
| 1999 | * |
| 2000 | * Return: 0 on success and -ve on failure. |
| 2001 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2002 | QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2003 | struct scan_stop_params *param) |
| 2004 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2005 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2006 | int ret; |
| 2007 | int len = sizeof(*cmd); |
| 2008 | wmi_buf_t wmi_buf; |
| 2009 | |
| 2010 | /* Allocate the memory */ |
| 2011 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2012 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2013 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2014 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2015 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2016 | goto error; |
| 2017 | } |
| 2018 | |
| 2019 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2020 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2021 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2022 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2023 | cmd->vdev_id = param->vdev_id; |
| 2024 | cmd->requestor = param->requestor; |
| 2025 | cmd->scan_id = param->scan_id; |
| 2026 | /* stop the scan with the corresponding scan_id */ |
| 2027 | cmd->req_type = param->req_type; |
| 2028 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 2029 | len, WMI_STOP_SCAN_CMDID); |
| 2030 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2031 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2032 | wmi_buf_free(wmi_buf); |
| 2033 | } |
| 2034 | |
| 2035 | error: |
| 2036 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2037 | } |
| 2038 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2039 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2040 | /** |
| 2041 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2042 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2043 | * @param param : pointer to hold scan channel list parameter |
| 2044 | * |
| 2045 | * Return: 0 on success and -ve on failure. |
| 2046 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2047 | 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] | 2048 | struct scan_chan_list_params *chan_list) |
| 2049 | { |
| 2050 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2051 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2052 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2053 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2054 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2055 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2056 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2057 | |
| 2058 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2059 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2060 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2061 | WMI_LOGE("Failed to allocate memory"); |
| 2062 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2063 | goto end; |
| 2064 | } |
| 2065 | |
| 2066 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2067 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2068 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2069 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2070 | WMITLV_GET_STRUCT_TLVLEN |
| 2071 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2072 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2073 | 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] | 2074 | |
| 2075 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2076 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2077 | WMITLV_TAG_ARRAY_STRUC, |
| 2078 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2079 | chan_info = (wmi_channel_param *) |
| 2080 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2081 | tchan_info = chan_list->chan_info; |
| 2082 | |
| 2083 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2084 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2085 | WMITLV_TAG_STRUC_wmi_channel, |
| 2086 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2087 | chan_info->mhz = tchan_info->mhz; |
| 2088 | chan_info->band_center_freq1 = |
| 2089 | tchan_info->band_center_freq1; |
| 2090 | chan_info->band_center_freq2 = |
| 2091 | tchan_info->band_center_freq2; |
| 2092 | chan_info->info = tchan_info->info; |
| 2093 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2094 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2095 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2096 | |
| 2097 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2098 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2099 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2100 | tchan_info++; |
| 2101 | chan_info++; |
| 2102 | } |
| 2103 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2104 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2105 | WMI_SCAN_CHAN_LIST_CMDID); |
| 2106 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2107 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2108 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2109 | wmi_buf_free(buf); |
| 2110 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2111 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2112 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2113 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2114 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2115 | #else |
| 2116 | QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle, |
| 2117 | struct scan_chan_list_params *chan_list) |
| 2118 | { |
| 2119 | wmi_buf_t buf; |
| 2120 | QDF_STATUS qdf_status; |
| 2121 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2122 | int i; |
| 2123 | uint8_t *buf_ptr; |
| 2124 | wmi_channel *chan_info; |
| 2125 | struct channel_param *tchan_info; |
| 2126 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2127 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2128 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2129 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2130 | if (!buf) { |
| 2131 | WMI_LOGE("Failed to allocate memory"); |
| 2132 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2133 | goto end; |
| 2134 | } |
| 2135 | |
| 2136 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2137 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2138 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2139 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2140 | WMITLV_GET_STRUCT_TLVLEN |
| 2141 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2142 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2143 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2144 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2145 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2146 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2147 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2148 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2149 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2150 | tchan_info = &(chan_list->ch_param[0]); |
| 2151 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2152 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2153 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2154 | WMITLV_TAG_STRUC_wmi_channel, |
| 2155 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2156 | chan_info->mhz = tchan_info->mhz; |
| 2157 | chan_info->band_center_freq1 = |
| 2158 | tchan_info->cfreq1; |
| 2159 | chan_info->band_center_freq2 = |
| 2160 | tchan_info->cfreq2; |
| 2161 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2162 | if (tchan_info->is_chan_passive) |
| 2163 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2164 | WMI_CHAN_FLAG_PASSIVE); |
| 2165 | |
| 2166 | if (tchan_info->allow_vht) |
| 2167 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2168 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2169 | else if (tchan_info->allow_ht) |
| 2170 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2171 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2172 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2173 | tchan_info->phy_mode); |
| 2174 | |
| 2175 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2176 | * after FW support |
| 2177 | */ |
| 2178 | |
| 2179 | /* also fill in power information */ |
| 2180 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2181 | tchan_info->minpower); |
| 2182 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2183 | tchan_info->maxpower); |
| 2184 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2185 | tchan_info->maxregpower); |
| 2186 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2187 | tchan_info->antennamax); |
| 2188 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2189 | tchan_info->reg_class_id); |
| 2190 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2191 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2192 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2193 | tchan_info++; |
| 2194 | chan_info++; |
| 2195 | } |
| 2196 | |
| 2197 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2198 | WMI_SCAN_CHAN_LIST_CMDID); |
| 2199 | |
| 2200 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2201 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2202 | wmi_buf_free(buf); |
| 2203 | } |
| 2204 | |
| 2205 | end: |
| 2206 | return qdf_status; |
| 2207 | } |
| 2208 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2209 | /** |
| 2210 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2211 | * @wmi_handle : handle to WMI. |
| 2212 | * @param : pointer to hold mgmt cmd parameter |
| 2213 | * |
| 2214 | * Return: 0 on success and -ve on failure. |
| 2215 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2216 | QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2217 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2218 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2219 | wmi_buf_t buf; |
| 2220 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2221 | int32_t cmd_len; |
| 2222 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2223 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2224 | uint8_t *bufp; |
| 2225 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2226 | mgmt_tx_dl_frm_len; |
| 2227 | |
| 2228 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 2229 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 2230 | |
| 2231 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2232 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2233 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2234 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2235 | } |
| 2236 | |
| 2237 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2238 | bufp = (uint8_t *) cmd; |
| 2239 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2240 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2241 | WMITLV_GET_STRUCT_TLVLEN |
| 2242 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2243 | |
| 2244 | cmd->vdev_id = param->vdev_id; |
| 2245 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2246 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2247 | cmd->chanfreq = param->chanfreq; |
| 2248 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2249 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2250 | sizeof(uint32_t))); |
| 2251 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2252 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2253 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2254 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2255 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 2256 | #if defined(HELIUMPLUS_PADDR64) |
| 2257 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2258 | #endif |
| 2259 | cmd->frame_len = param->frm_len; |
| 2260 | cmd->buf_len = bufp_len; |
| 2261 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2262 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2263 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2264 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2265 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2266 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2267 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2268 | goto err1; |
| 2269 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2270 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2271 | |
| 2272 | err1: |
| 2273 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2274 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2275 | } |
| 2276 | |
| 2277 | /** |
| 2278 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2279 | * @wmi_handle: wmi handle |
| 2280 | * @param_value: parameter value |
| 2281 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2282 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2283 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2284 | 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] | 2285 | uint32_t param_value) |
| 2286 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2287 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2288 | wmi_modem_power_state_cmd_param *cmd; |
| 2289 | wmi_buf_t buf; |
| 2290 | uint16_t len = sizeof(*cmd); |
| 2291 | |
| 2292 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2293 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2294 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2295 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2296 | } |
| 2297 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2298 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2299 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2300 | WMITLV_GET_STRUCT_TLVLEN |
| 2301 | (wmi_modem_power_state_cmd_param)); |
| 2302 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2303 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2304 | param_value); |
| 2305 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2306 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2307 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2308 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2309 | wmi_buf_free(buf); |
| 2310 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2311 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2312 | return ret; |
| 2313 | } |
| 2314 | |
| 2315 | /** |
| 2316 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2317 | * @wmi_handle: wmi handle |
| 2318 | * @vdev_id: vdev id |
| 2319 | * @val: value |
| 2320 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2321 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2322 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2323 | 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] | 2324 | uint32_t vdev_id, uint8_t val) |
| 2325 | { |
| 2326 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2327 | wmi_buf_t buf; |
| 2328 | int32_t len = sizeof(*cmd); |
| 2329 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2330 | 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] | 2331 | |
| 2332 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2333 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2334 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2335 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2336 | } |
| 2337 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2338 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2339 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2340 | WMITLV_GET_STRUCT_TLVLEN |
| 2341 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2342 | cmd->vdev_id = vdev_id; |
| 2343 | if (val) |
| 2344 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2345 | else |
| 2346 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2347 | |
| 2348 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2349 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2350 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2351 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2352 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2353 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2354 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2355 | return 0; |
| 2356 | } |
| 2357 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2358 | /** |
| 2359 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2360 | * @wmi_handle: wmi handle |
| 2361 | * @vdev_id: vdev id |
| 2362 | * @value: value |
| 2363 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2364 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2365 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2366 | QDF_STATUS send_set_mimops_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2367 | uint8_t vdev_id, int value) |
| 2368 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2369 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2370 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2371 | wmi_buf_t buf; |
| 2372 | uint16_t len = sizeof(*cmd); |
| 2373 | |
| 2374 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2375 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2376 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2377 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2378 | } |
| 2379 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2380 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2381 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2382 | WMITLV_GET_STRUCT_TLVLEN |
| 2383 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2384 | |
| 2385 | cmd->vdev_id = vdev_id; |
| 2386 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2387 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2388 | * to SM power save values defined in the specification. |
| 2389 | * Make sure to send the right mapping. |
| 2390 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2391 | switch (value) { |
| 2392 | case 0: |
| 2393 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 2394 | break; |
| 2395 | case 1: |
| 2396 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 2397 | break; |
| 2398 | case 2: |
| 2399 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 2400 | break; |
| 2401 | case 3: |
| 2402 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 2403 | break; |
| 2404 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2405 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 2406 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2407 | } |
| 2408 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2409 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2410 | |
| 2411 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2412 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2413 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2414 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2415 | wmi_buf_free(buf); |
| 2416 | } |
| 2417 | |
| 2418 | return ret; |
| 2419 | } |
| 2420 | |
| 2421 | /** |
| 2422 | * send_set_smps_params_cmd_tlv() - set smps params |
| 2423 | * @wmi_handle: wmi handle |
| 2424 | * @vdev_id: vdev id |
| 2425 | * @value: value |
| 2426 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2427 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2428 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2429 | 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] | 2430 | int value) |
| 2431 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2432 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2433 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 2434 | wmi_buf_t buf; |
| 2435 | uint16_t len = sizeof(*cmd); |
| 2436 | |
| 2437 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2438 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2439 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2440 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2441 | } |
| 2442 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 2443 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2444 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 2445 | WMITLV_GET_STRUCT_TLVLEN |
| 2446 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 2447 | |
| 2448 | cmd->vdev_id = vdev_id; |
| 2449 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 2450 | cmd->param = |
| 2451 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 2452 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2453 | 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] | 2454 | cmd->param); |
| 2455 | |
| 2456 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2457 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2458 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2459 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2460 | wmi_buf_free(buf); |
| 2461 | } |
| 2462 | |
| 2463 | return ret; |
| 2464 | } |
| 2465 | |
| 2466 | /** |
| 2467 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 2468 | * @wmi_handle: wmi handle |
| 2469 | * @noa: p2p power save parameters |
| 2470 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2471 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2472 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2473 | 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] | 2474 | struct p2p_ps_params *noa) |
| 2475 | { |
| 2476 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 2477 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 2478 | wmi_buf_t buf; |
| 2479 | uint8_t *buf_ptr; |
| 2480 | uint16_t len; |
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 | uint32_t duration; |
| 2483 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2484 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2485 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 2486 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2487 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2488 | WMI_LOGE("Failed to allocate memory"); |
| 2489 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2490 | goto end; |
| 2491 | } |
| 2492 | |
| 2493 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2494 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 2495 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2496 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 2497 | WMITLV_GET_STRUCT_TLVLEN |
| 2498 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 2499 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 2500 | cmd->vdev_id = noa->session_id; |
| 2501 | cmd->enable = (duration) ? true : false; |
| 2502 | cmd->num_noa = 1; |
| 2503 | |
| 2504 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 2505 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 2506 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 2507 | sizeof |
| 2508 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 2509 | + WMI_TLV_HDR_SIZE); |
| 2510 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 2511 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 2512 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 2513 | noa_discriptor->type_count = noa->count; |
| 2514 | noa_discriptor->duration = duration; |
| 2515 | noa_discriptor->interval = noa->interval; |
| 2516 | noa_discriptor->start_time = 0; |
| 2517 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2518 | 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] | 2519 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 2520 | noa->interval); |
| 2521 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2522 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2523 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2524 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2525 | wmi_buf_free(buf); |
| 2526 | } |
| 2527 | |
| 2528 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2529 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2530 | return status; |
| 2531 | } |
| 2532 | |
| 2533 | |
| 2534 | /** |
| 2535 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 2536 | * @wmi_handle: wmi handle |
| 2537 | * @noa: p2p opp power save parameters |
| 2538 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2539 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2540 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2541 | 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] | 2542 | struct p2p_ps_params *oppps) |
| 2543 | { |
| 2544 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 2545 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2546 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2547 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2548 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2549 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2550 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2551 | WMI_LOGE("Failed to allocate memory"); |
| 2552 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2553 | goto end; |
| 2554 | } |
| 2555 | |
| 2556 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 2557 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2558 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 2559 | WMITLV_GET_STRUCT_TLVLEN |
| 2560 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 2561 | cmd->vdev_id = oppps->session_id; |
| 2562 | if (oppps->ctwindow) |
| 2563 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 2564 | |
| 2565 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2566 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2567 | cmd->vdev_id, oppps->ctwindow); |
| 2568 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 2569 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2570 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2571 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2572 | wmi_buf_free(buf); |
| 2573 | } |
| 2574 | |
| 2575 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2576 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2577 | return status; |
| 2578 | } |
| 2579 | |
| 2580 | /** |
| 2581 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 2582 | * @wmi_handle: wmi handle |
| 2583 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2584 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2585 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2586 | QDF_STATUS send_get_temperature_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2587 | { |
| 2588 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 2589 | wmi_buf_t wmi_buf; |
| 2590 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 2591 | uint8_t *buf_ptr; |
| 2592 | |
| 2593 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2594 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 2595 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2596 | } |
| 2597 | |
| 2598 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2599 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2600 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2601 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2602 | } |
| 2603 | |
| 2604 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2605 | |
| 2606 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 2607 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2608 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 2609 | WMITLV_GET_STRUCT_TLVLEN |
| 2610 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 2611 | |
| 2612 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 2613 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2614 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2615 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2616 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2617 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2618 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2619 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2620 | } |
| 2621 | |
| 2622 | /** |
| 2623 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 2624 | * @wmi_handle: wmi handle |
| 2625 | * @vdevid: vdev id |
| 2626 | * @peer_addr: peer mac address |
| 2627 | * @auto_triggerparam: auto trigger parameters |
| 2628 | * @num_ac: number of access category |
| 2629 | * |
| 2630 | * This function sets the trigger |
| 2631 | * uapsd params such as service interval, delay interval |
| 2632 | * and suspend interval which will be used by the firmware |
| 2633 | * to send trigger frames periodically when there is no |
| 2634 | * traffic on the transmit side. |
| 2635 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2636 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2637 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2638 | 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] | 2639 | struct sta_uapsd_trig_params *param) |
| 2640 | { |
| 2641 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2642 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2643 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 2644 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 2645 | uint32_t i; |
| 2646 | wmi_buf_t buf; |
| 2647 | uint8_t *buf_ptr; |
| 2648 | |
| 2649 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2650 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2651 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2652 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2653 | } |
| 2654 | |
| 2655 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2656 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 2657 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2658 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 2659 | WMITLV_GET_STRUCT_TLVLEN |
| 2660 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 2661 | cmd->vdev_id = param->vdevid; |
| 2662 | cmd->num_ac = param->num_ac; |
| 2663 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 2664 | |
| 2665 | /* TLV indicating array of structures to follow */ |
| 2666 | buf_ptr += sizeof(*cmd); |
| 2667 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 2668 | |
| 2669 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2670 | qdf_mem_copy(buf_ptr, param->auto_triggerparam, param_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2671 | |
| 2672 | /* |
| 2673 | * Update tag and length for uapsd auto trigger params (this will take |
| 2674 | * care of updating tag and length if it is not pre-filled by caller). |
| 2675 | */ |
| 2676 | for (i = 0; i < param->num_ac; i++) { |
| 2677 | WMITLV_SET_HDR((buf_ptr + |
| 2678 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 2679 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 2680 | WMITLV_GET_STRUCT_TLVLEN |
| 2681 | (wmi_sta_uapsd_auto_trig_param)); |
| 2682 | } |
| 2683 | |
| 2684 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2685 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2686 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2687 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2688 | wmi_buf_free(buf); |
| 2689 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2690 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2691 | return ret; |
| 2692 | } |
| 2693 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2694 | /** |
| 2695 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 2696 | * @wmi_handle: pointer to the wmi handle |
| 2697 | * @utc: pointer to the UTC time struct |
| 2698 | * |
| 2699 | * Return: 0 on succes |
| 2700 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2701 | 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] | 2702 | struct ocb_utc_param *utc) |
| 2703 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2704 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2705 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 2706 | uint8_t *buf_ptr; |
| 2707 | uint32_t len, i; |
| 2708 | wmi_buf_t buf; |
| 2709 | |
| 2710 | len = sizeof(*cmd); |
| 2711 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2712 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2713 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2714 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2715 | } |
| 2716 | |
| 2717 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2718 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 2719 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2720 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 2721 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 2722 | cmd->vdev_id = utc->vdev_id; |
| 2723 | |
| 2724 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 2725 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 2726 | |
| 2727 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 2728 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 2729 | |
| 2730 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2731 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2732 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2733 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2734 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2735 | } |
| 2736 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2737 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2738 | } |
| 2739 | |
| 2740 | /** |
| 2741 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 2742 | * frames on a channel |
| 2743 | * @wmi_handle: pointer to the wmi handle |
| 2744 | * @timing_advert: pointer to the timing advertisement struct |
| 2745 | * |
| 2746 | * Return: 0 on succes |
| 2747 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2748 | QDF_STATUS send_ocb_start_timing_advert_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2749 | struct ocb_timing_advert_param *timing_advert) |
| 2750 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2751 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2752 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 2753 | uint8_t *buf_ptr; |
| 2754 | uint32_t len, len_template; |
| 2755 | wmi_buf_t buf; |
| 2756 | |
| 2757 | len = sizeof(*cmd) + |
| 2758 | WMI_TLV_HDR_SIZE; |
| 2759 | |
| 2760 | len_template = timing_advert->template_length; |
| 2761 | /* Add padding to the template if needed */ |
| 2762 | if (len_template % 4 != 0) |
| 2763 | len_template += 4 - (len_template % 4); |
| 2764 | len += len_template; |
| 2765 | |
| 2766 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2767 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2768 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2769 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2770 | } |
| 2771 | |
| 2772 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2773 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 2774 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2775 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 2776 | WMITLV_GET_STRUCT_TLVLEN( |
| 2777 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 2778 | cmd->vdev_id = timing_advert->vdev_id; |
| 2779 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 2780 | cmd->channel_freq = timing_advert->chan_freq; |
| 2781 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 2782 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 2783 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 2784 | buf_ptr += sizeof(*cmd); |
| 2785 | |
| 2786 | /* Add the timing advert template */ |
| 2787 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2788 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2789 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2790 | (uint8_t *)timing_advert->template_value, |
| 2791 | timing_advert->template_length); |
| 2792 | |
| 2793 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2794 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2795 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2796 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2797 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2798 | } |
| 2799 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2800 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2801 | } |
| 2802 | |
| 2803 | /** |
| 2804 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 2805 | * on a channel |
| 2806 | * @wmi_handle: pointer to the wmi handle |
| 2807 | * @timing_advert: pointer to the timing advertisement struct |
| 2808 | * |
| 2809 | * Return: 0 on succes |
| 2810 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2811 | 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] | 2812 | struct ocb_timing_advert_param *timing_advert) |
| 2813 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2814 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2815 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 2816 | uint8_t *buf_ptr; |
| 2817 | uint32_t len; |
| 2818 | wmi_buf_t buf; |
| 2819 | |
| 2820 | len = sizeof(*cmd); |
| 2821 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2822 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2823 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2824 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2825 | } |
| 2826 | |
| 2827 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2828 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 2829 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2830 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 2831 | WMITLV_GET_STRUCT_TLVLEN( |
| 2832 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 2833 | cmd->vdev_id = timing_advert->vdev_id; |
| 2834 | cmd->channel_freq = timing_advert->chan_freq; |
| 2835 | |
| 2836 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2837 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2838 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2839 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2840 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2841 | } |
| 2842 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2843 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2844 | } |
| 2845 | |
| 2846 | /** |
| 2847 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 2848 | * @wmi_handle: pointer to the wmi handle |
| 2849 | * @request: pointer to the request |
| 2850 | * |
| 2851 | * Return: 0 on succes |
| 2852 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2853 | 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] | 2854 | uint8_t vdev_id) |
| 2855 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2856 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2857 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 2858 | uint8_t *buf_ptr; |
| 2859 | wmi_buf_t buf; |
| 2860 | int32_t len; |
| 2861 | |
| 2862 | len = sizeof(*cmd); |
| 2863 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2864 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2865 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2866 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2867 | } |
| 2868 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2869 | |
| 2870 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2871 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2872 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2873 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 2874 | WMITLV_GET_STRUCT_TLVLEN( |
| 2875 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 2876 | cmd->vdev_id = vdev_id; |
| 2877 | |
| 2878 | /* Send the WMI command */ |
| 2879 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2880 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 2881 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2882 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2883 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2884 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2885 | } |
| 2886 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2887 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2888 | } |
| 2889 | |
| 2890 | /** |
| 2891 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 2892 | * @wmi_handle: pointer to the wmi handle |
| 2893 | * @get_stats_param: pointer to the dcc stats |
| 2894 | * |
| 2895 | * Return: 0 on succes |
| 2896 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2897 | 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] | 2898 | struct dcc_get_stats_param *get_stats_param) |
| 2899 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2900 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2901 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 2902 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 2903 | wmi_buf_t buf; |
| 2904 | uint8_t *buf_ptr; |
| 2905 | uint32_t len; |
| 2906 | uint32_t i; |
| 2907 | |
| 2908 | /* Validate the input */ |
| 2909 | if (get_stats_param->request_array_len != |
| 2910 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2911 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2912 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2913 | } |
| 2914 | |
| 2915 | /* Allocate memory for the WMI command */ |
| 2916 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 2917 | get_stats_param->request_array_len; |
| 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")); |
| 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_get_stats_cmd_fixed_param *)buf_ptr; |
| 2930 | buf_ptr += sizeof(*cmd); |
| 2931 | |
| 2932 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2933 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 2934 | WMITLV_GET_STRUCT_TLVLEN( |
| 2935 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 2936 | cmd->vdev_id = get_stats_param->vdev_id; |
| 2937 | cmd->num_channels = get_stats_param->channel_count; |
| 2938 | |
| 2939 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2940 | get_stats_param->request_array_len); |
| 2941 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2942 | |
| 2943 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2944 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2945 | get_stats_param->request_array_len); |
| 2946 | for (i = 0; i < cmd->num_channels; i++) |
| 2947 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 2948 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 2949 | WMITLV_GET_STRUCT_TLVLEN( |
| 2950 | wmi_dcc_channel_stats_request)); |
| 2951 | |
| 2952 | /* Send the WMI command */ |
| 2953 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2954 | WMI_DCC_GET_STATS_CMDID); |
| 2955 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2956 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2957 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2958 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2959 | } |
| 2960 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2961 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2962 | } |
| 2963 | |
| 2964 | /** |
| 2965 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 2966 | * @wmi_handle: pointer to the wmi handle |
| 2967 | * @vdev_id: vdev id |
| 2968 | * @dcc_stats_bitmap: dcc status bitmap |
| 2969 | * |
| 2970 | * Return: 0 on succes |
| 2971 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2972 | 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] | 2973 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 2974 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2975 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2976 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 2977 | wmi_buf_t buf; |
| 2978 | uint8_t *buf_ptr; |
| 2979 | uint32_t len; |
| 2980 | |
| 2981 | /* Allocate memory for the WMI command */ |
| 2982 | len = sizeof(*cmd); |
| 2983 | |
| 2984 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2985 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2986 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2987 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2988 | } |
| 2989 | |
| 2990 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2991 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2992 | |
| 2993 | /* Populate the WMI command */ |
| 2994 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 2995 | |
| 2996 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2997 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 2998 | WMITLV_GET_STRUCT_TLVLEN( |
| 2999 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 3000 | cmd->vdev_id = vdev_id; |
| 3001 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 3002 | |
| 3003 | /* Send the WMI command */ |
| 3004 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3005 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3006 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3007 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3008 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3009 | } |
| 3010 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3011 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3012 | } |
| 3013 | |
| 3014 | /** |
| 3015 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 3016 | * @wmi_handle: pointer to the wmi handle |
| 3017 | * @update_ndl_param: pointer to the request parameters |
| 3018 | * |
| 3019 | * Return: 0 on success |
| 3020 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3021 | 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] | 3022 | struct dcc_update_ndl_param *update_ndl_param) |
| 3023 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3024 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3025 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 3026 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 3027 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 3028 | uint32_t active_state_count; |
| 3029 | wmi_buf_t buf; |
| 3030 | uint8_t *buf_ptr; |
| 3031 | uint32_t len; |
| 3032 | uint32_t i; |
| 3033 | |
| 3034 | /* validate the input */ |
| 3035 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 3036 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3037 | WMI_LOGE(FL("Invalid parameter")); |
| 3038 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3039 | } |
| 3040 | active_state_count = 0; |
| 3041 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 3042 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 3043 | active_state_count += |
| 3044 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 3045 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 3046 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3047 | WMI_LOGE(FL("Invalid parameter")); |
| 3048 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3049 | } |
| 3050 | |
| 3051 | /* Allocate memory for the WMI command */ |
| 3052 | len = sizeof(*cmd) + |
| 3053 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 3054 | WMI_TLV_HDR_SIZE + |
| 3055 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 3056 | |
| 3057 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3058 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3059 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3060 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3061 | } |
| 3062 | |
| 3063 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3064 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3065 | |
| 3066 | /* Populate the WMI command */ |
| 3067 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3068 | buf_ptr += sizeof(*cmd); |
| 3069 | |
| 3070 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3071 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3072 | WMITLV_GET_STRUCT_TLVLEN( |
| 3073 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3074 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3075 | cmd->num_channel = update_ndl_param->channel_count; |
| 3076 | |
| 3077 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3078 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3079 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3080 | |
| 3081 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3082 | 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] | 3083 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3084 | for (i = 0; i < cmd->num_channel; i++) |
| 3085 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3086 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3087 | WMITLV_GET_STRUCT_TLVLEN( |
| 3088 | wmi_dcc_ndl_chan)); |
| 3089 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3090 | |
| 3091 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3092 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3093 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3094 | |
| 3095 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3096 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3097 | update_ndl_param->dcc_ndl_active_state_list, |
| 3098 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3099 | for (i = 0; i < active_state_count; i++) { |
| 3100 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3101 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3102 | WMITLV_GET_STRUCT_TLVLEN( |
| 3103 | wmi_dcc_ndl_active_state_config)); |
| 3104 | } |
| 3105 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3106 | |
| 3107 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3108 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3109 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3110 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3111 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3112 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3113 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3114 | } |
| 3115 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3116 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3117 | } |
| 3118 | |
| 3119 | /** |
| 3120 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3121 | * @wmi_handle: pointer to the wmi handle |
| 3122 | * @config: the OCB configuration |
| 3123 | * |
| 3124 | * Return: 0 on success |
| 3125 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3126 | 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] | 3127 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3128 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3129 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3130 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3131 | wmi_channel *chan; |
| 3132 | wmi_ocb_channel *ocb_chan; |
| 3133 | wmi_qos_parameter *qos_param; |
| 3134 | wmi_dcc_ndl_chan *ndl_chan; |
| 3135 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3136 | wmi_ocb_schedule_element *sched_elem; |
| 3137 | uint8_t *buf_ptr; |
| 3138 | wmi_buf_t buf; |
| 3139 | int32_t len; |
| 3140 | int32_t i, j, active_state_count; |
| 3141 | |
| 3142 | /* |
| 3143 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3144 | * states. Validate dcc_ndl_active_state_list_len. |
| 3145 | */ |
| 3146 | active_state_count = 0; |
| 3147 | if (config->dcc_ndl_chan_list_len) { |
| 3148 | if (!config->dcc_ndl_chan_list || |
| 3149 | config->dcc_ndl_chan_list_len != |
| 3150 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3151 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3152 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3153 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3154 | } |
| 3155 | |
| 3156 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3157 | i < config->channel_count; ++i, ++ndl_chan) |
| 3158 | active_state_count += |
| 3159 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3160 | |
| 3161 | if (active_state_count) { |
| 3162 | if (!config->dcc_ndl_active_state_list || |
| 3163 | config->dcc_ndl_active_state_list_len != |
| 3164 | active_state_count * |
| 3165 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3166 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3167 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3168 | } |
| 3169 | } |
| 3170 | } |
| 3171 | |
| 3172 | len = sizeof(*cmd) + |
| 3173 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3174 | sizeof(wmi_channel) + |
| 3175 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3176 | sizeof(wmi_ocb_channel) + |
| 3177 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3178 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3179 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3180 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3181 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3182 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3183 | sizeof(wmi_ocb_schedule_element); |
| 3184 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3185 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3186 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3187 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3188 | } |
| 3189 | |
| 3190 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3191 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3192 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3193 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3194 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3195 | cmd->vdev_id = config->session_id; |
| 3196 | cmd->channel_count = config->channel_count; |
| 3197 | cmd->schedule_size = config->schedule_size; |
| 3198 | cmd->flags = config->flags; |
| 3199 | buf_ptr += sizeof(*cmd); |
| 3200 | |
| 3201 | /* Add the wmi_channel info */ |
| 3202 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3203 | config->channel_count*sizeof(wmi_channel)); |
| 3204 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3205 | for (i = 0; i < config->channel_count; i++) { |
| 3206 | chan = (wmi_channel *)buf_ptr; |
| 3207 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3208 | WMITLV_TAG_STRUC_wmi_channel, |
| 3209 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3210 | chan->mhz = config->channels[i].chan_freq; |
| 3211 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3212 | chan->band_center_freq2 = 0; |
| 3213 | chan->info = 0; |
| 3214 | |
| 3215 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3216 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3217 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3218 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3219 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3220 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3221 | config->channels[i].antenna_max); |
| 3222 | |
| 3223 | if (config->channels[i].bandwidth < 10) |
| 3224 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3225 | else if (config->channels[i].bandwidth < 20) |
| 3226 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3227 | buf_ptr += sizeof(*chan); |
| 3228 | } |
| 3229 | |
| 3230 | /* Add the wmi_ocb_channel info */ |
| 3231 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3232 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3233 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3234 | for (i = 0; i < config->channel_count; i++) { |
| 3235 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3236 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3237 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 3238 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 3239 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 3240 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 3241 | config->channels[i].mac_address.bytes, |
| 3242 | &ocb_chan->mac_address); |
| 3243 | buf_ptr += sizeof(*ocb_chan); |
| 3244 | } |
| 3245 | |
| 3246 | /* Add the wmi_qos_parameter info */ |
| 3247 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3248 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 3249 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3250 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 3251 | for (i = 0; i < config->channel_count; i++) { |
| 3252 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 3253 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 3254 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 3255 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 3256 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 3257 | qos_param->aifsn = |
| 3258 | config->channels[i].qos_params[j].aifsn; |
| 3259 | qos_param->cwmin = |
| 3260 | config->channels[i].qos_params[j].cwmin; |
| 3261 | qos_param->cwmax = |
| 3262 | config->channels[i].qos_params[j].cwmax; |
| 3263 | buf_ptr += sizeof(*qos_param); |
| 3264 | } |
| 3265 | } |
| 3266 | |
| 3267 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 3268 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3269 | config->dcc_ndl_chan_list_len); |
| 3270 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3271 | if (config->dcc_ndl_chan_list_len) { |
| 3272 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3273 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3274 | config->dcc_ndl_chan_list_len); |
| 3275 | for (i = 0; i < config->channel_count; i++) |
| 3276 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 3277 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3278 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 3279 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 3280 | } |
| 3281 | |
| 3282 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 3283 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 3284 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 3285 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3286 | if (active_state_count) { |
| 3287 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3288 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3289 | config->dcc_ndl_active_state_list, |
| 3290 | active_state_count * sizeof(*ndl_active_config)); |
| 3291 | for (i = 0; i < active_state_count; ++i) |
| 3292 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 3293 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3294 | WMITLV_GET_STRUCT_TLVLEN( |
| 3295 | wmi_dcc_ndl_active_state_config)); |
| 3296 | buf_ptr += active_state_count * |
| 3297 | sizeof(*ndl_active_config); |
| 3298 | } |
| 3299 | |
| 3300 | /* Add the wmi_ocb_schedule_element info */ |
| 3301 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3302 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 3303 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3304 | for (i = 0; i < config->schedule_size; i++) { |
| 3305 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 3306 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 3307 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 3308 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 3309 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 3310 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 3311 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 3312 | buf_ptr += sizeof(*sched_elem); |
| 3313 | } |
| 3314 | |
| 3315 | |
| 3316 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3317 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3318 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3319 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3320 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3321 | } |
| 3322 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3323 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3324 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3325 | |
| 3326 | /** |
| 3327 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 3328 | * @wmi_handle: wmi handle |
| 3329 | * @mcc_adaptive_scheduler: enable/disable |
| 3330 | * |
| 3331 | * This function enable/disable mcc adaptive scheduler in fw. |
| 3332 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3333 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3334 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3335 | QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3336 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 3337 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3338 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3339 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3340 | wmi_buf_t buf = 0; |
| 3341 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 3342 | uint16_t len = |
| 3343 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 3344 | |
| 3345 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3346 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3347 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 3348 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3349 | } |
| 3350 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 3351 | wmi_buf_data(buf); |
| 3352 | |
| 3353 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3354 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 3355 | WMITLV_GET_STRUCT_TLVLEN |
| 3356 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 3357 | cmd->enable = mcc_adaptive_scheduler; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3358 | cmd->pdev_id = pdev_id; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3359 | |
| 3360 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3361 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3362 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3363 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3364 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3365 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3366 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3367 | |
| 3368 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3369 | } |
| 3370 | |
| 3371 | /** |
| 3372 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 3373 | * @wmi: wmi handle |
| 3374 | * @mcc_channel: mcc channel |
| 3375 | * @mcc_channel_time_latency: MCC channel time latency. |
| 3376 | * |
| 3377 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 3378 | * channel of it and channel number. The info is provided run time using |
| 3379 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 3380 | * |
| 3381 | * Return: CDF status |
| 3382 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3383 | 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] | 3384 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 3385 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3386 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3387 | wmi_buf_t buf = 0; |
| 3388 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 3389 | uint16_t len = 0; |
| 3390 | uint8_t *buf_ptr = NULL; |
| 3391 | wmi_resmgr_chan_latency chan_latency; |
| 3392 | /* Note: we only support MCC time latency for a single channel */ |
| 3393 | uint32_t num_channels = 1; |
| 3394 | uint32_t chan1_freq = mcc_channel_freq; |
| 3395 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 3396 | |
| 3397 | |
| 3398 | /* If 0ms latency is provided, then FW will set to a default. |
| 3399 | * Otherwise, latency must be at least 30ms. |
| 3400 | */ |
| 3401 | if ((latency_chan1 > 0) && |
| 3402 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3403 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3404 | "Minimum is 30ms (or 0 to use default value by " |
| 3405 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3406 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3407 | } |
| 3408 | |
| 3409 | /* Set WMI CMD for channel time latency here */ |
| 3410 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 3411 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 3412 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 3413 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3414 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3415 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3416 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3417 | } |
| 3418 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3419 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 3420 | wmi_buf_data(buf); |
| 3421 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 3422 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 3423 | WMITLV_GET_STRUCT_TLVLEN |
| 3424 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 3425 | cmdTL->num_chans = num_channels; |
| 3426 | /* Update channel time latency information for home channel(s) */ |
| 3427 | buf_ptr += sizeof(*cmdTL); |
| 3428 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3429 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 3430 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3431 | chan_latency.chan_mhz = chan1_freq; |
| 3432 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3433 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3434 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3435 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3436 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3437 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3438 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3439 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3440 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3441 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3442 | |
| 3443 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3444 | } |
| 3445 | |
| 3446 | /** |
| 3447 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 3448 | * @wmi: wmi handle |
| 3449 | * @adapter_1_chan_number: adapter 1 channel number |
| 3450 | * @adapter_1_quota: adapter 1 quota |
| 3451 | * @adapter_2_chan_number: adapter 2 channel number |
| 3452 | * |
| 3453 | * Return: CDF status |
| 3454 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3455 | 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] | 3456 | uint32_t adapter_1_chan_freq, |
| 3457 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 3458 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3459 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3460 | wmi_buf_t buf = 0; |
| 3461 | uint16_t len = 0; |
| 3462 | uint8_t *buf_ptr = NULL; |
| 3463 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 3464 | wmi_resmgr_chan_time_quota chan_quota; |
| 3465 | uint32_t quota_chan1 = adapter_1_quota; |
| 3466 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 3467 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 3468 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 3469 | uint32_t num_channels = 2; |
| 3470 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 3471 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 3472 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3473 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3474 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 3475 | chan1_freq, quota_chan1, chan2_freq, |
| 3476 | quota_chan2); |
| 3477 | |
| 3478 | /* |
| 3479 | * Perform sanity check on time quota values provided. |
| 3480 | */ |
| 3481 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 3482 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3483 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3484 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3485 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3486 | } |
| 3487 | /* Set WMI CMD for channel time quota here */ |
| 3488 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 3489 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 3490 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 3491 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3492 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3493 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3494 | QDF_ASSERT(0); |
| 3495 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3496 | } |
| 3497 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3498 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 3499 | wmi_buf_data(buf); |
| 3500 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 3501 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 3502 | WMITLV_GET_STRUCT_TLVLEN |
| 3503 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 3504 | cmdTQ->num_chans = num_channels; |
| 3505 | |
| 3506 | /* Update channel time quota information for home channel(s) */ |
| 3507 | buf_ptr += sizeof(*cmdTQ); |
| 3508 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3509 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 3510 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3511 | chan_quota.chan_mhz = chan1_freq; |
| 3512 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3513 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3514 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 3515 | buf_ptr += sizeof(chan_quota); |
| 3516 | chan_quota.chan_mhz = chan2_freq; |
| 3517 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3518 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3519 | |
| 3520 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3521 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3522 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3523 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3524 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3525 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3526 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3527 | |
| 3528 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3529 | } |
| 3530 | |
| 3531 | /** |
| 3532 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 3533 | * @wmi_handle: Pointer to wmi handle |
| 3534 | * @thermal_info: Thermal command information |
| 3535 | * |
| 3536 | * This function sends the thermal management command |
| 3537 | * to the firmware |
| 3538 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3539 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3540 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3541 | 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] | 3542 | struct thermal_cmd_params *thermal_info) |
| 3543 | { |
| 3544 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 3545 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3546 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3547 | uint32_t len = 0; |
| 3548 | |
| 3549 | len = sizeof(*cmd); |
| 3550 | |
| 3551 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3552 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3553 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3554 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3555 | } |
| 3556 | |
| 3557 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 3558 | |
| 3559 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3560 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 3561 | WMITLV_GET_STRUCT_TLVLEN |
| 3562 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 3563 | |
| 3564 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 3565 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 3566 | cmd->enable = thermal_info->thermal_enable; |
| 3567 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3568 | 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] | 3569 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 3570 | |
| 3571 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3572 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3573 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3574 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3575 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3576 | } |
| 3577 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3578 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3579 | } |
| 3580 | |
| 3581 | |
| 3582 | /** |
| 3583 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3584 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3585 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 3586 | * |
| 3587 | * This function sends down the LRO configuration parameters to |
| 3588 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 3589 | * seed values for the toeplitz hash generation |
| 3590 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3591 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3592 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3593 | QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3594 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 3595 | { |
| 3596 | wmi_lro_info_cmd_fixed_param *cmd; |
| 3597 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3598 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3599 | |
| 3600 | |
| 3601 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3602 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3603 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3604 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3605 | } |
| 3606 | |
| 3607 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 3608 | |
| 3609 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3610 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 3611 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 3612 | |
| 3613 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 3614 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 3615 | wmi_lro_cmd->tcp_flag); |
| 3616 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 3617 | wmi_lro_cmd->tcp_flag_mask); |
| 3618 | cmd->toeplitz_hash_ipv4_0_3 = |
| 3619 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 3620 | cmd->toeplitz_hash_ipv4_4_7 = |
| 3621 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 3622 | cmd->toeplitz_hash_ipv4_8_11 = |
| 3623 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 3624 | cmd->toeplitz_hash_ipv4_12_15 = |
| 3625 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 3626 | cmd->toeplitz_hash_ipv4_16 = |
| 3627 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 3628 | |
| 3629 | cmd->toeplitz_hash_ipv6_0_3 = |
| 3630 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 3631 | cmd->toeplitz_hash_ipv6_4_7 = |
| 3632 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 3633 | cmd->toeplitz_hash_ipv6_8_11 = |
| 3634 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 3635 | cmd->toeplitz_hash_ipv6_12_15 = |
| 3636 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 3637 | cmd->toeplitz_hash_ipv6_16_19 = |
| 3638 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 3639 | cmd->toeplitz_hash_ipv6_20_23 = |
| 3640 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 3641 | cmd->toeplitz_hash_ipv6_24_27 = |
| 3642 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 3643 | cmd->toeplitz_hash_ipv6_28_31 = |
| 3644 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 3645 | cmd->toeplitz_hash_ipv6_32_35 = |
| 3646 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 3647 | cmd->toeplitz_hash_ipv6_36_39 = |
| 3648 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 3649 | cmd->toeplitz_hash_ipv6_40 = |
| 3650 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 3651 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3652 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3653 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 3654 | |
| 3655 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 3656 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3657 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3658 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3659 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3660 | } |
| 3661 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3662 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3663 | } |
| 3664 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3665 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3666 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 3667 | * @wmi_handle: Pointer to wmi handle |
| 3668 | * @rate_report_params: Pointer to peer rate report parameters |
| 3669 | * |
| 3670 | * |
| 3671 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 3672 | */ |
| 3673 | QDF_STATUS send_peer_rate_report_cmd_tlv(wmi_unified_t wmi_handle, |
| 3674 | struct wmi_peer_rate_report_params *rate_report_params) |
| 3675 | { |
| 3676 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 3677 | wmi_buf_t buf = NULL; |
| 3678 | QDF_STATUS status = 0; |
| 3679 | uint32_t len = 0; |
| 3680 | uint32_t i, j; |
| 3681 | |
| 3682 | len = sizeof(*cmd); |
| 3683 | |
| 3684 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3685 | if (!buf) { |
| 3686 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 3687 | return QDF_STATUS_E_FAILURE; |
| 3688 | } |
| 3689 | |
| 3690 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 3691 | wmi_buf_data(buf); |
| 3692 | |
| 3693 | WMITLV_SET_HDR( |
| 3694 | &cmd->tlv_header, |
| 3695 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 3696 | WMITLV_GET_STRUCT_TLVLEN( |
| 3697 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 3698 | |
| 3699 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 3700 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 3701 | cmd->report_timer_period = rate_report_params->timer_period; |
| 3702 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 3703 | cmd->cond_per_phy[i].val_cond_flags = |
| 3704 | rate_report_params->report_per_phy[i].cond_flags; |
| 3705 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 3706 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 3707 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 3708 | rate_report_params->report_per_phy[i].delta.percent; |
| 3709 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 3710 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 3711 | rate_report_params->report_per_phy[i]. |
| 3712 | report_rate_threshold[j]; |
| 3713 | } |
| 3714 | } |
| 3715 | |
| 3716 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 3717 | cmd->enable_rate_report, |
| 3718 | cmd->report_backoff_time, cmd->report_timer_period); |
| 3719 | |
| 3720 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3721 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 3722 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3723 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3724 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 3725 | __func__); |
| 3726 | } |
| 3727 | return status; |
| 3728 | } |
| 3729 | |
| 3730 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3731 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 3732 | * @wmi_handle: wmi handle |
| 3733 | * @param: bcn ll cmd parameter |
| 3734 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3735 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3736 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3737 | 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] | 3738 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 3739 | { |
| 3740 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 3741 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3742 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3743 | |
| 3744 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3745 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3746 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3747 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3748 | } |
| 3749 | |
| 3750 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 3751 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3752 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 3753 | WMITLV_GET_STRUCT_TLVLEN |
| 3754 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 3755 | cmd->vdev_id = param->vdev_id; |
| 3756 | cmd->data_len = param->data_len; |
| 3757 | cmd->frame_ctrl = param->frame_ctrl; |
| 3758 | cmd->frag_ptr = param->frag_ptr; |
| 3759 | cmd->dtim_flag = param->dtim_flag; |
| 3760 | |
| 3761 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 3762 | WMI_PDEV_SEND_BCN_CMDID); |
| 3763 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3764 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3765 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3766 | wmi_buf_free(wmi_buf); |
| 3767 | } |
| 3768 | |
| 3769 | return ret; |
| 3770 | } |
| 3771 | |
| 3772 | /** |
| 3773 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 3774 | * @wmi_handle: wmi handle |
| 3775 | * @vdev_id: vdev id |
| 3776 | * @max_retries: max retries |
| 3777 | * @retry_interval: retry interval |
| 3778 | * This function sets sta query related parameters in fw. |
| 3779 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3780 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3781 | */ |
| 3782 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3783 | 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] | 3784 | uint8_t vdev_id, uint32_t max_retries, |
| 3785 | uint32_t retry_interval) |
| 3786 | { |
| 3787 | wmi_buf_t buf; |
| 3788 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 3789 | int len; |
| 3790 | |
| 3791 | len = sizeof(*cmd); |
| 3792 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3793 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3794 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3795 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3796 | } |
| 3797 | |
| 3798 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 3799 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3800 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 3801 | WMITLV_GET_STRUCT_TLVLEN |
| 3802 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 3803 | |
| 3804 | |
| 3805 | cmd->vdev_id = vdev_id; |
| 3806 | cmd->sa_query_max_retry_count = max_retries; |
| 3807 | cmd->sa_query_retry_interval = retry_interval; |
| 3808 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3809 | 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] | 3810 | vdev_id, retry_interval, max_retries); |
| 3811 | |
| 3812 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3813 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3814 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3815 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3816 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3817 | } |
| 3818 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3819 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3820 | return 0; |
| 3821 | } |
| 3822 | |
| 3823 | /** |
| 3824 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 3825 | * @wmi_handle: wmi handle |
| 3826 | * @params: sta keep alive parameter |
| 3827 | * |
| 3828 | * This function sets keep alive related parameters in fw. |
| 3829 | * |
| 3830 | * Return: CDF status |
| 3831 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3832 | 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] | 3833 | struct sta_params *params) |
| 3834 | { |
| 3835 | wmi_buf_t buf; |
| 3836 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 3837 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 3838 | uint8_t *buf_ptr; |
| 3839 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3840 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3841 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3842 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3843 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3844 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 3845 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3846 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3847 | WMI_LOGE("wmi_buf_alloc failed"); |
| 3848 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3849 | } |
| 3850 | |
| 3851 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 3852 | buf_ptr = (uint8_t *) cmd; |
| 3853 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3854 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 3855 | WMITLV_GET_STRUCT_TLVLEN |
| 3856 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 3857 | cmd->interval = params->timeperiod; |
| 3858 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 3859 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3860 | 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] | 3861 | params->timeperiod, params->method); |
| 3862 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 3863 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 3864 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 3865 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 3866 | |
| 3867 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 3868 | if ((NULL == params->hostv4addr) || |
| 3869 | (NULL == params->destv4addr) || |
| 3870 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3871 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3872 | "destv4addr:%p destmac:%p ", __func__, |
| 3873 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3874 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3875 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3876 | } |
| 3877 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3878 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3879 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3880 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3881 | WMI_IPV4_ADDR_LEN); |
| 3882 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 3883 | } else { |
| 3884 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 3885 | } |
| 3886 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3887 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3888 | WMI_STA_KEEPALIVE_CMDID); |
| 3889 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3890 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3891 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3892 | } |
| 3893 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3894 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3895 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3896 | } |
| 3897 | |
| 3898 | /** |
| 3899 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 3900 | * @wmi_handle: wmi handle |
| 3901 | * @if_id: vdev id |
| 3902 | * @gtx_info: GTX config params |
| 3903 | * |
| 3904 | * This function set GTX related params in firmware. |
| 3905 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3906 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3907 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3908 | 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] | 3909 | struct wmi_gtx_config *gtx_info) |
| 3910 | { |
| 3911 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 3912 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3913 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3914 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3915 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3916 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3917 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3918 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3919 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3920 | } |
| 3921 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 3922 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3923 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 3924 | WMITLV_GET_STRUCT_TLVLEN |
| 3925 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 3926 | cmd->vdev_id = if_id; |
| 3927 | |
| 3928 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 3929 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 3930 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 3931 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 3932 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 3933 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 3934 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 3935 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 3936 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3937 | 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] | 3938 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 3939 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 3940 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 3941 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 3942 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3943 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3944 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3945 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 3946 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 3947 | wmi_buf_free(buf); |
| 3948 | } |
| 3949 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3950 | } |
| 3951 | |
| 3952 | /** |
| 3953 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 3954 | * @wmi_handle: wmi handle |
| 3955 | * @edca_params: edca parameters |
| 3956 | * |
| 3957 | * This function updates EDCA parameters to the target |
| 3958 | * |
| 3959 | * Return: CDF Status |
| 3960 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3961 | 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] | 3962 | uint8_t vdev_id, |
| 3963 | wmi_wmm_vparams gwmm_param[WMI_MAX_NUM_AC]) |
| 3964 | { |
| 3965 | uint8_t *buf_ptr; |
| 3966 | wmi_buf_t buf; |
| 3967 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
| 3968 | wmi_wmm_vparams *wmm_param, *twmm_param; |
| 3969 | int len = sizeof(*cmd); |
| 3970 | int ac; |
| 3971 | |
| 3972 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3973 | |
| 3974 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3975 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3976 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3977 | } |
| 3978 | |
| 3979 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3980 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 3981 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3982 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3983 | WMITLV_GET_STRUCT_TLVLEN |
| 3984 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 3985 | cmd->vdev_id = vdev_id; |
| 3986 | |
| 3987 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 3988 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
| 3989 | twmm_param = (wmi_wmm_vparams *) (&gwmm_param[ac]); |
| 3990 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 3991 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3992 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 3993 | wmm_param->cwmin = twmm_param->cwmin; |
| 3994 | wmm_param->cwmax = twmm_param->cwmax; |
| 3995 | wmm_param->aifs = twmm_param->aifs; |
| 3996 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 3997 | wmm_param->acm = twmm_param->acm; |
| 3998 | wmm_param->no_ack = twmm_param->no_ack; |
| 3999 | } |
| 4000 | |
| 4001 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4002 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 4003 | goto fail; |
| 4004 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4005 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4006 | |
| 4007 | fail: |
| 4008 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4009 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 4010 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4011 | } |
| 4012 | |
| 4013 | /** |
| 4014 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 4015 | * @wmi_handle: wmi handle |
| 4016 | * @vdev_id: vdev id |
| 4017 | * @probe_rsp_info: probe response info |
| 4018 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4019 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4020 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4021 | 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] | 4022 | uint8_t vdev_id, |
| 4023 | struct wmi_probe_resp_params *probe_rsp_info, |
| 4024 | uint8_t *frm) |
| 4025 | { |
| 4026 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 4027 | wmi_bcn_prb_info *bcn_prb_info; |
| 4028 | wmi_buf_t wmi_buf; |
| 4029 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 4030 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4031 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4032 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4033 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4034 | |
| 4035 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 4036 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 4037 | |
| 4038 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 4039 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 4040 | tmpl_len_aligned; |
| 4041 | |
| 4042 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4043 | 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] | 4044 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4045 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4046 | } |
| 4047 | |
| 4048 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4049 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4050 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4051 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4052 | } |
| 4053 | |
| 4054 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4055 | |
| 4056 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 4057 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4058 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 4059 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 4060 | cmd->vdev_id = vdev_id; |
| 4061 | cmd->buf_len = tmpl_len; |
| 4062 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 4063 | |
| 4064 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4065 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4066 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4067 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4068 | bcn_prb_info->caps = 0; |
| 4069 | bcn_prb_info->erp = 0; |
| 4070 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4071 | |
| 4072 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4073 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4074 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4075 | |
| 4076 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4077 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4078 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4079 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4080 | wmi_buf_free(wmi_buf); |
| 4081 | } |
| 4082 | |
| 4083 | return ret; |
| 4084 | } |
| 4085 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4086 | #ifdef FEATURE_WLAN_WAPI |
| 4087 | #define WPI_IV_LEN 16 |
| 4088 | |
| 4089 | /** |
| 4090 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4091 | * |
| 4092 | * @dest_tx: destination address of tsc key counter |
| 4093 | * @src_tx: source address of tsc key counter |
| 4094 | * @dest_rx: destination address of rsc key counter |
| 4095 | * @src_rx: source address of rsc key counter |
| 4096 | * |
| 4097 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4098 | * |
| 4099 | * Return: None |
| 4100 | * |
| 4101 | */ |
| 4102 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4103 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4104 | { |
| 4105 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4106 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4107 | } |
| 4108 | #else |
| 4109 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4110 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4111 | { |
| 4112 | return; |
| 4113 | } |
| 4114 | #endif |
| 4115 | |
| 4116 | /** |
| 4117 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4118 | * @wmi_handle: wmi handle |
| 4119 | * @key_params: key parameters |
| 4120 | * |
| 4121 | * This function fills structure from information |
| 4122 | * passed in key_params. |
| 4123 | * |
| 4124 | * Return: QDF_STATUS_SUCCESS - success |
| 4125 | * QDF_STATUS_E_FAILURE - failure |
| 4126 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4127 | */ |
| 4128 | QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle, |
| 4129 | struct set_key_params *key_params) |
| 4130 | { |
| 4131 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4132 | wmi_buf_t buf; |
| 4133 | uint8_t *buf_ptr; |
| 4134 | uint32_t len; |
| 4135 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4136 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4137 | |
| 4138 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4139 | WMI_TLV_HDR_SIZE; |
| 4140 | |
| 4141 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4142 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4143 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4144 | return QDF_STATUS_E_NOMEM; |
| 4145 | } |
| 4146 | |
| 4147 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4148 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4149 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4150 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4151 | WMITLV_GET_STRUCT_TLVLEN |
| 4152 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4153 | cmd->vdev_id = key_params->vdev_id; |
| 4154 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame^] | 4155 | |
| 4156 | if (key_params->key_idx >= (IEEE80211_WEP_NKID + 1)) |
| 4157 | cmd->key_ix = 0; |
| 4158 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4159 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4160 | cmd->key_flags |= key_params->key_flags; |
| 4161 | cmd->key_cipher = key_params->key_cipher; |
| 4162 | if ((key_params->key_txmic_len) && |
| 4163 | (key_params->key_rxmic_len)) { |
| 4164 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4165 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4166 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4167 | #ifdef FEATURE_WLAN_WAPI |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4168 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4169 | key_params->tx_iv, |
| 4170 | cmd->wpi_key_rsc_counter, |
| 4171 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4172 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4173 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4174 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4175 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4176 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4177 | qdf_mem_copy((void *)key_data, |
| 4178 | (const void *)key_params->key_data, key_params->key_len); |
| 4179 | cmd->key_len = key_params->key_len; |
| 4180 | |
| 4181 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4182 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4183 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4184 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4185 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4186 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4187 | } |
| 4188 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4189 | /** |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 4190 | * send_sar_limit_cmd_tlv() - send sar limit cmd to fw |
| 4191 | * @wmi_handle: wmi handle |
| 4192 | * @params: sar limit params |
| 4193 | * |
| 4194 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4195 | */ |
| 4196 | static QDF_STATUS send_sar_limit_cmd_tlv(wmi_unified_t wmi_handle, |
| 4197 | struct sar_limit_cmd_params *sar_limit_params) |
| 4198 | { |
| 4199 | wmi_buf_t buf; |
| 4200 | QDF_STATUS qdf_status; |
| 4201 | wmi_sar_limits_cmd_fixed_param *cmd; |
| 4202 | int i; |
| 4203 | uint8_t *buf_ptr; |
| 4204 | wmi_sar_limit_cmd_row *wmi_sar_rows_list; |
| 4205 | struct sar_limit_cmd_row *sar_rows_list; |
| 4206 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4207 | |
| 4208 | len += sizeof(wmi_sar_limit_cmd_row) * sar_limit_params->num_limit_rows; |
| 4209 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4210 | if (!buf) { |
| 4211 | WMI_LOGE("Failed to allocate memory"); |
| 4212 | qdf_status = QDF_STATUS_E_NOMEM; |
| 4213 | goto end; |
| 4214 | } |
| 4215 | |
| 4216 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4217 | cmd = (wmi_sar_limits_cmd_fixed_param *) buf_ptr; |
| 4218 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4219 | WMITLV_TAG_STRUC_wmi_sar_limits_cmd_fixed_param, |
| 4220 | WMITLV_GET_STRUCT_TLVLEN |
| 4221 | (wmi_sar_limits_cmd_fixed_param)); |
| 4222 | cmd->sar_enable = sar_limit_params->sar_enable; |
| 4223 | cmd->commit_limits = sar_limit_params->commit_limits; |
| 4224 | cmd->num_limit_rows = sar_limit_params->num_limit_rows; |
| 4225 | |
| 4226 | WMI_LOGD("no of sar rows = %d, len = %d", |
| 4227 | sar_limit_params->num_limit_rows, len); |
| 4228 | buf_ptr += sizeof(*cmd); |
| 4229 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4230 | sizeof(wmi_sar_limit_cmd_row) * |
| 4231 | sar_limit_params->num_limit_rows); |
| 4232 | if (cmd->num_limit_rows == 0) |
| 4233 | goto send_sar_limits; |
| 4234 | |
| 4235 | wmi_sar_rows_list = (wmi_sar_limit_cmd_row *) |
| 4236 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4237 | sar_rows_list = sar_limit_params->sar_limit_row_list; |
| 4238 | |
| 4239 | for (i = 0; i < sar_limit_params->num_limit_rows; i++) { |
| 4240 | WMITLV_SET_HDR(&wmi_sar_rows_list->tlv_header, |
| 4241 | WMITLV_TAG_STRUC_wmi_sar_limit_cmd_row, |
| 4242 | WMITLV_GET_STRUCT_TLVLEN(wmi_sar_limit_cmd_row)); |
| 4243 | wmi_sar_rows_list->band_id = sar_rows_list->band_id; |
| 4244 | wmi_sar_rows_list->chain_id = sar_rows_list->chain_id; |
| 4245 | wmi_sar_rows_list->mod_id = sar_rows_list->mod_id; |
| 4246 | wmi_sar_rows_list->limit_value = sar_rows_list->limit_value; |
| 4247 | wmi_sar_rows_list->validity_bitmap = |
| 4248 | sar_rows_list->validity_bitmap; |
| 4249 | WMI_LOGD("row %d, band_id = %d, chain_id = %d, mod_id = %d, limit_value = %d, validity_bitmap = %d", |
| 4250 | i, wmi_sar_rows_list->band_id, |
| 4251 | wmi_sar_rows_list->chain_id, |
| 4252 | wmi_sar_rows_list->mod_id, |
| 4253 | wmi_sar_rows_list->limit_value, |
| 4254 | wmi_sar_rows_list->validity_bitmap); |
| 4255 | sar_rows_list++; |
| 4256 | wmi_sar_rows_list++; |
| 4257 | } |
| 4258 | send_sar_limits: |
| 4259 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4260 | WMI_SAR_LIMITS_CMDID); |
| 4261 | |
| 4262 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 4263 | WMI_LOGE("Failed to send WMI_SAR_LIMITS_CMDID"); |
| 4264 | wmi_buf_free(buf); |
| 4265 | } |
| 4266 | |
| 4267 | end: |
| 4268 | return qdf_status; |
| 4269 | } |
| 4270 | |
| 4271 | /** |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4272 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 4273 | * @wmi_handle: wmi handle |
| 4274 | * @params: encrypt/decrypt params |
| 4275 | * |
| 4276 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4277 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 4278 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4279 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 4280 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 4281 | { |
| 4282 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 4283 | wmi_buf_t wmi_buf; |
| 4284 | uint8_t *buf_ptr; |
| 4285 | QDF_STATUS ret; |
| 4286 | uint32_t len; |
| 4287 | |
| 4288 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 4289 | |
| 4290 | len = sizeof(*cmd) + |
| 4291 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 4292 | WMI_TLV_HDR_SIZE; |
| 4293 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4294 | if (!wmi_buf) { |
| 4295 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 4296 | __func__); |
| 4297 | return QDF_STATUS_E_NOMEM; |
| 4298 | } |
| 4299 | |
| 4300 | buf_ptr = wmi_buf_data(wmi_buf); |
| 4301 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 4302 | |
| 4303 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4304 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 4305 | WMITLV_GET_STRUCT_TLVLEN( |
| 4306 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 4307 | |
| 4308 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 4309 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 4310 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 4311 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 4312 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 4313 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 4314 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 4315 | |
| 4316 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 4317 | encrypt_decrypt_params->key_len); |
| 4318 | |
| 4319 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 4320 | MAX_MAC_HEADER_LEN); |
| 4321 | |
| 4322 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 4323 | |
| 4324 | if (cmd->data_len) { |
| 4325 | buf_ptr += sizeof(*cmd); |
| 4326 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4327 | roundup(encrypt_decrypt_params->data_len, |
| 4328 | sizeof(A_UINT32))); |
| 4329 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4330 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 4331 | encrypt_decrypt_params->data_len); |
| 4332 | } |
| 4333 | |
| 4334 | /* This conversion is to facilitate data to FW in little endian */ |
| 4335 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 4336 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 4337 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 4338 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 4339 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 4340 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 4341 | |
| 4342 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4343 | wmi_buf, len, |
| 4344 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 4345 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4346 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 4347 | wmi_buf_free(wmi_buf); |
| 4348 | } |
| 4349 | |
| 4350 | return ret; |
| 4351 | } |
| 4352 | |
| 4353 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4354 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4355 | /** |
| 4356 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 4357 | * @wmi_handle: wmi handle |
| 4358 | * @vdev_id: vdev id |
| 4359 | * @p2p_ie: p2p IE |
| 4360 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4361 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4362 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4363 | 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] | 4364 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 4365 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4366 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4367 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 4368 | wmi_buf_t wmi_buf; |
| 4369 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 4370 | uint8_t *buf_ptr; |
| 4371 | |
| 4372 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 4373 | |
| 4374 | /* More than one P2P IE may be included in a single frame. |
| 4375 | If multiple P2P IEs are present, the complete P2P attribute |
| 4376 | data consists of the concatenation of the P2P Attribute |
| 4377 | fields of the P2P IEs. The P2P Attributes field of each |
| 4378 | P2P IE may be any length up to the maximum (251 octets). |
| 4379 | In this case host sends one P2P IE to firmware so the length |
| 4380 | should not exceed more than 251 bytes |
| 4381 | */ |
| 4382 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4383 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4384 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4385 | } |
| 4386 | |
| 4387 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 4388 | |
| 4389 | wmi_buf_len = |
| 4390 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 4391 | WMI_TLV_HDR_SIZE; |
| 4392 | |
| 4393 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4394 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4395 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4396 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4397 | } |
| 4398 | |
| 4399 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4400 | |
| 4401 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 4402 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4403 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 4404 | WMITLV_GET_STRUCT_TLVLEN |
| 4405 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 4406 | cmd->vdev_id = vdev_id; |
| 4407 | cmd->ie_buf_len = ie_len; |
| 4408 | |
| 4409 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 4410 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 4411 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4412 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4413 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4414 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4415 | |
| 4416 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4417 | wmi_buf, wmi_buf_len, |
| 4418 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4419 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4420 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4421 | wmi_buf_free(wmi_buf); |
| 4422 | } |
| 4423 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4424 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4425 | return ret; |
| 4426 | } |
| 4427 | |
| 4428 | /** |
| 4429 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 4430 | * @wmi_handle: wmi handle |
| 4431 | * @req: gateway parameter update request structure |
| 4432 | * |
| 4433 | * This function reads the incoming @req and fill in the destination |
| 4434 | * WMI structure and sends down the gateway configs down to the firmware |
| 4435 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4436 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4437 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4438 | 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] | 4439 | struct gateway_update_req_param *req) |
| 4440 | { |
| 4441 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 4442 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4443 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4444 | int len = sizeof(*cmd); |
| 4445 | |
| 4446 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4447 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4448 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4449 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4450 | } |
| 4451 | |
| 4452 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 4453 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4454 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 4455 | WMITLV_GET_STRUCT_TLVLEN( |
| 4456 | wmi_roam_subnet_change_config_fixed_param)); |
| 4457 | |
| 4458 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4459 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 4460 | QDF_IPV4_ADDR_SIZE); |
| 4461 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 4462 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4463 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 4464 | &cmd->inet_gw_mac_addr); |
| 4465 | cmd->max_retries = req->max_retries; |
| 4466 | cmd->timeout = req->timeout; |
| 4467 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 4468 | cmd->flag = 0; |
| 4469 | if (req->ipv4_addr_type) |
| 4470 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 4471 | |
| 4472 | if (req->ipv6_addr_type) |
| 4473 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 4474 | |
| 4475 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4476 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4477 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4478 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4479 | ret); |
| 4480 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4481 | } |
| 4482 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4483 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4484 | } |
| 4485 | |
| 4486 | /** |
| 4487 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 4488 | * @wmi_handle: wmi handle |
| 4489 | * @req: rssi monitoring request structure |
| 4490 | * |
| 4491 | * This function reads the incoming @req and fill in the destination |
| 4492 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 4493 | * |
| 4494 | * Return: 0 on success; error number otherwise |
| 4495 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4496 | 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] | 4497 | struct rssi_monitor_param *req) |
| 4498 | { |
| 4499 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 4500 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4501 | QDF_STATUS ret; |
| 4502 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4503 | |
| 4504 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4505 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4506 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4507 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4508 | } |
| 4509 | |
| 4510 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 4511 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4512 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 4513 | WMITLV_GET_STRUCT_TLVLEN( |
| 4514 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 4515 | |
| 4516 | cmd->vdev_id = req->session_id; |
| 4517 | cmd->request_id = req->request_id; |
| 4518 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 4519 | cmd->hi_rssi_reenable_histeresis = 0; |
| 4520 | cmd->min_report_interval = 0; |
| 4521 | cmd->max_num_report = 1; |
| 4522 | if (req->control) { |
| 4523 | /* enable one threshold for each min/max */ |
| 4524 | cmd->enabled_bitmap = 0x09; |
| 4525 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 4526 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 4527 | } else { |
| 4528 | cmd->enabled_bitmap = 0; |
| 4529 | cmd->low_rssi_breach_threshold[0] = 0; |
| 4530 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 4531 | } |
| 4532 | |
| 4533 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4534 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4535 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4536 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4537 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4538 | } |
| 4539 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4540 | WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4541 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4542 | } |
| 4543 | |
| 4544 | /** |
| 4545 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 4546 | * @wmi_handle: wmi handle |
| 4547 | * @psetoui: OUI parameters |
| 4548 | * |
| 4549 | * set scan probe OUI parameters in firmware |
| 4550 | * |
| 4551 | * Return: CDF status |
| 4552 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4553 | 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] | 4554 | struct scan_mac_oui *psetoui) |
| 4555 | { |
| 4556 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 4557 | wmi_buf_t wmi_buf; |
| 4558 | uint32_t len; |
| 4559 | uint8_t *buf_ptr; |
| 4560 | uint32_t *oui_buf; |
| 4561 | |
| 4562 | len = sizeof(*cmd); |
| 4563 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4564 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4565 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4566 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4567 | } |
| 4568 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4569 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 4570 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4571 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 4572 | WMITLV_GET_STRUCT_TLVLEN |
| 4573 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 4574 | |
| 4575 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4576 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4577 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 4578 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4579 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4580 | cmd->prob_req_oui); |
| 4581 | |
| 4582 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4583 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4584 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4585 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4586 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4587 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4588 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4589 | } |
| 4590 | |
| 4591 | /** |
| 4592 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 4593 | * @wmi_handle: wmi handle |
| 4594 | * @req: passpoint network request structure |
| 4595 | * |
| 4596 | * This function sends down WMI command with network id set to wildcard id. |
| 4597 | * firmware shall clear all the config entries |
| 4598 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4599 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4600 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4601 | 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] | 4602 | struct wifi_passpoint_req_param *req) |
| 4603 | { |
| 4604 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 4605 | wmi_buf_t buf; |
| 4606 | uint32_t len; |
| 4607 | int ret; |
| 4608 | |
| 4609 | len = sizeof(*cmd); |
| 4610 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4611 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4612 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4613 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4614 | } |
| 4615 | |
| 4616 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 4617 | |
| 4618 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4619 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 4620 | WMITLV_GET_STRUCT_TLVLEN( |
| 4621 | wmi_passpoint_config_cmd_fixed_param)); |
| 4622 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 4623 | |
| 4624 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4625 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 4626 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4627 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4628 | __func__); |
| 4629 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4630 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4631 | } |
| 4632 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4633 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4634 | } |
| 4635 | |
| 4636 | /** |
| 4637 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 4638 | * @wmi_handle: wmi handle |
| 4639 | * @req: passpoint network request structure |
| 4640 | * |
| 4641 | * This function reads the incoming @req and fill in the destination |
| 4642 | * WMI structure and send down the passpoint configs down to the firmware |
| 4643 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4644 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4645 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4646 | 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] | 4647 | struct wifi_passpoint_req_param *req) |
| 4648 | { |
| 4649 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 4650 | u_int8_t i, j, *bytes; |
| 4651 | wmi_buf_t buf; |
| 4652 | uint32_t len; |
| 4653 | int ret; |
| 4654 | |
| 4655 | len = sizeof(*cmd); |
| 4656 | for (i = 0; i < req->num_networks; i++) { |
| 4657 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4658 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4659 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4660 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4661 | } |
| 4662 | |
| 4663 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 4664 | wmi_buf_data(buf); |
| 4665 | |
| 4666 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4667 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 4668 | WMITLV_GET_STRUCT_TLVLEN( |
| 4669 | wmi_passpoint_config_cmd_fixed_param)); |
| 4670 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4671 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 4672 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4673 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4674 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4675 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 4676 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4677 | 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] | 4678 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 4679 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 4680 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4681 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4682 | &req->networks[i].roaming_consortium_ids[j], |
| 4683 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 4684 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4685 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4686 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4687 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4688 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 4689 | |
| 4690 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4691 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 4692 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4693 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4694 | __func__); |
| 4695 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4696 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4697 | } |
| 4698 | } |
| 4699 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4700 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4701 | } |
| 4702 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4703 | /** |
| 4704 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 4705 | * @wmi_handle: wmi handle |
| 4706 | * @scan_cmd_fp: start scan command ptr |
| 4707 | * @roam_req: roam request param |
| 4708 | * |
| 4709 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 4710 | * of WMI_ROAM_SCAN_MODE. |
| 4711 | * |
| 4712 | * Return: QDF status |
| 4713 | */ |
| 4714 | QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 4715 | wmi_start_scan_cmd_fixed_param * |
| 4716 | scan_cmd_fp, |
| 4717 | struct roam_offload_scan_params *roam_req) |
| 4718 | { |
| 4719 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4720 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4721 | int len; |
| 4722 | uint8_t *buf_ptr; |
| 4723 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4724 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4725 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4726 | int auth_mode = roam_req->auth_mode; |
| 4727 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 4728 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 4729 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 4730 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4731 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4732 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4733 | /* Need to create a buf with roam_scan command at |
| 4734 | * front and piggyback with scan command */ |
| 4735 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 4736 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4737 | (2 * WMI_TLV_HDR_SIZE) + |
| 4738 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4739 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 4740 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4741 | if (roam_req->is_roam_req_valid && |
| 4742 | roam_req->roam_offload_enabled) { |
| 4743 | len += sizeof(wmi_roam_offload_tlv_param); |
| 4744 | len += WMI_TLV_HDR_SIZE; |
| 4745 | if ((auth_mode != WMI_AUTH_NONE) && |
| 4746 | ((auth_mode != WMI_AUTH_OPEN) || |
| 4747 | (auth_mode == WMI_AUTH_OPEN && |
| 4748 | roam_req->mdid.mdie_present) || |
| 4749 | roam_req->is_ese_assoc)) { |
| 4750 | len += WMI_TLV_HDR_SIZE; |
| 4751 | if (roam_req->is_ese_assoc) |
| 4752 | len += |
| 4753 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 4754 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 4755 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 4756 | (auth_mode == WMI_AUTH_OPEN && |
| 4757 | roam_req->mdid.mdie_present)) |
| 4758 | len += |
| 4759 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 4760 | else |
| 4761 | len += |
| 4762 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 4763 | } else { |
| 4764 | len += WMI_TLV_HDR_SIZE; |
| 4765 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4766 | |
| 4767 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 4768 | + roundup(roam_req->assoc_ie_length, |
| 4769 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4770 | } else { |
| 4771 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4772 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4773 | __func__, roam_req->roam_offload_enabled); |
| 4774 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4775 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4776 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4777 | } |
| 4778 | if (roam_req->is_roam_req_valid && |
| 4779 | roam_req->roam_offload_enabled) { |
| 4780 | roam_req->mode = roam_req->mode | |
| 4781 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 4782 | } |
| 4783 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4784 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4785 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 4786 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 4787 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 4788 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4789 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4790 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4791 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4792 | return QDF_STATUS_E_NOMEM; |
| 4793 | } |
| 4794 | |
| 4795 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4796 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4797 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 4798 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 4799 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 4800 | WMITLV_GET_STRUCT_TLVLEN |
| 4801 | (wmi_roam_scan_mode_fixed_param)); |
| 4802 | |
| 4803 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 4804 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4805 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 4806 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 4807 | goto send_roam_scan_mode_cmd; |
| 4808 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4809 | /* Fill in scan parameters suitable for roaming scan */ |
| 4810 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4811 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4812 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 4813 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 4814 | /* Ensure there is no additional IEs */ |
| 4815 | scan_cmd_fp->ie_len = 0; |
| 4816 | WMITLV_SET_HDR(buf_ptr, |
| 4817 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 4818 | WMITLV_GET_STRUCT_TLVLEN |
| 4819 | (wmi_start_scan_cmd_fixed_param)); |
| 4820 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4821 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 4822 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 4823 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4824 | sizeof(wmi_roam_offload_tlv_param)); |
| 4825 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4826 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 4827 | WMITLV_SET_HDR(buf_ptr, |
| 4828 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 4829 | WMITLV_GET_STRUCT_TLVLEN |
| 4830 | (wmi_roam_offload_tlv_param)); |
| 4831 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 4832 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 4833 | roam_offload_params->select_5g_margin = |
| 4834 | roam_req->select_5ghz_margin; |
| 4835 | roam_offload_params->reassoc_failure_timeout = |
| 4836 | roam_req->reassoc_failure_timeout; |
| 4837 | |
| 4838 | /* Fill the capabilities */ |
| 4839 | roam_offload_params->capability = |
| 4840 | roam_req->roam_offload_params.capability; |
| 4841 | roam_offload_params->ht_caps_info = |
| 4842 | roam_req->roam_offload_params.ht_caps_info; |
| 4843 | roam_offload_params->ampdu_param = |
| 4844 | roam_req->roam_offload_params.ampdu_param; |
| 4845 | roam_offload_params->ht_ext_cap = |
| 4846 | roam_req->roam_offload_params.ht_ext_cap; |
| 4847 | roam_offload_params->ht_txbf = |
| 4848 | roam_req->roam_offload_params.ht_txbf; |
| 4849 | roam_offload_params->asel_cap = |
| 4850 | roam_req->roam_offload_params.asel_cap; |
| 4851 | roam_offload_params->qos_caps = |
| 4852 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 4853 | roam_offload_params->qos_enabled = |
| 4854 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4855 | roam_offload_params->wmm_caps = |
| 4856 | roam_req->roam_offload_params.wmm_caps; |
| 4857 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 4858 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 4859 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 4860 | |
| 4861 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 4862 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 4863 | * they are filled in the same order.Depending on the |
| 4864 | * authentication type, the other mode TLV's are nullified |
| 4865 | * and only headers are filled.*/ |
| 4866 | if ((auth_mode != WMI_AUTH_NONE) && |
| 4867 | ((auth_mode != WMI_AUTH_OPEN) || |
| 4868 | (auth_mode == WMI_AUTH_OPEN |
| 4869 | && roam_req->mdid.mdie_present) || |
| 4870 | roam_req->is_ese_assoc)) { |
| 4871 | if (roam_req->is_ese_assoc) { |
| 4872 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4873 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4874 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4875 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4876 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4877 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4878 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4879 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 4880 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4881 | roam_offload_ese = |
| 4882 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 4883 | qdf_mem_copy(roam_offload_ese->krk, |
| 4884 | roam_req->krk, |
| 4885 | sizeof(roam_req->krk)); |
| 4886 | qdf_mem_copy(roam_offload_ese->btk, |
| 4887 | roam_req->btk, |
| 4888 | sizeof(roam_req->btk)); |
| 4889 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 4890 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 4891 | WMITLV_GET_STRUCT_TLVLEN |
| 4892 | (wmi_roam_ese_offload_tlv_param)); |
| 4893 | buf_ptr += |
| 4894 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 4895 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 4896 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 4897 | || (auth_mode == WMI_AUTH_OPEN |
| 4898 | && roam_req->mdid.mdie_present)) { |
| 4899 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4900 | 0); |
| 4901 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4902 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4903 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 4904 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4905 | roam_offload_11r = |
| 4906 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 4907 | roam_offload_11r->r0kh_id_len = |
| 4908 | roam_req->rokh_id_length; |
| 4909 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 4910 | roam_req->rokh_id, |
| 4911 | roam_offload_11r->r0kh_id_len); |
| 4912 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 4913 | roam_req->psk_pmk, |
| 4914 | sizeof(roam_req->psk_pmk)); |
| 4915 | roam_offload_11r->psk_msk_len = |
| 4916 | roam_req->pmk_len; |
| 4917 | roam_offload_11r->mdie_present = |
| 4918 | roam_req->mdid.mdie_present; |
| 4919 | roam_offload_11r->mdid = |
| 4920 | roam_req->mdid.mobility_domain; |
| 4921 | if (auth_mode == WMI_AUTH_OPEN) { |
| 4922 | /* If FT-Open ensure pmk length |
| 4923 | and r0khid len are zero */ |
| 4924 | roam_offload_11r->r0kh_id_len = 0; |
| 4925 | roam_offload_11r->psk_msk_len = 0; |
| 4926 | } |
| 4927 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 4928 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 4929 | WMITLV_GET_STRUCT_TLVLEN |
| 4930 | (wmi_roam_11r_offload_tlv_param)); |
| 4931 | buf_ptr += |
| 4932 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 4933 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4934 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4935 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4936 | } else { |
| 4937 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4938 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 4939 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4940 | roam_offload_11i = |
| 4941 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 4942 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 4943 | roam_req->okc_enabled) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4944 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 4945 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4946 | WMI_LOGE("LFR3:OKC Enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4947 | } else { |
| 4948 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 4949 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4950 | WMI_LOGE("LFR3:OKC Disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4951 | } |
| 4952 | |
| 4953 | qdf_mem_copy(roam_offload_11i->pmk, |
| 4954 | roam_req->psk_pmk, |
| 4955 | sizeof(roam_req->psk_pmk)); |
| 4956 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 4957 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 4958 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 4959 | WMITLV_GET_STRUCT_TLVLEN |
| 4960 | (wmi_roam_11i_offload_tlv_param)); |
| 4961 | buf_ptr += |
| 4962 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 4963 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4964 | 0); |
| 4965 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4966 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4967 | 0); |
| 4968 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4969 | } |
| 4970 | } else { |
| 4971 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4972 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4973 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4974 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4975 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4976 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4977 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4978 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4979 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4980 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4981 | |
| 4982 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4983 | sizeof(*assoc_ies)); |
| 4984 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4985 | |
| 4986 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 4987 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 4988 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 4989 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 4990 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 4991 | |
| 4992 | buf_ptr += sizeof(*assoc_ies); |
| 4993 | |
| 4994 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4995 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 4996 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4997 | |
| 4998 | if (assoc_ies->buf_len != 0) { |
| 4999 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 5000 | assoc_ies->buf_len); |
| 5001 | } |
| 5002 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5003 | } else { |
| 5004 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5005 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5006 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5007 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5008 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5009 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5010 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5011 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5012 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5013 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5014 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5015 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5016 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5017 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5018 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5019 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5020 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5021 | } |
| 5022 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5023 | |
| 5024 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5025 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5026 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5027 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5028 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5029 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 5030 | status); |
| 5031 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5032 | } |
| 5033 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5034 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5035 | } |
| 5036 | |
| 5037 | |
| 5038 | /** |
| 5039 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 5040 | * rssi threashold |
| 5041 | * @wmi_handle: wmi handle |
| 5042 | * @roam_req: Roaming request buffer |
| 5043 | * |
| 5044 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 5045 | * |
| 5046 | * Return: QDF status |
| 5047 | */ |
| 5048 | QDF_STATUS send_roam_scan_offload_rssi_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
| 5049 | struct roam_offload_scan_rssi_params *roam_req) |
| 5050 | { |
| 5051 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5052 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5053 | int len; |
| 5054 | uint8_t *buf_ptr; |
| 5055 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 5056 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 5057 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5058 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5059 | |
| 5060 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5061 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5062 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5063 | len += WMI_TLV_HDR_SIZE; |
| 5064 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5065 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 5066 | len += sizeof(wmi_roam_dense_thres_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5067 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5068 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5069 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5070 | return QDF_STATUS_E_NOMEM; |
| 5071 | } |
| 5072 | |
| 5073 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5074 | rssi_threshold_fp = |
| 5075 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 5076 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 5077 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 5078 | WMITLV_GET_STRUCT_TLVLEN |
| 5079 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 5080 | /* fill in threshold values */ |
| 5081 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 5082 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 5083 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 5084 | rssi_threshold_fp->hirssi_scan_max_count = |
| 5085 | roam_req->hi_rssi_scan_max_count; |
| 5086 | rssi_threshold_fp->hirssi_scan_delta = |
| 5087 | roam_req->hi_rssi_scan_rssi_delta; |
| 5088 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
| 5089 | |
| 5090 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5091 | WMITLV_SET_HDR(buf_ptr, |
| 5092 | WMITLV_TAG_ARRAY_STRUC, |
| 5093 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 5094 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5095 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 5096 | |
| 5097 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 5098 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 5099 | ext_thresholds->boost_threshold_5g = |
| 5100 | roam_req->boost_threshold_5g; |
| 5101 | |
| 5102 | ext_thresholds->boost_algorithm_5g = |
| 5103 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5104 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 5105 | ext_thresholds->penalty_algorithm_5g = |
| 5106 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5107 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 5108 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 5109 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 5110 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 5111 | |
| 5112 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 5113 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 5114 | WMITLV_GET_STRUCT_TLVLEN |
| 5115 | (wmi_roam_scan_extended_threshold_param)); |
| 5116 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5117 | WMITLV_SET_HDR(buf_ptr, |
| 5118 | WMITLV_TAG_ARRAY_STRUC, |
| 5119 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 5120 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5121 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 5122 | early_stop_thresholds->roam_earlystop_thres_min = |
| 5123 | roam_req->roam_earlystop_thres_min; |
| 5124 | early_stop_thresholds->roam_earlystop_thres_max = |
| 5125 | roam_req->roam_earlystop_thres_max; |
| 5126 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 5127 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 5128 | WMITLV_GET_STRUCT_TLVLEN |
| 5129 | (wmi_roam_earlystop_rssi_thres_param)); |
| 5130 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5131 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 5132 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5133 | sizeof(wmi_roam_dense_thres_param)); |
| 5134 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5135 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 5136 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 5137 | roam_req->dense_rssi_thresh_offset; |
| 5138 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 5139 | dense_thresholds->roam_dense_traffic_thres = |
| 5140 | roam_req->traffic_threshold; |
| 5141 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 5142 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 5143 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 5144 | WMITLV_GET_STRUCT_TLVLEN |
| 5145 | (wmi_roam_dense_thres_param)); |
| 5146 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5147 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5148 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5149 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5150 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5151 | status); |
| 5152 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5153 | } |
| 5154 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5155 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5156 | } |
| 5157 | |
| 5158 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5159 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 5160 | * configuration params |
| 5161 | * @wma_handle: wma handler |
| 5162 | * @dwelltime_params: pointer to dwelltime_params |
| 5163 | * |
| 5164 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 5165 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5166 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5167 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5168 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 5169 | { |
| 5170 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 5171 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 5172 | wmi_buf_t buf; |
| 5173 | uint8_t *buf_ptr; |
| 5174 | int32_t err; |
| 5175 | int len; |
| 5176 | |
| 5177 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5178 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5179 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 5180 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5181 | if (!buf) { |
| 5182 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 5183 | __func__); |
| 5184 | return QDF_STATUS_E_NOMEM; |
| 5185 | } |
| 5186 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5187 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 5188 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 5189 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 5190 | WMITLV_GET_STRUCT_TLVLEN |
| 5191 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 5192 | |
| 5193 | dwell_param->enable = dwelltime_params->is_enabled; |
| 5194 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5195 | WMITLV_SET_HDR(buf_ptr, |
| 5196 | WMITLV_TAG_ARRAY_STRUC, |
| 5197 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5198 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5199 | |
| 5200 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 5201 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5202 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 5203 | WMITLV_GET_STRUCT_TLVLEN( |
| 5204 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5205 | |
| 5206 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 5207 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 5208 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 5209 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 5210 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 5211 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 5212 | if (err) { |
| 5213 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 5214 | wmi_buf_free(buf); |
| 5215 | return QDF_STATUS_E_FAILURE; |
| 5216 | } |
| 5217 | |
| 5218 | return QDF_STATUS_SUCCESS; |
| 5219 | } |
| 5220 | |
| 5221 | |
| 5222 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5223 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 5224 | * @wmi_handle: wmi handle |
| 5225 | * @roam_req: Request which contains the filters |
| 5226 | * |
| 5227 | * There are filters such as whitelist, blacklist and preferred |
| 5228 | * list that need to be applied to the scan results to form the |
| 5229 | * probable candidates for roaming. |
| 5230 | * |
| 5231 | * Return: Return success upon succesfully passing the |
| 5232 | * parameters to the firmware, otherwise failure. |
| 5233 | */ |
| 5234 | QDF_STATUS send_roam_scan_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 5235 | struct roam_scan_filter_params *roam_req) |
| 5236 | { |
| 5237 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5238 | QDF_STATUS status; |
| 5239 | uint32_t i; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5240 | uint32_t len; |
| 5241 | uint8_t *buf_ptr; |
| 5242 | wmi_roam_filter_fixed_param *roam_filter; |
| 5243 | uint8_t *bssid_src_ptr = NULL; |
| 5244 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 5245 | wmi_ssid *ssid_ptr = NULL; |
| 5246 | uint32_t *bssid_preferred_factor_ptr = NULL; |
| 5247 | |
| 5248 | len = sizeof(wmi_roam_filter_fixed_param); |
| 5249 | len += WMI_TLV_HDR_SIZE; |
| 5250 | len += roam_req->len; |
| 5251 | |
| 5252 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5253 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5254 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5255 | return QDF_STATUS_E_NOMEM; |
| 5256 | } |
| 5257 | |
| 5258 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 5259 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 5260 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 5261 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 5262 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 5263 | /* fill in fixed values */ |
| 5264 | roam_filter->vdev_id = roam_req->session_id; |
| 5265 | roam_filter->flags = 0; |
| 5266 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 5267 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 5268 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 5269 | roam_filter->num_bssid_preferred_list = |
| 5270 | roam_req->num_bssid_preferred_list; |
| 5271 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 5272 | |
| 5273 | WMITLV_SET_HDR((buf_ptr), |
| 5274 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5275 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 5276 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 5277 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5278 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 5279 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 5280 | bssid_src_ptr += ATH_MAC_LEN; |
| 5281 | bssid_dst_ptr++; |
| 5282 | } |
| 5283 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5284 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 5285 | WMITLV_SET_HDR((buf_ptr), |
| 5286 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5287 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 5288 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5289 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 5290 | qdf_mem_copy(&ssid_ptr->ssid, |
| 5291 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 5292 | roam_req->ssid_allowed_list[i].length); |
| 5293 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 5294 | ssid_ptr++; |
| 5295 | } |
| 5296 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 5297 | sizeof(wmi_ssid)); |
| 5298 | WMITLV_SET_HDR((buf_ptr), |
| 5299 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5300 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 5301 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 5302 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5303 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5304 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 5305 | (wmi_mac_addr *)bssid_dst_ptr); |
| 5306 | bssid_src_ptr += ATH_MAC_LEN; |
| 5307 | bssid_dst_ptr++; |
| 5308 | } |
| 5309 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5310 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 5311 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 5312 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 5313 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5314 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5315 | *bssid_preferred_factor_ptr = |
| 5316 | roam_req->bssid_favored_factor[i]; |
| 5317 | bssid_preferred_factor_ptr++; |
| 5318 | } |
| 5319 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5320 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 5321 | |
| 5322 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5323 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5324 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5325 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5326 | status); |
| 5327 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5328 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5329 | |
| 5330 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5331 | } |
| 5332 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5333 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 5334 | * @wmi_handle: wmi handle |
| 5335 | * @req: epno config params request structure |
| 5336 | * |
| 5337 | * This function reads the incoming epno config request structure |
| 5338 | * and constructs the WMI message to the firmware. |
| 5339 | * |
| 5340 | * Returns: 0 on success, error number otherwise |
| 5341 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5342 | 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] | 5343 | struct wifi_enhanched_pno_params *req) |
| 5344 | { |
| 5345 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 5346 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5347 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5348 | u_int8_t i, *buf_ptr; |
| 5349 | wmi_buf_t buf; |
| 5350 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5351 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5352 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5353 | /* Fixed Params */ |
| 5354 | len = sizeof(*cmd); |
| 5355 | if (req->num_networks) { |
| 5356 | /* TLV place holder for array of structures |
| 5357 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 5358 | */ |
| 5359 | len += WMI_TLV_HDR_SIZE; |
| 5360 | len += (sizeof(nlo_configured_parameters) |
| 5361 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 5362 | /* TLV for array of uint32 channel_list */ |
| 5363 | len += WMI_TLV_HDR_SIZE; |
| 5364 | /* TLV for nlo_channel_prediction_cfg */ |
| 5365 | len += WMI_TLV_HDR_SIZE; |
| 5366 | /* TLV for candidate score params */ |
| 5367 | len += sizeof(enlo_candidate_score_params); |
| 5368 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5369 | |
| 5370 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5371 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5372 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5373 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5374 | } |
| 5375 | |
| 5376 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5377 | |
| 5378 | buf_ptr = (u_int8_t *) cmd; |
| 5379 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5380 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5381 | WMITLV_GET_STRUCT_TLVLEN( |
| 5382 | wmi_nlo_config_cmd_fixed_param)); |
| 5383 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5384 | |
| 5385 | /* set flag to reset if num of networks are 0 */ |
| 5386 | cmd->flags = (req->num_networks == 0 ? |
| 5387 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5388 | |
| 5389 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 5390 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5391 | 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] | 5392 | WMI_LOGD("SSID count: %d flags: %d", |
| 5393 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5394 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5395 | /* Fill nlo_config only when num_networks are non zero */ |
| 5396 | if (cmd->no_of_ssids) { |
| 5397 | /* Fill networks */ |
| 5398 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5399 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 5400 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5401 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5402 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 5403 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 5404 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 5405 | WMITLV_TAG_ARRAY_BYTE, |
| 5406 | WMITLV_GET_STRUCT_TLVLEN( |
| 5407 | nlo_configured_parameters)); |
| 5408 | /* Copy ssid and it's length */ |
| 5409 | nlo_list[i].ssid.valid = true; |
| 5410 | nlo_list[i].ssid.ssid.ssid_len = |
| 5411 | req->networks[i].ssid.length; |
| 5412 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 5413 | req->networks[i].ssid.mac_ssid, |
| 5414 | nlo_list[i].ssid.ssid.ssid_len); |
| 5415 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 5416 | nlo_list[i].ssid.ssid.ssid_len, |
| 5417 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 5418 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5419 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5420 | /* Copy pno flags */ |
| 5421 | nlo_list[i].bcast_nw_type.valid = true; |
| 5422 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 5423 | req->networks[i].flags; |
| 5424 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5425 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 5426 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5427 | /* Copy auth bit field */ |
| 5428 | nlo_list[i].auth_type.valid = true; |
| 5429 | nlo_list[i].auth_type.auth_type = |
| 5430 | req->networks[i].auth_bit_field; |
| 5431 | WMI_LOGD("Auth bit field (%u)", |
| 5432 | nlo_list[i].auth_type.auth_type); |
| 5433 | } |
| 5434 | |
| 5435 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 5436 | /* Fill the channel list */ |
| 5437 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 5438 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5439 | |
| 5440 | /* Fill prediction_param */ |
| 5441 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5442 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5443 | |
| 5444 | /* Fill epno candidate score params */ |
| 5445 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 5446 | WMITLV_SET_HDR(buf_ptr, |
| 5447 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 5448 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 5449 | cand_score_params->min5GHz_rssi = |
| 5450 | req->min_5ghz_rssi; |
| 5451 | cand_score_params->min24GHz_rssi = |
| 5452 | req->min_24ghz_rssi; |
| 5453 | cand_score_params->initial_score_max = |
| 5454 | req->initial_score_max; |
| 5455 | cand_score_params->current_connection_bonus = |
| 5456 | req->current_connection_bonus; |
| 5457 | cand_score_params->same_network_bonus = |
| 5458 | req->same_network_bonus; |
| 5459 | cand_score_params->secure_bonus = |
| 5460 | req->secure_bonus; |
| 5461 | cand_score_params->band5GHz_bonus = |
| 5462 | req->band_5ghz_bonus; |
| 5463 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5464 | } |
| 5465 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5466 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5467 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5468 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5469 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5470 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5471 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5472 | } |
| 5473 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5474 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5475 | req->session_id); |
| 5476 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5477 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5478 | } |
| 5479 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5480 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5481 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 5482 | * @wmi_handle: wmi handle |
| 5483 | * @ipa_offload: ipa offload control parameter |
| 5484 | * |
| 5485 | * Returns: 0 on success, error number otherwise |
| 5486 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5487 | 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] | 5488 | struct ipa_offload_control_params *ipa_offload) |
| 5489 | { |
| 5490 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 5491 | wmi_buf_t wmi_buf; |
| 5492 | uint32_t len; |
| 5493 | u_int8_t *buf_ptr; |
| 5494 | |
| 5495 | len = sizeof(*cmd); |
| 5496 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5497 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5498 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 5499 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5500 | } |
| 5501 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5502 | WMI_LOGE("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5503 | ipa_offload->offload_type, ipa_offload->enable); |
| 5504 | |
| 5505 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 5506 | |
| 5507 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 5508 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5509 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 5510 | WMITLV_GET_STRUCT_TLVLEN( |
| 5511 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 5512 | |
| 5513 | cmd->offload_type = ipa_offload->offload_type; |
| 5514 | cmd->vdev_id = ipa_offload->vdev_id; |
| 5515 | cmd->enable = ipa_offload->enable; |
| 5516 | |
| 5517 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5518 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5519 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5520 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5521 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5522 | } |
| 5523 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5524 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5525 | } |
| 5526 | |
| 5527 | /** |
| 5528 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 5529 | * @wmi_handle: wmi handle |
| 5530 | * @pgetcapab: get capabilities params |
| 5531 | * |
| 5532 | * This function send request to fw to get extscan capabilities. |
| 5533 | * |
| 5534 | * Return: CDF status |
| 5535 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5536 | 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] | 5537 | struct extscan_capabilities_params *pgetcapab) |
| 5538 | { |
| 5539 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 5540 | wmi_buf_t wmi_buf; |
| 5541 | uint32_t len; |
| 5542 | uint8_t *buf_ptr; |
| 5543 | |
| 5544 | len = sizeof(*cmd); |
| 5545 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5546 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5547 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5548 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5549 | } |
| 5550 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5551 | |
| 5552 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 5553 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5554 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 5555 | WMITLV_GET_STRUCT_TLVLEN |
| 5556 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 5557 | |
| 5558 | cmd->request_id = pgetcapab->request_id; |
| 5559 | |
| 5560 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5561 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5562 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5563 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5564 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5565 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5566 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5567 | } |
| 5568 | |
| 5569 | /** |
| 5570 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 5571 | * @wmi_handle: wmi handle |
| 5572 | * @pcached_results: cached results parameters |
| 5573 | * |
| 5574 | * This function send request to fw to get cached results. |
| 5575 | * |
| 5576 | * Return: CDF status |
| 5577 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5578 | 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] | 5579 | struct extscan_cached_result_params *pcached_results) |
| 5580 | { |
| 5581 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 5582 | wmi_buf_t wmi_buf; |
| 5583 | uint32_t len; |
| 5584 | uint8_t *buf_ptr; |
| 5585 | |
| 5586 | len = sizeof(*cmd); |
| 5587 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5588 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5589 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5590 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5591 | } |
| 5592 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5593 | |
| 5594 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 5595 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5596 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 5597 | WMITLV_GET_STRUCT_TLVLEN |
| 5598 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 5599 | |
| 5600 | cmd->request_id = pcached_results->request_id; |
| 5601 | cmd->vdev_id = pcached_results->session_id; |
| 5602 | cmd->control_flags = pcached_results->flush; |
| 5603 | |
| 5604 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5605 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5606 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5607 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5608 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5609 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5610 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5611 | } |
| 5612 | |
| 5613 | /** |
| 5614 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 5615 | * @wmi_handle: wmi handle |
| 5616 | * @reset_req: Reset change request params |
| 5617 | * |
| 5618 | * This function sends stop change monitor request to fw. |
| 5619 | * |
| 5620 | * Return: CDF status |
| 5621 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5622 | 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] | 5623 | struct extscan_capabilities_reset_params *reset_req) |
| 5624 | { |
| 5625 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 5626 | wmi_buf_t wmi_buf; |
| 5627 | uint32_t len; |
| 5628 | uint8_t *buf_ptr; |
| 5629 | int change_list = 0; |
| 5630 | |
| 5631 | len = sizeof(*cmd); |
| 5632 | |
| 5633 | /* reset significant change tlv is set to 0 */ |
| 5634 | len += WMI_TLV_HDR_SIZE; |
| 5635 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 5636 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5637 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5638 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5639 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5640 | } |
| 5641 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5642 | |
| 5643 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 5644 | buf_ptr; |
| 5645 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5646 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 5647 | WMITLV_GET_STRUCT_TLVLEN |
| 5648 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 5649 | |
| 5650 | cmd->request_id = reset_req->request_id; |
| 5651 | cmd->vdev_id = reset_req->session_id; |
| 5652 | cmd->mode = 0; |
| 5653 | |
| 5654 | buf_ptr += sizeof(*cmd); |
| 5655 | WMITLV_SET_HDR(buf_ptr, |
| 5656 | WMITLV_TAG_ARRAY_STRUC, |
| 5657 | change_list * |
| 5658 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5659 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 5660 | sizeof |
| 5661 | (wmi_extscan_wlan_change_bssid_param)); |
| 5662 | |
| 5663 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5664 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5665 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5666 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5667 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5668 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5669 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5670 | } |
| 5671 | |
| 5672 | /** |
| 5673 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 5674 | * @wmi_handle: wmi handle |
| 5675 | * @psigchange: change monitor request params |
| 5676 | * @buf: wmi buffer |
| 5677 | * @buf_len: buffer length |
| 5678 | * |
| 5679 | * This function fills elements of change monitor request buffer. |
| 5680 | * |
| 5681 | * Return: CDF status |
| 5682 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5683 | 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] | 5684 | struct extscan_set_sig_changereq_params |
| 5685 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 5686 | { |
| 5687 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 5688 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 5689 | uint8_t *buf_ptr; |
| 5690 | int j; |
| 5691 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 5692 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5693 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 5694 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 5695 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5696 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 5697 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5698 | } |
| 5699 | len += WMI_TLV_HDR_SIZE; |
| 5700 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 5701 | |
| 5702 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 5703 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5704 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5705 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5706 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5707 | } |
| 5708 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 5709 | cmd = |
| 5710 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 5711 | buf_ptr; |
| 5712 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5713 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 5714 | WMITLV_GET_STRUCT_TLVLEN |
| 5715 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 5716 | |
| 5717 | cmd->request_id = psigchange->request_id; |
| 5718 | cmd->vdev_id = psigchange->session_id; |
| 5719 | cmd->total_entries = numap; |
| 5720 | cmd->mode = 1; |
| 5721 | cmd->num_entries_in_page = numap; |
| 5722 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 5723 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 5724 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 5725 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 5726 | |
| 5727 | buf_ptr += sizeof(*cmd); |
| 5728 | WMITLV_SET_HDR(buf_ptr, |
| 5729 | WMITLV_TAG_ARRAY_STRUC, |
| 5730 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5731 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 5732 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5733 | |
| 5734 | for (j = 0; j < numap; j++) { |
| 5735 | WMITLV_SET_HDR(dest_chglist, |
| 5736 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 5737 | WMITLV_GET_STRUCT_TLVLEN |
| 5738 | (wmi_extscan_wlan_change_bssid_param)); |
| 5739 | |
| 5740 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 5741 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 5742 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 5743 | &dest_chglist->bssid); |
| 5744 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5745 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5746 | dest_chglist->lower_rssi_limit); |
| 5747 | dest_chglist++; |
| 5748 | src_ap++; |
| 5749 | } |
| 5750 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5751 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5752 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5753 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5754 | } |
| 5755 | |
| 5756 | /** |
| 5757 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 5758 | * @wmi_handle: wmi handle |
| 5759 | * @psigchange: change monitor request params |
| 5760 | * |
| 5761 | * This function sends start change monitor request to fw. |
| 5762 | * |
| 5763 | * Return: CDF status |
| 5764 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5765 | 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] | 5766 | struct extscan_set_sig_changereq_params * |
| 5767 | psigchange) |
| 5768 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5769 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5770 | wmi_buf_t buf; |
| 5771 | int len; |
| 5772 | |
| 5773 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5774 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5775 | psigchange, &buf, |
| 5776 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5777 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 5778 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5779 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5780 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5781 | } |
| 5782 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5783 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 5784 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5785 | } |
| 5786 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5787 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5788 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5789 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5790 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5791 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5792 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5793 | } |
| 5794 | |
| 5795 | /** |
| 5796 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 5797 | * @wmi_handle: wmi handle |
| 5798 | * @photlist_reset: hotlist reset params |
| 5799 | * |
| 5800 | * This function configures hotlist monitor to stop in fw. |
| 5801 | * |
| 5802 | * Return: CDF status |
| 5803 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5804 | 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] | 5805 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 5806 | { |
| 5807 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 5808 | wmi_buf_t wmi_buf; |
| 5809 | uint32_t len; |
| 5810 | uint8_t *buf_ptr; |
| 5811 | int hotlist_entries = 0; |
| 5812 | |
| 5813 | len = sizeof(*cmd); |
| 5814 | |
| 5815 | /* reset bssid hotlist with tlv set to 0 */ |
| 5816 | len += WMI_TLV_HDR_SIZE; |
| 5817 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 5818 | |
| 5819 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5820 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5821 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5822 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5823 | } |
| 5824 | |
| 5825 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5826 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 5827 | buf_ptr; |
| 5828 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5829 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 5830 | WMITLV_GET_STRUCT_TLVLEN |
| 5831 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 5832 | |
| 5833 | cmd->request_id = photlist_reset->request_id; |
| 5834 | cmd->vdev_id = photlist_reset->session_id; |
| 5835 | cmd->mode = 0; |
| 5836 | |
| 5837 | buf_ptr += sizeof(*cmd); |
| 5838 | WMITLV_SET_HDR(buf_ptr, |
| 5839 | WMITLV_TAG_ARRAY_STRUC, |
| 5840 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 5841 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5842 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 5843 | |
| 5844 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5845 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5846 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5847 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5848 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5849 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5850 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5851 | } |
| 5852 | |
| 5853 | /** |
| 5854 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 5855 | * @wmi_handle: wmi handle |
| 5856 | * @pstopcmd: stop scan command request params |
| 5857 | * |
| 5858 | * This function sends stop extscan request to fw. |
| 5859 | * |
| 5860 | * Return: CDF Status. |
| 5861 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5862 | QDF_STATUS send_stop_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5863 | struct extscan_stop_req_params *pstopcmd) |
| 5864 | { |
| 5865 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 5866 | wmi_buf_t wmi_buf; |
| 5867 | uint32_t len; |
| 5868 | uint8_t *buf_ptr; |
| 5869 | |
| 5870 | len = sizeof(*cmd); |
| 5871 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5872 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5873 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5874 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5875 | } |
| 5876 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5877 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 5878 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5879 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 5880 | WMITLV_GET_STRUCT_TLVLEN |
| 5881 | (wmi_extscan_stop_cmd_fixed_param)); |
| 5882 | |
| 5883 | cmd->request_id = pstopcmd->request_id; |
| 5884 | cmd->vdev_id = pstopcmd->session_id; |
| 5885 | |
| 5886 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5887 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5888 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5889 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5890 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5891 | } |
| 5892 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5893 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5894 | } |
| 5895 | |
| 5896 | /** |
| 5897 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 5898 | * @wmi_handle: wmi handle |
| 5899 | * @pstart: scan command request params |
| 5900 | * @buf: event buffer |
| 5901 | * @buf_len: length of buffer |
| 5902 | * |
| 5903 | * This function fills individual elements of extscan request and |
| 5904 | * TLV for buckets, channel list. |
| 5905 | * |
| 5906 | * Return: CDF Status. |
| 5907 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5908 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5909 | 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] | 5910 | struct wifi_scan_cmd_req_params *pstart, |
| 5911 | wmi_buf_t *buf, int *buf_len) |
| 5912 | { |
| 5913 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 5914 | wmi_extscan_bucket *dest_blist; |
| 5915 | wmi_extscan_bucket_channel *dest_clist; |
| 5916 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 5917 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 5918 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 5919 | |
| 5920 | uint8_t *buf_ptr; |
| 5921 | int i, k, count = 0; |
| 5922 | int len = sizeof(*cmd); |
| 5923 | int nbuckets = pstart->numBuckets; |
| 5924 | int nchannels = 0; |
| 5925 | |
| 5926 | /* These TLV's are are NULL by default */ |
| 5927 | uint32_t ie_len_with_pad = 0; |
| 5928 | int num_ssid = 0; |
| 5929 | int num_bssid = 0; |
| 5930 | int ie_len = 0; |
| 5931 | |
| 5932 | uint32_t base_period = pstart->basePeriod; |
| 5933 | |
| 5934 | /* TLV placeholder for ssid_list (NULL) */ |
| 5935 | len += WMI_TLV_HDR_SIZE; |
| 5936 | len += num_ssid * sizeof(wmi_ssid); |
| 5937 | |
| 5938 | /* TLV placeholder for bssid_list (NULL) */ |
| 5939 | len += WMI_TLV_HDR_SIZE; |
| 5940 | len += num_bssid * sizeof(wmi_mac_addr); |
| 5941 | |
| 5942 | /* TLV placeholder for ie_data (NULL) */ |
| 5943 | len += WMI_TLV_HDR_SIZE; |
| 5944 | len += ie_len * sizeof(uint32_t); |
| 5945 | |
| 5946 | /* TLV placeholder for bucket */ |
| 5947 | len += WMI_TLV_HDR_SIZE; |
| 5948 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 5949 | |
| 5950 | /* TLV channel placeholder */ |
| 5951 | len += WMI_TLV_HDR_SIZE; |
| 5952 | for (i = 0; i < nbuckets; i++) { |
| 5953 | nchannels += src_bucket->numChannels; |
| 5954 | src_bucket++; |
| 5955 | } |
| 5956 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5957 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5958 | __func__, nbuckets, nchannels); |
| 5959 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 5960 | /* Allocate the memory */ |
| 5961 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 5962 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5963 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5964 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5965 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5966 | } |
| 5967 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 5968 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 5969 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5970 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 5971 | WMITLV_GET_STRUCT_TLVLEN |
| 5972 | (wmi_extscan_start_cmd_fixed_param)); |
| 5973 | |
| 5974 | cmd->request_id = pstart->requestId; |
| 5975 | cmd->vdev_id = pstart->sessionId; |
| 5976 | cmd->base_period = pstart->basePeriod; |
| 5977 | cmd->num_buckets = nbuckets; |
| 5978 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 5979 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5980 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5981 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5982 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5983 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5984 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 5985 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5986 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 5987 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 5988 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5989 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 5990 | |
| 5991 | /* The max dwell time is retrieved from the first channel |
| 5992 | * of the first bucket and kept common for all channels. |
| 5993 | */ |
| 5994 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 5995 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 5996 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 5997 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 5998 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 5999 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 6000 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 6001 | |
| 6002 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6003 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6004 | cmd->probe_delay = 0; |
| 6005 | cmd->probe_spacing_time = 0; |
| 6006 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6007 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 6008 | WMI_SCAN_ADD_CCK_RATES | |
| 6009 | WMI_SCAN_ADD_OFDM_RATES | |
| 6010 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 6011 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6012 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 6013 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 6014 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6015 | cmd->num_ssids = 0; |
| 6016 | cmd->num_bssid = 0; |
| 6017 | cmd->ie_len = 0; |
| 6018 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 6019 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 6020 | |
| 6021 | buf_ptr += sizeof(*cmd); |
| 6022 | WMITLV_SET_HDR(buf_ptr, |
| 6023 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6024 | num_ssid * sizeof(wmi_ssid)); |
| 6025 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 6026 | |
| 6027 | WMITLV_SET_HDR(buf_ptr, |
| 6028 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6029 | num_bssid * sizeof(wmi_mac_addr)); |
| 6030 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 6031 | |
| 6032 | ie_len_with_pad = 0; |
| 6033 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 6034 | ie_len_with_pad); |
| 6035 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 6036 | |
| 6037 | WMITLV_SET_HDR(buf_ptr, |
| 6038 | WMITLV_TAG_ARRAY_STRUC, |
| 6039 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 6040 | dest_blist = (wmi_extscan_bucket *) |
| 6041 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6042 | src_bucket = pstart->buckets; |
| 6043 | |
| 6044 | /* Retrieve scanning information from each bucket and |
| 6045 | * channels and send it to the target |
| 6046 | */ |
| 6047 | for (i = 0; i < nbuckets; i++) { |
| 6048 | WMITLV_SET_HDR(dest_blist, |
| 6049 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6050 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 6051 | |
| 6052 | dest_blist->bucket_id = src_bucket->bucket; |
| 6053 | dest_blist->base_period_multiplier = |
| 6054 | src_bucket->period / base_period; |
| 6055 | dest_blist->min_period = src_bucket->period; |
| 6056 | dest_blist->max_period = src_bucket->max_period; |
| 6057 | dest_blist->exp_backoff = src_bucket->exponent; |
| 6058 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 6059 | dest_blist->channel_band = src_bucket->band; |
| 6060 | dest_blist->num_channels = src_bucket->numChannels; |
| 6061 | dest_blist->notify_extscan_events = 0; |
| 6062 | |
| 6063 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 6064 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 6065 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 6066 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6067 | |
| 6068 | if (src_bucket->reportEvents & |
| 6069 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 6070 | dest_blist->forwarding_flags = |
| 6071 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 6072 | dest_blist->notify_extscan_events |= |
| 6073 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 6074 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 6075 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 6076 | } else { |
| 6077 | dest_blist->forwarding_flags = |
| 6078 | WMI_EXTSCAN_NO_FORWARDING; |
| 6079 | } |
| 6080 | |
| 6081 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 6082 | dest_blist->configuration_flags = 0; |
| 6083 | else |
| 6084 | dest_blist->configuration_flags = |
| 6085 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 6086 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6087 | 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] | 6088 | __func__, dest_blist->notify_extscan_events, |
| 6089 | dest_blist->configuration_flags, |
| 6090 | dest_blist->forwarding_flags); |
| 6091 | |
| 6092 | dest_blist->min_dwell_time_active = |
| 6093 | src_bucket->min_dwell_time_active; |
| 6094 | dest_blist->max_dwell_time_active = |
| 6095 | src_bucket->max_dwell_time_active; |
| 6096 | dest_blist->min_dwell_time_passive = |
| 6097 | src_bucket->min_dwell_time_passive; |
| 6098 | dest_blist->max_dwell_time_passive = |
| 6099 | src_bucket->max_dwell_time_passive; |
| 6100 | src_channel = src_bucket->channels; |
| 6101 | |
| 6102 | /* save the channel info to later populate |
| 6103 | * the channel TLV |
| 6104 | */ |
| 6105 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 6106 | save_channel[count++].channel = src_channel->channel; |
| 6107 | src_channel++; |
| 6108 | } |
| 6109 | dest_blist++; |
| 6110 | src_bucket++; |
| 6111 | } |
| 6112 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 6113 | WMITLV_SET_HDR(buf_ptr, |
| 6114 | WMITLV_TAG_ARRAY_STRUC, |
| 6115 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6116 | dest_clist = (wmi_extscan_bucket_channel *) |
| 6117 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6118 | |
| 6119 | /* Active or passive scan is based on the bucket dwell time |
| 6120 | * and channel specific active,passive scans are not |
| 6121 | * supported yet |
| 6122 | */ |
| 6123 | for (i = 0; i < nchannels; i++) { |
| 6124 | WMITLV_SET_HDR(dest_clist, |
| 6125 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 6126 | WMITLV_GET_STRUCT_TLVLEN |
| 6127 | (wmi_extscan_bucket_channel)); |
| 6128 | dest_clist->channel = save_channel[i].channel; |
| 6129 | dest_clist++; |
| 6130 | } |
| 6131 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6132 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6133 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6134 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6135 | } |
| 6136 | |
| 6137 | /** |
| 6138 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 6139 | * @wmi_handle: wmi handle |
| 6140 | * @pstart: scan command request params |
| 6141 | * |
| 6142 | * This function sends start extscan request to fw. |
| 6143 | * |
| 6144 | * Return: CDF Status. |
| 6145 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6146 | QDF_STATUS send_start_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6147 | struct wifi_scan_cmd_req_params *pstart) |
| 6148 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6149 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6150 | wmi_buf_t buf; |
| 6151 | int len; |
| 6152 | |
| 6153 | /* Fill individual elements of extscan request and |
| 6154 | * TLV for buckets, channel list. |
| 6155 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6156 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6157 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6158 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6159 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 6160 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6161 | } |
| 6162 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6163 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6164 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6165 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6166 | } |
| 6167 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 6168 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6169 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6170 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6171 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6172 | } |
| 6173 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6174 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6175 | } |
| 6176 | |
| 6177 | /** |
| 6178 | * send_plm_stop_cmd_tlv() - plm stop request |
| 6179 | * @wmi_handle: wmi handle |
| 6180 | * @plm: plm request parameters |
| 6181 | * |
| 6182 | * This function request FW to stop PLM. |
| 6183 | * |
| 6184 | * Return: CDF status |
| 6185 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6186 | QDF_STATUS send_plm_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6187 | const struct plm_req_params *plm) |
| 6188 | { |
| 6189 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 6190 | int32_t len; |
| 6191 | wmi_buf_t buf; |
| 6192 | uint8_t *buf_ptr; |
| 6193 | int ret; |
| 6194 | |
| 6195 | len = sizeof(*cmd); |
| 6196 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6197 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6198 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6199 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6200 | } |
| 6201 | |
| 6202 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 6203 | |
| 6204 | buf_ptr = (uint8_t *) cmd; |
| 6205 | |
| 6206 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6207 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 6208 | WMITLV_GET_STRUCT_TLVLEN |
| 6209 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 6210 | |
| 6211 | cmd->vdev_id = plm->session_id; |
| 6212 | |
| 6213 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6214 | 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] | 6215 | |
| 6216 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6217 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 6218 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6219 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6220 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6221 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6222 | } |
| 6223 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6224 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6225 | } |
| 6226 | |
| 6227 | /** |
| 6228 | * send_plm_start_cmd_tlv() - plm start request |
| 6229 | * @wmi_handle: wmi handle |
| 6230 | * @plm: plm request parameters |
| 6231 | * |
| 6232 | * This function request FW to start PLM. |
| 6233 | * |
| 6234 | * Return: CDF status |
| 6235 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6236 | QDF_STATUS send_plm_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6237 | const struct plm_req_params *plm, |
| 6238 | uint32_t *gchannel_list) |
| 6239 | { |
| 6240 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 6241 | uint32_t *channel_list; |
| 6242 | int32_t len; |
| 6243 | wmi_buf_t buf; |
| 6244 | uint8_t *buf_ptr; |
| 6245 | uint8_t count; |
| 6246 | int ret; |
| 6247 | |
| 6248 | /* TLV place holder for channel_list */ |
| 6249 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 6250 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 6251 | |
| 6252 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6253 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6254 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6255 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6256 | } |
| 6257 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 6258 | |
| 6259 | buf_ptr = (uint8_t *) cmd; |
| 6260 | |
| 6261 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6262 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 6263 | WMITLV_GET_STRUCT_TLVLEN |
| 6264 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 6265 | |
| 6266 | cmd->vdev_id = plm->session_id; |
| 6267 | |
| 6268 | cmd->meas_token = plm->meas_token; |
| 6269 | cmd->dialog_token = plm->diag_token; |
| 6270 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6271 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6272 | cmd->off_duration = plm->meas_duration; |
| 6273 | cmd->burst_cycle = plm->burst_len; |
| 6274 | cmd->tx_power = plm->desired_tx_pwr; |
| 6275 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 6276 | cmd->num_chans = plm->plm_num_ch; |
| 6277 | |
| 6278 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 6279 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6280 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 6281 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 6282 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 6283 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 6284 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 6285 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 6286 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 6287 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6288 | |
| 6289 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6290 | (cmd->num_chans * sizeof(uint32_t))); |
| 6291 | |
| 6292 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6293 | if (cmd->num_chans) { |
| 6294 | channel_list = (uint32_t *) buf_ptr; |
| 6295 | for (count = 0; count < cmd->num_chans; count++) { |
| 6296 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6297 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6298 | channel_list[count] = |
| 6299 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6300 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6301 | } |
| 6302 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 6303 | } |
| 6304 | |
| 6305 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6306 | WMI_VDEV_PLMREQ_START_CMDID); |
| 6307 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6308 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6309 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6310 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6311 | } |
| 6312 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6313 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6314 | } |
| 6315 | |
| 6316 | /** |
| 6317 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 6318 | * @wmi_handle: wmi handle |
| 6319 | * @vdev_id: vdev id |
| 6320 | * |
| 6321 | * This function request FW to stop ongoing PNO operation. |
| 6322 | * |
| 6323 | * Return: CDF status |
| 6324 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6325 | 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] | 6326 | { |
| 6327 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6328 | int32_t len = sizeof(*cmd); |
| 6329 | wmi_buf_t buf; |
| 6330 | uint8_t *buf_ptr; |
| 6331 | int ret; |
| 6332 | |
| 6333 | /* |
| 6334 | * TLV place holder for array of structures nlo_configured_parameters |
| 6335 | * TLV place holder for array of uint32_t channel_list |
| 6336 | * TLV place holder for chnl prediction cfg |
| 6337 | */ |
| 6338 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6339 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6340 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6341 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6342 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6343 | } |
| 6344 | |
| 6345 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6346 | buf_ptr = (uint8_t *) cmd; |
| 6347 | |
| 6348 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6349 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6350 | WMITLV_GET_STRUCT_TLVLEN |
| 6351 | (wmi_nlo_config_cmd_fixed_param)); |
| 6352 | |
| 6353 | cmd->vdev_id = vdev_id; |
| 6354 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 6355 | buf_ptr += sizeof(*cmd); |
| 6356 | |
| 6357 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6358 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6359 | |
| 6360 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6361 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6362 | |
| 6363 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6364 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6365 | |
| 6366 | |
| 6367 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6368 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6369 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6370 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6371 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6372 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6373 | } |
| 6374 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6375 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6376 | } |
| 6377 | |
| 6378 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6379 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 6380 | * @buf_ptr: Buffer passed by upper layers |
| 6381 | * @pno: Buffer to be sent to the firmware |
| 6382 | * |
| 6383 | * Copy the PNO Channel prediction configuration parameters |
| 6384 | * passed by the upper layers to a WMI format TLV and send it |
| 6385 | * down to the firmware. |
| 6386 | * |
| 6387 | * Return: None |
| 6388 | */ |
| 6389 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 6390 | struct pno_scan_req_params *pno) |
| 6391 | { |
| 6392 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 6393 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 6394 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 6395 | WMITLV_TAG_ARRAY_BYTE, |
| 6396 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6397 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6398 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 6399 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 6400 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 6401 | channel_prediction_cfg->full_scan_period_ms = |
| 6402 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6403 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6404 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 6405 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 6406 | channel_prediction_cfg->enable, |
| 6407 | channel_prediction_cfg->top_k_num, |
| 6408 | channel_prediction_cfg->stationary_threshold, |
| 6409 | channel_prediction_cfg->full_scan_period_ms); |
| 6410 | } |
| 6411 | |
| 6412 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6413 | * send_pno_start_cmd_tlv() - PNO start request |
| 6414 | * @wmi_handle: wmi handle |
| 6415 | * @pno: PNO request |
| 6416 | * |
| 6417 | * This function request FW to start PNO request. |
| 6418 | * Request: CDF status |
| 6419 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6420 | QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6421 | struct pno_scan_req_params *pno, |
| 6422 | uint32_t *gchannel_freq_list) |
| 6423 | { |
| 6424 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6425 | nlo_configured_parameters *nlo_list; |
| 6426 | uint32_t *channel_list; |
| 6427 | int32_t len; |
| 6428 | wmi_buf_t buf; |
| 6429 | uint8_t *buf_ptr; |
| 6430 | uint8_t i; |
| 6431 | int ret; |
| 6432 | |
| 6433 | /* |
| 6434 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 6435 | * TLV place holder for array of uint32_t channel_list |
| 6436 | * TLV place holder for chnnl prediction cfg |
| 6437 | */ |
| 6438 | len = sizeof(*cmd) + |
| 6439 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6440 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6441 | len += sizeof(uint32_t) * QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6442 | WMI_NLO_MAX_CHAN); |
| 6443 | len += sizeof(nlo_configured_parameters) * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6444 | QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6445 | len += sizeof(nlo_channel_prediction_cfg); |
| 6446 | |
| 6447 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6448 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6449 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6450 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6451 | } |
| 6452 | |
| 6453 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6454 | |
| 6455 | buf_ptr = (uint8_t *) cmd; |
| 6456 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6457 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6458 | WMITLV_GET_STRUCT_TLVLEN |
| 6459 | (wmi_nlo_config_cmd_fixed_param)); |
| 6460 | cmd->vdev_id = pno->sessionId; |
| 6461 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 6462 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6463 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6464 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
| 6465 | pno->pnoscan_adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6466 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6467 | /* Current FW does not support min-max range for dwell time */ |
| 6468 | cmd->active_dwell_time = pno->active_max_time; |
| 6469 | cmd->passive_dwell_time = pno->passive_max_time; |
| 6470 | |
| 6471 | /* Copy scan interval */ |
| 6472 | cmd->fast_scan_period = pno->fast_scan_period; |
| 6473 | cmd->slow_scan_period = pno->slow_scan_period; |
| 6474 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6475 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6476 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6477 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6478 | |
| 6479 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6480 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6481 | cmd->no_of_ssids = QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
| 6482 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6483 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6484 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6485 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6486 | |
| 6487 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6488 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6489 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6490 | WMITLV_TAG_ARRAY_BYTE, |
| 6491 | WMITLV_GET_STRUCT_TLVLEN |
| 6492 | (nlo_configured_parameters)); |
| 6493 | /* Copy ssid and it's length */ |
| 6494 | nlo_list[i].ssid.valid = true; |
| 6495 | nlo_list[i].ssid.ssid.ssid_len = pno->aNetworks[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6496 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6497 | pno->aNetworks[i].ssid.mac_ssid, |
| 6498 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6499 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6500 | nlo_list[i].ssid.ssid.ssid_len, |
| 6501 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 6502 | nlo_list[i].ssid.ssid.ssid_len); |
| 6503 | |
| 6504 | /* Copy rssi threshold */ |
| 6505 | if (pno->aNetworks[i].rssiThreshold && |
| 6506 | pno->aNetworks[i].rssiThreshold > WMI_RSSI_THOLD_DEFAULT) { |
| 6507 | nlo_list[i].rssi_cond.valid = true; |
| 6508 | nlo_list[i].rssi_cond.rssi = |
| 6509 | pno->aNetworks[i].rssiThreshold; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6510 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6511 | nlo_list[i].rssi_cond.rssi); |
| 6512 | } |
| 6513 | nlo_list[i].bcast_nw_type.valid = true; |
| 6514 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6515 | pno->aNetworks[i].bcastNetwType; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6516 | WMI_LOGI("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6517 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6518 | } |
| 6519 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6520 | |
| 6521 | /* Copy channel info */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6522 | cmd->num_of_channels = QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6523 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6524 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6525 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6526 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 6527 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6528 | |
| 6529 | channel_list = (uint32_t *) buf_ptr; |
| 6530 | for (i = 0; i < cmd->num_of_channels; i++) { |
| 6531 | channel_list[i] = pno->aNetworks[0].aChannels[i]; |
| 6532 | |
| 6533 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
| 6534 | channel_list[i] = gchannel_freq_list[i]; |
| 6535 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6536 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6537 | } |
| 6538 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 6539 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6540 | sizeof(nlo_channel_prediction_cfg)); |
| 6541 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6542 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6543 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6544 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 6545 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 6546 | */ |
| 6547 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6548 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6549 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6550 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6551 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6552 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6553 | } |
| 6554 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6555 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6556 | } |
| 6557 | |
| 6558 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 6559 | * @wmi_handle: wmi handle |
| 6560 | * @msg: message |
| 6561 | * @is_add_ts: is addts required |
| 6562 | * |
| 6563 | * This function sets ric request element for 11r roaming. |
| 6564 | * |
| 6565 | * Return: CDF status |
| 6566 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6567 | 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] | 6568 | void *msg, uint8_t is_add_ts) |
| 6569 | { |
| 6570 | wmi_ric_request_fixed_param *cmd; |
| 6571 | wmi_ric_tspec *tspec_param; |
| 6572 | wmi_buf_t buf; |
| 6573 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6574 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6575 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 6576 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 6577 | |
| 6578 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6579 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6580 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6581 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6582 | } |
| 6583 | |
| 6584 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6585 | |
| 6586 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 6587 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6588 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 6589 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 6590 | if (is_add_ts) |
| 6591 | cmd->vdev_id = ((struct add_ts_param *) msg)->sessionId; |
| 6592 | else |
| 6593 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 6594 | cmd->num_ric_request = 1; |
| 6595 | cmd->is_add_ric = is_add_ts; |
| 6596 | |
| 6597 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 6598 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 6599 | |
| 6600 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6601 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 6602 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 6603 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 6604 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 6605 | |
| 6606 | if (is_add_ts) |
| 6607 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6608 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6609 | else |
| 6610 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6611 | #endif |
| 6612 | if (ptspecIE) { |
| 6613 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6614 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6615 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 6616 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6617 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6618 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 6619 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6620 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 6621 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6622 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 6623 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 6624 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 6625 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 6626 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 6627 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 6628 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 6629 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 6630 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 6631 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 6632 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 6633 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 6634 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 6635 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 6636 | tspec_param->medium_time = 0; |
| 6637 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6638 | 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] | 6639 | |
| 6640 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6641 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6642 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6643 | __func__); |
| 6644 | if (is_add_ts) |
| 6645 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6646 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6647 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6648 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6649 | } |
| 6650 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6651 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6652 | } |
| 6653 | |
| 6654 | /** |
| 6655 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 6656 | * @wmi_handle: wmi handle |
| 6657 | * @clear_req: ll stats clear request command params |
| 6658 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6659 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6660 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6661 | 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] | 6662 | const struct ll_stats_clear_params *clear_req, |
| 6663 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6664 | { |
| 6665 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 6666 | int32_t len; |
| 6667 | wmi_buf_t buf; |
| 6668 | uint8_t *buf_ptr; |
| 6669 | int ret; |
| 6670 | |
| 6671 | len = sizeof(*cmd); |
| 6672 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6673 | |
| 6674 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6675 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6676 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6677 | } |
| 6678 | |
| 6679 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6680 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6681 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 6682 | |
| 6683 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6684 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 6685 | WMITLV_GET_STRUCT_TLVLEN |
| 6686 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 6687 | |
| 6688 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 6689 | cmd->vdev_id = clear_req->sta_id; |
| 6690 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 6691 | |
| 6692 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 6693 | &cmd->peer_macaddr); |
| 6694 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6695 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 6696 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 6697 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 6698 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 6699 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6700 | cmd->peer_macaddr); */ |
| 6701 | |
| 6702 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6703 | WMI_CLEAR_LINK_STATS_CMDID); |
| 6704 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6705 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6706 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6707 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6708 | } |
| 6709 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6710 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 6711 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6712 | } |
| 6713 | |
| 6714 | /** |
| 6715 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 6716 | * @wmi_handle: wmi handle |
| 6717 | * @setReq: ll stats set request command params |
| 6718 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6719 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6720 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6721 | 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] | 6722 | const struct ll_stats_set_params *set_req) |
| 6723 | { |
| 6724 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 6725 | int32_t len; |
| 6726 | wmi_buf_t buf; |
| 6727 | uint8_t *buf_ptr; |
| 6728 | int ret; |
| 6729 | |
| 6730 | len = sizeof(*cmd); |
| 6731 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6732 | |
| 6733 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6734 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6735 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6736 | } |
| 6737 | |
| 6738 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6739 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6740 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 6741 | |
| 6742 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6743 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 6744 | WMITLV_GET_STRUCT_TLVLEN |
| 6745 | (wmi_start_link_stats_cmd_fixed_param)); |
| 6746 | |
| 6747 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 6748 | cmd->aggressive_statistics_gathering = |
| 6749 | set_req->aggressive_statistics_gathering; |
| 6750 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6751 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 6752 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 6753 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6754 | |
| 6755 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6756 | WMI_START_LINK_STATS_CMDID); |
| 6757 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6758 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6759 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6760 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6761 | } |
| 6762 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6763 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6764 | } |
| 6765 | |
| 6766 | /** |
| 6767 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 6768 | * @wmi_handle:wmi handle |
| 6769 | * @get_req:ll stats get request command params |
| 6770 | * @addr: mac address |
| 6771 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6772 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6773 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6774 | 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] | 6775 | const struct ll_stats_get_params *get_req, |
| 6776 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6777 | { |
| 6778 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 6779 | int32_t len; |
| 6780 | wmi_buf_t buf; |
| 6781 | uint8_t *buf_ptr; |
| 6782 | int ret; |
| 6783 | |
| 6784 | len = sizeof(*cmd); |
| 6785 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6786 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 6787 | if (!buf) { |
| 6788 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 6789 | return QDF_STATUS_E_NOMEM; |
| 6790 | } |
| 6791 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6792 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6793 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6794 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 6795 | |
| 6796 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6797 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 6798 | WMITLV_GET_STRUCT_TLVLEN |
| 6799 | (wmi_request_link_stats_cmd_fixed_param)); |
| 6800 | |
| 6801 | cmd->request_id = get_req->req_id; |
| 6802 | cmd->stats_type = get_req->param_id_mask; |
| 6803 | cmd->vdev_id = get_req->sta_id; |
| 6804 | |
| 6805 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 6806 | &cmd->peer_macaddr); |
| 6807 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6808 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
| 6809 | WMI_LOGD("Request ID : %d", cmd->request_id); |
| 6810 | WMI_LOGD("Stats Type : %d", cmd->stats_type); |
| 6811 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 6812 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6813 | |
| 6814 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6815 | WMI_REQUEST_LINK_STATS_CMDID); |
| 6816 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6817 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +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 | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6820 | } |
| 6821 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6822 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6823 | } |
| 6824 | |
| 6825 | /** |
| 6826 | * send_get_stats_cmd_tlv() - get stats request |
| 6827 | * @wmi_handle: wmi handle |
| 6828 | * @get_stats_param: stats params |
| 6829 | * @addr: mac address |
| 6830 | * |
| 6831 | * Return: CDF status |
| 6832 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6833 | QDF_STATUS send_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6834 | struct pe_stats_req *get_stats_param, |
| 6835 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6836 | { |
| 6837 | wmi_buf_t buf; |
| 6838 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6839 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6840 | |
| 6841 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6842 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6843 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 6844 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6845 | } |
| 6846 | |
| 6847 | |
| 6848 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6849 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6850 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6851 | WMITLV_GET_STRUCT_TLVLEN |
| 6852 | (wmi_request_stats_cmd_fixed_param)); |
| 6853 | cmd->stats_id = |
| 6854 | WMI_REQUEST_PEER_STAT | WMI_REQUEST_PDEV_STAT | |
Himanshu Agarwal | c9fc2a3 | 2016-07-21 14:46:58 +0530 | [diff] [blame] | 6855 | WMI_REQUEST_VDEV_STAT | WMI_REQUEST_RSSI_PER_CHAIN_STAT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6856 | cmd->vdev_id = get_stats_param->session_id; |
| 6857 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6858 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6859 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6860 | WMI_REQUEST_STATS_CMDID)) { |
| 6861 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6862 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6863 | __func__); |
| 6864 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6865 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6866 | } |
| 6867 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6868 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6869 | |
| 6870 | } |
| 6871 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6872 | /** |
| 6873 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 6874 | * @wmi_handle: wmi handle |
| 6875 | * @rssi_req: get RSSI request |
| 6876 | * |
| 6877 | * Return: CDF status |
| 6878 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6879 | QDF_STATUS send_snr_request_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6880 | { |
| 6881 | wmi_buf_t buf; |
| 6882 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6883 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6884 | |
| 6885 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6886 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6887 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6888 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6889 | } |
| 6890 | |
| 6891 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6892 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6893 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6894 | WMITLV_GET_STRUCT_TLVLEN |
| 6895 | (wmi_request_stats_cmd_fixed_param)); |
| 6896 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 6897 | if (wmi_unified_cmd_send |
| 6898 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6899 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6900 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6901 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6902 | } |
| 6903 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6904 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6905 | } |
| 6906 | |
| 6907 | /** |
| 6908 | * send_snr_cmd_tlv() - get RSSI from fw |
| 6909 | * @wmi_handle: wmi handle |
| 6910 | * @vdev_id: vdev id |
| 6911 | * |
| 6912 | * Return: CDF status |
| 6913 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6914 | 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] | 6915 | { |
| 6916 | wmi_buf_t buf; |
| 6917 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6918 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6919 | |
| 6920 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6921 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6922 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6923 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6924 | } |
| 6925 | |
| 6926 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6927 | cmd->vdev_id = vdev_id; |
| 6928 | |
| 6929 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6930 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6931 | WMITLV_GET_STRUCT_TLVLEN |
| 6932 | (wmi_request_stats_cmd_fixed_param)); |
| 6933 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 6934 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6935 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6936 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6937 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6938 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6939 | } |
| 6940 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6941 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6942 | } |
| 6943 | |
| 6944 | /** |
| 6945 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 6946 | * @wmi_handle: wmi handle |
| 6947 | * @link_status: get link params |
| 6948 | * |
| 6949 | * Return: CDF status |
| 6950 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6951 | 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] | 6952 | struct link_status_params *link_status) |
| 6953 | { |
| 6954 | wmi_buf_t buf; |
| 6955 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6956 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6957 | |
| 6958 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6959 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6960 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6961 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6962 | } |
| 6963 | |
| 6964 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6965 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6966 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6967 | WMITLV_GET_STRUCT_TLVLEN |
| 6968 | (wmi_request_stats_cmd_fixed_param)); |
| 6969 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 6970 | cmd->vdev_id = link_status->session_id; |
| 6971 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6972 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6973 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6974 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6975 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6976 | } |
| 6977 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6978 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6979 | } |
| 6980 | |
| 6981 | #ifdef FEATURE_WLAN_LPHB |
| 6982 | |
| 6983 | /** |
| 6984 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 6985 | * @wmi_handle: wmi handle |
| 6986 | * @lphb_conf_req: configuration info |
| 6987 | * |
| 6988 | * Return: CDF status |
| 6989 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6990 | 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] | 6991 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 6992 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6993 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6994 | wmi_buf_t buf = NULL; |
| 6995 | uint8_t *buf_ptr; |
| 6996 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 6997 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 6998 | |
| 6999 | |
| 7000 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7001 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7002 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7003 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7004 | } |
| 7005 | |
| 7006 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7007 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 7008 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 7009 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 7010 | WMITLV_GET_STRUCT_TLVLEN |
| 7011 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 7012 | |
| 7013 | /* fill in values */ |
| 7014 | hb_enable_fp->vdev_id = params->session; |
| 7015 | hb_enable_fp->enable = params->enable; |
| 7016 | hb_enable_fp->item = params->item; |
| 7017 | hb_enable_fp->session = params->session; |
| 7018 | |
| 7019 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7020 | len, WMI_HB_SET_ENABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7021 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7022 | 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] | 7023 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7024 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7025 | } |
| 7026 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7027 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7028 | } |
| 7029 | |
| 7030 | /** |
| 7031 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 7032 | * @wmi_handle: wmi handle |
| 7033 | * @lphb_conf_req: lphb config request |
| 7034 | * |
| 7035 | * Return: CDF status |
| 7036 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7037 | 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] | 7038 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 7039 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7040 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7041 | wmi_buf_t buf = NULL; |
| 7042 | uint8_t *buf_ptr; |
| 7043 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 7044 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 7045 | |
| 7046 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7047 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7048 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7049 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7050 | } |
| 7051 | |
| 7052 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7053 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 7054 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 7055 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 7056 | WMITLV_GET_STRUCT_TLVLEN |
| 7057 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 7058 | |
| 7059 | /* fill in values */ |
| 7060 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7061 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 7062 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 7063 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 7064 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 7065 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 7066 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 7067 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 7068 | hb_tcp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7069 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7070 | &lphb_conf_req->gateway_mac, |
| 7071 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 7072 | |
| 7073 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7074 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7075 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7076 | 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] | 7077 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7078 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7079 | } |
| 7080 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7081 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7082 | } |
| 7083 | |
| 7084 | /** |
| 7085 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 7086 | * @wmi_handle: wmi handle |
| 7087 | * @lphb_conf_req: lphb config request |
| 7088 | * |
| 7089 | * Return: CDF status |
| 7090 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7091 | 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] | 7092 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 7093 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7094 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7095 | wmi_buf_t buf = NULL; |
| 7096 | uint8_t *buf_ptr; |
| 7097 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 7098 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 7099 | |
| 7100 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7101 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7102 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7103 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7104 | } |
| 7105 | |
| 7106 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7107 | hb_tcp_filter_fp = |
| 7108 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 7109 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 7110 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 7111 | WMITLV_GET_STRUCT_TLVLEN |
| 7112 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 7113 | |
| 7114 | /* fill in values */ |
| 7115 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 7116 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 7117 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 7118 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 7119 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 7120 | (void *)&g_hb_tcp_filter_fp->filter, |
| 7121 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 7122 | |
| 7123 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7124 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7125 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7126 | 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] | 7127 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7128 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7129 | } |
| 7130 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7131 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7132 | } |
| 7133 | |
| 7134 | /** |
| 7135 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 7136 | * @wmi_handle: wmi handle |
| 7137 | * @lphb_conf_req: lphb config request |
| 7138 | * |
| 7139 | * Return: CDF status |
| 7140 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7141 | 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] | 7142 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 7143 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7144 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7145 | wmi_buf_t buf = NULL; |
| 7146 | uint8_t *buf_ptr; |
| 7147 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 7148 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 7149 | |
| 7150 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7151 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7152 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7153 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7154 | } |
| 7155 | |
| 7156 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7157 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 7158 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 7159 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 7160 | WMITLV_GET_STRUCT_TLVLEN |
| 7161 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 7162 | |
| 7163 | /* fill in values */ |
| 7164 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7165 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 7166 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 7167 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 7168 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 7169 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 7170 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 7171 | hb_udp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7172 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7173 | &lphb_conf_req->gateway_mac, |
| 7174 | sizeof(lphb_conf_req->gateway_mac)); |
| 7175 | |
| 7176 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7177 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7178 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7179 | 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] | 7180 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7181 | wmi_buf_free(buf); |
| 7182 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7183 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7184 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7185 | } |
| 7186 | |
| 7187 | /** |
| 7188 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 7189 | * @wmi_handle: wmi handle |
| 7190 | * @lphb_conf_req: lphb config request |
| 7191 | * |
| 7192 | * Return: CDF status |
| 7193 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7194 | 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] | 7195 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 7196 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7197 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7198 | wmi_buf_t buf = NULL; |
| 7199 | uint8_t *buf_ptr; |
| 7200 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 7201 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 7202 | |
| 7203 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7204 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7205 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7206 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7207 | } |
| 7208 | |
| 7209 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7210 | hb_udp_filter_fp = |
| 7211 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 7212 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 7213 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 7214 | WMITLV_GET_STRUCT_TLVLEN |
| 7215 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 7216 | |
| 7217 | /* fill in values */ |
| 7218 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7219 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 7220 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 7221 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 7222 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 7223 | (void *)&lphb_conf_req->filter, |
| 7224 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 7225 | |
| 7226 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7227 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7228 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7229 | 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] | 7230 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7231 | wmi_buf_free(buf); |
| 7232 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7233 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7234 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7235 | } |
| 7236 | #endif /* FEATURE_WLAN_LPHB */ |
| 7237 | |
| 7238 | /** |
| 7239 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 7240 | * @wmi_handle: wmi handle |
| 7241 | * @ta_dhcp_ind: DHCP indication parameter |
| 7242 | * |
| 7243 | * Return: CDF Status |
| 7244 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7245 | 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] | 7246 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 7247 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7248 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7249 | wmi_buf_t buf = NULL; |
| 7250 | uint8_t *buf_ptr; |
| 7251 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 7252 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 7253 | |
| 7254 | |
| 7255 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7256 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7257 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7258 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7259 | } |
| 7260 | |
| 7261 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7262 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 7263 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 7264 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 7265 | WMITLV_GET_STRUCT_TLVLEN |
| 7266 | (wmi_peer_set_param_cmd_fixed_param)); |
| 7267 | |
| 7268 | /* fill in values */ |
| 7269 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 7270 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 7271 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7272 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7273 | &ta_dhcp_ind->peer_macaddr, |
| 7274 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 7275 | |
| 7276 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7277 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7278 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7279 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7280 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7281 | wmi_buf_free(buf); |
| 7282 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7283 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7284 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7285 | } |
| 7286 | |
| 7287 | /** |
| 7288 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 7289 | * @wmi_handle: wmi handle |
| 7290 | * @pLinkSpeed: link speed info |
| 7291 | * |
| 7292 | * Return: CDF status |
| 7293 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7294 | 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] | 7295 | wmi_mac_addr peer_macaddr) |
| 7296 | { |
| 7297 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 7298 | wmi_buf_t wmi_buf; |
| 7299 | uint32_t len; |
| 7300 | uint8_t *buf_ptr; |
| 7301 | |
| 7302 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 7303 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7304 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7305 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7306 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7307 | } |
| 7308 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7309 | |
| 7310 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 7311 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7312 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 7313 | WMITLV_GET_STRUCT_TLVLEN |
| 7314 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 7315 | |
| 7316 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7317 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7318 | &peer_macaddr, |
| 7319 | sizeof(peer_macaddr)); |
| 7320 | |
| 7321 | |
| 7322 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7323 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7324 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7325 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7326 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7327 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7328 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7329 | } |
| 7330 | |
| 7331 | /** |
| 7332 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 7333 | * @wmi_handle: wmi handler |
| 7334 | * @egap_params: pointer to egap_params |
| 7335 | * |
| 7336 | * Return: 0 for success, otherwise appropriate error code |
| 7337 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7338 | 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] | 7339 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 7340 | { |
| 7341 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 7342 | wmi_buf_t buf; |
| 7343 | int32_t err; |
| 7344 | |
| 7345 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7346 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7347 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 7348 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7349 | } |
| 7350 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 7351 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7352 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 7353 | WMITLV_GET_STRUCT_TLVLEN( |
| 7354 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 7355 | |
| 7356 | cmd->enable = egap_params->enable; |
| 7357 | cmd->inactivity_time = egap_params->inactivity_time; |
| 7358 | cmd->wait_time = egap_params->wait_time; |
| 7359 | cmd->flags = egap_params->flags; |
| 7360 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7361 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 7362 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7363 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7364 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7365 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7366 | } |
| 7367 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7368 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7369 | } |
| 7370 | |
| 7371 | /** |
| 7372 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 7373 | * @wmi_handl: wmi handle |
| 7374 | * @cmd: Profiling command index |
| 7375 | * @value1: parameter1 value |
| 7376 | * @value2: parameter2 value |
| 7377 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7378 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7379 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7380 | QDF_STATUS send_fw_profiling_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7381 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 7382 | { |
| 7383 | wmi_buf_t buf; |
| 7384 | int32_t len = 0; |
| 7385 | int ret; |
| 7386 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 7387 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 7388 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 7389 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 7390 | |
| 7391 | switch (cmd) { |
| 7392 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 7393 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 7394 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7395 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7396 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7397 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7398 | } |
| 7399 | prof_trig_cmd = |
| 7400 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 7401 | wmi_buf_data(buf); |
| 7402 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 7403 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 7404 | WMITLV_GET_STRUCT_TLVLEN |
| 7405 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 7406 | prof_trig_cmd->enable = value1; |
| 7407 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7408 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 7409 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7410 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7411 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7412 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7413 | return ret; |
| 7414 | } |
| 7415 | break; |
| 7416 | |
| 7417 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 7418 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 7419 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7420 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7421 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7422 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7423 | } |
| 7424 | profile_getdata_cmd = |
| 7425 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 7426 | wmi_buf_data(buf); |
| 7427 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 7428 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 7429 | WMITLV_GET_STRUCT_TLVLEN |
| 7430 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 7431 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7432 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 7433 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7434 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7435 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7436 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7437 | return ret; |
| 7438 | } |
| 7439 | break; |
| 7440 | |
| 7441 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 7442 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 7443 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7444 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7445 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7446 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7447 | } |
| 7448 | hist_intvl_cmd = |
| 7449 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 7450 | wmi_buf_data(buf); |
| 7451 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 7452 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 7453 | WMITLV_GET_STRUCT_TLVLEN |
| 7454 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 7455 | hist_intvl_cmd->profile_id = value1; |
| 7456 | hist_intvl_cmd->value = value2; |
| 7457 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7458 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 7459 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7460 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7461 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7462 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7463 | return ret; |
| 7464 | } |
| 7465 | break; |
| 7466 | |
| 7467 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 7468 | len = |
| 7469 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 7470 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7471 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7472 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7473 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7474 | } |
| 7475 | profile_enable_cmd = |
| 7476 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 7477 | wmi_buf_data(buf); |
| 7478 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 7479 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 7480 | WMITLV_GET_STRUCT_TLVLEN |
| 7481 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 7482 | profile_enable_cmd->profile_id = value1; |
| 7483 | profile_enable_cmd->enable = value2; |
| 7484 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7485 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 7486 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7487 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7488 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7489 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7490 | return ret; |
| 7491 | } |
| 7492 | break; |
| 7493 | |
| 7494 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7495 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7496 | break; |
| 7497 | } |
| 7498 | |
| 7499 | return 0; |
| 7500 | } |
| 7501 | |
| 7502 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 7503 | /** |
| 7504 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 7505 | * @wmi_handle: wmi handle |
| 7506 | * @vdev_id: vdev id |
| 7507 | * |
| 7508 | * Return: CDF status |
| 7509 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7510 | 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] | 7511 | uint8_t vdev_id, uint8_t default_pattern, |
| 7512 | uint16_t rate_limit_interval) |
| 7513 | { |
| 7514 | |
| 7515 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 7516 | wmi_buf_t buf; |
| 7517 | uint8_t *buf_ptr; |
| 7518 | int32_t len; |
| 7519 | int ret; |
| 7520 | |
| 7521 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 7522 | WMI_TLV_HDR_SIZE + |
| 7523 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 7524 | WMI_TLV_HDR_SIZE + |
| 7525 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 7526 | WMI_TLV_HDR_SIZE + |
| 7527 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 7528 | WMI_TLV_HDR_SIZE + |
| 7529 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 7530 | WMI_TLV_HDR_SIZE + |
| 7531 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 7532 | |
| 7533 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7534 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7535 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7536 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7537 | } |
| 7538 | |
| 7539 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7540 | buf_ptr = (uint8_t *) cmd; |
| 7541 | |
| 7542 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7543 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 7544 | WMITLV_GET_STRUCT_TLVLEN |
| 7545 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 7546 | cmd->vdev_id = vdev_id; |
| 7547 | cmd->pattern_id = default_pattern, |
| 7548 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 7549 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 7550 | |
| 7551 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 7552 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7553 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7554 | |
| 7555 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 7556 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7557 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7558 | |
| 7559 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 7560 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7561 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7562 | |
| 7563 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 7564 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7565 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7566 | |
| 7567 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 7568 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7569 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7570 | |
| 7571 | /* Fill TLV for ra_ratelimit_interval. */ |
| 7572 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 7573 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7574 | |
| 7575 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 7576 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7577 | 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] | 7578 | rate_limit_interval, vdev_id); |
| 7579 | |
| 7580 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7581 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 7582 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7583 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7584 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7585 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7586 | } |
| 7587 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7588 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7589 | |
| 7590 | } |
| 7591 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 7592 | |
| 7593 | /** |
| 7594 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 7595 | * @wmi_handle: wmi handle |
| 7596 | * @vdev_id: vdev id |
| 7597 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7598 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7599 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7600 | 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] | 7601 | { |
| 7602 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 7603 | wmi_buf_t buf; |
| 7604 | int32_t len = sizeof(*cmd); |
| 7605 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7606 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7607 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7608 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7609 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7610 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7611 | } |
| 7612 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 7613 | wmi_buf_data(buf); |
| 7614 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7615 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 7616 | WMITLV_GET_STRUCT_TLVLEN |
| 7617 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 7618 | cmd->vdev_id = vdev_id; |
| 7619 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 7620 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7621 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7622 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7623 | __func__); |
| 7624 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7625 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7626 | } |
| 7627 | |
| 7628 | return 0; |
| 7629 | } |
| 7630 | |
| 7631 | /** |
| 7632 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 7633 | * @wmi_handle: wmi handle |
| 7634 | * @vdev_id: vdev id |
| 7635 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7636 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7637 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7638 | 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] | 7639 | uint8_t vdev_id) |
| 7640 | { |
| 7641 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 7642 | wmi_buf_t buf; |
| 7643 | int32_t len = sizeof(*cmd); |
| 7644 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7645 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7646 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7647 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7648 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7649 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7650 | } |
| 7651 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 7652 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7653 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 7654 | WMITLV_GET_STRUCT_TLVLEN |
| 7655 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 7656 | cmd->vdev_id = vdev_id; |
| 7657 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 7658 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7659 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7660 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7661 | __func__); |
| 7662 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7663 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7664 | } |
| 7665 | |
| 7666 | return 0; |
| 7667 | } |
| 7668 | |
| 7669 | /** |
| 7670 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 7671 | * @wmi_handle: wmi handle |
| 7672 | * @startOemDataReq: start request params |
| 7673 | * |
| 7674 | * Return: CDF status |
| 7675 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7676 | 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] | 7677 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7678 | uint8_t *data) |
| 7679 | { |
| 7680 | wmi_buf_t buf; |
| 7681 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7682 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7683 | |
| 7684 | buf = wmi_buf_alloc(wmi_handle, |
| 7685 | (data_len + WMI_TLV_HDR_SIZE)); |
| 7686 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7687 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 7688 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7689 | } |
| 7690 | |
| 7691 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 7692 | |
| 7693 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 7694 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7695 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7696 | data_len); |
| 7697 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7698 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7699 | data_len); |
| 7700 | |
| 7701 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 7702 | (data_len + |
| 7703 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 7704 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7705 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7706 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7707 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7708 | } |
| 7709 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7710 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7711 | } |
| 7712 | |
| 7713 | /** |
| 7714 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 7715 | * @wmi_handle: wmi handle |
| 7716 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 7717 | * |
| 7718 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 7719 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 7720 | * to firmware based on phyerr filtering |
| 7721 | * offload status. |
| 7722 | * |
| 7723 | * Return: 1 success, 0 failure |
| 7724 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7725 | QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7726 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 7727 | bool dfs_phyerr_filter_offload) |
| 7728 | { |
| 7729 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 7730 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 7731 | wmi_buf_t buf; |
| 7732 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7733 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7734 | |
| 7735 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 7736 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7737 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7738 | __func__); |
| 7739 | len = sizeof(*disable_phyerr_offload_cmd); |
| 7740 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7741 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7742 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7743 | return 0; |
| 7744 | } |
| 7745 | disable_phyerr_offload_cmd = |
| 7746 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 7747 | wmi_buf_data(buf); |
| 7748 | |
| 7749 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 7750 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 7751 | WMITLV_GET_STRUCT_TLVLEN |
| 7752 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 7753 | |
| 7754 | /* |
| 7755 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 7756 | * to the firmware to disable the phyerror |
| 7757 | * filtering offload. |
| 7758 | */ |
| 7759 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7760 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7761 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7762 | 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] | 7763 | __func__, ret); |
| 7764 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7765 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7766 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7767 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7768 | __func__); |
| 7769 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7770 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7771 | __func__); |
| 7772 | |
| 7773 | len = sizeof(*enable_phyerr_offload_cmd); |
| 7774 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7775 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7776 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7777 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7778 | } |
| 7779 | |
| 7780 | enable_phyerr_offload_cmd = |
| 7781 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 7782 | wmi_buf_data(buf); |
| 7783 | |
| 7784 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 7785 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 7786 | WMITLV_GET_STRUCT_TLVLEN |
| 7787 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 7788 | |
| 7789 | /* |
| 7790 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 7791 | * to the firmware to enable the phyerror |
| 7792 | * filtering offload. |
| 7793 | */ |
| 7794 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7795 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 7796 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7797 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7798 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7799 | __func__, ret); |
| 7800 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7801 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7802 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7803 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7804 | __func__); |
| 7805 | } |
| 7806 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7807 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7808 | } |
| 7809 | |
| 7810 | #if !defined(REMOVE_PKT_LOG) |
| 7811 | /** |
| 7812 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 7813 | * @wmi_handle: wmi handle |
| 7814 | * @pktlog_event: pktlog event |
| 7815 | * @cmd_id: pktlog cmd id |
| 7816 | * |
| 7817 | * Return: CDF status |
| 7818 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7819 | 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] | 7820 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7821 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7822 | { |
| 7823 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 7824 | WMI_CMD_ID CMD_ID; |
| 7825 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 7826 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 7827 | int len = 0; |
| 7828 | wmi_buf_t buf; |
| 7829 | |
| 7830 | PKTLOG_EVENT = pktlog_event; |
| 7831 | CMD_ID = cmd_id; |
| 7832 | |
| 7833 | switch (CMD_ID) { |
| 7834 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 7835 | len = sizeof(*cmd); |
| 7836 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7837 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7838 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7839 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7840 | } |
| 7841 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 7842 | wmi_buf_data(buf); |
| 7843 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7844 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 7845 | WMITLV_GET_STRUCT_TLVLEN |
| 7846 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 7847 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7848 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 7849 | : WMI_PKTLOG_ENABLE_AUTO; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7850 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7851 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7852 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7853 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7854 | goto wmi_send_failed; |
| 7855 | } |
| 7856 | break; |
| 7857 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 7858 | len = sizeof(*disable_cmd); |
| 7859 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7860 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7861 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7862 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7863 | } |
| 7864 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 7865 | wmi_buf_data(buf); |
| 7866 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 7867 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 7868 | WMITLV_GET_STRUCT_TLVLEN |
| 7869 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7870 | disable_cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7871 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7872 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7873 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7874 | goto wmi_send_failed; |
| 7875 | } |
| 7876 | break; |
| 7877 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7878 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7879 | break; |
| 7880 | } |
| 7881 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7882 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7883 | |
| 7884 | wmi_send_failed: |
| 7885 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7886 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7887 | } |
| 7888 | #endif /* REMOVE_PKT_LOG */ |
| 7889 | |
| 7890 | /** |
| 7891 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 7892 | * @wmi_handle: wmi handle |
| 7893 | * @vdev_id: vdev id |
| 7894 | * @bitmap: Event bitmap |
| 7895 | * @enable: enable/disable |
| 7896 | * |
| 7897 | * Return: CDF status |
| 7898 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7899 | 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] | 7900 | uint32_t vdev_id, |
| 7901 | uint32_t bitmap, |
| 7902 | bool enable) |
| 7903 | { |
| 7904 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 7905 | uint16_t len; |
| 7906 | wmi_buf_t buf; |
| 7907 | int ret; |
| 7908 | |
| 7909 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 7910 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7911 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7912 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7913 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7914 | } |
| 7915 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 7916 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7917 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 7918 | WMITLV_GET_STRUCT_TLVLEN |
| 7919 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 7920 | cmd->vdev_id = vdev_id; |
| 7921 | cmd->is_add = enable; |
| 7922 | cmd->event_bitmap = bitmap; |
| 7923 | |
| 7924 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7925 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 7926 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7927 | WMI_LOGE("Failed to config wow wakeup event"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7928 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7929 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7930 | } |
| 7931 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7932 | WMI_LOGD("Wakeup pattern 0x%x %s in fw", bitmap, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7933 | enable ? "enabled" : "disabled"); |
| 7934 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7935 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7936 | } |
| 7937 | |
| 7938 | /** |
| 7939 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 7940 | * @wmi_handle: wmi handle |
| 7941 | * @vdev_id: vdev id |
| 7942 | * @ptrn_id: pattern id |
| 7943 | * @ptrn: pattern |
| 7944 | * @ptrn_len: pattern length |
| 7945 | * @ptrn_offset: pattern offset |
| 7946 | * @mask: mask |
| 7947 | * @mask_len: mask length |
| 7948 | * @user: true for user configured pattern and false for default pattern |
| 7949 | * @default_patterns: default patterns |
| 7950 | * |
| 7951 | * Return: CDF status |
| 7952 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7953 | 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] | 7954 | uint8_t vdev_id, uint8_t ptrn_id, |
| 7955 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 7956 | uint8_t ptrn_offset, const uint8_t *mask, |
| 7957 | uint8_t mask_len, bool user, |
| 7958 | uint8_t default_patterns) |
| 7959 | { |
| 7960 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 7961 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 7962 | wmi_buf_t buf; |
| 7963 | uint8_t *buf_ptr; |
| 7964 | int32_t len; |
| 7965 | int ret; |
| 7966 | |
| 7967 | |
| 7968 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 7969 | WMI_TLV_HDR_SIZE + |
| 7970 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 7971 | WMI_TLV_HDR_SIZE + |
| 7972 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 7973 | WMI_TLV_HDR_SIZE + |
| 7974 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 7975 | WMI_TLV_HDR_SIZE + |
| 7976 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 7977 | WMI_TLV_HDR_SIZE + |
| 7978 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 7979 | |
| 7980 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7981 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7982 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7983 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7984 | } |
| 7985 | |
| 7986 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7987 | buf_ptr = (uint8_t *) cmd; |
| 7988 | |
| 7989 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7990 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 7991 | WMITLV_GET_STRUCT_TLVLEN |
| 7992 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 7993 | cmd->vdev_id = vdev_id; |
| 7994 | cmd->pattern_id = ptrn_id; |
| 7995 | |
| 7996 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 7997 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 7998 | |
| 7999 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 8000 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 8001 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8002 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 8003 | |
| 8004 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 8005 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 8006 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 8007 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8008 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 8009 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8010 | |
| 8011 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 8012 | bitmap_pattern->pattern_len = ptrn_len; |
| 8013 | |
| 8014 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 8015 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 8016 | |
| 8017 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 8018 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 8019 | |
| 8020 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 8021 | bitmap_pattern->pattern_id = ptrn_id; |
| 8022 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8023 | 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] | 8024 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 8025 | bitmap_pattern->pattern_offset, user); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8026 | #ifdef CONFIG_MCL |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8027 | WMI_LOGI("Pattern : "); |
| 8028 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8029 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 8030 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8031 | WMI_LOGI("Mask : "); |
| 8032 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8033 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8034 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8035 | |
| 8036 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 8037 | |
| 8038 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 8039 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 8040 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8041 | |
| 8042 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 8043 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 8044 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8045 | |
| 8046 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 8047 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 8048 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8049 | |
| 8050 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 8051 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 8052 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8053 | |
| 8054 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 8055 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 8056 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8057 | *(A_UINT32 *) buf_ptr = 0; |
| 8058 | |
| 8059 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8060 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 8061 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8062 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8063 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8064 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8065 | } |
| 8066 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8067 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8068 | } |
| 8069 | |
| 8070 | /** |
| 8071 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 8072 | * @wmi_handle: wmi handle |
| 8073 | * @ptrn_id: pattern id |
| 8074 | * @vdev_id: vdev id |
| 8075 | * |
| 8076 | * Return: CDF status |
| 8077 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8078 | 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] | 8079 | uint8_t vdev_id) |
| 8080 | { |
| 8081 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 8082 | wmi_buf_t buf; |
| 8083 | int32_t len; |
| 8084 | int ret; |
| 8085 | |
| 8086 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 8087 | |
| 8088 | |
| 8089 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8090 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8091 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8092 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8093 | } |
| 8094 | |
| 8095 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 8096 | |
| 8097 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8098 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 8099 | WMITLV_GET_STRUCT_TLVLEN( |
| 8100 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 8101 | cmd->vdev_id = vdev_id; |
| 8102 | cmd->pattern_id = ptrn_id; |
| 8103 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 8104 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8105 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8106 | cmd->pattern_id, vdev_id); |
| 8107 | |
| 8108 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8109 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 8110 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8111 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8112 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8113 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8114 | } |
| 8115 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8116 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8117 | } |
| 8118 | |
| 8119 | /** |
| 8120 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 8121 | * @wmi_handle: wmi handle |
| 8122 | * |
| 8123 | * Sends host wakeup indication to FW. On receiving this indication, |
| 8124 | * FW will come out of WOW. |
| 8125 | * |
| 8126 | * Return: CDF status |
| 8127 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8128 | 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] | 8129 | { |
| 8130 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 8131 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8132 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8133 | int32_t len; |
| 8134 | int ret; |
| 8135 | |
| 8136 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 8137 | |
| 8138 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8139 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8140 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8141 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8142 | } |
| 8143 | |
| 8144 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 8145 | wmi_buf_data(buf); |
| 8146 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8147 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 8148 | WMITLV_GET_STRUCT_TLVLEN |
| 8149 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 8150 | |
| 8151 | |
| 8152 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8153 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 8154 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8155 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8156 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8157 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8158 | } |
| 8159 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8160 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8161 | } |
| 8162 | |
| 8163 | /** |
| 8164 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8165 | * @wmi_handle: wmi handle |
| 8166 | * @msg: delts params |
| 8167 | * |
| 8168 | * Return: CDF status |
| 8169 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8170 | 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] | 8171 | uint8_t ac) |
| 8172 | { |
| 8173 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8174 | wmi_buf_t buf; |
| 8175 | int32_t len = sizeof(*cmd); |
| 8176 | |
| 8177 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8178 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8179 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8180 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8181 | } |
| 8182 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8183 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8184 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8185 | WMITLV_GET_STRUCT_TLVLEN |
| 8186 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8187 | cmd->vdev_id = vdev_id; |
| 8188 | cmd->ac = ac; |
| 8189 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8190 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8191 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8192 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8193 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8194 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8195 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8196 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8197 | } |
| 8198 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8199 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8200 | } |
| 8201 | |
| 8202 | /** |
| 8203 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8204 | * @wmi_handle: handle to wmi |
| 8205 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8206 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8207 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8208 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8209 | * active flow. |
| 8210 | * |
| 8211 | * Return: CDF status |
| 8212 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8213 | QDF_STATUS send_aggr_qos_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8214 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8215 | { |
| 8216 | int i = 0; |
| 8217 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8218 | wmi_buf_t buf; |
| 8219 | int32_t len = sizeof(*cmd); |
| 8220 | |
| 8221 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 8222 | /* if flow in this AC is active */ |
| 8223 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 8224 | /* |
| 8225 | * as per implementation of wma_add_ts_req() we |
| 8226 | * are not waiting any response from firmware so |
| 8227 | * apart from sending ADDTS to firmware just send |
| 8228 | * success to upper layers |
| 8229 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8230 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8231 | |
| 8232 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8233 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8234 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8235 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8236 | } |
| 8237 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 8238 | wmi_buf_data(buf); |
| 8239 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8240 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8241 | WMITLV_GET_STRUCT_TLVLEN |
| 8242 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8243 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 8244 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 8245 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8246 | traffic.userPrio); |
| 8247 | cmd->medium_time_us = |
| 8248 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 8249 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8250 | 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] | 8251 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 8252 | cmd->medium_time_us, cmd->downgrade_type); |
| 8253 | if (wmi_unified_cmd_send |
| 8254 | (wmi_handle, buf, len, |
| 8255 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8256 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8257 | __func__); |
| 8258 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8259 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8260 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8261 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8262 | } |
| 8263 | } |
| 8264 | } |
| 8265 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8266 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8267 | } |
| 8268 | |
| 8269 | /** |
| 8270 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 8271 | * @wmi_handle: wmi handle |
| 8272 | * @msg: ADDTS params |
| 8273 | * |
| 8274 | * Return: CDF status |
| 8275 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8276 | QDF_STATUS send_add_ts_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8277 | struct add_ts_param *msg) |
| 8278 | { |
| 8279 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8280 | wmi_buf_t buf; |
| 8281 | int32_t len = sizeof(*cmd); |
| 8282 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8283 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8284 | |
| 8285 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8286 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8287 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8288 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8289 | } |
| 8290 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8291 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8292 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8293 | WMITLV_GET_STRUCT_TLVLEN |
| 8294 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8295 | cmd->vdev_id = msg->sme_session_id; |
| 8296 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 8297 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 8298 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8299 | 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] | 8300 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 8301 | cmd->downgrade_type, __func__, __LINE__); |
| 8302 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8303 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8304 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 8305 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8306 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8307 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8308 | } |
| 8309 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8310 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8311 | } |
| 8312 | |
| 8313 | /** |
| 8314 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter in target |
| 8315 | * @wmi_handle: wmi handle |
| 8316 | * @vdev_id: vdev id |
| 8317 | * @enable: Flag to enable/disable packet filter |
| 8318 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8319 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8320 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8321 | 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] | 8322 | uint8_t vdev_id, bool enable) |
| 8323 | { |
| 8324 | int32_t len; |
| 8325 | int ret = 0; |
| 8326 | wmi_buf_t buf; |
| 8327 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 8328 | |
| 8329 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 8330 | |
| 8331 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8332 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8333 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8334 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8335 | } |
| 8336 | |
| 8337 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 8338 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8339 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 8340 | WMITLV_GET_STRUCT_TLVLEN( |
| 8341 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 8342 | |
| 8343 | cmd->vdev_id = vdev_id; |
| 8344 | if (enable) |
| 8345 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 8346 | else |
| 8347 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 8348 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8349 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8350 | __func__, cmd->enable, vdev_id); |
| 8351 | |
| 8352 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8353 | WMI_PACKET_FILTER_ENABLE_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8354 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8355 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8356 | wmi_buf_free(buf); |
| 8357 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8358 | |
| 8359 | return ret; |
| 8360 | } |
| 8361 | |
| 8362 | /** |
| 8363 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 8364 | * @wmi_handle: wmi handle |
| 8365 | * @vdev_id: vdev id |
| 8366 | * @rcv_filter_param: Packet filter parameters |
| 8367 | * @filter_id: Filter id |
| 8368 | * @enable: Flag to add/delete packet filter configuration |
| 8369 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8370 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8371 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8372 | 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] | 8373 | uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param, |
| 8374 | uint8_t filter_id, bool enable) |
| 8375 | { |
| 8376 | int len, i; |
| 8377 | int err = 0; |
| 8378 | wmi_buf_t buf; |
| 8379 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 8380 | |
| 8381 | |
| 8382 | /* allocate the memory */ |
| 8383 | len = sizeof(*cmd); |
| 8384 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8385 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8386 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8387 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8388 | } |
| 8389 | |
| 8390 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 8391 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8392 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 8393 | WMITLV_GET_STRUCT_TLVLEN |
| 8394 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 8395 | |
| 8396 | cmd->vdev_id = vdev_id; |
| 8397 | cmd->filter_id = filter_id; |
| 8398 | if (enable) |
| 8399 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 8400 | else |
| 8401 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 8402 | |
| 8403 | if (enable) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8404 | cmd->num_params = QDF_MIN( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8405 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 8406 | rcv_filter_param->numFieldParams); |
| 8407 | cmd->filter_type = rcv_filter_param->filterType; |
| 8408 | cmd->coalesce_time = rcv_filter_param->coalesceTime; |
| 8409 | |
| 8410 | for (i = 0; i < cmd->num_params; i++) { |
| 8411 | cmd->paramsData[i].proto_type = |
| 8412 | rcv_filter_param->paramsData[i].protocolLayer; |
| 8413 | cmd->paramsData[i].cmp_type = |
| 8414 | rcv_filter_param->paramsData[i].cmpFlag; |
| 8415 | cmd->paramsData[i].data_length = |
| 8416 | rcv_filter_param->paramsData[i].dataLength; |
| 8417 | cmd->paramsData[i].data_offset = |
| 8418 | rcv_filter_param->paramsData[i].dataOffset; |
| 8419 | memcpy(&cmd->paramsData[i].compareData, |
| 8420 | rcv_filter_param->paramsData[i].compareData, |
| 8421 | sizeof(cmd->paramsData[i].compareData)); |
| 8422 | memcpy(&cmd->paramsData[i].dataMask, |
| 8423 | rcv_filter_param->paramsData[i].dataMask, |
| 8424 | sizeof(cmd->paramsData[i].dataMask)); |
| 8425 | } |
| 8426 | } |
| 8427 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8428 | 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] | 8429 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 8430 | /* send the command along with data */ |
| 8431 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8432 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 8433 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8434 | WMI_LOGE("Failed to send pkt_filter cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8435 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8436 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8437 | } |
| 8438 | |
| 8439 | |
| 8440 | return 0; |
| 8441 | } |
| 8442 | |
| 8443 | /** |
| 8444 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 8445 | * @wmi_handle: wmi handle |
| 8446 | * @vdev_id: vdev id |
| 8447 | * @multicastAddr: mcast address |
| 8448 | * @clearList: clear list flag |
| 8449 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8450 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8451 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8452 | 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] | 8453 | uint8_t vdev_id, |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8454 | struct qdf_mac_addr multicast_addr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8455 | bool clearList) |
| 8456 | { |
| 8457 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 8458 | wmi_buf_t buf; |
| 8459 | int err; |
| 8460 | |
| 8461 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8462 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8463 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8464 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8465 | } |
| 8466 | |
| 8467 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8468 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8469 | |
| 8470 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8471 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 8472 | WMITLV_GET_STRUCT_TLVLEN |
| 8473 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 8474 | cmd->action = |
| 8475 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 8476 | cmd->vdev_id = vdev_id; |
| 8477 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8478 | |
| 8479 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 8480 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 8481 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8482 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 8483 | sizeof(*cmd), |
| 8484 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 8485 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8486 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8487 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8488 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8489 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8490 | |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8491 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8492 | } |
| 8493 | |
| 8494 | /** |
| 8495 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 8496 | * @wmi_handle: wmi handle |
| 8497 | * @vdev_id: vdev id |
| 8498 | * @params: GTK offload parameters |
| 8499 | * |
| 8500 | * Return: CDF status |
| 8501 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8502 | 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] | 8503 | struct gtk_offload_params *params, |
| 8504 | bool enable_offload, |
| 8505 | uint32_t gtk_offload_opcode) |
| 8506 | { |
| 8507 | int len; |
| 8508 | wmi_buf_t buf; |
| 8509 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8510 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8511 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8512 | WMI_LOGD("%s Enter", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8513 | |
| 8514 | len = sizeof(*cmd); |
| 8515 | |
| 8516 | /* alloc wmi buffer */ |
| 8517 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8518 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8519 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 8520 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8521 | goto out; |
| 8522 | } |
| 8523 | |
| 8524 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 8525 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8526 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 8527 | WMITLV_GET_STRUCT_TLVLEN |
| 8528 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 8529 | |
| 8530 | cmd->vdev_id = vdev_id; |
| 8531 | |
| 8532 | /* Request target to enable GTK offload */ |
Siddarth Poddar | 9500f2e | 2016-04-01 17:45:06 +0530 | [diff] [blame] | 8533 | if (enable_offload == WMI_GTK_OFFLOAD_ENABLE) { |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8534 | cmd->flags = gtk_offload_opcode; |
| 8535 | |
| 8536 | /* Copy the keys and replay counter */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8537 | qdf_mem_copy(cmd->KCK, params->aKCK, WMI_GTK_OFFLOAD_KCK_BYTES); |
| 8538 | qdf_mem_copy(cmd->KEK, params->aKEK, WMI_GTK_OFFLOAD_KEK_BYTES); |
| 8539 | qdf_mem_copy(cmd->replay_counter, ¶ms->ullKeyReplayCounter, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8540 | GTK_REPLAY_COUNTER_BYTES); |
| 8541 | } else { |
| 8542 | cmd->flags = gtk_offload_opcode; |
| 8543 | } |
| 8544 | |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8545 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 8546 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8547 | /* send the wmi command */ |
| 8548 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8549 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8550 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8551 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8552 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8553 | } |
| 8554 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8555 | out: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8556 | WMI_LOGD("%s Exit", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8557 | return status; |
| 8558 | } |
| 8559 | |
| 8560 | /** |
| 8561 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 8562 | * @wmi_handle: wmi handle |
| 8563 | * @params: GTK offload params |
| 8564 | * |
| 8565 | * Return: CDF status |
| 8566 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8567 | 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] | 8568 | uint8_t vdev_id, |
| 8569 | uint64_t offload_req_opcode) |
| 8570 | { |
| 8571 | int len; |
| 8572 | wmi_buf_t buf; |
| 8573 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8574 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8575 | |
| 8576 | len = sizeof(*cmd); |
| 8577 | |
| 8578 | /* alloc wmi buffer */ |
| 8579 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8580 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8581 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 8582 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8583 | goto out; |
| 8584 | } |
| 8585 | |
| 8586 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 8587 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8588 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 8589 | WMITLV_GET_STRUCT_TLVLEN |
| 8590 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 8591 | |
| 8592 | /* Request for GTK offload status */ |
| 8593 | cmd->flags = offload_req_opcode; |
| 8594 | cmd->vdev_id = vdev_id; |
| 8595 | |
| 8596 | /* send the wmi command */ |
| 8597 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8598 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8599 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8600 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8601 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8602 | } |
| 8603 | |
| 8604 | out: |
| 8605 | return status; |
| 8606 | } |
| 8607 | |
| 8608 | /** |
| 8609 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 8610 | * @wmi_handle: wmi handle |
| 8611 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 8612 | * |
| 8613 | * Retrun: CDF status |
| 8614 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8615 | 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] | 8616 | struct periodic_tx_pattern * |
| 8617 | pAddPeriodicTxPtrnParams, |
| 8618 | uint8_t vdev_id) |
| 8619 | { |
| 8620 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8621 | wmi_buf_t wmi_buf; |
| 8622 | uint32_t len; |
| 8623 | uint8_t *buf_ptr; |
| 8624 | uint32_t ptrn_len, ptrn_len_aligned; |
| 8625 | int j; |
| 8626 | |
| 8627 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8628 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 8629 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 8630 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 8631 | |
| 8632 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8633 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8634 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8635 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8636 | } |
| 8637 | |
| 8638 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8639 | |
| 8640 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 8641 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8642 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8643 | WMITLV_GET_STRUCT_TLVLEN |
| 8644 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8645 | |
| 8646 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8647 | cmd->vdev_id = vdev_id; |
| 8648 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 8649 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 8650 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8651 | |
| 8652 | /* Pattern info */ |
| 8653 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8654 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 8655 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8656 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8657 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8658 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8659 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8660 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8661 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8662 | |
| 8663 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8664 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8665 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8666 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8667 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8668 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8669 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8670 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8671 | } |
| 8672 | |
| 8673 | /** |
| 8674 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 8675 | * @wmi_handle: wmi handle |
| 8676 | * @vdev_id: vdev id |
| 8677 | * @pattern_id: pattern id |
| 8678 | * |
| 8679 | * Retrun: CDF status |
| 8680 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8681 | 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] | 8682 | uint8_t vdev_id, |
| 8683 | uint8_t pattern_id) |
| 8684 | { |
| 8685 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8686 | wmi_buf_t wmi_buf; |
| 8687 | uint32_t len = |
| 8688 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8689 | |
| 8690 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8691 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8692 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8693 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8694 | } |
| 8695 | |
| 8696 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 8697 | wmi_buf_data(wmi_buf); |
| 8698 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8699 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8700 | WMITLV_GET_STRUCT_TLVLEN |
| 8701 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8702 | |
| 8703 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8704 | cmd->vdev_id = vdev_id; |
| 8705 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8706 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8707 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8708 | |
| 8709 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8710 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8711 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8712 | wmi_buf_free(wmi_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 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8715 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8716 | } |
| 8717 | |
| 8718 | /** |
| 8719 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 8720 | * @wmi_handle: wmi handle |
| 8721 | * @preq: stats ext params |
| 8722 | * |
| 8723 | * Return: CDF status |
| 8724 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8725 | 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] | 8726 | struct stats_ext_params *preq) |
| 8727 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8728 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8729 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 8730 | wmi_buf_t buf; |
| 8731 | uint16_t len; |
| 8732 | uint8_t *buf_ptr; |
| 8733 | |
| 8734 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 8735 | |
| 8736 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8737 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8738 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8739 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8740 | } |
| 8741 | |
| 8742 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8743 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 8744 | |
| 8745 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8746 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 8747 | WMITLV_GET_STRUCT_TLVLEN |
| 8748 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 8749 | cmd->vdev_id = preq->vdev_id; |
| 8750 | cmd->data_len = preq->request_data_len; |
| 8751 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8752 | 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] | 8753 | __func__, preq->request_data_len, preq->vdev_id); |
| 8754 | |
| 8755 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 8756 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 8757 | |
| 8758 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8759 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8760 | |
| 8761 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8762 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8763 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8764 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8765 | ret); |
| 8766 | wmi_buf_free(buf); |
| 8767 | } |
| 8768 | |
| 8769 | return ret; |
| 8770 | } |
| 8771 | |
| 8772 | /** |
| 8773 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 8774 | * @wmi_handle: wmi handle |
| 8775 | * @params: ext wow params |
| 8776 | * |
| 8777 | * Return:0 for success or error code |
| 8778 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8779 | 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] | 8780 | struct ext_wow_params *params) |
| 8781 | { |
| 8782 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 8783 | wmi_buf_t buf; |
| 8784 | int32_t len; |
| 8785 | int ret; |
| 8786 | |
| 8787 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 8788 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8789 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8790 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8791 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8792 | } |
| 8793 | |
| 8794 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8795 | |
| 8796 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8797 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 8798 | WMITLV_GET_STRUCT_TLVLEN |
| 8799 | (wmi_extwow_enable_cmd_fixed_param)); |
| 8800 | |
| 8801 | cmd->vdev_id = params->vdev_id; |
| 8802 | cmd->type = params->type; |
| 8803 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 8804 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8805 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8806 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 8807 | |
| 8808 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8809 | WMI_EXTWOW_ENABLE_CMDID); |
| 8810 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8811 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8812 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8813 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8814 | } |
| 8815 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8816 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8817 | |
| 8818 | } |
| 8819 | |
| 8820 | /** |
| 8821 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 8822 | * @wmi_handle: wmi handle |
| 8823 | * @app_type1_params: app type1 params |
| 8824 | * |
| 8825 | * Return: CDF status |
| 8826 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8827 | 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] | 8828 | struct app_type1_params *app_type1_params) |
| 8829 | { |
| 8830 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 8831 | wmi_buf_t buf; |
| 8832 | int32_t len; |
| 8833 | int ret; |
| 8834 | |
| 8835 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 8836 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8837 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8838 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8839 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8840 | } |
| 8841 | |
| 8842 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 8843 | wmi_buf_data(buf); |
| 8844 | |
| 8845 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8846 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 8847 | WMITLV_GET_STRUCT_TLVLEN |
| 8848 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 8849 | |
| 8850 | cmd->vdev_id = app_type1_params->vdev_id; |
| 8851 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 8852 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8853 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8854 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8855 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8856 | cmd->passwd_len = app_type1_params->pass_length; |
| 8857 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8858 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8859 | "identification_id %.8s id_length %u " |
| 8860 | "password %.16s pass_length %u", |
| 8861 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 8862 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 8863 | |
| 8864 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8865 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 8866 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8867 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8868 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8869 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8870 | } |
| 8871 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8872 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8873 | } |
| 8874 | |
| 8875 | /** |
| 8876 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 8877 | * @wmi_handle: wmi handle |
| 8878 | * @appType2Params: app type2 params |
| 8879 | * |
| 8880 | * Return: CDF status |
| 8881 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8882 | 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] | 8883 | struct app_type2_params *appType2Params) |
| 8884 | { |
| 8885 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 8886 | wmi_buf_t buf; |
| 8887 | int32_t len; |
| 8888 | int ret; |
| 8889 | |
| 8890 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 8891 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8892 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8893 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8894 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8895 | } |
| 8896 | |
| 8897 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 8898 | wmi_buf_data(buf); |
| 8899 | |
| 8900 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8901 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 8902 | WMITLV_GET_STRUCT_TLVLEN |
| 8903 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 8904 | |
| 8905 | cmd->vdev_id = appType2Params->vdev_id; |
| 8906 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8907 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8908 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 8909 | |
| 8910 | cmd->ip_id = appType2Params->ip_id; |
| 8911 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 8912 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 8913 | |
| 8914 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 8915 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 8916 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 8917 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 8918 | |
| 8919 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 8920 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 8921 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 8922 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 8923 | |
| 8924 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 8925 | &cmd->gateway_mac); |
| 8926 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 8927 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 8928 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8929 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8930 | "rc4_key %.16s rc4_key_len %u " |
| 8931 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 8932 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 8933 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 8934 | "keepalive_max %u keepalive_inc %u " |
| 8935 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 8936 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 8937 | cmd->rc4_key, cmd->rc4_key_len, |
| 8938 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 8939 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 8940 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 8941 | cmd->keepalive_max, cmd->keepalive_inc, |
| 8942 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 8943 | |
| 8944 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8945 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 8946 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8947 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8948 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8949 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8950 | } |
| 8951 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8952 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8953 | |
| 8954 | } |
| 8955 | |
| 8956 | /** |
| 8957 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 8958 | * @wmi_handle: wmi handle |
| 8959 | * @timer_val: auto shutdown timer value |
| 8960 | * |
| 8961 | * Return: CDF status |
| 8962 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8963 | 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] | 8964 | uint32_t timer_val) |
| 8965 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8966 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8967 | wmi_buf_t buf = NULL; |
| 8968 | uint8_t *buf_ptr; |
| 8969 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 8970 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 8971 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8972 | 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] | 8973 | __func__, timer_val); |
| 8974 | |
| 8975 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8976 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8977 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8978 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8979 | } |
| 8980 | |
| 8981 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8982 | wmi_auto_sh_cmd = |
| 8983 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 8984 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 8985 | |
| 8986 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 8987 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 8988 | WMITLV_GET_STRUCT_TLVLEN |
| 8989 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 8990 | |
| 8991 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8992 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8993 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8994 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8995 | __func__, status); |
| 8996 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8997 | } |
| 8998 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8999 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9000 | } |
| 9001 | |
| 9002 | /** |
| 9003 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 9004 | * @wmi_handle: wmi handle |
| 9005 | * @nan_req: request data which will be non-null |
| 9006 | * |
| 9007 | * Return: CDF status |
| 9008 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9009 | QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9010 | struct nan_req_params *nan_req) |
| 9011 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9012 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9013 | wmi_nan_cmd_param *cmd; |
| 9014 | wmi_buf_t buf; |
| 9015 | uint16_t len = sizeof(*cmd); |
| 9016 | uint16_t nan_data_len, nan_data_len_aligned; |
| 9017 | uint8_t *buf_ptr; |
| 9018 | |
| 9019 | /* |
| 9020 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 9021 | * +------------+----------+-----------------------+--------------+ |
| 9022 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 9023 | * +------------+----------+-----------------------+--------------+ |
| 9024 | */ |
| 9025 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9026 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 9027 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9028 | } |
| 9029 | nan_data_len = nan_req->request_data_len; |
| 9030 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 9031 | sizeof(uint32_t)); |
| 9032 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 9033 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9034 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9035 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 9036 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9037 | } |
| 9038 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9039 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 9040 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9041 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 9042 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 9043 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9044 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9045 | __func__, nan_req->request_data_len); |
| 9046 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 9047 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 9048 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9049 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9050 | |
| 9051 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9052 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9053 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9054 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9055 | __func__, ret); |
| 9056 | wmi_buf_free(buf); |
| 9057 | } |
| 9058 | |
| 9059 | return ret; |
| 9060 | } |
| 9061 | |
| 9062 | /** |
| 9063 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 9064 | * @wmi_handle: wmi handle |
| 9065 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 9066 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9067 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9068 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9069 | 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] | 9070 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 9071 | { |
| 9072 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 9073 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9074 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9075 | |
| 9076 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 9077 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9078 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9079 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9080 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9081 | } |
| 9082 | |
| 9083 | 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] | 9084 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9085 | |
| 9086 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9087 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 9088 | WMITLV_GET_STRUCT_TLVLEN |
| 9089 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 9090 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 9091 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 9092 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 9093 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 9094 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9095 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9096 | sizeof(*cmd), |
| 9097 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9098 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9099 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9100 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9101 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9102 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9103 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9104 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9105 | |
| 9106 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9107 | } |
| 9108 | |
| 9109 | /** |
| 9110 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 9111 | * @wmi_handle: wmi handle |
| 9112 | * @flashing: flashing request |
| 9113 | * |
| 9114 | * Return: CDF status |
| 9115 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9116 | 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] | 9117 | struct flashing_req_params *flashing) |
| 9118 | { |
| 9119 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9120 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9121 | wmi_buf_t buf; |
| 9122 | uint8_t *buf_ptr; |
| 9123 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 9124 | |
| 9125 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9126 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9127 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9128 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9129 | } |
| 9130 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9131 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 9132 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9133 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 9134 | WMITLV_GET_STRUCT_TLVLEN |
| 9135 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 9136 | cmd->pattern_id = flashing->pattern_id; |
| 9137 | cmd->led_x0 = flashing->led_x0; |
| 9138 | cmd->led_x1 = flashing->led_x1; |
| 9139 | |
| 9140 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9141 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9142 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9143 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9144 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9145 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9146 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9147 | |
| 9148 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9149 | } |
| 9150 | |
| 9151 | /** |
| 9152 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 9153 | * @wmi_handle: wmi handle |
| 9154 | * @ch_avoid_update_req: channel avoid update params |
| 9155 | * |
| 9156 | * Return: CDF status |
| 9157 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9158 | 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] | 9159 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9160 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9161 | wmi_buf_t buf = NULL; |
| 9162 | uint8_t *buf_ptr; |
| 9163 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 9164 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 9165 | |
| 9166 | |
| 9167 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9168 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9169 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9170 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9171 | } |
| 9172 | |
| 9173 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9174 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 9175 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 9176 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 9177 | WMITLV_GET_STRUCT_TLVLEN |
| 9178 | (wmi_chan_avoid_update_cmd_param)); |
| 9179 | |
| 9180 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9181 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9182 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9183 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9184 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 9185 | " returned Error %d", status); |
| 9186 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9187 | } |
| 9188 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9189 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9190 | } |
| 9191 | |
| 9192 | /** |
| 9193 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 9194 | * @wmi_handle: wmi handle |
| 9195 | * @reg_dmn: reg domain |
| 9196 | * @regdmn2G: 2G reg domain |
| 9197 | * @regdmn5G: 5G reg domain |
| 9198 | * @ctl2G: 2G test limit |
| 9199 | * @ctl5G: 5G test limit |
| 9200 | * |
| 9201 | * Return: none |
| 9202 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9203 | 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] | 9204 | uint32_t reg_dmn, uint16_t regdmn2G, |
| 9205 | uint16_t regdmn5G, int8_t ctl2G, |
| 9206 | int8_t ctl5G) |
| 9207 | { |
| 9208 | wmi_buf_t buf; |
| 9209 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9210 | int32_t len = sizeof(*cmd); |
| 9211 | |
| 9212 | |
| 9213 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9214 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9215 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9216 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9217 | } |
| 9218 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9219 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9220 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9221 | WMITLV_GET_STRUCT_TLVLEN |
| 9222 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9223 | cmd->reg_domain = reg_dmn; |
| 9224 | cmd->reg_domain_2G = regdmn2G; |
| 9225 | cmd->reg_domain_5G = regdmn5G; |
| 9226 | cmd->conformance_test_limit_2G = ctl2G; |
| 9227 | cmd->conformance_test_limit_5G = ctl5G; |
| 9228 | |
| 9229 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9230 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9231 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9232 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9233 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9234 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9235 | } |
| 9236 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9237 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9238 | } |
| 9239 | |
| 9240 | |
| 9241 | /** |
| 9242 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 9243 | * @wmi_handle: wmi handle |
| 9244 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 9245 | * |
| 9246 | * This function sets tdls off channel mode |
| 9247 | * |
| 9248 | * Return: 0 on success; Negative errno otherwise |
| 9249 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9250 | 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] | 9251 | struct tdls_channel_switch_params *chan_switch_params) |
| 9252 | { |
| 9253 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9254 | wmi_buf_t wmi_buf; |
| 9255 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9256 | |
| 9257 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9258 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9259 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9260 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9261 | } |
| 9262 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9263 | wmi_buf_data(wmi_buf); |
| 9264 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9265 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9266 | WMITLV_GET_STRUCT_TLVLEN( |
| 9267 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9268 | |
| 9269 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9270 | &cmd->peer_macaddr); |
| 9271 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9272 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9273 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9274 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9275 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9276 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9277 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9278 | 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] | 9279 | cmd->peer_macaddr.mac_addr31to0, |
| 9280 | cmd->peer_macaddr.mac_addr47to32); |
| 9281 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9282 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9283 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9284 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9285 | ), |
| 9286 | cmd->vdev_id, |
| 9287 | cmd->offchan_mode, |
| 9288 | cmd->offchan_num, |
| 9289 | cmd->offchan_bw_bitmap, |
| 9290 | cmd->is_peer_responder, |
| 9291 | cmd->offchan_oper_class); |
| 9292 | |
| 9293 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9294 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9295 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9296 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9297 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9298 | } |
| 9299 | |
| 9300 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9301 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9302 | } |
| 9303 | |
| 9304 | /** |
| 9305 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9306 | * @wmi_handle: wmi handle |
| 9307 | * @pwmaTdlsparams: TDLS params |
| 9308 | * |
| 9309 | * Return: 0 for sucess or error code |
| 9310 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9311 | 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] | 9312 | void *tdls_param, uint8_t tdls_state) |
| 9313 | { |
| 9314 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9315 | wmi_buf_t wmi_buf; |
| 9316 | |
| 9317 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9318 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9319 | |
| 9320 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9321 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9322 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9323 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9324 | } |
| 9325 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9326 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9327 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9328 | WMITLV_GET_STRUCT_TLVLEN |
| 9329 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9330 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9331 | cmd->state = tdls_state; |
| 9332 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9333 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9334 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9335 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9336 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9337 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9338 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9339 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9340 | wmi_tdls->peer_traffic_response_timeout; |
| 9341 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9342 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9343 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9344 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9345 | cmd->teardown_notification_ms = |
| 9346 | wmi_tdls->teardown_notification_ms; |
| 9347 | cmd->tdls_peer_kickout_threshold = |
| 9348 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9349 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9350 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9351 | "notification_interval_ms: %d, " |
| 9352 | "tx_discovery_threshold: %d, " |
| 9353 | "tx_teardown_threshold: %d, " |
| 9354 | "rssi_teardown_threshold: %d, " |
| 9355 | "rssi_delta: %d, " |
| 9356 | "tdls_options: 0x%x, " |
| 9357 | "tdls_peer_traffic_ind_window: %d, " |
| 9358 | "tdls_peer_traffic_response_timeout: %d, " |
| 9359 | "tdls_puapsd_mask: 0x%x, " |
| 9360 | "tdls_puapsd_inactivity_time: %d, " |
| 9361 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9362 | "teardown_notification_ms: %d, " |
| 9363 | "tdls_peer_kickout_threshold: %d", |
| 9364 | __func__, tdls_state, cmd->state, |
| 9365 | cmd->notification_interval_ms, |
| 9366 | cmd->tx_discovery_threshold, |
| 9367 | cmd->tx_teardown_threshold, |
| 9368 | cmd->rssi_teardown_threshold, |
| 9369 | cmd->rssi_delta, |
| 9370 | cmd->tdls_options, |
| 9371 | cmd->tdls_peer_traffic_ind_window, |
| 9372 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9373 | cmd->tdls_puapsd_mask, |
| 9374 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9375 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9376 | cmd->teardown_notification_ms, |
| 9377 | cmd->tdls_peer_kickout_threshold); |
| 9378 | |
| 9379 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9380 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9381 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9382 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9383 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9384 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9385 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9386 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9387 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9388 | } |
| 9389 | |
| 9390 | /** |
| 9391 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9392 | * @wmi_handle: wmi handle |
| 9393 | * @peerStateParams: TDLS peer state params |
| 9394 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9395 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9396 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9397 | 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] | 9398 | struct tdls_peer_state_params *peerStateParams, |
| 9399 | uint32_t *ch_mhz) |
| 9400 | { |
| 9401 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9402 | wmi_tdls_peer_capabilities *peer_cap; |
| 9403 | wmi_channel *chan_info; |
| 9404 | wmi_buf_t wmi_buf; |
| 9405 | uint8_t *buf_ptr; |
| 9406 | uint32_t i; |
| 9407 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9408 | sizeof(wmi_tdls_peer_capabilities); |
| 9409 | |
| 9410 | |
| 9411 | len += WMI_TLV_HDR_SIZE + |
| 9412 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9413 | |
| 9414 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9415 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9416 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9417 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9418 | } |
| 9419 | |
| 9420 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9421 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9422 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9423 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9424 | WMITLV_GET_STRUCT_TLVLEN |
| 9425 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9426 | |
| 9427 | cmd->vdev_id = peerStateParams->vdevId; |
| 9428 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9429 | &cmd->peer_macaddr); |
| 9430 | |
| 9431 | |
| 9432 | cmd->peer_state = peerStateParams->peerState; |
| 9433 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9434 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9435 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9436 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9437 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9438 | cmd->peer_macaddr.mac_addr31to0, |
| 9439 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9440 | |
| 9441 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9442 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9443 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9444 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9445 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9446 | |
| 9447 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9448 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9449 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9450 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9451 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9452 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9453 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9454 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9455 | |
| 9456 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9457 | * but fill SP |
| 9458 | */ |
| 9459 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9460 | peerStateParams->peerCap.peerMaxSp); |
| 9461 | |
| 9462 | peer_cap->buff_sta_support = |
| 9463 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9464 | peer_cap->off_chan_support = |
| 9465 | peerStateParams->peerCap.peerOffChanSupport; |
| 9466 | peer_cap->peer_curr_operclass = |
| 9467 | peerStateParams->peerCap.peerCurrOperClass; |
| 9468 | /* self curr operclass is not being used and so pass op class for |
| 9469 | * preferred off chan in it. |
| 9470 | */ |
| 9471 | peer_cap->self_curr_operclass = |
| 9472 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 9473 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 9474 | peer_cap->peer_operclass_len = |
| 9475 | peerStateParams->peerCap.peerOperClassLen; |
| 9476 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9477 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9478 | __func__, peer_cap->peer_operclass_len); |
| 9479 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 9480 | peer_cap->peer_operclass[i] = |
| 9481 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9482 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9483 | __func__, i, peer_cap->peer_operclass[i]); |
| 9484 | } |
| 9485 | |
| 9486 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 9487 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 9488 | peer_cap->pref_offchan_bw = |
| 9489 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 9490 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9491 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9492 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 9493 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 9494 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 9495 | " %d, pref_offchan_bw: %d", |
| 9496 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 9497 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 9498 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 9499 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 9500 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 9501 | |
| 9502 | /* next fill variable size array of peer chan info */ |
| 9503 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 9504 | WMITLV_SET_HDR(buf_ptr, |
| 9505 | WMITLV_TAG_ARRAY_STRUC, |
| 9506 | sizeof(wmi_channel) * |
| 9507 | peerStateParams->peerCap.peerChanLen); |
| 9508 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9509 | |
| 9510 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 9511 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 9512 | WMITLV_TAG_STRUC_wmi_channel, |
| 9513 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 9514 | chan_info->mhz = ch_mhz[i]; |
| 9515 | chan_info->band_center_freq1 = chan_info->mhz; |
| 9516 | chan_info->band_center_freq2 = 0; |
| 9517 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9518 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9519 | |
| 9520 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 9521 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9522 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9523 | peerStateParams->peerCap.peerChan[i].chanId, |
| 9524 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 9525 | } |
| 9526 | |
| 9527 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 9528 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 9529 | else |
| 9530 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 9531 | |
| 9532 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 9533 | peerStateParams->peerCap. |
| 9534 | peerChan[i].pwr); |
| 9535 | |
| 9536 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 9537 | peerStateParams->peerCap.peerChan[i]. |
| 9538 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9539 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9540 | peerStateParams->peerCap.peerChan[i].pwr); |
| 9541 | |
| 9542 | chan_info++; |
| 9543 | } |
| 9544 | |
| 9545 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9546 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9547 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9548 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9549 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9550 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9551 | } |
| 9552 | |
| 9553 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9554 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9555 | } |
| 9556 | |
| 9557 | /* |
| 9558 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 9559 | * firmware |
| 9560 | * @wmi_handle: Pointer to wmi handle |
| 9561 | * @mem_dump_req: Pointer for mem_dump_req |
| 9562 | * |
| 9563 | * This function sends memory dump request to firmware |
| 9564 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9565 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9566 | * |
| 9567 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9568 | 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] | 9569 | struct fw_dump_req_param *mem_dump_req) |
| 9570 | { |
| 9571 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 9572 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9573 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9574 | int32_t len; |
| 9575 | wmi_buf_t buf; |
| 9576 | u_int8_t *buf_ptr; |
| 9577 | int ret, loop; |
| 9578 | |
| 9579 | /* |
| 9580 | * len = sizeof(fixed param) that includes tlv header + |
| 9581 | * tlv header for array of struc + |
| 9582 | * sizeof (each struct) |
| 9583 | */ |
| 9584 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9585 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 9586 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9587 | |
| 9588 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9589 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 9590 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9591 | } |
| 9592 | |
| 9593 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9594 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9595 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 9596 | |
| 9597 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9598 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 9599 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 9600 | |
| 9601 | cmd->request_id = mem_dump_req->request_id; |
| 9602 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 9603 | |
| 9604 | /* TLV indicating array of structures to follow */ |
| 9605 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 9606 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9607 | sizeof(wmi_fw_mem_dump) * |
| 9608 | cmd->num_fw_mem_dump_segs); |
| 9609 | |
| 9610 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9611 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 9612 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9613 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9614 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 9615 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9616 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9617 | ((uint8_t *)(mem_dump_req->segment) + |
| 9618 | loop * sizeof(*seg_req)); |
| 9619 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 9620 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 9621 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 9622 | dump_params->seg_id = seg_req->seg_id; |
| 9623 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 9624 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 9625 | dump_params->seg_length = seg_req->seg_length; |
| 9626 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 9627 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9628 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 9629 | 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] | 9630 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 9631 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9632 | 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] | 9633 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 9634 | dump_params->dest_addr_hi); |
| 9635 | dump_params++; |
| 9636 | } |
| 9637 | |
| 9638 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9639 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 9640 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9641 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9642 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9643 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9644 | } |
| 9645 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9646 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 9647 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9648 | } |
| 9649 | |
| 9650 | /* |
| 9651 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 9652 | * @wmi_handle: Pointer to WMi handle |
| 9653 | * @ie_data: Pointer for ie data |
| 9654 | * |
| 9655 | * This function sends IE information to firmware |
| 9656 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9657 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9658 | * |
| 9659 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9660 | 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] | 9661 | struct vdev_ie_info_param *ie_info) |
| 9662 | { |
| 9663 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 9664 | wmi_buf_t buf; |
| 9665 | uint8_t *buf_ptr; |
| 9666 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9667 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9668 | |
| 9669 | |
| 9670 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 9671 | /* Allocate memory for the WMI command */ |
| 9672 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 9673 | |
| 9674 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9675 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9676 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9677 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9678 | } |
| 9679 | |
| 9680 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9681 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9682 | |
| 9683 | /* Populate the WMI command */ |
| 9684 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 9685 | |
| 9686 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9687 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 9688 | WMITLV_GET_STRUCT_TLVLEN( |
| 9689 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 9690 | cmd->vdev_id = ie_info->vdev_id; |
| 9691 | cmd->ie_id = ie_info->ie_id; |
| 9692 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 9693 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9694 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9695 | 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] | 9696 | ie_info->length, ie_info->vdev_id); |
| 9697 | |
| 9698 | buf_ptr += sizeof(*cmd); |
| 9699 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 9700 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9701 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9702 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9703 | |
| 9704 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9705 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9706 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9707 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9708 | wmi_buf_free(buf); |
| 9709 | } |
| 9710 | |
| 9711 | return ret; |
| 9712 | } |
| 9713 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 9714 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9715 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9716 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9717 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9718 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9719 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 9720 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 9721 | resource_cfg->num_offload_reorder_buffs = |
| 9722 | tgt_res_cfg->num_offload_reorder_buffs; |
| 9723 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 9724 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 9725 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 9726 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 9727 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 9728 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 9729 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 9730 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 9731 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 9732 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 9733 | resource_cfg->scan_max_pending_req = |
| 9734 | tgt_res_cfg->scan_max_pending_req; |
| 9735 | resource_cfg->bmiss_offload_max_vdev = |
| 9736 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 9737 | resource_cfg->roam_offload_max_vdev = |
| 9738 | tgt_res_cfg->roam_offload_max_vdev; |
| 9739 | resource_cfg->roam_offload_max_ap_profiles = |
| 9740 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 9741 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 9742 | resource_cfg->num_mcast_table_elems = |
| 9743 | tgt_res_cfg->num_mcast_table_elems; |
| 9744 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 9745 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 9746 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 9747 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 9748 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 9749 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 9750 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 9751 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 9752 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 9753 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 9754 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 9755 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 9756 | resource_cfg->num_tdls_conn_table_entries = |
| 9757 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 9758 | resource_cfg->beacon_tx_offload_max_vdev = |
| 9759 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 9760 | resource_cfg->num_multicast_filter_entries = |
| 9761 | tgt_res_cfg->num_multicast_filter_entries; |
| 9762 | resource_cfg->num_wow_filters = |
| 9763 | tgt_res_cfg->num_wow_filters; |
| 9764 | resource_cfg->num_keep_alive_pattern = |
| 9765 | tgt_res_cfg->num_keep_alive_pattern; |
| 9766 | resource_cfg->keep_alive_pattern_size = |
| 9767 | tgt_res_cfg->keep_alive_pattern_size; |
| 9768 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 9769 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 9770 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 9771 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 9772 | resource_cfg->wmi_send_separate = |
| 9773 | tgt_res_cfg->wmi_send_separate; |
| 9774 | resource_cfg->num_ocb_vdevs = |
| 9775 | tgt_res_cfg->num_ocb_vdevs; |
| 9776 | resource_cfg->num_ocb_channels = |
| 9777 | tgt_res_cfg->num_ocb_channels; |
| 9778 | resource_cfg->num_ocb_schedules = |
| 9779 | tgt_res_cfg->num_ocb_schedules; |
| 9780 | |
| 9781 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 9782 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9783 | /** |
| 9784 | * send_init_cmd_tlv() - wmi init command |
| 9785 | * @wmi_handle: pointer to wmi handle |
| 9786 | * @res_cfg: resource config |
| 9787 | * @num_mem_chunks: no of mem chunck |
| 9788 | * @mem_chunk: pointer to mem chunck structure |
| 9789 | * |
| 9790 | * This function sends IE information to firmware |
| 9791 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9792 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9793 | * |
| 9794 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9795 | QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9796 | wmi_resource_config *tgt_res_cfg, |
| 9797 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 9798 | bool action) |
| 9799 | { |
| 9800 | wmi_buf_t buf; |
| 9801 | wmi_init_cmd_fixed_param *cmd; |
| 9802 | wmi_abi_version my_vers; |
| 9803 | int num_whitelist; |
| 9804 | uint8_t *buf_ptr; |
| 9805 | wmi_resource_config *resource_cfg; |
| 9806 | wlan_host_memory_chunk *host_mem_chunks; |
| 9807 | uint32_t mem_chunk_len = 0; |
| 9808 | uint16_t idx; |
| 9809 | int len; |
| 9810 | int ret; |
| 9811 | |
| 9812 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 9813 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 9814 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 9815 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9816 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 9817 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9818 | } |
| 9819 | |
| 9820 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9821 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 9822 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 9823 | |
| 9824 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 9825 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 9826 | + WMI_TLV_HDR_SIZE); |
| 9827 | |
| 9828 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9829 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 9830 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 9831 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9832 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9833 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 9834 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 9835 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 9836 | |
| 9837 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 9838 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 9839 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 9840 | WMITLV_GET_STRUCT_TLVLEN |
| 9841 | (wlan_host_memory_chunk)); |
| 9842 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 9843 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 9844 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9845 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9846 | idx, host_mem_chunks[idx].size, |
| 9847 | host_mem_chunks[idx].ptr); |
| 9848 | } |
| 9849 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 9850 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 9851 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 9852 | WMITLV_TAG_ARRAY_STRUC, |
| 9853 | (sizeof(wlan_host_memory_chunk) * |
| 9854 | num_mem_chunks)); |
| 9855 | |
| 9856 | num_whitelist = sizeof(version_whitelist) / |
| 9857 | sizeof(wmi_whitelist_version_info); |
| 9858 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 9859 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 9860 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 9861 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 9862 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 9863 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9864 | #ifdef CONFIG_MCL |
| 9865 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 9866 | * 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] | 9867 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 9868 | &my_vers, |
| 9869 | &wmi_handle->fw_abi_version, |
| 9870 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9871 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9872 | 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] | 9873 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 9874 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 9875 | cmd->host_abi_vers.abi_version_ns_0, |
| 9876 | cmd->host_abi_vers.abi_version_ns_1, |
| 9877 | cmd->host_abi_vers.abi_version_ns_2, |
| 9878 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9879 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9880 | /* Save version sent from host - |
| 9881 | * Will be used to check ready event |
| 9882 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9883 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9884 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9885 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9886 | if (action) { |
| 9887 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9888 | WMI_INIT_CMDID); |
| 9889 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9890 | 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] | 9891 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9892 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9893 | } |
| 9894 | } else { |
| 9895 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 9896 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 9897 | } |
| 9898 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9899 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9900 | |
| 9901 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 9902 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9903 | /** |
| 9904 | * send_saved_init_cmd_tlv() - wmi init command |
| 9905 | * @wmi_handle: pointer to wmi handle |
| 9906 | * |
| 9907 | * This function sends IE information to firmware |
| 9908 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9909 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9910 | * |
| 9911 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9912 | QDF_STATUS send_saved_init_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9913 | { |
| 9914 | int status; |
| 9915 | |
| 9916 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 9917 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9918 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 9919 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9920 | } |
| 9921 | status = wmi_unified_cmd_send(wmi_handle, |
| 9922 | wmi_handle->saved_wmi_init_cmd.buf, |
| 9923 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 9924 | WMI_INIT_CMDID); |
| 9925 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9926 | 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] | 9927 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9928 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9929 | } |
| 9930 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 9931 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 9932 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9933 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9934 | } |
| 9935 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9936 | 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] | 9937 | { |
| 9938 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 9939 | wmi_service_ready_event_fixed_param *ev; |
| 9940 | |
| 9941 | |
| 9942 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 9943 | |
| 9944 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 9945 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9946 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9947 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9948 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9949 | /*Save fw version from service ready message */ |
| 9950 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9951 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9952 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9953 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9954 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9955 | } |
| 9956 | |
| 9957 | /** |
| 9958 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 9959 | * @wmi_handle: pointer to wmi handle |
| 9960 | * @res_cfg: resource config |
| 9961 | * @num_mem_chunks: no of mem chunck |
| 9962 | * @mem_chunk: pointer to mem chunck structure |
| 9963 | * |
| 9964 | * This function sends IE information to firmware |
| 9965 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9966 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9967 | * |
| 9968 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9969 | 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] | 9970 | void *evt_buf) |
| 9971 | { |
| 9972 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 9973 | wmi_ready_event_fixed_param *ev = NULL; |
| 9974 | |
| 9975 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 9976 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9977 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9978 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 9979 | &ev->fw_abi_vers)) { |
| 9980 | /* |
| 9981 | * Error: Our host version and the given firmware version |
| 9982 | * are incompatible. |
| 9983 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9984 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9985 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 9986 | __func__, |
| 9987 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 9988 | abi_version_0), |
| 9989 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 9990 | abi_version_0), |
| 9991 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 9992 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 9993 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 9994 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 9995 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 9996 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 9997 | ev->fw_abi_vers.abi_version_ns_0, |
| 9998 | ev->fw_abi_vers.abi_version_ns_1, |
| 9999 | ev->fw_abi_vers.abi_version_ns_2, |
| 10000 | ev->fw_abi_vers.abi_version_ns_3); |
| 10001 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10002 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10003 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10004 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10005 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10006 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10007 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10008 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10009 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10010 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10011 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10012 | |
| 10013 | /** |
| 10014 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 10015 | * @wmi_handle: wmi handle |
| 10016 | * @custom_addr: base mac address |
| 10017 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10018 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10019 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10020 | 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] | 10021 | uint8_t *custom_addr) |
| 10022 | { |
| 10023 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 10024 | wmi_buf_t buf; |
| 10025 | int err; |
| 10026 | |
| 10027 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 10028 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10029 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10030 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10031 | } |
| 10032 | |
| 10033 | 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] | 10034 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10035 | |
| 10036 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10037 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 10038 | WMITLV_GET_STRUCT_TLVLEN |
| 10039 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 10040 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 10041 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10042 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 10043 | sizeof(*cmd), |
| 10044 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 10045 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10046 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10047 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10048 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10049 | } |
| 10050 | |
| 10051 | return 0; |
| 10052 | } |
| 10053 | |
| 10054 | /** |
| 10055 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 10056 | * @handle: wmi handle |
| 10057 | * @event: Event received from FW |
| 10058 | * @len: Length of the event |
| 10059 | * |
| 10060 | * Enables the low frequency events and disables the high frequency |
| 10061 | * events. Bit 17 indicates if the event if low/high frequency. |
| 10062 | * 1 - high frequency, 0 - low frequency |
| 10063 | * |
| 10064 | * Return: 0 on successfully enabling/disabling the events |
| 10065 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10066 | 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] | 10067 | uint8_t *event, |
| 10068 | uint32_t len) |
| 10069 | { |
| 10070 | uint32_t num_of_diag_events_logs; |
| 10071 | wmi_diag_event_log_config_fixed_param *cmd; |
| 10072 | wmi_buf_t buf; |
| 10073 | uint8_t *buf_ptr; |
| 10074 | uint32_t *cmd_args, *evt_args; |
| 10075 | uint32_t buf_len, i; |
| 10076 | |
| 10077 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 10078 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 10079 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10080 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10081 | |
| 10082 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 10083 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10084 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10085 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10086 | } |
| 10087 | wmi_event = param_buf->fixed_param; |
| 10088 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 10089 | evt_args = param_buf->diag_events_logs_list; |
| 10090 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10091 | 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] | 10092 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10093 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10094 | } |
| 10095 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10096 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10097 | __func__, num_of_diag_events_logs); |
| 10098 | |
| 10099 | /* Free any previous allocation */ |
| 10100 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10101 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10102 | |
| 10103 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10104 | 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] | 10105 | sizeof(uint32_t)); |
| 10106 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10107 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10108 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10109 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10110 | } |
| 10111 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 10112 | |
| 10113 | /* Prepare the send buffer */ |
| 10114 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10115 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 10116 | |
| 10117 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 10118 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10119 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10120 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10121 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10122 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10123 | } |
| 10124 | |
| 10125 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 10126 | buf_ptr = (uint8_t *) cmd; |
| 10127 | |
| 10128 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10129 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 10130 | WMITLV_GET_STRUCT_TLVLEN( |
| 10131 | wmi_diag_event_log_config_fixed_param)); |
| 10132 | |
| 10133 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 10134 | |
| 10135 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 10136 | |
| 10137 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10138 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 10139 | |
| 10140 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10141 | |
| 10142 | /* Populate the events */ |
| 10143 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 10144 | /* Low freq (0) - Enable (1) the event |
| 10145 | * High freq (1) - Disable (0) the event |
| 10146 | */ |
| 10147 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 10148 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 10149 | /* Set the event ID */ |
| 10150 | WMI_DIAG_ID_SET(cmd_args[i], |
| 10151 | WMI_DIAG_ID_GET(evt_args[i])); |
| 10152 | /* Set the type */ |
| 10153 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 10154 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10155 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10156 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 10157 | } |
| 10158 | |
| 10159 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 10160 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10161 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10162 | __func__); |
| 10163 | wmi_buf_free(buf); |
| 10164 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 10165 | * Host can still have this list |
| 10166 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10167 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10168 | } |
| 10169 | |
| 10170 | return 0; |
| 10171 | } |
| 10172 | |
| 10173 | /** |
| 10174 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 10175 | * @wmi_handle: wmi handle |
| 10176 | * @start_log: Start logging related parameters |
| 10177 | * |
| 10178 | * Send the command to the FW based on which specific logging of diag |
| 10179 | * event/log id can be started/stopped |
| 10180 | * |
| 10181 | * Return: None |
| 10182 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10183 | 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] | 10184 | struct wmi_wifi_start_log *start_log) |
| 10185 | { |
| 10186 | wmi_diag_event_log_config_fixed_param *cmd; |
| 10187 | wmi_buf_t buf; |
| 10188 | uint8_t *buf_ptr; |
| 10189 | uint32_t len, count, log_level, i; |
| 10190 | uint32_t *cmd_args; |
| 10191 | uint32_t total_len; |
| 10192 | count = 0; |
| 10193 | |
| 10194 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10195 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10196 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10197 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10198 | } |
| 10199 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 10200 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 10201 | */ |
| 10202 | total_len = 0; |
| 10203 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 10204 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 10205 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 10206 | total_len++; |
| 10207 | } |
| 10208 | |
| 10209 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10210 | (total_len * sizeof(uint32_t)); |
| 10211 | |
| 10212 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10213 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10214 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10215 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10216 | } |
| 10217 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 10218 | buf_ptr = (uint8_t *) cmd; |
| 10219 | |
| 10220 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10221 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 10222 | WMITLV_GET_STRUCT_TLVLEN( |
| 10223 | wmi_diag_event_log_config_fixed_param)); |
| 10224 | |
| 10225 | cmd->num_of_diag_events_logs = total_len; |
| 10226 | |
| 10227 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 10228 | |
| 10229 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10230 | (total_len * sizeof(uint32_t))); |
| 10231 | |
| 10232 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10233 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10234 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10235 | log_level = 1; |
| 10236 | else |
| 10237 | log_level = 0; |
| 10238 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10239 | 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] | 10240 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 10241 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 10242 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 10243 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 10244 | |
| 10245 | WMI_DIAG_ID_SET(cmd_args[count], |
| 10246 | WMI_DIAG_ID_GET(val)); |
| 10247 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 10248 | WMI_DIAG_TYPE_GET(val)); |
| 10249 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 10250 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10251 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10252 | count++; |
| 10253 | } |
| 10254 | } |
| 10255 | |
| 10256 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10257 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10258 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10259 | __func__); |
| 10260 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10261 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10262 | } |
| 10263 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10264 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10265 | } |
| 10266 | |
| 10267 | /** |
| 10268 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 10269 | * @wmi_handle: WMI handle |
| 10270 | * |
| 10271 | * This function is used to send the flush command to the FW, |
| 10272 | * that will flush the fw logs that are residue in the FW |
| 10273 | * |
| 10274 | * Return: None |
| 10275 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10276 | 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] | 10277 | { |
| 10278 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 10279 | wmi_buf_t buf; |
| 10280 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10281 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10282 | |
| 10283 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10284 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10285 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10286 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10287 | } |
| 10288 | |
| 10289 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 10290 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10291 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 10292 | WMITLV_GET_STRUCT_TLVLEN( |
| 10293 | wmi_debug_mesg_flush_fixed_param)); |
| 10294 | cmd->reserved0 = 0; |
| 10295 | |
| 10296 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10297 | buf, |
| 10298 | len, |
| 10299 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10300 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10301 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10302 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10303 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10304 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10305 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10306 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10307 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10308 | } |
| 10309 | |
| 10310 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10311 | * 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] | 10312 | * @wmi_handle: wmi handle |
| 10313 | * @msg: PCL structure containing the PCL and the number of channels |
| 10314 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10315 | * 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] | 10316 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 10317 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 10318 | * to migrate to a new channel without host driver involvement. An example of |
| 10319 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 10320 | * manage the channel selection without firmware involvement. |
| 10321 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10322 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 10323 | * channel list. The weights corresponds to the channels sent in |
| 10324 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 10325 | * weightage compared to the non PCL channels. |
| 10326 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10327 | * Return: Success if the cmd is sent successfully to the firmware |
| 10328 | */ |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10329 | QDF_STATUS send_pdev_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10330 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10331 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10332 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10333 | wmi_buf_t buf; |
| 10334 | uint8_t *buf_ptr; |
| 10335 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10336 | uint32_t chan_len; |
| 10337 | |
| 10338 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10339 | |
| 10340 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10341 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10342 | |
| 10343 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10344 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10345 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10346 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10347 | } |
| 10348 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10349 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10350 | buf_ptr = (uint8_t *) cmd; |
| 10351 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10352 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 10353 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10354 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10355 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 10356 | cmd->num_chan = chan_len; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10357 | WMI_LOGI("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10358 | |
| 10359 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10360 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10361 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10362 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10363 | for (i = 0; i < chan_len ; i++) { |
| 10364 | cmd_args[i] = msg->weighed_valid_list[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10365 | WMI_LOGI("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10366 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10367 | } |
| 10368 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10369 | WMI_PDEV_SET_PCL_CMDID)) { |
| 10370 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10371 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10372 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10373 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10374 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10375 | } |
| 10376 | |
| 10377 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10378 | * 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] | 10379 | * @wmi_handle: wmi handle |
| 10380 | * @msg: Structure containing the following parameters |
| 10381 | * |
| 10382 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 10383 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 10384 | * |
| 10385 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 10386 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 10387 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 10388 | * |
| 10389 | * Return: Success if the cmd is sent successfully to the firmware |
| 10390 | */ |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10391 | 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] | 10392 | uint32_t hw_mode_index) |
| 10393 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10394 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10395 | wmi_buf_t buf; |
| 10396 | uint32_t len; |
| 10397 | |
| 10398 | len = sizeof(*cmd); |
| 10399 | |
| 10400 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10401 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10402 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10403 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10404 | } |
| 10405 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10406 | 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] | 10407 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10408 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 10409 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 10410 | |
| 10411 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10412 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10413 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10414 | |
| 10415 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10416 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 10417 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10418 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10419 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10420 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10421 | } |
| 10422 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10423 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10424 | } |
| 10425 | |
| 10426 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10427 | * 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] | 10428 | * @wmi_handle: wmi handle |
| 10429 | * @msg: Dual MAC config parameters |
| 10430 | * |
| 10431 | * Configures WLAN firmware with the dual MAC features |
| 10432 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10433 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10434 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 10435 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10436 | 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] | 10437 | struct wmi_dual_mac_config *msg) |
| 10438 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10439 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10440 | wmi_buf_t buf; |
| 10441 | uint32_t len; |
| 10442 | |
| 10443 | len = sizeof(*cmd); |
| 10444 | |
| 10445 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10446 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10447 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10448 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10449 | } |
| 10450 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10451 | 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] | 10452 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10453 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10454 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10455 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 10456 | |
| 10457 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10458 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 10459 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10460 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10461 | __func__, msg->scan_config, msg->fw_mode_config); |
| 10462 | |
| 10463 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10464 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 10465 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10466 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10467 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10468 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10469 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10470 | } |
| 10471 | |
| 10472 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10473 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 10474 | * @wmi_handle: wmi handle |
| 10475 | * @offload_req: offload request |
| 10476 | * @buf_ptr: buffer pointer |
| 10477 | * |
| 10478 | * To fill ARP offload data to firmware |
| 10479 | * when target goes to wow mode. |
| 10480 | * |
| 10481 | * Return: None |
| 10482 | */ |
| 10483 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10484 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10485 | { |
| 10486 | |
| 10487 | int i; |
| 10488 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
| 10489 | bool enable_or_disable = offload_req->enableOrDisable; |
| 10490 | |
| 10491 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10492 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 10493 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10494 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 10495 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 10496 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 10497 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 10498 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 10499 | |
| 10500 | /* Fill data for ARP and NS in the first tupple for LA */ |
| 10501 | if ((enable_or_disable & WMI_OFFLOAD_ENABLE) && (i == 0)) { |
| 10502 | /* Copy the target ip addr and flags */ |
| 10503 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 10504 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
| 10505 | offload_req->params.hostIpv4Addr, |
| 10506 | WMI_IPV4_ADDR_LEN); |
| 10507 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
| 10508 | offload_req->params.hostIpv4Addr); |
| 10509 | } |
| 10510 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 10511 | } |
| 10512 | } |
| 10513 | |
| 10514 | #ifdef WLAN_NS_OFFLOAD |
| 10515 | /** |
| 10516 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 10517 | * @wmi|_handle: wmi handle |
| 10518 | * @offload_req: offload request |
| 10519 | * @buf_ptr: buffer pointer |
| 10520 | * |
| 10521 | * To fill NS offload data to firmware |
| 10522 | * when target goes to wow mode. |
| 10523 | * |
| 10524 | * Return: None |
| 10525 | */ |
| 10526 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10527 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10528 | { |
| 10529 | |
| 10530 | int i; |
| 10531 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 10532 | struct ns_offload_req_params ns_req; |
| 10533 | |
| 10534 | ns_req = offload_req->nsOffloadInfo; |
| 10535 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10536 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 10537 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10538 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 10539 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 10540 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 10541 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 10542 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 10543 | |
| 10544 | /* |
| 10545 | * Fill data only for NS offload in the first ARP tuple for LA |
| 10546 | */ |
| 10547 | if ((offload_req->enableOrDisable & WMI_OFFLOAD_ENABLE)) { |
| 10548 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 10549 | /* Copy the target/solicitation/remote ip addr */ |
| 10550 | if (ns_req.targetIPv6AddrValid[i]) |
| 10551 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
| 10552 | &ns_req.targetIPv6Addr[i], |
| 10553 | sizeof(WMI_IPV6_ADDR)); |
| 10554 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
| 10555 | &ns_req.selfIPv6Addr[i], |
| 10556 | sizeof(WMI_IPV6_ADDR)); |
| 10557 | if (ns_req.target_ipv6_addr_ac_type[i]) { |
| 10558 | ns_tuple->flags |= |
| 10559 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 10560 | } |
| 10561 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
| 10562 | i, &ns_req.selfIPv6Addr[i], |
| 10563 | &ns_req.targetIPv6Addr[i]); |
| 10564 | |
| 10565 | /* target MAC is optional, check if it is valid, |
| 10566 | * if this is not valid, the target will use the known |
| 10567 | * local MAC address rather than the tuple |
| 10568 | */ |
| 10569 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 10570 | ns_req.self_macaddr.bytes, |
| 10571 | &ns_tuple->target_mac); |
| 10572 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 10573 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 10574 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 10575 | } |
| 10576 | } |
| 10577 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 10578 | } |
| 10579 | } |
| 10580 | |
| 10581 | |
| 10582 | /** |
| 10583 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 10584 | * @wmi: wmi handle |
| 10585 | * @offload_req: offload request |
| 10586 | * @buf_ptr: buffer pointer |
| 10587 | * |
| 10588 | * To fill extended NS offload extended data to firmware |
| 10589 | * when target goes to wow mode. |
| 10590 | * |
| 10591 | * Return: None |
| 10592 | */ |
| 10593 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
| 10594 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10595 | { |
| 10596 | int i; |
| 10597 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 10598 | uint32_t count, num_ns_ext_tuples; |
| 10599 | struct ns_offload_req_params ns_req; |
| 10600 | |
| 10601 | ns_req = offload_req->nsOffloadInfo; |
| 10602 | count = offload_req->num_ns_offload_count; |
| 10603 | num_ns_ext_tuples = offload_req->num_ns_offload_count - |
| 10604 | WMI_MAX_NS_OFFLOADS; |
| 10605 | |
| 10606 | /* Populate extended NS offload tuples */ |
| 10607 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10608 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 10609 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10610 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 10611 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 10612 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 10613 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 10614 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 10615 | |
| 10616 | /* |
| 10617 | * Fill data only for NS offload in the first ARP tuple for LA |
| 10618 | */ |
| 10619 | if ((offload_req->enableOrDisable & WMI_OFFLOAD_ENABLE)) { |
| 10620 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 10621 | /* Copy the target/solicitation/remote ip addr */ |
| 10622 | if (ns_req.targetIPv6AddrValid[i]) |
| 10623 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
| 10624 | &ns_req.targetIPv6Addr[i], |
| 10625 | sizeof(WMI_IPV6_ADDR)); |
| 10626 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
| 10627 | &ns_req.selfIPv6Addr[i], |
| 10628 | sizeof(WMI_IPV6_ADDR)); |
| 10629 | if (ns_req.target_ipv6_addr_ac_type[i]) { |
| 10630 | ns_tuple->flags |= |
| 10631 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 10632 | } |
| 10633 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
| 10634 | i, &ns_req.selfIPv6Addr[i], |
| 10635 | &ns_req.targetIPv6Addr[i]); |
| 10636 | |
| 10637 | /* target MAC is optional, check if it is valid, |
| 10638 | * if this is not valid, the target will use the |
| 10639 | * known local MAC address rather than the tuple |
| 10640 | */ |
| 10641 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 10642 | ns_req.self_macaddr.bytes, |
| 10643 | &ns_tuple->target_mac); |
| 10644 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 10645 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 10646 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 10647 | } |
| 10648 | } |
| 10649 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 10650 | } |
| 10651 | } |
| 10652 | #else |
| 10653 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10654 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10655 | { |
| 10656 | return; |
| 10657 | } |
| 10658 | |
| 10659 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
| 10660 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10661 | { |
| 10662 | return; |
| 10663 | } |
| 10664 | #endif |
| 10665 | |
| 10666 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10667 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 10668 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10669 | * @arp_offload_req: arp offload request |
| 10670 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10671 | * @arp_only: flag |
| 10672 | * |
| 10673 | * To configure ARP NS off load data to firmware |
| 10674 | * when target goes to wow mode. |
| 10675 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10676 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10677 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10678 | 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] | 10679 | struct host_offload_req_param *arp_offload_req, |
| 10680 | struct host_offload_req_param *ns_offload_req, |
| 10681 | bool arp_only, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10682 | uint8_t vdev_id) |
| 10683 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10684 | int32_t res; |
| 10685 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10686 | A_UINT8 *buf_ptr; |
| 10687 | wmi_buf_t buf; |
| 10688 | int32_t len; |
| 10689 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 10690 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10691 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10692 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10693 | /* |
| 10694 | * TLV place holder size for array of NS tuples |
| 10695 | * TLV place holder size for array of ARP tuples |
| 10696 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10697 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 10698 | WMI_TLV_HDR_SIZE + |
| 10699 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 10700 | WMI_TLV_HDR_SIZE + |
| 10701 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10702 | |
| 10703 | /* |
| 10704 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 10705 | * extra length for extended NS offload tuples which follows ARP offload |
| 10706 | * tuples. Host needs to fill this structure in following format: |
| 10707 | * 2 NS ofload tuples |
| 10708 | * 2 ARP offload tuples |
| 10709 | * N numbers of extended NS offload tuples if HDD has given more than |
| 10710 | * 2 NS offload addresses |
| 10711 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10712 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10713 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10714 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 10715 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10716 | } |
| 10717 | |
| 10718 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10719 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10720 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10721 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10722 | } |
| 10723 | |
| 10724 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 10725 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 10726 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10727 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 10728 | WMITLV_GET_STRUCT_TLVLEN |
| 10729 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 10730 | cmd->flags = 0; |
| 10731 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10732 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10733 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10734 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10735 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10736 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10737 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 10738 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 10739 | if (num_ns_ext_tuples) |
| 10740 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10741 | |
| 10742 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10743 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 10744 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10745 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10746 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10747 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10748 | } |
| 10749 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10750 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10751 | } |
| 10752 | |
| 10753 | /** |
| 10754 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 10755 | * @wmi_handle: wmi handle |
| 10756 | * @request: SSID hotlist set request |
| 10757 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10758 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10759 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10760 | QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10761 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 10762 | struct ssid_hotlist_request_params *request) |
| 10763 | { |
| 10764 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 10765 | wmi_buf_t wmi_buf; |
| 10766 | uint32_t len; |
| 10767 | uint32_t array_size; |
| 10768 | uint8_t *buf_ptr; |
| 10769 | |
| 10770 | /* length of fixed portion */ |
| 10771 | len = sizeof(*cmd); |
| 10772 | |
| 10773 | /* length of variable portion */ |
| 10774 | array_size = |
| 10775 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 10776 | len += WMI_TLV_HDR_SIZE + array_size; |
| 10777 | |
| 10778 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10779 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10780 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10781 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10782 | } |
| 10783 | |
| 10784 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 10785 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 10786 | buf_ptr; |
| 10787 | WMITLV_SET_HDR |
| 10788 | (&cmd->tlv_header, |
| 10789 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 10790 | WMITLV_GET_STRUCT_TLVLEN |
| 10791 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 10792 | |
| 10793 | cmd->request_id = request->request_id; |
| 10794 | cmd->requestor_id = 0; |
| 10795 | cmd->vdev_id = request->session_id; |
| 10796 | cmd->table_id = 0; |
| 10797 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 10798 | cmd->total_entries = request->ssid_count; |
| 10799 | cmd->num_entries_in_page = request->ssid_count; |
| 10800 | cmd->first_entry_index = 0; |
| 10801 | |
| 10802 | buf_ptr += sizeof(*cmd); |
| 10803 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 10804 | |
| 10805 | if (request->ssid_count) { |
| 10806 | wmi_extscan_hotlist_ssid_entry *entry; |
| 10807 | int i; |
| 10808 | |
| 10809 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10810 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 10811 | for (i = 0; i < request->ssid_count; i++) { |
| 10812 | WMITLV_SET_HDR |
| 10813 | (entry, |
| 10814 | WMITLV_TAG_ARRAY_STRUC, |
| 10815 | WMITLV_GET_STRUCT_TLVLEN |
| 10816 | (wmi_extscan_hotlist_ssid_entry)); |
| 10817 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10818 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10819 | request->ssids[i].ssid.mac_ssid, |
| 10820 | request->ssids[i].ssid.length); |
| 10821 | entry->band = request->ssids[i].band; |
| 10822 | entry->min_rssi = request->ssids[i].rssi_low; |
| 10823 | entry->max_rssi = request->ssids[i].rssi_high; |
| 10824 | entry++; |
| 10825 | } |
| 10826 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 10827 | } else { |
| 10828 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 10829 | } |
| 10830 | |
| 10831 | if (wmi_unified_cmd_send |
| 10832 | (wmi_handle, wmi_buf, len, |
| 10833 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10834 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10835 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10836 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10837 | } |
| 10838 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10839 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10840 | } |
| 10841 | |
| 10842 | /** |
| 10843 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 10844 | * @wmi_handle: wmi handle |
| 10845 | * @vdev_id: vdev id |
| 10846 | * |
| 10847 | * This function sends roam synch complete event to fw. |
| 10848 | * |
| 10849 | * Return: CDF STATUS |
| 10850 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10851 | 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] | 10852 | uint8_t vdev_id) |
| 10853 | { |
| 10854 | wmi_roam_synch_complete_fixed_param *cmd; |
| 10855 | wmi_buf_t wmi_buf; |
| 10856 | uint8_t *buf_ptr; |
| 10857 | uint16_t len; |
| 10858 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 10859 | |
| 10860 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10861 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10862 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10863 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10864 | } |
| 10865 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 10866 | buf_ptr = (uint8_t *) cmd; |
| 10867 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10868 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 10869 | WMITLV_GET_STRUCT_TLVLEN |
| 10870 | (wmi_roam_synch_complete_fixed_param)); |
| 10871 | cmd->vdev_id = vdev_id; |
| 10872 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10873 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10874 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10875 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10876 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10877 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10878 | } |
| 10879 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10880 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10881 | } |
| 10882 | |
| 10883 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 10884 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 10885 | * @wmi_handle: wmi handle |
| 10886 | * @wmi_fwtest: fw test command |
| 10887 | * |
| 10888 | * This function sends fw test command to fw. |
| 10889 | * |
| 10890 | * Return: CDF STATUS |
| 10891 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 10892 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 10893 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 10894 | struct set_fwtest_params *wmi_fwtest) |
| 10895 | { |
| 10896 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 10897 | wmi_buf_t wmi_buf; |
| 10898 | uint16_t len; |
| 10899 | |
| 10900 | len = sizeof(*cmd); |
| 10901 | |
| 10902 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10903 | if (!wmi_buf) { |
| 10904 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10905 | return QDF_STATUS_E_NOMEM; |
| 10906 | } |
| 10907 | |
| 10908 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 10909 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10910 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 10911 | WMITLV_GET_STRUCT_TLVLEN( |
| 10912 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 10913 | cmd->param_id = wmi_fwtest->arg; |
| 10914 | cmd->param_value = wmi_fwtest->value; |
| 10915 | |
| 10916 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10917 | WMI_FWTEST_CMDID)) { |
| 10918 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 10919 | qdf_nbuf_free(wmi_buf); |
| 10920 | return QDF_STATUS_E_FAILURE; |
| 10921 | } |
| 10922 | |
| 10923 | return QDF_STATUS_SUCCESS; |
| 10924 | } |
| 10925 | |
| 10926 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10927 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 10928 | * @wmi_handle: wmi handle |
| 10929 | * @wmi_utest: unit test command |
| 10930 | * |
| 10931 | * This function send unit test command to fw. |
| 10932 | * |
| 10933 | * Return: CDF STATUS |
| 10934 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10935 | QDF_STATUS send_unit_test_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10936 | struct wmi_unit_test_cmd *wmi_utest) |
| 10937 | { |
| 10938 | wmi_unit_test_cmd_fixed_param *cmd; |
| 10939 | wmi_buf_t wmi_buf; |
| 10940 | uint8_t *buf_ptr; |
| 10941 | int i; |
| 10942 | uint16_t len, args_tlv_len; |
| 10943 | A_UINT32 *unit_test_cmd_args; |
| 10944 | |
| 10945 | args_tlv_len = |
| 10946 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 10947 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 10948 | |
| 10949 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10950 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10951 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 10952 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10953 | } |
| 10954 | |
| 10955 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 10956 | buf_ptr = (uint8_t *) cmd; |
| 10957 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10958 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 10959 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 10960 | cmd->vdev_id = wmi_utest->vdev_id; |
| 10961 | cmd->module_id = wmi_utest->module_id; |
| 10962 | cmd->num_args = wmi_utest->num_args; |
| 10963 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 10964 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10965 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 10966 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10967 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10968 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 10969 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10970 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10971 | } |
| 10972 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10973 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10974 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10975 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10976 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10977 | } |
| 10978 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10979 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10980 | } |
| 10981 | |
| 10982 | /** |
| 10983 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 10984 | * @wmi_handle: wma handle |
| 10985 | * @roaminvoke: roam invoke command |
| 10986 | * |
| 10987 | * Send roam invoke command to fw for fastreassoc. |
| 10988 | * |
| 10989 | * Return: CDF STATUS |
| 10990 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10991 | QDF_STATUS send_roam_invoke_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10992 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 10993 | uint32_t ch_hz) |
| 10994 | { |
| 10995 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 10996 | wmi_buf_t wmi_buf; |
| 10997 | u_int8_t *buf_ptr; |
| 10998 | u_int16_t len, args_tlv_len; |
| 10999 | A_UINT32 *channel_list; |
| 11000 | wmi_mac_addr *bssid_list; |
| 11001 | |
| 11002 | /* Host sends only one channel and one bssid */ |
| 11003 | args_tlv_len = 2 * WMI_TLV_HDR_SIZE + sizeof(A_UINT32) + |
| 11004 | sizeof(wmi_mac_addr); |
| 11005 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 11006 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 11007 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11008 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 11009 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11010 | } |
| 11011 | |
| 11012 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 11013 | buf_ptr = (u_int8_t *) cmd; |
| 11014 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11015 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 11016 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 11017 | cmd->vdev_id = roaminvoke->vdev_id; |
| 11018 | cmd->flags = 0; |
| 11019 | cmd->roam_scan_mode = 0; |
| 11020 | cmd->roam_ap_sel_mode = 0; |
| 11021 | cmd->roam_delay = 0; |
| 11022 | cmd->num_chan = 1; |
| 11023 | cmd->num_bssid = 1; |
| 11024 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 11025 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11026 | (sizeof(u_int32_t))); |
| 11027 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 11028 | *channel_list = ch_hz; |
| 11029 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 11030 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 11031 | (sizeof(wmi_mac_addr))); |
| 11032 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 11033 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
| 11034 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 11035 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11036 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11037 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11038 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11039 | } |
| 11040 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11041 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11042 | } |
| 11043 | |
| 11044 | /** |
| 11045 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 11046 | * @wmi_handle: wmi handle |
| 11047 | * @command: command |
| 11048 | * @vdev_id: vdev id |
| 11049 | * |
| 11050 | * This function set roam offload command to fw. |
| 11051 | * |
| 11052 | * Return: CDF status |
| 11053 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11054 | 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] | 11055 | uint32_t command, uint32_t vdev_id) |
| 11056 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11057 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11058 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 11059 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11060 | int len; |
| 11061 | uint8_t *buf_ptr; |
| 11062 | |
| 11063 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 11064 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11065 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11066 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11067 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11068 | } |
| 11069 | |
| 11070 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11071 | |
| 11072 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 11073 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 11074 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 11075 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 11076 | cmd_fp->vdev_id = vdev_id; |
| 11077 | cmd_fp->command_arg = command; |
| 11078 | |
| 11079 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11080 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11081 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11082 | 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] | 11083 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11084 | goto error; |
| 11085 | } |
| 11086 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11087 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 11088 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11089 | |
| 11090 | error: |
| 11091 | wmi_buf_free(buf); |
| 11092 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11093 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11094 | } |
| 11095 | |
| 11096 | /** |
| 11097 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 11098 | * @wmi_handle: wmi handle |
| 11099 | * @ap_profile_p: ap profile |
| 11100 | * @vdev_id: vdev id |
| 11101 | * |
| 11102 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 11103 | * |
| 11104 | * Return: CDF status |
| 11105 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11106 | 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] | 11107 | wmi_ap_profile *ap_profile_p, |
| 11108 | uint32_t vdev_id) |
| 11109 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11110 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11111 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11112 | int len; |
| 11113 | uint8_t *buf_ptr; |
| 11114 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 11115 | |
| 11116 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 11117 | |
| 11118 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11119 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11120 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11121 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11122 | } |
| 11123 | |
| 11124 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11125 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 11126 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 11127 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 11128 | WMITLV_GET_STRUCT_TLVLEN |
| 11129 | (wmi_roam_ap_profile_fixed_param)); |
| 11130 | /* fill in threshold values */ |
| 11131 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 11132 | roam_ap_profile_fp->id = 0; |
| 11133 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 11134 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11135 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11136 | WMITLV_SET_HDR(buf_ptr, |
| 11137 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 11138 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 11139 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11140 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11141 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11142 | 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] | 11143 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11144 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11145 | } |
| 11146 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11147 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11148 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11149 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11150 | } |
| 11151 | |
| 11152 | /** |
| 11153 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 11154 | * @wmi_handle: wmi handle |
| 11155 | * @scan_period: scan period |
| 11156 | * @scan_age: scan age |
| 11157 | * @vdev_id: vdev id |
| 11158 | * |
| 11159 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 11160 | * |
| 11161 | * Return: CDF status |
| 11162 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11163 | 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] | 11164 | uint32_t scan_period, |
| 11165 | uint32_t scan_age, |
| 11166 | uint32_t vdev_id) |
| 11167 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11168 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11169 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11170 | int len; |
| 11171 | uint8_t *buf_ptr; |
| 11172 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 11173 | |
| 11174 | /* Send scan period values */ |
| 11175 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 11176 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11177 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11178 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11179 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11180 | } |
| 11181 | |
| 11182 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11183 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 11184 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 11185 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 11186 | WMITLV_GET_STRUCT_TLVLEN |
| 11187 | (wmi_roam_scan_period_fixed_param)); |
| 11188 | /* fill in scan period values */ |
| 11189 | scan_period_fp->vdev_id = vdev_id; |
| 11190 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 11191 | scan_period_fp->roam_scan_age = scan_age; |
| 11192 | |
| 11193 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11194 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11195 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11196 | 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] | 11197 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11198 | goto error; |
| 11199 | } |
| 11200 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11201 | 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] | 11202 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11203 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11204 | error: |
| 11205 | wmi_buf_free(buf); |
| 11206 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11207 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11208 | } |
| 11209 | |
| 11210 | /** |
| 11211 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 11212 | * @wmi_handle: wmi handle |
| 11213 | * @chan_count: channel count |
| 11214 | * @chan_list: channel list |
| 11215 | * @list_type: list type |
| 11216 | * @vdev_id: vdev id |
| 11217 | * |
| 11218 | * Set roam offload channel list. |
| 11219 | * |
| 11220 | * Return: CDF status |
| 11221 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11222 | 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] | 11223 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 11224 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11225 | uint8_t list_type, uint32_t vdev_id) |
| 11226 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11227 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11228 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11229 | int len, list_tlv_len; |
| 11230 | int i; |
| 11231 | uint8_t *buf_ptr; |
| 11232 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 11233 | A_UINT32 *roam_chan_list_array; |
| 11234 | |
| 11235 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11236 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11237 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11238 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11239 | } |
| 11240 | /* Channel list is a table of 2 TLV's */ |
| 11241 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 11242 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 11243 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11244 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11245 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11246 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11247 | } |
| 11248 | |
| 11249 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11250 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 11251 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 11252 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 11253 | WMITLV_GET_STRUCT_TLVLEN |
| 11254 | (wmi_roam_chan_list_fixed_param)); |
| 11255 | chan_list_fp->vdev_id = vdev_id; |
| 11256 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 11257 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11258 | /* external app is controlling channel list */ |
| 11259 | chan_list_fp->chan_list_type = |
| 11260 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 11261 | } else { |
| 11262 | /* umac supplied occupied channel list in LFR */ |
| 11263 | chan_list_fp->chan_list_type = |
| 11264 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 11265 | } |
| 11266 | |
| 11267 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 11268 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11269 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 11270 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11271 | WMI_LOGI("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11272 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 11273 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 11274 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11275 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11276 | } |
| 11277 | |
| 11278 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11279 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11280 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11281 | 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] | 11282 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11283 | goto error; |
| 11284 | } |
| 11285 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11286 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
| 11287 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11288 | error: |
| 11289 | wmi_buf_free(buf); |
| 11290 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11291 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11292 | } |
| 11293 | |
| 11294 | /** |
| 11295 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 11296 | * @wmi_handle: wmi handle |
| 11297 | * @rssi_change_thresh: RSSI Change threshold |
| 11298 | * @bcn_rssi_weight: beacon RSSI weight |
| 11299 | * @vdev_id: vdev id |
| 11300 | * |
| 11301 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 11302 | * |
| 11303 | * Return: CDF status |
| 11304 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11305 | 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] | 11306 | uint32_t vdev_id, |
| 11307 | int32_t rssi_change_thresh, |
| 11308 | uint32_t bcn_rssi_weight, |
| 11309 | uint32_t hirssi_delay_btw_scans) |
| 11310 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11311 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11312 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11313 | int len; |
| 11314 | uint8_t *buf_ptr; |
| 11315 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 11316 | |
| 11317 | /* Send rssi change parameters */ |
| 11318 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 11319 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11320 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11321 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11322 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11323 | } |
| 11324 | |
| 11325 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11326 | rssi_change_fp = |
| 11327 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 11328 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 11329 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 11330 | WMITLV_GET_STRUCT_TLVLEN |
| 11331 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 11332 | /* fill in rssi change threshold (hysteresis) values */ |
| 11333 | rssi_change_fp->vdev_id = vdev_id; |
| 11334 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 11335 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 11336 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 11337 | |
| 11338 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11339 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11340 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11341 | 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] | 11342 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11343 | goto error; |
| 11344 | } |
| 11345 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11346 | 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] | 11347 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11348 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 11349 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11350 | error: |
| 11351 | wmi_buf_free(buf); |
| 11352 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11353 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11354 | } |
| 11355 | |
| 11356 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 11357 | * @wmi_handle: wmi handle. |
| 11358 | * @cmd: size of command structure. |
| 11359 | * @per_entry_size: per entry size. |
| 11360 | * |
| 11361 | * This utility function calculates how many hotlist entries can |
| 11362 | * fit in one page. |
| 11363 | * |
| 11364 | * Return: number of entries |
| 11365 | */ |
| 11366 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 11367 | size_t cmd_size, |
| 11368 | size_t per_entry_size) |
| 11369 | { |
| 11370 | uint32_t avail_space = 0; |
| 11371 | int num_entries = 0; |
| 11372 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 11373 | |
| 11374 | /* Calculate number of hotlist entries that can |
| 11375 | * be passed in wma message request. |
| 11376 | */ |
| 11377 | avail_space = max_msg_len - cmd_size; |
| 11378 | num_entries = avail_space / per_entry_size; |
| 11379 | return num_entries; |
| 11380 | } |
| 11381 | |
| 11382 | /** |
| 11383 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 11384 | * @wmi_handle: wmi handle |
| 11385 | * @photlist: hotlist command params |
| 11386 | * @buf_len: buffer length |
| 11387 | * |
| 11388 | * This function fills individual elements for hotlist request and |
| 11389 | * TLV for bssid entries |
| 11390 | * |
| 11391 | * Return: CDF Status. |
| 11392 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11393 | 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] | 11394 | struct ext_scan_setbssi_hotlist_params * |
| 11395 | photlist, int *buf_len) |
| 11396 | { |
| 11397 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 11398 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 11399 | struct ap_threshold_params *src_ap = photlist->ap; |
| 11400 | wmi_buf_t buf; |
| 11401 | uint8_t *buf_ptr; |
| 11402 | |
| 11403 | int j, index = 0; |
| 11404 | int cmd_len = 0; |
| 11405 | int num_entries; |
| 11406 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 11407 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11408 | int len = sizeof(*cmd); |
| 11409 | |
| 11410 | len += WMI_TLV_HDR_SIZE; |
| 11411 | cmd_len = len; |
| 11412 | |
| 11413 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 11414 | cmd_len, |
| 11415 | sizeof(*dest_hotlist)); |
| 11416 | /* setbssid hotlist expects the bssid list |
| 11417 | * to be non zero value |
| 11418 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 11419 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 11420 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11421 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11422 | } |
| 11423 | |
| 11424 | /* Split the hot list entry pages and send multiple command |
| 11425 | * requests if the buffer reaches the maximum request size |
| 11426 | */ |
| 11427 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11428 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11429 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 11430 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11431 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11432 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 11433 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11434 | } |
| 11435 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11436 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 11437 | buf_ptr; |
| 11438 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11439 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 11440 | WMITLV_GET_STRUCT_TLVLEN |
| 11441 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 11442 | |
| 11443 | /* Multiple requests are sent until the num_entries_in_page |
| 11444 | * matches the total_entries |
| 11445 | */ |
| 11446 | cmd->request_id = photlist->requestId; |
| 11447 | cmd->vdev_id = photlist->sessionId; |
| 11448 | cmd->total_entries = numap; |
| 11449 | cmd->mode = 1; |
| 11450 | cmd->num_entries_in_page = min_entries; |
| 11451 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 11452 | cmd->first_entry_index = index; |
| 11453 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11454 | 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] | 11455 | __func__, cmd->vdev_id, cmd->total_entries, |
| 11456 | cmd->num_entries_in_page, |
| 11457 | cmd->lost_ap_scan_count); |
| 11458 | |
| 11459 | buf_ptr += sizeof(*cmd); |
| 11460 | WMITLV_SET_HDR(buf_ptr, |
| 11461 | WMITLV_TAG_ARRAY_STRUC, |
| 11462 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 11463 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 11464 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11465 | |
| 11466 | /* Populate bssid, channel info and rssi |
| 11467 | * for the bssid's that are sent as hotlists. |
| 11468 | */ |
| 11469 | for (j = 0; j < min_entries; j++) { |
| 11470 | WMITLV_SET_HDR(dest_hotlist, |
| 11471 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 11472 | WMITLV_GET_STRUCT_TLVLEN |
| 11473 | (wmi_extscan_hotlist_entry)); |
| 11474 | |
| 11475 | dest_hotlist->min_rssi = src_ap->low; |
| 11476 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 11477 | &dest_hotlist->bssid); |
| 11478 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11479 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11480 | __func__, dest_hotlist->channel, |
| 11481 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11482 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11483 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 11484 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 11485 | dest_hotlist->bssid.mac_addr47to32); |
| 11486 | dest_hotlist++; |
| 11487 | src_ap++; |
| 11488 | } |
| 11489 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 11490 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 11491 | |
| 11492 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11493 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11494 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11495 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11496 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11497 | } |
| 11498 | index = index + min_entries; |
| 11499 | num_entries = numap - min_entries; |
| 11500 | len = cmd_len; |
| 11501 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11502 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11503 | } |
| 11504 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 11505 | /** |
| 11506 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 11507 | * @wmi_handle: wmi handle |
| 11508 | * @param: wmi power debug parameter |
| 11509 | * |
| 11510 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 11511 | * |
| 11512 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 11513 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11514 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 11515 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 11516 | { |
| 11517 | wmi_buf_t buf = NULL; |
| 11518 | QDF_STATUS status; |
| 11519 | int len, args_tlv_len; |
| 11520 | uint8_t *buf_ptr; |
| 11521 | uint8_t i; |
| 11522 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 11523 | uint32_t *cmd_args; |
| 11524 | |
| 11525 | /* Prepare and send power debug cmd parameters */ |
| 11526 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 11527 | len = sizeof(*cmd) + args_tlv_len; |
| 11528 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11529 | if (!buf) { |
| 11530 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11531 | return QDF_STATUS_E_NOMEM; |
| 11532 | } |
| 11533 | |
| 11534 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11535 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 11536 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11537 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 11538 | WMITLV_GET_STRUCT_TLVLEN |
| 11539 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 11540 | |
| 11541 | cmd->pdev_id = param->pdev_id; |
| 11542 | cmd->module_id = param->module_id; |
| 11543 | cmd->num_args = param->num_args; |
| 11544 | buf_ptr += sizeof(*cmd); |
| 11545 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11546 | (param->num_args * sizeof(uint32_t))); |
| 11547 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11548 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 11549 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 11550 | cmd_args[i] = param->args[i]; |
| 11551 | WMI_LOGI("%d,", param->args[i]); |
| 11552 | } |
| 11553 | |
| 11554 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11555 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 11556 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11557 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 11558 | status); |
| 11559 | goto error; |
| 11560 | } |
| 11561 | |
| 11562 | return QDF_STATUS_SUCCESS; |
| 11563 | error: |
| 11564 | wmi_buf_free(buf); |
| 11565 | |
| 11566 | return status; |
| 11567 | } |
| 11568 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11569 | /** |
| 11570 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 11571 | * @wmi_handle: wmi handle |
| 11572 | * @param tgt_res_cfg: pointer to target resource configuration |
| 11573 | * @param num_mem_chunks: Number of memory chunks |
| 11574 | * @param mem_chunks: pointer to target memory chunks |
| 11575 | * |
| 11576 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11577 | */ |
| 11578 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
| 11579 | target_resource_config *tgt_res_cfg, uint8_t num_mem_chunks, |
| 11580 | struct wmi_host_mem_chunk *mem_chunks) |
| 11581 | { |
| 11582 | wmi_buf_t buf; |
| 11583 | wmi_init_cmd_fixed_param *cmd; |
| 11584 | wmi_abi_version my_vers; |
| 11585 | int num_whitelist; |
| 11586 | uint8_t *buf_ptr; |
| 11587 | wmi_resource_config *resource_cfg; |
| 11588 | wlan_host_memory_chunk *host_mem_chunks; |
| 11589 | uint32_t mem_chunk_len = 0; |
| 11590 | uint16_t idx; |
| 11591 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11592 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11593 | |
| 11594 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 11595 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 11596 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 11597 | if (!buf) { |
| 11598 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11599 | return QDF_STATUS_E_FAILURE; |
| 11600 | } |
| 11601 | |
| 11602 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11603 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 11604 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 11605 | |
| 11606 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 11607 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 11608 | + WMI_TLV_HDR_SIZE); |
| 11609 | |
| 11610 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11611 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 11612 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 11613 | |
| 11614 | wmi_copy_resource_config(resource_cfg, tgt_res_cfg); |
| 11615 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 11616 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 11617 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 11618 | |
| 11619 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 11620 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 11621 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 11622 | WMITLV_GET_STRUCT_TLVLEN |
| 11623 | (wlan_host_memory_chunk)); |
| 11624 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 11625 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 11626 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
| 11627 | qdf_print("chunk %d len %d requested ,ptr 0x%x ", |
| 11628 | idx, host_mem_chunks[idx].size, |
| 11629 | host_mem_chunks[idx].ptr); |
| 11630 | } |
| 11631 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 11632 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 11633 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 11634 | WMITLV_TAG_ARRAY_STRUC, |
| 11635 | (sizeof(wlan_host_memory_chunk) * |
| 11636 | num_mem_chunks)); |
| 11637 | |
| 11638 | num_whitelist = sizeof(version_whitelist) / |
| 11639 | sizeof(wmi_whitelist_version_info); |
| 11640 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 11641 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 11642 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 11643 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 11644 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 11645 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 11646 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11647 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11648 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 11649 | &my_vers, |
| 11650 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 11651 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11652 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11653 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 11654 | __func__, |
| 11655 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 11656 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 11657 | cmd->host_abi_vers.abi_version_ns_0, |
| 11658 | cmd->host_abi_vers.abi_version_ns_1, |
| 11659 | cmd->host_abi_vers.abi_version_ns_2, |
| 11660 | cmd->host_abi_vers.abi_version_ns_3); |
| 11661 | |
| 11662 | /* Save version sent from host - |
| 11663 | * Will be used to check ready event |
| 11664 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11665 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11666 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 11667 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11668 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11669 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 11670 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 11671 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 11672 | ret); |
| 11673 | wmi_buf_free(buf); |
| 11674 | } |
| 11675 | return ret; |
| 11676 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11677 | } |
| 11678 | |
| 11679 | /** |
| 11680 | * save_service_bitmap_tlv() - save service bitmap |
| 11681 | * @wmi_handle: wmi handle |
| 11682 | * @param evt_buf: pointer to event buffer |
| 11683 | * |
| 11684 | * Return: None |
| 11685 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 11686 | #ifndef CONFIG_MCL |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11687 | static |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11688 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11689 | { |
| 11690 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11691 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11692 | |
| 11693 | qdf_mem_copy(wmi_handle->wmi_service_bitmap, |
| 11694 | param_buf->wmi_service_bitmap, |
| 11695 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
| 11696 | } |
| 11697 | #else |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11698 | static |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11699 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11700 | { |
| 11701 | return; |
| 11702 | } |
| 11703 | |
| 11704 | #endif |
| 11705 | |
| 11706 | /** |
| 11707 | * is_service_enabled_tlv() - Check if service enabled |
| 11708 | * @param wmi_handle: wmi handle |
| 11709 | * @param service_id: service identifier |
| 11710 | * |
| 11711 | * Return: 1 enabled, 0 disabled |
| 11712 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 11713 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11714 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 11715 | uint32_t service_id) |
| 11716 | { |
| 11717 | return WMI_SERVICE_IS_ENABLED(wmi_handle->wmi_service_bitmap, |
| 11718 | service_id); |
| 11719 | } |
| 11720 | #else |
| 11721 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 11722 | uint32_t service_id) |
| 11723 | { |
| 11724 | return false; |
| 11725 | } |
| 11726 | #endif |
| 11727 | |
| 11728 | /** |
| 11729 | * extract_service_ready_tlv() - extract service ready event |
| 11730 | * @wmi_handle: wmi handle |
| 11731 | * @param evt_buf: pointer to received event buffer |
| 11732 | * @param cap: pointer to hold target capability information extracted from even |
| 11733 | * |
| 11734 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11735 | */ |
| 11736 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
| 11737 | void *evt_buf, target_capability_info *cap) |
| 11738 | { |
| 11739 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11740 | wmi_service_ready_event_fixed_param *ev; |
| 11741 | |
| 11742 | |
| 11743 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11744 | |
| 11745 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11746 | if (!ev) { |
| 11747 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11748 | return QDF_STATUS_E_FAILURE; |
| 11749 | } |
| 11750 | |
| 11751 | cap->phy_capability = ev->phy_capability; |
| 11752 | cap->max_frag_entry = ev->max_frag_entry; |
| 11753 | cap->num_rf_chains = ev->num_rf_chains; |
| 11754 | cap->ht_cap_info = ev->ht_cap_info; |
| 11755 | cap->vht_cap_info = ev->vht_cap_info; |
| 11756 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 11757 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 11758 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 11759 | cap->sys_cap_info = ev->sys_cap_info; |
| 11760 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 11761 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 11762 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 11763 | cap->max_supported_macs = ev->max_supported_macs; |
| 11764 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 11765 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 11766 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 11767 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 11768 | |
| 11769 | return QDF_STATUS_SUCCESS; |
| 11770 | } |
| 11771 | |
| 11772 | /** |
| 11773 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 11774 | * @wmi_handle: wmi handle |
| 11775 | * @param evt_buf: Pointer to event buffer |
| 11776 | * @param cap: pointer to hold HAL reg capabilities |
| 11777 | * |
| 11778 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11779 | */ |
| 11780 | static QDF_STATUS extract_hal_reg_cap_tlv(wmi_unified_t wmi_handle, |
| 11781 | void *evt_buf, TARGET_HAL_REG_CAPABILITIES *cap) |
| 11782 | { |
| 11783 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11784 | |
| 11785 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11786 | |
| 11787 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 11788 | sizeof(uint32_t)), |
| 11789 | sizeof(TARGET_HAL_REG_CAPABILITIES)); |
| 11790 | |
| 11791 | return QDF_STATUS_SUCCESS; |
| 11792 | } |
| 11793 | |
| 11794 | /** |
| 11795 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 11796 | * @wmi_handle: wmi handle |
| 11797 | * @param evt_buf: pointer to event buffer |
| 11798 | * @param num_entries: pointer to hold number of entries requested |
| 11799 | * |
| 11800 | * Return: Number of entries requested |
| 11801 | */ |
| 11802 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 11803 | void *evt_buf, uint8_t *num_entries) |
| 11804 | { |
| 11805 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11806 | wmi_service_ready_event_fixed_param *ev; |
| 11807 | |
| 11808 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11809 | |
| 11810 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11811 | if (!ev) { |
| 11812 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11813 | return NULL; |
| 11814 | } |
| 11815 | |
| 11816 | *num_entries = ev->num_mem_reqs; |
| 11817 | |
| 11818 | return (host_mem_req *)param_buf->mem_reqs; |
| 11819 | } |
| 11820 | |
| 11821 | /** |
| 11822 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 11823 | * ready function |
| 11824 | * @wmi_handle: wmi handle |
| 11825 | * @param evt_buf: pointer to event buffer |
| 11826 | * |
| 11827 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11828 | */ |
| 11829 | static QDF_STATUS |
| 11830 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11831 | { |
| 11832 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11833 | wmi_service_ready_event_fixed_param *ev; |
| 11834 | |
| 11835 | |
| 11836 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11837 | |
| 11838 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11839 | if (!ev) { |
| 11840 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11841 | return QDF_STATUS_E_FAILURE; |
| 11842 | } |
| 11843 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11844 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11845 | /*Save fw version from service ready message */ |
| 11846 | /*This will be used while sending INIT message */ |
| 11847 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 11848 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11849 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11850 | return QDF_STATUS_SUCCESS; |
| 11851 | } |
| 11852 | |
| 11853 | /** |
| 11854 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 11855 | * @wmi_handle: wmi handle |
| 11856 | * @param evt_buf: Pointer to event buffer |
| 11857 | * |
| 11858 | * Return: ready status |
| 11859 | */ |
| 11860 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 11861 | void *evt_buf) |
| 11862 | { |
| 11863 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 11864 | wmi_ready_event_fixed_param *ev = NULL; |
| 11865 | |
| 11866 | |
| 11867 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 11868 | ev = param_buf->fixed_param; |
| 11869 | |
| 11870 | qdf_print("%s:%d\n", __func__, ev->status); |
| 11871 | |
| 11872 | return ev->status; |
| 11873 | } |
| 11874 | |
| 11875 | /** |
| 11876 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 11877 | * @wmi_handle: wmi handle |
| 11878 | * @param evt_buf: pointer to event buffer |
| 11879 | * @param macaddr: Pointer to hold MAC address |
| 11880 | * |
| 11881 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11882 | */ |
| 11883 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 11884 | void *evt_buf, uint8_t *macaddr) |
| 11885 | { |
| 11886 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 11887 | wmi_ready_event_fixed_param *ev = NULL; |
| 11888 | |
| 11889 | |
| 11890 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 11891 | ev = param_buf->fixed_param; |
| 11892 | |
| 11893 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 11894 | |
| 11895 | return QDF_STATUS_SUCCESS; |
| 11896 | } |
| 11897 | |
| 11898 | /** |
| 11899 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 11900 | * @wmi_handle: wmi handle |
| 11901 | * @param evt_buf: pointer to event buffer |
| 11902 | * |
| 11903 | * Return: length |
| 11904 | */ |
| 11905 | static uint8_t *extract_dbglog_data_len_tlv(wmi_unified_t wmi_handle, |
| 11906 | void *evt_buf, uint16_t *len) |
| 11907 | { |
| 11908 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 11909 | |
| 11910 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 11911 | |
| 11912 | *len = param_buf->num_bufp; |
| 11913 | |
| 11914 | return param_buf->bufp; |
| 11915 | } |
| 11916 | |
| 11917 | /** |
| 11918 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 11919 | * @wmi_handle: wmi handle |
| 11920 | * @param evt_buf: pointer to event buffer |
| 11921 | * @param vdev_rsp: Pointer to hold vdev response |
| 11922 | * |
| 11923 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11924 | */ |
| 11925 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 11926 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 11927 | { |
| 11928 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 11929 | wmi_vdev_start_response_event_fixed_param *ev; |
| 11930 | |
| 11931 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 11932 | if (!param_buf) { |
| 11933 | qdf_print("Invalid start response event buffer\n"); |
| 11934 | return QDF_STATUS_E_INVAL; |
| 11935 | } |
| 11936 | |
| 11937 | ev = param_buf->fixed_param; |
| 11938 | if (!ev) { |
| 11939 | qdf_print("Invalid start response event buffer\n"); |
| 11940 | return QDF_STATUS_E_INVAL; |
| 11941 | } |
| 11942 | |
| 11943 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 11944 | |
| 11945 | vdev_rsp->vdev_id = ev->vdev_id; |
| 11946 | vdev_rsp->requestor_id = ev->requestor_id; |
| 11947 | vdev_rsp->resp_type = ev->resp_type; |
| 11948 | vdev_rsp->status = ev->status; |
| 11949 | vdev_rsp->chain_mask = ev->chain_mask; |
| 11950 | vdev_rsp->smps_mode = ev->smps_mode; |
| 11951 | vdev_rsp->mac_id = ev->mac_id; |
| 11952 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 11953 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 11954 | |
| 11955 | return QDF_STATUS_SUCCESS; |
| 11956 | } |
| 11957 | |
| 11958 | /** |
| 11959 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset update param |
| 11960 | * @wmi_handle: wmi handle |
| 11961 | * @param evt_buf: pointer to event buffer |
| 11962 | * @param vdev_map: Pointer to hold vdev map |
| 11963 | * @param tbttoffset_list: Pointer to tbtt offset list |
| 11964 | * |
| 11965 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11966 | */ |
| 11967 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 11968 | void *evt_buf, uint32_t *vdev_map, uint32_t **tbttoffset_list) |
| 11969 | { |
| 11970 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 11971 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 11972 | |
| 11973 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 11974 | if (!param_buf) { |
| 11975 | qdf_print("Invalid tbtt update event buffer\n"); |
| 11976 | return QDF_STATUS_E_INVAL; |
| 11977 | } |
| 11978 | tbtt_offset_event = param_buf->fixed_param; |
| 11979 | |
| 11980 | *vdev_map = tbtt_offset_event->vdev_map; |
| 11981 | *tbttoffset_list = param_buf->tbttoffset_list; |
| 11982 | |
| 11983 | return QDF_STATUS_SUCCESS; |
| 11984 | } |
| 11985 | |
| 11986 | /** |
| 11987 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 11988 | * @wmi_handle: wmi handle |
| 11989 | * @param evt_buf: pointer to event buffer |
| 11990 | * @param hdr: Pointer to hold header |
| 11991 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 11992 | * |
| 11993 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11994 | */ |
| 11995 | static QDF_STATUS extract_mgmt_rx_params_tlv(wmi_unified_t wmi_handle, |
| 11996 | void *evt_buf, wmi_host_mgmt_rx_hdr *hdr, uint8_t **bufp) |
| 11997 | { |
| 11998 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 11999 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 12000 | |
| 12001 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 12002 | if (!param_tlvs) { |
| 12003 | WMI_LOGE("Get NULL point message from FW"); |
| 12004 | return QDF_STATUS_E_INVAL; |
| 12005 | } |
| 12006 | |
| 12007 | ev_hdr = param_tlvs->hdr; |
| 12008 | if (!hdr) { |
| 12009 | WMI_LOGE("Rx event is NULL"); |
| 12010 | return QDF_STATUS_E_INVAL; |
| 12011 | } |
| 12012 | |
| 12013 | |
| 12014 | hdr->channel = ev_hdr->channel; |
| 12015 | hdr->snr = ev_hdr->snr; |
| 12016 | hdr->rate = ev_hdr->rate; |
| 12017 | hdr->phy_mode = ev_hdr->phy_mode; |
| 12018 | hdr->buf_len = ev_hdr->buf_len; |
| 12019 | hdr->status = ev_hdr->status; |
| 12020 | hdr->flags = ev_hdr->flags; |
| 12021 | hdr->rssi = ev_hdr->rssi; |
| 12022 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 12023 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 12024 | |
| 12025 | *bufp = param_tlvs->bufp; |
| 12026 | |
| 12027 | return QDF_STATUS_SUCCESS; |
| 12028 | } |
| 12029 | |
| 12030 | /** |
| 12031 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 12032 | * @wmi_handle: wmi handle |
| 12033 | * @param evt_buf: pointer to event buffer |
| 12034 | * @param vdev_id: Pointer to hold vdev identifier |
| 12035 | * |
| 12036 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12037 | */ |
| 12038 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 12039 | void *evt_buf, uint32_t *vdev_id) |
| 12040 | { |
| 12041 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 12042 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 12043 | |
| 12044 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 12045 | if (!param_buf) { |
| 12046 | WMI_LOGE("Invalid event buffer"); |
| 12047 | return QDF_STATUS_E_INVAL; |
| 12048 | } |
| 12049 | resp_event = param_buf->fixed_param; |
| 12050 | *vdev_id = resp_event->vdev_id; |
| 12051 | |
| 12052 | return QDF_STATUS_SUCCESS; |
| 12053 | } |
| 12054 | |
| 12055 | /** |
| 12056 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 12057 | * @wmi_handle: wmi handle |
| 12058 | * @param evt_buf: pointer to event buffer |
| 12059 | * @param param: Pointer to hold roam param |
| 12060 | * |
| 12061 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12062 | */ |
| 12063 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 12064 | void *evt_buf, wmi_host_roam_event *param) |
| 12065 | { |
| 12066 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 12067 | wmi_roam_event_fixed_param *evt; |
| 12068 | |
| 12069 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 12070 | if (!param_buf) { |
| 12071 | WMI_LOGE("Invalid roam event buffer"); |
| 12072 | return QDF_STATUS_E_INVAL; |
| 12073 | } |
| 12074 | |
| 12075 | evt = param_buf->fixed_param; |
| 12076 | qdf_mem_zero(param, sizeof(*param)); |
| 12077 | |
| 12078 | param->vdev_id = evt->vdev_id; |
| 12079 | param->reason = evt->reason; |
| 12080 | param->rssi = evt->rssi; |
| 12081 | |
| 12082 | return QDF_STATUS_SUCCESS; |
| 12083 | } |
| 12084 | |
| 12085 | /** |
| 12086 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 12087 | * @wmi_handle: wmi handle |
| 12088 | * @param evt_buf: pointer to event buffer |
| 12089 | * @param param: Pointer to hold vdev scan param |
| 12090 | * |
| 12091 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12092 | */ |
| 12093 | static QDF_STATUS extract_vdev_scan_ev_param_tlv(wmi_unified_t wmi_handle, |
| 12094 | void *evt_buf, wmi_host_scan_event *param) |
| 12095 | { |
| 12096 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 12097 | wmi_scan_event_fixed_param *evt = NULL; |
| 12098 | |
| 12099 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 12100 | evt = param_buf->fixed_param; |
| 12101 | |
| 12102 | qdf_mem_zero(param, sizeof(*param)); |
| 12103 | switch (evt->event) { |
| 12104 | case WMI_SCAN_EVENT_STARTED: |
| 12105 | param->event = WMI_HOST_SCAN_EVENT_STARTED; |
| 12106 | break; |
| 12107 | case WMI_SCAN_EVENT_COMPLETED: |
| 12108 | param->event = WMI_HOST_SCAN_EVENT_COMPLETED; |
| 12109 | break; |
| 12110 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
| 12111 | param->event = WMI_HOST_SCAN_EVENT_BSS_CHANNEL; |
| 12112 | break; |
| 12113 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
| 12114 | param->event = WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL; |
| 12115 | break; |
| 12116 | case WMI_SCAN_EVENT_DEQUEUED: |
| 12117 | param->event = WMI_HOST_SCAN_EVENT_DEQUEUED; |
| 12118 | break; |
| 12119 | case WMI_SCAN_EVENT_PREEMPTED: |
| 12120 | param->event = WMI_HOST_SCAN_EVENT_PREEMPTED; |
| 12121 | break; |
| 12122 | case WMI_SCAN_EVENT_START_FAILED: |
| 12123 | param->event = WMI_HOST_SCAN_EVENT_START_FAILED; |
| 12124 | break; |
| 12125 | case WMI_SCAN_EVENT_RESTARTED: |
| 12126 | param->event = WMI_HOST_SCAN_EVENT_RESTARTED; |
| 12127 | break; |
| 12128 | case WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
| 12129 | param->event = WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 12130 | break; |
| 12131 | case WMI_SCAN_EVENT_MAX: |
| 12132 | default: |
| 12133 | param->event = WMI_HOST_SCAN_EVENT_MAX; |
| 12134 | break; |
| 12135 | }; |
| 12136 | |
| 12137 | switch (evt->reason) { |
| 12138 | case WMI_SCAN_REASON_NONE: |
| 12139 | param->reason = WMI_HOST_SCAN_REASON_NONE; |
| 12140 | break; |
| 12141 | case WMI_SCAN_REASON_COMPLETED: |
| 12142 | param->reason = WMI_HOST_SCAN_REASON_COMPLETED; |
| 12143 | break; |
| 12144 | case WMI_SCAN_REASON_CANCELLED: |
| 12145 | param->reason = WMI_HOST_SCAN_REASON_CANCELLED; |
| 12146 | break; |
| 12147 | case WMI_SCAN_REASON_PREEMPTED: |
| 12148 | param->reason = WMI_HOST_SCAN_REASON_PREEMPTED; |
| 12149 | break; |
| 12150 | case WMI_SCAN_REASON_TIMEDOUT: |
| 12151 | param->reason = WMI_HOST_SCAN_REASON_TIMEDOUT; |
| 12152 | break; |
| 12153 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
| 12154 | param->reason = WMI_HOST_SCAN_REASON_INTERNAL_FAILURE; |
| 12155 | break; |
| 12156 | case WMI_SCAN_REASON_MAX: |
| 12157 | default: |
| 12158 | param->reason = WMI_HOST_SCAN_REASON_MAX; |
| 12159 | break; |
| 12160 | }; |
| 12161 | |
| 12162 | param->channel_freq = evt->channel_freq; |
| 12163 | param->requestor = evt->requestor; |
| 12164 | param->scan_id = evt->scan_id; |
| 12165 | param->vdev_id = evt->vdev_id; |
| 12166 | |
| 12167 | return QDF_STATUS_SUCCESS; |
| 12168 | } |
| 12169 | |
| 12170 | /** |
| 12171 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 12172 | * @wmi_handle: wmi handle |
| 12173 | * @param evt_buf: pointer to event buffer |
| 12174 | * @param param: Pointer to hold MGMT TX completion params |
| 12175 | * |
| 12176 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12177 | */ |
| 12178 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 12179 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 12180 | { |
| 12181 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 12182 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 12183 | |
| 12184 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 12185 | evt_buf; |
| 12186 | if (!param_buf) { |
| 12187 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 12188 | return QDF_STATUS_E_INVAL; |
| 12189 | } |
| 12190 | cmpl_params = param_buf->fixed_param; |
| 12191 | |
| 12192 | param->desc_id = cmpl_params->desc_id; |
| 12193 | param->status = cmpl_params->status; |
| 12194 | |
| 12195 | return QDF_STATUS_SUCCESS; |
| 12196 | } |
| 12197 | |
| 12198 | /** |
| 12199 | * extract_swba_vdev_map_tlv() - extract swba vdev map from event |
| 12200 | * @wmi_handle: wmi handle |
| 12201 | * @param evt_buf: pointer to event buffer |
| 12202 | * @param vdev_map: Pointer to hold vdev map |
| 12203 | * |
| 12204 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12205 | */ |
| 12206 | static QDF_STATUS extract_swba_vdev_map_tlv(wmi_unified_t wmi_handle, |
| 12207 | void *evt_buf, uint32_t *vdev_map) |
| 12208 | { |
| 12209 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12210 | wmi_host_swba_event_fixed_param *swba_event; |
| 12211 | |
| 12212 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12213 | if (!param_buf) { |
| 12214 | WMI_LOGE("Invalid swba event buffer"); |
| 12215 | return QDF_STATUS_E_INVAL; |
| 12216 | } |
| 12217 | swba_event = param_buf->fixed_param; |
| 12218 | *vdev_map = swba_event->vdev_map; |
| 12219 | |
| 12220 | return QDF_STATUS_SUCCESS; |
| 12221 | } |
| 12222 | |
| 12223 | /** |
| 12224 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 12225 | * @wmi_handle: wmi handle |
| 12226 | * @param evt_buf: pointer to event buffer |
| 12227 | * @param idx: Index to bcn info |
| 12228 | * @param tim_info: Pointer to hold tim info |
| 12229 | * |
| 12230 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12231 | */ |
| 12232 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 12233 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 12234 | { |
| 12235 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12236 | wmi_tim_info *tim_info_ev; |
| 12237 | |
| 12238 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12239 | if (!param_buf) { |
| 12240 | WMI_LOGE("Invalid swba event buffer"); |
| 12241 | return QDF_STATUS_E_INVAL; |
| 12242 | } |
| 12243 | |
| 12244 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 12245 | |
| 12246 | tim_info->tim_len = tim_info_ev->tim_len; |
| 12247 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 12248 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 12249 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 12250 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 12251 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
| 12252 | |
| 12253 | return QDF_STATUS_SUCCESS; |
| 12254 | } |
| 12255 | |
| 12256 | /** |
| 12257 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 12258 | * @wmi_handle: wmi handle |
| 12259 | * @param evt_buf: pointer to event buffer |
| 12260 | * @param idx: Index to bcn info |
| 12261 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 12262 | * |
| 12263 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12264 | */ |
| 12265 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 12266 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 12267 | { |
| 12268 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12269 | wmi_p2p_noa_info *p2p_noa_info; |
| 12270 | uint8_t i = 0; |
| 12271 | |
| 12272 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12273 | if (!param_buf) { |
| 12274 | WMI_LOGE("Invalid swba event buffer"); |
| 12275 | return QDF_STATUS_E_INVAL; |
| 12276 | } |
| 12277 | |
| 12278 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 12279 | |
| 12280 | p2p_desc->modified = false; |
| 12281 | p2p_desc->num_descriptors = 0; |
| 12282 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 12283 | p2p_desc->modified = true; |
| 12284 | p2p_desc->index = |
| 12285 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 12286 | p2p_desc->oppPS = |
| 12287 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 12288 | p2p_desc->ctwindow = |
| 12289 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 12290 | p2p_desc->num_descriptors = |
| 12291 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 12292 | (p2p_noa_info); |
| 12293 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 12294 | p2p_desc->noa_descriptors[i].type_count = |
| 12295 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 12296 | type_count; |
| 12297 | p2p_desc->noa_descriptors[i].duration = |
| 12298 | p2p_noa_info->noa_descriptors[i].duration; |
| 12299 | p2p_desc->noa_descriptors[i].interval = |
| 12300 | p2p_noa_info->noa_descriptors[i].interval; |
| 12301 | p2p_desc->noa_descriptors[i].start_time = |
| 12302 | p2p_noa_info->noa_descriptors[i].start_time; |
| 12303 | } |
| 12304 | } |
| 12305 | |
| 12306 | return QDF_STATUS_SUCCESS; |
| 12307 | } |
| 12308 | |
| 12309 | /** |
| 12310 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 12311 | * @wmi_handle: wmi handle |
| 12312 | * @param evt_buf: pointer to event buffer |
| 12313 | * @param ev: Pointer to hold peer param |
| 12314 | * |
| 12315 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12316 | */ |
| 12317 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 12318 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 12319 | { |
| 12320 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 12321 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 12322 | |
| 12323 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 12324 | kickout_event = param_buf->fixed_param; |
| 12325 | |
| 12326 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 12327 | ev->peer_macaddr); |
| 12328 | |
| 12329 | ev->reason = kickout_event->reason; |
| 12330 | ev->rssi = kickout_event->rssi; |
| 12331 | |
| 12332 | return QDF_STATUS_SUCCESS; |
| 12333 | } |
| 12334 | |
| 12335 | /** |
| 12336 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 12337 | * @wmi_handle: wmi handle |
| 12338 | * @param evt_buf: pointer to event buffer |
| 12339 | * @param stats_param: Pointer to hold stats count |
| 12340 | * |
| 12341 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12342 | */ |
| 12343 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 12344 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 12345 | { |
| 12346 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12347 | wmi_stats_event_fixed_param *ev; |
| 12348 | |
| 12349 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12350 | |
| 12351 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12352 | if (!ev) { |
| 12353 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 12354 | return QDF_STATUS_E_FAILURE; |
| 12355 | } |
| 12356 | |
| 12357 | switch (ev->stats_id) { |
| 12358 | case WMI_REQUEST_PEER_STAT: |
| 12359 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 12360 | break; |
| 12361 | |
| 12362 | case WMI_REQUEST_AP_STAT: |
| 12363 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 12364 | break; |
| 12365 | |
| 12366 | case WMI_REQUEST_PDEV_STAT: |
| 12367 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 12368 | break; |
| 12369 | |
| 12370 | case WMI_REQUEST_VDEV_STAT: |
| 12371 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 12372 | break; |
| 12373 | |
| 12374 | case WMI_REQUEST_BCNFLT_STAT: |
| 12375 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 12376 | break; |
| 12377 | |
| 12378 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 12379 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 12380 | break; |
| 12381 | |
| 12382 | default: |
| 12383 | stats_param->stats_id = 0; |
| 12384 | break; |
| 12385 | |
| 12386 | } |
| 12387 | |
| 12388 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 12389 | stats_param->num_pdev_ext_stats = 0; |
| 12390 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 12391 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 12392 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 12393 | stats_param->num_chan_stats = ev->num_chan_stats; |
| 12394 | |
| 12395 | return QDF_STATUS_SUCCESS; |
| 12396 | } |
| 12397 | |
| 12398 | /** |
| 12399 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 12400 | * @wmi_handle: wmi handle |
| 12401 | * @param evt_buf: pointer to event buffer |
| 12402 | * @param index: Index into pdev stats |
| 12403 | * @param pdev_stats: Pointer to hold pdev stats |
| 12404 | * |
| 12405 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12406 | */ |
| 12407 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 12408 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 12409 | { |
| 12410 | return QDF_STATUS_SUCCESS; |
| 12411 | } |
| 12412 | |
| 12413 | /** |
| 12414 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 12415 | * @wmi_handle: wmi handle |
| 12416 | * @param evt_buf: pointer to event buffer |
| 12417 | * @param index: Index into extended pdev stats |
| 12418 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 12419 | * |
| 12420 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12421 | */ |
| 12422 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 12423 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 12424 | { |
| 12425 | return QDF_STATUS_SUCCESS; |
| 12426 | } |
| 12427 | |
| 12428 | /** |
| 12429 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 12430 | * @wmi_handle: wmi handle |
| 12431 | * @param evt_buf: pointer to event buffer |
| 12432 | * @param index: Index into vdev stats |
| 12433 | * @param vdev_stats: Pointer to hold vdev stats |
| 12434 | * |
| 12435 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12436 | */ |
| 12437 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 12438 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 12439 | { |
| 12440 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12441 | wmi_stats_event_fixed_param *ev_param; |
| 12442 | uint8_t *data; |
| 12443 | |
| 12444 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12445 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12446 | data = (uint8_t *) param_buf->data; |
| 12447 | |
| 12448 | if (index < ev_param->num_vdev_stats) { |
| 12449 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 12450 | ((ev_param->num_pdev_stats) * |
| 12451 | sizeof(wmi_pdev_stats)) + |
| 12452 | (index * sizeof(wmi_vdev_stats))); |
| 12453 | |
| 12454 | vdev_stats->vdev_id = ev->vdev_id; |
| 12455 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 12456 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 12457 | |
| 12458 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 12459 | sizeof(ev->tx_frm_cnt)); |
| 12460 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 12461 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 12462 | ev->multiple_retry_cnt, |
| 12463 | sizeof(ev->multiple_retry_cnt)); |
| 12464 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 12465 | sizeof(ev->fail_cnt)); |
| 12466 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 12467 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 12468 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 12469 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 12470 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 12471 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 12472 | sizeof(ev->tx_rate_history)); |
| 12473 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 12474 | sizeof(ev->bcn_rssi_history)); |
| 12475 | |
| 12476 | } |
| 12477 | |
| 12478 | return QDF_STATUS_SUCCESS; |
| 12479 | } |
| 12480 | |
| 12481 | /** |
| 12482 | * extract_peer_stats_tlv() - extract peer stats from event |
| 12483 | * @wmi_handle: wmi handle |
| 12484 | * @param evt_buf: pointer to event buffer |
| 12485 | * @param index: Index into peer stats |
| 12486 | * @param peer_stats: Pointer to hold peer stats |
| 12487 | * |
| 12488 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12489 | */ |
| 12490 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 12491 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 12492 | { |
| 12493 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12494 | wmi_stats_event_fixed_param *ev_param; |
| 12495 | uint8_t *data; |
| 12496 | |
| 12497 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12498 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12499 | data = (uint8_t *) param_buf->data; |
| 12500 | |
| 12501 | if (index < ev_param->num_peer_stats) { |
| 12502 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 12503 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 12504 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 12505 | (index * sizeof(wmi_peer_stats))); |
| 12506 | |
| 12507 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 12508 | |
| 12509 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 12510 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 12511 | |
| 12512 | peer_stats->peer_rssi = ev->peer_rssi; |
| 12513 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 12514 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 12515 | } |
| 12516 | |
| 12517 | return QDF_STATUS_SUCCESS; |
| 12518 | } |
| 12519 | |
| 12520 | /** |
| 12521 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 12522 | * @wmi_handle: wmi handle |
| 12523 | * @param evt_buf: pointer to event buffer |
| 12524 | * @param index: Index into bcn fault stats |
| 12525 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 12526 | * |
| 12527 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12528 | */ |
| 12529 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 12530 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 12531 | { |
| 12532 | return QDF_STATUS_SUCCESS; |
| 12533 | } |
| 12534 | |
| 12535 | /** |
| 12536 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 12537 | * @wmi_handle: wmi handle |
| 12538 | * @param evt_buf: pointer to event buffer |
| 12539 | * @param index: Index into extended peer stats |
| 12540 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 12541 | * |
| 12542 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12543 | */ |
| 12544 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 12545 | void *evt_buf, uint32_t index, |
| 12546 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 12547 | { |
| 12548 | return QDF_STATUS_SUCCESS; |
| 12549 | } |
| 12550 | |
| 12551 | /** |
| 12552 | * extract_chan_stats_tlv() - extract chan stats from event |
| 12553 | * @wmi_handle: wmi handle |
| 12554 | * @param evt_buf: pointer to event buffer |
| 12555 | * @param index: Index into chan stats |
| 12556 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 12557 | * |
| 12558 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12559 | */ |
| 12560 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 12561 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 12562 | { |
| 12563 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12564 | wmi_stats_event_fixed_param *ev_param; |
| 12565 | uint8_t *data; |
| 12566 | |
| 12567 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12568 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12569 | data = (uint8_t *) param_buf->data; |
| 12570 | |
| 12571 | if (index < ev_param->num_chan_stats) { |
| 12572 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 12573 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 12574 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 12575 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 12576 | (index * sizeof(wmi_chan_stats))); |
| 12577 | |
| 12578 | |
| 12579 | /* Non-TLV doesnt have num_chan_stats */ |
| 12580 | chan_stats->chan_mhz = ev->chan_mhz; |
| 12581 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 12582 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 12583 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 12584 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 12585 | } |
| 12586 | |
| 12587 | return QDF_STATUS_SUCCESS; |
| 12588 | } |
| 12589 | |
| 12590 | /** |
| 12591 | * extract_profile_ctx_tlv() - extract profile context from event |
| 12592 | * @wmi_handle: wmi handle |
| 12593 | * @param evt_buf: pointer to event buffer |
| 12594 | * @idx: profile stats index to extract |
| 12595 | * @param profile_ctx: Pointer to hold profile context |
| 12596 | * |
| 12597 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12598 | */ |
| 12599 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 12600 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 12601 | { |
| 12602 | return QDF_STATUS_SUCCESS; |
| 12603 | } |
| 12604 | |
| 12605 | /** |
| 12606 | * extract_profile_data_tlv() - extract profile data from event |
| 12607 | * @wmi_handle: wmi handle |
| 12608 | * @param evt_buf: pointer to event buffer |
| 12609 | * @param profile_data: Pointer to hold profile data |
| 12610 | * |
| 12611 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12612 | */ |
| 12613 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 12614 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 12615 | { |
| 12616 | |
| 12617 | return QDF_STATUS_SUCCESS; |
| 12618 | } |
| 12619 | |
| 12620 | /** |
| 12621 | * extract_chan_info_event_tlv() - extract chan information from event |
| 12622 | * @wmi_handle: wmi handle |
| 12623 | * @param evt_buf: pointer to event buffer |
| 12624 | * @param chan_info: Pointer to hold chan information |
| 12625 | * |
| 12626 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12627 | */ |
| 12628 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 12629 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 12630 | { |
| 12631 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 12632 | wmi_chan_info_event_fixed_param *ev; |
| 12633 | |
| 12634 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 12635 | |
| 12636 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 12637 | if (!ev) { |
| 12638 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 12639 | return QDF_STATUS_E_FAILURE; |
| 12640 | } |
| 12641 | |
| 12642 | chan_info->err_code = ev->err_code; |
| 12643 | chan_info->freq = ev->freq; |
| 12644 | chan_info->cmd_flags = ev->cmd_flags; |
| 12645 | chan_info->noise_floor = ev->noise_floor; |
| 12646 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 12647 | chan_info->cycle_count = ev->cycle_count; |
| 12648 | |
| 12649 | return QDF_STATUS_SUCCESS; |
| 12650 | } |
| 12651 | |
| 12652 | /** |
| 12653 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 12654 | * from event |
| 12655 | * @wmi_handle: wmi handle |
| 12656 | * @param evt_buf: pointer to event buffer |
| 12657 | * @param ch_hopping: Pointer to hold channel hopping param |
| 12658 | * |
| 12659 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12660 | */ |
| 12661 | static QDF_STATUS extract_channel_hopping_event_tlv(wmi_unified_t wmi_handle, |
| 12662 | void *evt_buf, wmi_host_pdev_channel_hopping_event *chan_info) |
| 12663 | { |
| 12664 | return QDF_STATUS_SUCCESS; |
| 12665 | } |
| 12666 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 12667 | /** |
| 12668 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 12669 | * from event |
| 12670 | * @wmi_handle: wmi handle |
| 12671 | * @param evt_buf: pointer to event buffer |
| 12672 | * @param param: Pointer to hold evt buf |
| 12673 | * |
| 12674 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12675 | */ |
| 12676 | static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle, |
| 12677 | uint8_t *event, struct wmi_host_service_ext_param *param) |
| 12678 | { |
| 12679 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12680 | wmi_service_ready_ext_event_fixed_param *ev; |
| 12681 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12682 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 12683 | |
| 12684 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12685 | if (!param_buf) |
| 12686 | return -EINVAL; |
| 12687 | |
| 12688 | ev = param_buf->fixed_param; |
| 12689 | if (!ev) |
| 12690 | return -EINVAL; |
| 12691 | |
| 12692 | /* Move this to host based bitmap */ |
| 12693 | param->default_conc_scan_config_bits = |
| 12694 | ev->default_conc_scan_config_bits; |
| 12695 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 12696 | param->he_cap_info = ev->he_cap_info; |
| 12697 | param->mpdu_density = ev->mpdu_density; |
| 12698 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 12699 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 12700 | |
| 12701 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12702 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 12703 | |
| 12704 | reg_caps = param_buf->soc_hal_reg_caps; |
| 12705 | param->num_phy = reg_caps->num_phy; |
| 12706 | |
| 12707 | return QDF_STATUS_SUCCESS; |
| 12708 | } |
| 12709 | |
| 12710 | /** |
| 12711 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 12712 | * extract HW mode cap from service ready event |
| 12713 | * @wmi_handle: wmi handle |
| 12714 | * @param evt_buf: pointer to event buffer |
| 12715 | * @param param: Pointer to hold evt buf |
| 12716 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 12717 | * |
| 12718 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12719 | */ |
| 12720 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 12721 | wmi_unified_t wmi_handle, |
| 12722 | uint8_t *event, uint8_t hw_mode_idx, |
| 12723 | struct wmi_host_hw_mode_caps *param) |
| 12724 | { |
| 12725 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12726 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12727 | |
| 12728 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12729 | if (!param_buf) |
| 12730 | return -EINVAL; |
| 12731 | |
| 12732 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12733 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
| 12734 | return -EINVAL; |
| 12735 | |
| 12736 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 12737 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 12738 | |
| 12739 | return QDF_STATUS_SUCCESS; |
| 12740 | } |
| 12741 | |
| 12742 | /** |
| 12743 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 12744 | * extract MAC phy cap from service ready event |
| 12745 | * @wmi_handle: wmi handle |
| 12746 | * @param evt_buf: pointer to event buffer |
| 12747 | * @param param: Pointer to hold evt buf |
| 12748 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 12749 | * |
| 12750 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12751 | */ |
| 12752 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 12753 | wmi_unified_t wmi_handle, |
| 12754 | uint8_t *event, uint8_t hw_mode_idx, |
| 12755 | struct wmi_host_mac_phy_caps *param) |
| 12756 | { |
| 12757 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12758 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 12759 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
| 12760 | |
| 12761 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12762 | if (!param_buf) |
| 12763 | return -EINVAL; |
| 12764 | |
| 12765 | hw_caps = param_buf->soc_hw_mode_caps; |
| 12766 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
| 12767 | return -EINVAL; |
| 12768 | |
| 12769 | mac_phy_caps = ¶m_buf->mac_phy_caps[hw_mode_idx]; |
| 12770 | |
| 12771 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
| 12772 | param->pdev_id = mac_phy_caps->pdev_id; |
| 12773 | param->phy_id = mac_phy_caps->phy_id; |
| 12774 | param->supports_11b = mac_phy_caps->supports_11b; |
| 12775 | param->supports_11g = mac_phy_caps->supports_11g; |
| 12776 | param->supports_11a = mac_phy_caps->supports_11a; |
| 12777 | param->supports_11n = mac_phy_caps->supports_11n; |
| 12778 | param->supports_11ac = mac_phy_caps->supports_11ac; |
| 12779 | param->supports_11ax = mac_phy_caps->supports_11ax; |
| 12780 | |
| 12781 | param->supported_bands = mac_phy_caps->supported_bands; |
| 12782 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 12783 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 12784 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 12785 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 12786 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 12787 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 12788 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 12789 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 12790 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 12791 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 12792 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 12793 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 12794 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 12795 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 12796 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 12797 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 12798 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
| 12799 | |
| 12800 | return QDF_STATUS_SUCCESS; |
| 12801 | } |
| 12802 | |
| 12803 | /** |
| 12804 | * extract_reg_cap_service_ready_ext_tlv() - |
| 12805 | * extract REG cap from service ready event |
| 12806 | * @wmi_handle: wmi handle |
| 12807 | * @param evt_buf: pointer to event buffer |
| 12808 | * @param param: Pointer to hold evt buf |
| 12809 | * @param phy_idx: phy idx should be less than num_mode |
| 12810 | * |
| 12811 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12812 | */ |
| 12813 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 12814 | wmi_unified_t wmi_handle, |
| 12815 | uint8_t *event, uint8_t phy_idx, |
| 12816 | struct WMI_HOST_HAL_REG_CAPABILITIES_EXT *param) |
| 12817 | { |
| 12818 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 12819 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 12820 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 12821 | |
| 12822 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 12823 | if (!param_buf) |
| 12824 | return -EINVAL; |
| 12825 | |
| 12826 | reg_caps = param_buf->soc_hal_reg_caps; |
| 12827 | if (phy_idx >= reg_caps->num_phy) |
| 12828 | return -EINVAL; |
| 12829 | |
| 12830 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 12831 | |
| 12832 | param->phy_id = ext_reg_cap->phy_id; |
| 12833 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 12834 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 12835 | param->regcap1 = ext_reg_cap->regcap1; |
| 12836 | param->regcap2 = ext_reg_cap->regcap2; |
| 12837 | param->wireless_modes = ext_reg_cap->wireless_modes; |
| 12838 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 12839 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 12840 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 12841 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 12842 | |
| 12843 | return QDF_STATUS_SUCCESS; |
| 12844 | } |
| 12845 | |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 12846 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12847 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 12848 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 12849 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12850 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12851 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12852 | return false; |
| 12853 | } |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 12854 | #endif |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 12855 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12856 | struct wmi_ops tlv_ops = { |
| 12857 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 12858 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 12859 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 12860 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 12861 | .send_hidden_ssid_vdev_restart_cmd = |
| 12862 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12863 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 12864 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 12865 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12866 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12867 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12868 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 12869 | .send_peer_rx_reorder_queue_setup_cmd = |
| 12870 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 12871 | .send_peer_rx_reorder_queue_remove_cmd = |
| 12872 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12873 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 12874 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 12875 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 12876 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 12877 | .send_resume_cmd = send_resume_cmd_tlv, |
| 12878 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 12879 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 12880 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 12881 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 12882 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 12883 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 12884 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 12885 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
| 12886 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12887 | #ifndef CONFIG_MCL |
| 12888 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
| 12889 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 12890 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 12891 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 12892 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 12893 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12894 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
| 12895 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 12896 | .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] | 12897 | .send_set_sta_uapsd_auto_trig_cmd = |
| 12898 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 12899 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 12900 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 12901 | .send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv, |
| 12902 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 12903 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 12904 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 12905 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 12906 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 12907 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 12908 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 12909 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 12910 | .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] | 12911 | .send_ocb_start_timing_advert_cmd = |
| 12912 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 12913 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 12914 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 12915 | .send_set_mcc_channel_time_latency_cmd = |
| 12916 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 12917 | .send_set_mcc_channel_time_quota_cmd = |
| 12918 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 12919 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 12920 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 12921 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12922 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 12923 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 12924 | .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] | 12925 | .send_probe_rsp_tmpl_send_cmd = |
| 12926 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 12927 | .send_p2p_go_set_beacon_ie_cmd = |
| 12928 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 12929 | .send_setup_install_key_cmd = |
| 12930 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12931 | .send_set_gateway_params_cmd = |
| 12932 | send_set_gateway_params_cmd_tlv, |
| 12933 | .send_set_rssi_monitoring_cmd = |
| 12934 | send_set_rssi_monitoring_cmd_tlv, |
| 12935 | .send_scan_probe_setoui_cmd = |
| 12936 | send_scan_probe_setoui_cmd_tlv, |
| 12937 | .send_reset_passpoint_network_list_cmd = |
| 12938 | send_reset_passpoint_network_list_cmd_tlv, |
| 12939 | .send_set_passpoint_network_list_cmd = |
| 12940 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 12941 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 12942 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
| 12943 | .send_roam_scan_filter_cmd = |
| 12944 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12945 | .send_set_epno_network_list_cmd = |
| 12946 | send_set_epno_network_list_cmd_tlv, |
| 12947 | .send_ipa_offload_control_cmd = |
| 12948 | send_ipa_offload_control_cmd_tlv, |
| 12949 | .send_extscan_get_capabilities_cmd = |
| 12950 | send_extscan_get_capabilities_cmd_tlv, |
| 12951 | .send_extscan_get_cached_results_cmd = |
| 12952 | send_extscan_get_cached_results_cmd_tlv, |
| 12953 | .send_extscan_stop_change_monitor_cmd = |
| 12954 | send_extscan_stop_change_monitor_cmd_tlv, |
| 12955 | .send_extscan_start_change_monitor_cmd = |
| 12956 | send_extscan_start_change_monitor_cmd_tlv, |
| 12957 | .send_extscan_stop_hotlist_monitor_cmd = |
| 12958 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 12959 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 12960 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 12961 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 12962 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 12963 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12964 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12965 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12966 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 12967 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 12968 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 12969 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 12970 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 12971 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12972 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 12973 | .send_snr_cmd = send_snr_cmd_tlv, |
| 12974 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12975 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12976 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 12977 | .send_lphb_config_tcp_params_cmd = send_lphb_config_tcp_params_cmd_tlv, |
| 12978 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 12979 | .send_lphb_config_udp_pkt_filter_cmd = |
| 12980 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
| 12981 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 12982 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 12983 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12984 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
| 12985 | .send_process_update_edca_param_cmd = |
| 12986 | send_process_update_edca_param_cmd_tlv, |
| 12987 | .send_roam_scan_offload_mode_cmd = |
| 12988 | send_roam_scan_offload_mode_cmd_tlv, |
| 12989 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 12990 | .send_roam_scan_offload_ap_profile_cmd = |
| 12991 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 12992 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12993 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 12994 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12995 | #ifdef FEATURE_WLAN_RA_FILTERING |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12996 | .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] | 12997 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 12998 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 12999 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
| 13000 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 13001 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 13002 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 13003 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 13004 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 13005 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 13006 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 13007 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 13008 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
| 13009 | .send_enable_disable_packet_filter_cmd = |
| 13010 | send_enable_disable_packet_filter_cmd_tlv, |
| 13011 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
| 13012 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
| 13013 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 13014 | .send_process_gtk_offload_getinfo_cmd = |
| 13015 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 13016 | .send_process_add_periodic_tx_ptrn_cmd = |
| 13017 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 13018 | .send_process_del_periodic_tx_ptrn_cmd = |
| 13019 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 13020 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 13021 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 13022 | .send_set_app_type2_params_in_fw_cmd = |
| 13023 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 13024 | .send_set_auto_shutdown_timer_cmd = |
| 13025 | send_set_auto_shutdown_timer_cmd_tlv, |
| 13026 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 13027 | .send_process_dhcpserver_offload_cmd = |
| 13028 | send_process_dhcpserver_offload_cmd_tlv, |
| 13029 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 13030 | .send_process_ch_avoid_update_cmd = |
| 13031 | send_process_ch_avoid_update_cmd_tlv, |
| 13032 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 13033 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 13034 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 13035 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 13036 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 13037 | .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] | 13038 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13039 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 13040 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13041 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13042 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13043 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13044 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13045 | .send_set_base_macaddr_indicate_cmd = |
| 13046 | send_set_base_macaddr_indicate_cmd_tlv, |
| 13047 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 13048 | .send_enable_specific_fw_logs_cmd = |
| 13049 | send_enable_specific_fw_logs_cmd_tlv, |
| 13050 | .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] | 13051 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13052 | .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] | 13053 | .send_pdev_set_dual_mac_config_cmd = |
| 13054 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13055 | .send_enable_arp_ns_offload_cmd = |
| 13056 | send_enable_arp_ns_offload_cmd_tlv, |
| 13057 | .send_app_type1_params_in_fw_cmd = |
| 13058 | send_app_type1_params_in_fw_cmd_tlv, |
| 13059 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 13060 | .send_process_roam_synch_complete_cmd = |
| 13061 | send_process_roam_synch_complete_cmd_tlv, |
| 13062 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 13063 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 13064 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13065 | .send_roam_scan_offload_scan_period_cmd = |
| 13066 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 13067 | .send_roam_scan_offload_chan_list_cmd = |
| 13068 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 13069 | .send_roam_scan_offload_rssi_change_cmd = |
| 13070 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 13071 | .send_get_buf_extscan_hotlist_cmd = |
| 13072 | send_get_buf_extscan_hotlist_cmd_tlv, |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 13073 | .send_adapt_dwelltime_params_cmd = |
| 13074 | send_adapt_dwelltime_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13075 | .init_cmd_send = init_cmd_send_tlv, |
| 13076 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 13077 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 13078 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 13079 | .save_service_bitmap = save_service_bitmap_tlv, |
| 13080 | .is_service_enabled = is_service_enabled_tlv, |
| 13081 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 13082 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 13083 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
| 13084 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 13085 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 13086 | .extract_tbttoffset_update_params = |
| 13087 | extract_tbttoffset_update_params_tlv, |
| 13088 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 13089 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 13090 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 13091 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
| 13092 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
| 13093 | .extract_swba_vdev_map = extract_swba_vdev_map_tlv, |
| 13094 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 13095 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
| 13096 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 13097 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 13098 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 13099 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 13100 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 13101 | .extract_peer_stats = extract_peer_stats_tlv, |
| 13102 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 13103 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 13104 | .extract_chan_stats = extract_chan_stats_tlv, |
| 13105 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 13106 | .extract_profile_data = extract_profile_data_tlv, |
| 13107 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 13108 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 13109 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 13110 | .send_encrypt_decrypt_send_cmd = |
| 13111 | send_encrypt_decrypt_send_cmd_tlv, |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 13112 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 13113 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13114 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 13115 | .extract_hw_mode_cap_service_ready_ext = |
| 13116 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 13117 | .extract_mac_phy_cap_service_ready_ext = |
| 13118 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 13119 | .extract_reg_cap_service_ready_ext = |
| 13120 | extract_reg_cap_service_ready_ext_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13121 | }; |
| 13122 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 13123 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13124 | /** |
| 13125 | * populate_tlv_service() - populates wmi services |
| 13126 | * |
| 13127 | * @param wmi_service: Pointer to hold wmi_service |
| 13128 | * Return: None |
| 13129 | */ |
| 13130 | static void populate_tlv_service(uint32_t *wmi_service) |
| 13131 | { |
| 13132 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
| 13133 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 13134 | wmi_service[wmi_service_roam_scan_offload] = |
| 13135 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 13136 | wmi_service[wmi_service_bcn_miss_offload] = |
| 13137 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 13138 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 13139 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 13140 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 13141 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 13142 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 13143 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 13144 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 13145 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 13146 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 13147 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 13148 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 13149 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 13150 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 13151 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 13152 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 13153 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 13154 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 13155 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 13156 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 13157 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 13158 | wmi_service[wmi_service_packet_power_save] = |
| 13159 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 13160 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 13161 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 13162 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 13163 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 13164 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 13165 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 13166 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 13167 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 13168 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 13169 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 13170 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 13171 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 13172 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 13173 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 13174 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 13175 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 13176 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 13177 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 13178 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 13179 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 13180 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 13181 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 13182 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 13183 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 13184 | wmi_service[wmi_service_lte_ant_share_support] = |
| 13185 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 13186 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 13187 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 13188 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 13189 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 13190 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 13191 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 13192 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 13193 | wmi_service[wmi_service_bcn_txrate_override] = |
| 13194 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 13195 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 13196 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 13197 | wmi_service[wmi_service_estimate_linkspeed] = |
| 13198 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 13199 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 13200 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 13201 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 13202 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 13203 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 13204 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 13205 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 13206 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 13207 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 13208 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 13209 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 13210 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 13211 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 13212 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 13213 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 13214 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 13215 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 13216 | wmi_service[wmi_service_sap_auth_offload] = |
| 13217 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 13218 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 13219 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 13220 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 13221 | wmi_service[wmi_service_ap_arpns_offload] = |
| 13222 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 13223 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 13224 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 13225 | wmi_service[wmi_service_packet_filter_offload] = |
| 13226 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 13227 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 13228 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 13229 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 13230 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 13231 | |
| 13232 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 13233 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 13234 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 13235 | WMI_SERVICE_UNAVAILABLE; |
| 13236 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 13237 | WMI_SERVICE_UNAVAILABLE; |
| 13238 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 13239 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
| 13240 | wmi_service[wmi_service_atf] = WMI_SERVICE_UNAVAILABLE; |
| 13241 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 13242 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 13243 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 13244 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 13245 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 13246 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 13247 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 13248 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
| 13249 | |
| 13250 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 13251 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 13252 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 13253 | WMI_SERVICE_UNAVAILABLE; |
| 13254 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 13255 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 13256 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
Sathish Kumar | 699f6b5 | 2016-11-10 15:30:22 +0530 | [diff] [blame] | 13257 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13258 | } |
| 13259 | |
| 13260 | /** |
| 13261 | * populate_tlv_event_id() - populates wmi event ids |
| 13262 | * |
| 13263 | * @param event_ids: Pointer to hold event ids |
| 13264 | * Return: None |
| 13265 | */ |
| 13266 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 13267 | { |
| 13268 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 13269 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 13270 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 13271 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 13272 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 13273 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 13274 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 13275 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 13276 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 13277 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 13278 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 13279 | event_ids[wmi_service_ready_ext_event_id] = |
| 13280 | WMI_SERVICE_READY_EXT_EVENTID; |
| 13281 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 13282 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 13283 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 13284 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 13285 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 13286 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 13287 | |
| 13288 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 13289 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 13290 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 13291 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 13292 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 13293 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 13294 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 13295 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
| 13296 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 13297 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 13298 | event_ids[wmi_tbttoffset_update_event_id] = |
| 13299 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
| 13300 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 13301 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 13302 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 13303 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 13304 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 13305 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 13306 | |
| 13307 | event_ids[wmi_tx_delba_complete_event_id] = |
| 13308 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 13309 | event_ids[wmi_tx_addba_complete_event_id] = |
| 13310 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 13311 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 13312 | |
| 13313 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 13314 | |
| 13315 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 13316 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 13317 | |
| 13318 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 13319 | |
| 13320 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 13321 | |
| 13322 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
| 13323 | |
| 13324 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 13325 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 13326 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 13327 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 13328 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 13329 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 13330 | |
| 13331 | event_ids[wmi_rtt_meas_report_event_id] = |
| 13332 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 13333 | event_ids[wmi_tsf_meas_report_event_id] = |
| 13334 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 13335 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 13336 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 13337 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 13338 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 13339 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 13340 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 13341 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 13342 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 13343 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 13344 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 13345 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 13346 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 13347 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 13348 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 13349 | |
| 13350 | event_ids[wmi_gtk_offload_status_event_id] = |
| 13351 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 13352 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 13353 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 13354 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 13355 | |
| 13356 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 13357 | |
| 13358 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 13359 | |
| 13360 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 13361 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 13362 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 13363 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 13364 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 13365 | event_ids[wmi_wlan_profile_data_event_id] = |
| 13366 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 13367 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 13368 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 13369 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 13370 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 13371 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 13372 | |
| 13373 | event_ids[wmi_diag_container_event_id] = |
| 13374 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 13375 | |
| 13376 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 13377 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 13378 | |
| 13379 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 13380 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 13381 | |
| 13382 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 13383 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 13384 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 13385 | |
| 13386 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 13387 | |
| 13388 | /** Set OCB Sched Response, deprecated */ |
| 13389 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 13390 | |
| 13391 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 13392 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 13393 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 13394 | |
| 13395 | /* GPIO Event */ |
| 13396 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 13397 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 13398 | |
| 13399 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 13400 | event_ids[wmi_rfkill_state_change_event_id] = |
| 13401 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 13402 | |
| 13403 | /* TDLS Event */ |
| 13404 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 13405 | |
| 13406 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 13407 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 13408 | event_ids[wmi_batch_scan_result_event_id] = |
| 13409 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 13410 | /* OEM Event */ |
| 13411 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 13412 | event_ids[wmi_oem_meas_report_event_id] = |
| 13413 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 13414 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 13415 | |
| 13416 | /* NAN Event */ |
| 13417 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 13418 | |
| 13419 | /* LPI Event */ |
| 13420 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 13421 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 13422 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 13423 | |
| 13424 | /* ExtScan events */ |
| 13425 | event_ids[wmi_extscan_start_stop_event_id] = |
| 13426 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 13427 | event_ids[wmi_extscan_operation_event_id] = |
| 13428 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 13429 | event_ids[wmi_extscan_table_usage_event_id] = |
| 13430 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 13431 | event_ids[wmi_extscan_cached_results_event_id] = |
| 13432 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 13433 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 13434 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 13435 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 13436 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 13437 | event_ids[wmi_extscan_capabilities_event_id] = |
| 13438 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 13439 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 13440 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 13441 | |
| 13442 | /* mDNS offload events */ |
| 13443 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 13444 | |
| 13445 | /* SAP Authentication offload events */ |
| 13446 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 13447 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 13448 | |
| 13449 | /** Out-of-context-of-bss (OCB) events */ |
| 13450 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 13451 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 13452 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 13453 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 13454 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 13455 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 13456 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 13457 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 13458 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 13459 | /* System-On-Chip events */ |
| 13460 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 13461 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 13462 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 13463 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 13464 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 13465 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
| 13466 | } |
| 13467 | |
| 13468 | /** |
| 13469 | * populate_pdev_param_tlv() - populates pdev params |
| 13470 | * |
| 13471 | * @param pdev_param: Pointer to hold pdev params |
| 13472 | * Return: None |
| 13473 | */ |
| 13474 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 13475 | { |
| 13476 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 13477 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 13478 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 13479 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 13480 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 13481 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 13482 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 13483 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 13484 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 13485 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 13486 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 13487 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 13488 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 13489 | pdev_param[wmi_pdev_param_protection_mode] = |
| 13490 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 13491 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 13492 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 13493 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 13494 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 13495 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 13496 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 13497 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 13498 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 13499 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 13500 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 13501 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 13502 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 13503 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 13504 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 13505 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 13506 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 13507 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 13508 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 13509 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 13510 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 13511 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 13512 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 13513 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 13514 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 13515 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 13516 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 13517 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 13518 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 13519 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 13520 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 13521 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 13522 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 13523 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 13524 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 13525 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 13526 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 13527 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 13528 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 13529 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 13530 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 13531 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 13532 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 13533 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 13534 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 13535 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 13536 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 13537 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 13538 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 13539 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 13540 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 13541 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 13542 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 13543 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 13544 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 13545 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 13546 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 13547 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 13548 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 13549 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 13550 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 13551 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 13552 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 13553 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 13554 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 13555 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 13556 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 13557 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 13558 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 13559 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 13560 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 13561 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 13562 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 13563 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 13564 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 13565 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 13566 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 13567 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 13568 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 13569 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 13570 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 13571 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 13572 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 13573 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 13574 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 13575 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 13576 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 13577 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 13578 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 13579 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 13580 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 13581 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 13582 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 13583 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 13584 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 13585 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 13586 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 13587 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 13588 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 13589 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 13590 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 13591 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 13592 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 13593 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 13594 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 13595 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 13596 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 13597 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 13598 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 13599 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 13600 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 13601 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 13602 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 13603 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 13604 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 13605 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 13606 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 13607 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
| 13608 | pdev_param[wmi_pdev_param_rx_filter] = WMI_UNAVAILABLE_PARAM; |
| 13609 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = WMI_UNAVAILABLE_PARAM; |
| 13610 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = WMI_UNAVAILABLE_PARAM; |
| 13611 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_UNAVAILABLE_PARAM; |
| 13612 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
| 13613 | WMI_UNAVAILABLE_PARAM; |
| 13614 | pdev_param[wmi_pdev_param_proxy_sta_mode] = WMI_UNAVAILABLE_PARAM; |
| 13615 | pdev_param[wmi_pdev_param_mu_group_policy] = WMI_UNAVAILABLE_PARAM; |
| 13616 | pdev_param[wmi_pdev_param_noise_detection] = WMI_UNAVAILABLE_PARAM; |
| 13617 | pdev_param[wmi_pdev_param_noise_threshold] = WMI_UNAVAILABLE_PARAM; |
| 13618 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_UNAVAILABLE_PARAM; |
| 13619 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = WMI_UNAVAILABLE_PARAM; |
| 13620 | pdev_param[wmi_pdev_param_atf_strict_sch] = WMI_UNAVAILABLE_PARAM; |
| 13621 | pdev_param[wmi_pdev_param_atf_sched_duration] = WMI_UNAVAILABLE_PARAM; |
| 13622 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_UNAVAILABLE_PARAM; |
| 13623 | pdev_param[wmi_pdev_param_sensitivity_level] = WMI_UNAVAILABLE_PARAM; |
| 13624 | pdev_param[wmi_pdev_param_signed_txpower_2g] = WMI_UNAVAILABLE_PARAM; |
| 13625 | pdev_param[wmi_pdev_param_signed_txpower_5g] = WMI_UNAVAILABLE_PARAM; |
| 13626 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = WMI_UNAVAILABLE_PARAM; |
| 13627 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = WMI_UNAVAILABLE_PARAM; |
| 13628 | pdev_param[wmi_pdev_param_cca_threshold] = WMI_UNAVAILABLE_PARAM; |
| 13629 | pdev_param[wmi_pdev_param_rts_fixed_rate] = WMI_UNAVAILABLE_PARAM; |
| 13630 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
| 13631 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_UNAVAILABLE_PARAM; |
| 13632 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = WMI_UNAVAILABLE_PARAM; |
| 13633 | pdev_param[wmi_pdev_param_arp_srcaddr] = WMI_UNAVAILABLE_PARAM; |
| 13634 | pdev_param[wmi_pdev_param_arp_dstaddr] = WMI_UNAVAILABLE_PARAM; |
| 13635 | pdev_param[wmi_pdev_param_txpower_decr_db] = WMI_UNAVAILABLE_PARAM; |
| 13636 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 13637 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
| 13638 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = WMI_UNAVAILABLE_PARAM; |
| 13639 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
| 13640 | WMI_UNAVAILABLE_PARAM; |
| 13641 | pdev_param[wmi_pdev_param_cust_txpower_scale] = WMI_UNAVAILABLE_PARAM; |
| 13642 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = WMI_UNAVAILABLE_PARAM; |
| 13643 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 13644 | WMI_UNAVAILABLE_PARAM; |
| 13645 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 13646 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
| 13647 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_UNAVAILABLE_PARAM; |
| 13648 | pdev_param[wmi_pdev_param_block_interbss] = WMI_UNAVAILABLE_PARAM; |
| 13649 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
| 13650 | WMI_UNAVAILABLE_PARAM; |
| 13651 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 13652 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
| 13653 | WMI_UNAVAILABLE_PARAM; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 13654 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 13655 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13656 | pdev_param[wmi_pdev_param_en_stats] = WMI_UNAVAILABLE_PARAM; |
| 13657 | } |
| 13658 | |
| 13659 | /** |
| 13660 | * populate_vdev_param_tlv() - populates vdev params |
| 13661 | * |
| 13662 | * @param vdev_param: Pointer to hold vdev params |
| 13663 | * Return: None |
| 13664 | */ |
| 13665 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 13666 | { |
| 13667 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 13668 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 13669 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 13670 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 13671 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 13672 | vdev_param[wmi_vdev_param_listen_interval] = |
| 13673 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 13674 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 13675 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 13676 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 13677 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 13678 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 13679 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 13680 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 13681 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 13682 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 13683 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 13684 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 13685 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 13686 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 13687 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 13688 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 13689 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 13690 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 13691 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 13692 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 13693 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 13694 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 13695 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 13696 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 13697 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 13698 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 13699 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 13700 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 13701 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 13702 | vdev_param[wmi_vdev_param_protection_mode] = |
| 13703 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 13704 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 13705 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 13706 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 13707 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 13708 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 13709 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 13710 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 13711 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 13712 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 13713 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 13714 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 13715 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 13716 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 13717 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 13718 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 13719 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 13720 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 13721 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 13722 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 13723 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 13724 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 13725 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 13726 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 13727 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 13728 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 13729 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 13730 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 13731 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 13732 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 13733 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 13734 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 13735 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 13736 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 13737 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 13738 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 13739 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 13740 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 13741 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 13742 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 13743 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 13744 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 13745 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 13746 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 13747 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 13748 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 13749 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 13750 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 13751 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 13752 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 13753 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 13754 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 13755 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 13756 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 13757 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 13758 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 13759 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 13760 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 13761 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 13762 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 13763 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 13764 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 13765 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 13766 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 13767 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 13768 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 13769 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 13770 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 13771 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 13772 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 13773 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 13774 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 13775 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 13776 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 13777 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 13778 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 13779 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 13780 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 13781 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 13782 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 13783 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 13784 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 13785 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 13786 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 13787 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 13788 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 13789 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 13790 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 13791 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 13792 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 13793 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13794 | } |
| 13795 | #endif |
| 13796 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13797 | /** |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13798 | * wmi_tlv_attach() - Attach TLV APIs |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13799 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13800 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13801 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 13802 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13803 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
| 13804 | { |
| 13805 | wmi_handle->ops = &tlv_ops; |
| 13806 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 13807 | wmi_handle->log_info.buf_offset_command = 2; |
| 13808 | wmi_handle->log_info.buf_offset_event = 4; |
| 13809 | wmi_handle->log_info.is_management_record = |
| 13810 | is_management_record_tlv; |
| 13811 | #endif |
| 13812 | populate_tlv_service(wmi_handle->services); |
| 13813 | populate_tlv_events_id(wmi_handle->wmi_events); |
| 13814 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 13815 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 13816 | } |
| 13817 | #else |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13818 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13819 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 13820 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 13821 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 13822 | wmi_handle->log_info.buf_offset_command = 2; |
| 13823 | wmi_handle->log_info.buf_offset_event = 4; |
| 13824 | wmi_handle->log_info.is_management_record = |
| 13825 | is_management_record_tlv; |
| 13826 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13827 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13828 | #endif |