Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1 | /* |
Paul Zhang | d19abd8 | 2017-01-04 16:45:42 +0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 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 | } |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 175 | WMI_LOGD("%s:vdev id = %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 176 | |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 182 | * @wmi: wmi handle |
| 183 | * @vdev_id: vdev id |
| 184 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 185 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 186 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 187 | 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] | 188 | { |
| 189 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 190 | wmi_buf_t buf; |
| 191 | int32_t len = sizeof(*cmd); |
| 192 | |
| 193 | buf = wmi_buf_alloc(wmi, len); |
| 194 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 195 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 196 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 197 | } |
| 198 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 199 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 200 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 201 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 202 | cmd->vdev_id = vdev_id; |
| 203 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 204 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 205 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 206 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 207 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 208 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 209 | |
| 210 | return 0; |
| 211 | } |
| 212 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 213 | #ifdef CONFIG_MCL |
| 214 | static inline void copy_channel_info( |
| 215 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 216 | wmi_channel *chan, |
| 217 | struct vdev_start_params *req) |
| 218 | { |
| 219 | chan->mhz = req->chan_freq; |
| 220 | |
| 221 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 222 | |
| 223 | chan->band_center_freq1 = req->band_center_freq1; |
| 224 | chan->band_center_freq2 = req->band_center_freq2; |
| 225 | |
| 226 | if (req->is_half_rate) |
| 227 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 228 | else if (req->is_quarter_rate) |
| 229 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 230 | |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame^] | 231 | if (req->is_dfs && req->flag_dfs) { |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 232 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 233 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 234 | } |
| 235 | |
| 236 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 237 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 238 | |
| 239 | } |
| 240 | #else |
| 241 | static inline void copy_channel_info( |
| 242 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 243 | wmi_channel *chan, |
| 244 | struct vdev_start_params *req) |
| 245 | { |
| 246 | chan->mhz = req->channel.mhz; |
| 247 | |
| 248 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 249 | |
| 250 | chan->band_center_freq1 = req->channel.cfreq1; |
| 251 | chan->band_center_freq2 = req->channel.cfreq2; |
| 252 | |
| 253 | if (req->channel.half_rate) |
| 254 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 255 | else if (req->channel.quarter_rate) |
| 256 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 257 | |
| 258 | if (req->channel.dfs_set) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 259 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 260 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 261 | } |
| 262 | |
| 263 | /* FIXME: Find out min, max and regulatory power levels */ |
| 264 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
| 265 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxpower); |
| 266 | |
| 267 | } |
| 268 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 269 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 270 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 271 | * @wmi_handle: wmi handle |
| 272 | * @req: vdev start params |
| 273 | * |
| 274 | * Return: QDF status |
| 275 | */ |
| 276 | QDF_STATUS send_vdev_start_cmd_tlv(wmi_unified_t wmi_handle, |
| 277 | struct vdev_start_params *req) |
| 278 | { |
| 279 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 280 | wmi_buf_t buf; |
| 281 | wmi_channel *chan; |
| 282 | int32_t len, ret; |
| 283 | uint8_t *buf_ptr; |
| 284 | |
| 285 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 286 | buf = wmi_buf_alloc(wmi_handle, len); |
| 287 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 288 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 289 | return QDF_STATUS_E_NOMEM; |
| 290 | } |
| 291 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 292 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 293 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 294 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 295 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 296 | WMITLV_GET_STRUCT_TLVLEN |
| 297 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 298 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 299 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 300 | cmd->vdev_id = req->vdev_id; |
| 301 | |
| 302 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 303 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 304 | |
| 305 | cmd->beacon_interval = req->beacon_intval; |
| 306 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 307 | |
| 308 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 309 | cmd->beacon_interval = req->beacon_intval; |
| 310 | cmd->dtim_period = req->dtim_period; |
| 311 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 312 | /* Copy the SSID */ |
| 313 | if (req->ssid.length) { |
| 314 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 315 | cmd->ssid.ssid_len = req->ssid.length; |
| 316 | else |
| 317 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 318 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 319 | cmd->ssid.ssid_len); |
| 320 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 321 | |
| 322 | if (req->hidden_ssid) |
| 323 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 324 | |
| 325 | if (req->pmf_enabled) |
| 326 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 327 | } |
| 328 | |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 329 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 330 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 331 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
| 332 | |
| 333 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 334 | sizeof(wmi_channel)); |
| 335 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 336 | cmd->num_noa_descriptors * |
| 337 | sizeof(wmi_p2p_noa_descriptor)); |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame^] | 338 | WMI_LOGA("%s: vdev_id %d freq %d chanmode %d ch_info: 0x%x is_dfs %d " |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 339 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 340 | "reg_info_1: 0x%x reg_info_2: 0x%x, req->max_txpow: 0x%x " |
| 341 | "Tx SS %d, Rx SS %d", |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame^] | 342 | __func__, req->vdev_id, chan->mhz, req->chan_mode, chan->info, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 343 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 344 | chan->band_center_freq1, chan->band_center_freq2, |
| 345 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
| 346 | req->preferred_tx_streams, req->preferred_rx_streams); |
| 347 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 348 | if (req->is_restart) |
| 349 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 350 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 351 | else |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 352 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 353 | WMI_VDEV_START_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 354 | if (ret) { |
| 355 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 356 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 357 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 358 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 359 | |
| 360 | return QDF_STATUS_SUCCESS; |
| 361 | } |
| 362 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 363 | /** |
| 364 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 365 | * @wmi_handle: wmi handle |
| 366 | * @restart_params: vdev restart params |
| 367 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 368 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 369 | */ |
| 370 | QDF_STATUS send_hidden_ssid_vdev_restart_cmd_tlv(wmi_unified_t wmi_handle, |
| 371 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 372 | { |
| 373 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 374 | wmi_buf_t buf; |
| 375 | wmi_channel *chan; |
| 376 | int32_t len; |
| 377 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 378 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 379 | |
| 380 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 381 | buf = wmi_buf_alloc(wmi_handle, len); |
| 382 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 383 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 384 | return QDF_STATUS_E_NOMEM; |
| 385 | } |
| 386 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 387 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 388 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 389 | |
| 390 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 391 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 392 | WMITLV_GET_STRUCT_TLVLEN |
| 393 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 394 | |
| 395 | WMITLV_SET_HDR(&chan->tlv_header, |
| 396 | WMITLV_TAG_STRUC_wmi_channel, |
| 397 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 398 | |
| 399 | cmd->vdev_id = restart_params->session_id; |
| 400 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 401 | qdf_mem_copy(cmd->ssid.ssid, |
| 402 | restart_params->ssid, |
| 403 | cmd->ssid.ssid_len); |
| 404 | cmd->flags = restart_params->flags; |
| 405 | cmd->requestor_id = restart_params->requestor_id; |
| 406 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 407 | |
| 408 | chan->mhz = restart_params->mhz; |
| 409 | chan->band_center_freq1 = |
| 410 | restart_params->band_center_freq1; |
| 411 | chan->band_center_freq2 = |
| 412 | restart_params->band_center_freq2; |
| 413 | chan->info = restart_params->info; |
| 414 | chan->reg_info_1 = restart_params->reg_info_1; |
| 415 | chan->reg_info_2 = restart_params->reg_info_2; |
| 416 | |
| 417 | cmd->num_noa_descriptors = 0; |
| 418 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 419 | sizeof(wmi_channel)); |
| 420 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 421 | cmd->num_noa_descriptors * |
| 422 | sizeof(wmi_p2p_noa_descriptor)); |
| 423 | |
| 424 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 425 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 426 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 427 | wmi_buf_free(buf); |
| 428 | return QDF_STATUS_E_FAILURE; |
| 429 | } |
| 430 | return QDF_STATUS_SUCCESS; |
| 431 | } |
| 432 | |
| 433 | |
| 434 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 435 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 436 | * @wmi: wmi handle |
| 437 | * @peer_addr: peer mac address |
| 438 | * @param: pointer to hold peer flush tid parameter |
| 439 | * |
| 440 | * Return: 0 for sucess or error code |
| 441 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 442 | QDF_STATUS send_peer_flush_tids_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 443 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 444 | struct peer_flush_params *param) |
| 445 | { |
| 446 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 447 | wmi_buf_t buf; |
| 448 | int32_t len = sizeof(*cmd); |
| 449 | |
| 450 | buf = wmi_buf_alloc(wmi, len); |
| 451 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 452 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 453 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 454 | } |
| 455 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 456 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 457 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 458 | WMITLV_GET_STRUCT_TLVLEN |
| 459 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 460 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 461 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 462 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 463 | 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] | 464 | peer_addr, param->vdev_id, |
| 465 | param->peer_tid_bitmap); |
| 466 | 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] | 467 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 468 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 469 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | return 0; |
| 473 | } |
| 474 | |
| 475 | /** |
| 476 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 477 | * @wmi: wmi handle |
| 478 | * @peer_addr: peer mac addr |
| 479 | * @vdev_id: vdev id |
| 480 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 481 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 482 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 483 | QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 484 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 485 | uint8_t vdev_id) |
| 486 | { |
| 487 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 488 | wmi_buf_t buf; |
| 489 | int32_t len = sizeof(*cmd); |
| 490 | buf = wmi_buf_alloc(wmi, len); |
| 491 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 492 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 493 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 494 | } |
| 495 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 496 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 497 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 498 | WMITLV_GET_STRUCT_TLVLEN |
| 499 | (wmi_peer_delete_cmd_fixed_param)); |
| 500 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 501 | cmd->vdev_id = vdev_id; |
| 502 | |
Orhan K AKYILDIZ | c8d1c4b | 2017-01-10 14:32:18 -0800 | [diff] [blame] | 503 | 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] | 504 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 505 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 506 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 507 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 508 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 509 | |
| 510 | return 0; |
| 511 | } |
| 512 | |
| 513 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 514 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 515 | * to target id. |
| 516 | * @targ_paramid: Target parameter id to hold the result. |
| 517 | * @peer_param_id: host param id. |
| 518 | * |
| 519 | * Return: QDF_STATUS_SUCCESS for success |
| 520 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
| 521 | */ |
| 522 | #ifdef CONFIG_MCL |
| 523 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 524 | uint32_t *targ_paramid, |
| 525 | uint32_t peer_param_id) |
| 526 | { |
| 527 | *targ_paramid = peer_param_id; |
| 528 | return QDF_STATUS_SUCCESS; |
| 529 | } |
| 530 | #else |
| 531 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 532 | uint32_t *targ_paramid, |
| 533 | uint32_t peer_param_id) |
| 534 | { |
| 535 | switch (peer_param_id) { |
| 536 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 537 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 538 | break; |
| 539 | case WMI_HOST_PEER_AMPDU: |
| 540 | *targ_paramid = WMI_PEER_AMPDU; |
| 541 | break; |
| 542 | case WMI_HOST_PEER_AUTHORIZE: |
| 543 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 544 | break; |
| 545 | case WMI_HOST_PEER_CHWIDTH: |
| 546 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 547 | break; |
| 548 | case WMI_HOST_PEER_NSS: |
| 549 | *targ_paramid = WMI_PEER_NSS; |
| 550 | break; |
| 551 | case WMI_HOST_PEER_USE_4ADDR: |
| 552 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 553 | break; |
| 554 | case WMI_HOST_PEER_MEMBERSHIP: |
| 555 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 556 | break; |
| 557 | case WMI_HOST_PEER_USERPOS: |
| 558 | *targ_paramid = WMI_PEER_USERPOS; |
| 559 | break; |
| 560 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 561 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 562 | break; |
| 563 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 564 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 565 | break; |
| 566 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 567 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 568 | break; |
| 569 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 570 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 571 | break; |
| 572 | case WMI_HOST_PEER_PHYMODE: |
| 573 | *targ_paramid = WMI_PEER_PHYMODE; |
| 574 | break; |
| 575 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 576 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 577 | break; |
| 578 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 579 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 580 | break; |
| 581 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 582 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 583 | break; |
| 584 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 585 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 586 | break; |
| 587 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 588 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 589 | break; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 590 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 591 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 592 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 593 | default: |
| 594 | return QDF_STATUS_E_NOSUPPORT; |
| 595 | } |
| 596 | |
| 597 | return QDF_STATUS_SUCCESS; |
| 598 | } |
| 599 | #endif |
| 600 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 601 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 602 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 603 | * @peer_addr: peer mac address |
| 604 | * @param : pointer to hold peer set parameter |
| 605 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 606 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 607 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 608 | QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 609 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 610 | struct peer_set_params *param) |
| 611 | { |
| 612 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 613 | wmi_buf_t buf; |
| 614 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 615 | uint32_t param_id; |
| 616 | |
| 617 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 618 | param->param_id) != QDF_STATUS_SUCCESS) |
| 619 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 620 | |
| 621 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 622 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 623 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 624 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 625 | } |
| 626 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 627 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 628 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 629 | WMITLV_GET_STRUCT_TLVLEN |
| 630 | (wmi_peer_set_param_cmd_fixed_param)); |
| 631 | cmd->vdev_id = param->vdev_id; |
| 632 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 633 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 634 | cmd->param_value = param->param_value; |
| 635 | err = wmi_unified_cmd_send(wmi, buf, |
| 636 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 637 | WMI_PEER_SET_PARAM_CMDID); |
| 638 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 639 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 640 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 641 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 642 | } |
| 643 | |
| 644 | return 0; |
| 645 | } |
| 646 | |
| 647 | /** |
| 648 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 649 | * @wmi: wmi handle |
| 650 | * @bssid: bssid |
| 651 | * @vdev_up_params: pointer to hold vdev up parameter |
| 652 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 653 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 654 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 655 | QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 656 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 657 | struct vdev_up_params *params) |
| 658 | { |
| 659 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 660 | wmi_buf_t buf; |
| 661 | int32_t len = sizeof(*cmd); |
| 662 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 663 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 664 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 665 | params->vdev_id, params->assoc_id, bssid); |
| 666 | buf = wmi_buf_alloc(wmi, len); |
| 667 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 668 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 669 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 670 | } |
| 671 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 672 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 673 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 674 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 675 | cmd->vdev_id = params->vdev_id; |
| 676 | cmd->vdev_assoc_id = params->assoc_id; |
| 677 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 678 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 679 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 680 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 681 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 682 | } |
| 683 | |
| 684 | return 0; |
| 685 | } |
| 686 | |
| 687 | /** |
| 688 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 689 | * @wmi: wmi handle |
| 690 | * @peer_addr: peer mac address |
| 691 | * @peer_type: peer type |
| 692 | * @vdev_id: vdev id |
| 693 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 694 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 695 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 696 | QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 697 | struct peer_create_params *param) |
| 698 | { |
| 699 | wmi_peer_create_cmd_fixed_param *cmd; |
| 700 | wmi_buf_t buf; |
| 701 | int32_t len = sizeof(*cmd); |
| 702 | |
| 703 | buf = wmi_buf_alloc(wmi, len); |
| 704 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 705 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 706 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 707 | } |
| 708 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 709 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 710 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 711 | WMITLV_GET_STRUCT_TLVLEN |
| 712 | (wmi_peer_create_cmd_fixed_param)); |
| 713 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 714 | cmd->peer_type = param->peer_type; |
| 715 | cmd->vdev_id = param->vdev_id; |
| 716 | |
| 717 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 718 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 719 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 720 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 721 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 722 | 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] | 723 | param->vdev_id); |
| 724 | |
| 725 | return 0; |
| 726 | } |
| 727 | |
| 728 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 729 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 730 | * command to fw |
| 731 | * @wmi: wmi handle |
| 732 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 733 | * |
| 734 | * Return: 0 for success or error code |
| 735 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 736 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 737 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 738 | struct rx_reorder_queue_setup_params *param) |
| 739 | { |
| 740 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 741 | wmi_buf_t buf; |
| 742 | int32_t len = sizeof(*cmd); |
| 743 | |
| 744 | buf = wmi_buf_alloc(wmi, len); |
| 745 | if (!buf) { |
| 746 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 747 | return QDF_STATUS_E_NOMEM; |
| 748 | } |
| 749 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 750 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 751 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 752 | WMITLV_GET_STRUCT_TLVLEN |
| 753 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 754 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 755 | cmd->vdev_id = param->vdev_id; |
| 756 | cmd->tid = param->tid; |
| 757 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 758 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 759 | cmd->queue_no = param->queue_no; |
| 760 | |
| 761 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 762 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 763 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 764 | __func__); |
| 765 | qdf_nbuf_free(buf); |
| 766 | return QDF_STATUS_E_FAILURE; |
| 767 | } |
| 768 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 769 | param->peer_macaddr, param->vdev_id, param->tid); |
| 770 | |
| 771 | return QDF_STATUS_SUCCESS; |
| 772 | } |
| 773 | |
| 774 | /** |
| 775 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 776 | * command to fw |
| 777 | * @wmi: wmi handle |
| 778 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 779 | * |
| 780 | * Return: 0 for success or error code |
| 781 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 782 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 783 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 784 | struct rx_reorder_queue_remove_params *param) |
| 785 | { |
| 786 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 787 | wmi_buf_t buf; |
| 788 | int32_t len = sizeof(*cmd); |
| 789 | |
| 790 | buf = wmi_buf_alloc(wmi, len); |
| 791 | if (!buf) { |
| 792 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 793 | return QDF_STATUS_E_NOMEM; |
| 794 | } |
| 795 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 796 | wmi_buf_data(buf); |
| 797 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 798 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 799 | WMITLV_GET_STRUCT_TLVLEN |
| 800 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 801 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 802 | cmd->vdev_id = param->vdev_id; |
| 803 | cmd->tid_mask = param->peer_tid_bitmap; |
| 804 | |
| 805 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 806 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 807 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 808 | __func__); |
| 809 | qdf_nbuf_free(buf); |
| 810 | return QDF_STATUS_E_FAILURE; |
| 811 | } |
| 812 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 813 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 814 | |
| 815 | return QDF_STATUS_SUCCESS; |
| 816 | } |
| 817 | |
| 818 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 819 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 820 | * @wmi_handle: wmi handle |
| 821 | * @value: value |
| 822 | * @mac_id: mac id to have radio context |
| 823 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 824 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 825 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 826 | 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] | 827 | uint32_t value, uint8_t mac_id) |
| 828 | { |
| 829 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 830 | wmi_buf_t buf; |
| 831 | int32_t len = sizeof(*cmd); |
| 832 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 833 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 834 | |
| 835 | buf = wmi_buf_alloc(wmi_handle, len); |
| 836 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 837 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 838 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 839 | } |
| 840 | |
| 841 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 842 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 843 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 844 | WMITLV_GET_STRUCT_TLVLEN |
| 845 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 846 | cmd->pdev_id = 0; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 847 | cmd->enable = value; |
| 848 | |
| 849 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 850 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 851 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 852 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 853 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 854 | } |
| 855 | |
| 856 | return 0; |
| 857 | } |
| 858 | |
| 859 | /** |
| 860 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 861 | * @wmi_handle: wmi handle |
| 862 | * @param: pointer to pdev_utf_params |
| 863 | * @mac_id: mac id to have radio context |
| 864 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 865 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 866 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 867 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 868 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 869 | struct pdev_utf_params *param, |
| 870 | uint8_t mac_id) |
| 871 | { |
| 872 | wmi_buf_t buf; |
| 873 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 874 | /* if param->len is 0 no data is sent, return error */ |
| 875 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 876 | static uint8_t msgref = 1; |
| 877 | uint8_t segNumber = 0, segInfo, numSegments; |
| 878 | uint16_t chunk_len, total_bytes; |
| 879 | uint8_t *bufpos; |
| 880 | struct seg_hdr_info segHdrInfo; |
| 881 | |
| 882 | bufpos = param->utf_payload; |
| 883 | total_bytes = param->len; |
| 884 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 885 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 886 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 887 | |
| 888 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 889 | numSegments++; |
| 890 | |
| 891 | while (param->len) { |
| 892 | if (param->len > MAX_WMI_UTF_LEN) |
| 893 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 894 | else |
| 895 | chunk_len = param->len; |
| 896 | |
| 897 | buf = wmi_buf_alloc(wmi_handle, |
| 898 | (chunk_len + sizeof(segHdrInfo) + |
| 899 | WMI_TLV_HDR_SIZE)); |
| 900 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 901 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 902 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 903 | } |
| 904 | |
| 905 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 906 | |
| 907 | segHdrInfo.len = total_bytes; |
| 908 | segHdrInfo.msgref = msgref; |
| 909 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 910 | segHdrInfo.segmentInfo = segInfo; |
| 911 | segHdrInfo.pad = 0; |
| 912 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 913 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 914 | " segHdrInfo.segmentInfo = %d", |
| 915 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 916 | segHdrInfo.segmentInfo); |
| 917 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 918 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 919 | "chunk len %d", __func__, total_bytes, segNumber, |
| 920 | numSegments, chunk_len); |
| 921 | |
| 922 | segNumber++; |
| 923 | |
| 924 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 925 | (chunk_len + sizeof(segHdrInfo))); |
| 926 | cmd += WMI_TLV_HDR_SIZE; |
| 927 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 928 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 929 | |
| 930 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 931 | (chunk_len + sizeof(segHdrInfo) + |
| 932 | WMI_TLV_HDR_SIZE), |
| 933 | WMI_PDEV_UTF_CMDID); |
| 934 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 935 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 936 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 937 | wmi_buf_free(buf); |
| 938 | break; |
| 939 | } |
| 940 | |
| 941 | param->len -= chunk_len; |
| 942 | bufpos += chunk_len; |
| 943 | } |
| 944 | |
| 945 | msgref++; |
| 946 | |
| 947 | return ret; |
| 948 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 949 | #ifdef CONFIG_MCL |
| 950 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 951 | uint32_t host_param) |
| 952 | { |
| 953 | return host_param; |
| 954 | } |
| 955 | #else |
| 956 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 957 | uint32_t host_param) |
| 958 | { |
| 959 | if (host_param < wmi_pdev_param_max) |
| 960 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 961 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 962 | return WMI_UNAVAILABLE_PARAM; |
| 963 | } |
| 964 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 965 | /** |
| 966 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 967 | * @wmi_handle: wmi handle |
| 968 | * @param: pointer to pdev parameter |
| 969 | * @mac_id: radio context |
| 970 | * |
| 971 | * Return: 0 on success, errno on failure |
| 972 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 973 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 974 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 975 | struct pdev_params *param, |
| 976 | uint8_t mac_id) |
| 977 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 978 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 979 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 980 | wmi_buf_t buf; |
| 981 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 982 | uint32_t pdev_param; |
| 983 | |
| 984 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 985 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 986 | WMI_LOGW("%s: Unavailable param %d\n", |
| 987 | __func__, param->param_id); |
| 988 | return QDF_STATUS_E_INVAL; |
| 989 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 990 | |
| 991 | buf = wmi_buf_alloc(wmi_handle, len); |
| 992 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 993 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 994 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 995 | } |
| 996 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 997 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 998 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 999 | WMITLV_GET_STRUCT_TLVLEN |
| 1000 | (wmi_pdev_set_param_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 1001 | cmd->pdev_id = 0; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1002 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1003 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1004 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1005 | param->param_value); |
| 1006 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1007 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1008 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1009 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1010 | wmi_buf_free(buf); |
| 1011 | } |
| 1012 | return ret; |
| 1013 | } |
| 1014 | |
| 1015 | /** |
| 1016 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1017 | * @param wmi_handle : handle to WMI. |
| 1018 | * @param param : pointer to hold suspend parameter |
| 1019 | * @mac_id: radio context |
| 1020 | * |
| 1021 | * Return 0 on success and -ve on failure. |
| 1022 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1023 | QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1024 | struct suspend_params *param, |
| 1025 | uint8_t mac_id) |
| 1026 | { |
| 1027 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1028 | wmi_buf_t wmibuf; |
| 1029 | uint32_t len = sizeof(*cmd); |
| 1030 | int32_t ret; |
| 1031 | |
| 1032 | /* |
| 1033 | * send the comand to Target to ignore the |
| 1034 | * PCIE reset so as to ensure that Host and target |
| 1035 | * states are in sync |
| 1036 | */ |
| 1037 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1038 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1039 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1040 | |
| 1041 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1042 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1043 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1044 | WMITLV_GET_STRUCT_TLVLEN |
| 1045 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1046 | if (param->disable_target_intr) |
| 1047 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1048 | else |
| 1049 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
| 1050 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1051 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1052 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1053 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1054 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1055 | } |
| 1056 | |
| 1057 | return ret; |
| 1058 | } |
| 1059 | |
| 1060 | /** |
| 1061 | * send_resume_cmd_tlv() - WMI resume function |
| 1062 | * @param wmi_handle : handle to WMI. |
| 1063 | * @mac_id: radio context |
| 1064 | * |
| 1065 | * Return: 0 on success and -ve on failure. |
| 1066 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1067 | QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1068 | uint8_t mac_id) |
| 1069 | { |
| 1070 | wmi_buf_t wmibuf; |
| 1071 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1072 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1073 | |
| 1074 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1075 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1076 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1077 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1078 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1079 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1080 | WMITLV_GET_STRUCT_TLVLEN |
| 1081 | (wmi_pdev_resume_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 1082 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1083 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1084 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1085 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1086 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1087 | wmi_buf_free(wmibuf); |
| 1088 | } |
| 1089 | |
| 1090 | return ret; |
| 1091 | } |
| 1092 | |
| 1093 | /** |
| 1094 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1095 | * @param wmi_handle : handle to WMI. |
| 1096 | * @param param : pointer to hold wow enable parameter |
| 1097 | * @mac_id: radio context |
| 1098 | * |
| 1099 | * Return: 0 on success and -ve on failure. |
| 1100 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1101 | QDF_STATUS send_wow_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1102 | struct wow_cmd_params *param, |
| 1103 | uint8_t mac_id) |
| 1104 | { |
| 1105 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1106 | wmi_buf_t buf; |
| 1107 | int32_t len; |
| 1108 | int32_t ret; |
| 1109 | |
| 1110 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1111 | |
| 1112 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1113 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1114 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1115 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1116 | } |
| 1117 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1118 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1119 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1120 | WMITLV_GET_STRUCT_TLVLEN |
| 1121 | (wmi_wow_enable_cmd_fixed_param)); |
| 1122 | cmd->enable = param->enable; |
| 1123 | if (param->can_suspend_link) |
| 1124 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1125 | else |
| 1126 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1127 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1128 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1129 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1130 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1131 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1132 | |
| 1133 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1134 | WMI_WOW_ENABLE_CMDID); |
| 1135 | if (ret) |
| 1136 | wmi_buf_free(buf); |
| 1137 | |
| 1138 | return ret; |
| 1139 | } |
| 1140 | |
| 1141 | /** |
| 1142 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1143 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1144 | * @peer_addr: peer mac address |
| 1145 | * @param: pointer to ap_ps parameter structure |
| 1146 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1147 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1148 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1149 | 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] | 1150 | uint8_t *peer_addr, |
| 1151 | struct ap_ps_params *param) |
| 1152 | { |
| 1153 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1154 | wmi_buf_t buf; |
| 1155 | int32_t err; |
| 1156 | |
| 1157 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1158 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1159 | 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] | 1160 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1161 | } |
| 1162 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1163 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1164 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1165 | WMITLV_GET_STRUCT_TLVLEN |
| 1166 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1167 | cmd->vdev_id = param->vdev_id; |
| 1168 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1169 | cmd->param = param->param; |
| 1170 | cmd->value = param->value; |
| 1171 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1172 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1173 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1174 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1175 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1176 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1177 | } |
| 1178 | |
| 1179 | return 0; |
| 1180 | } |
| 1181 | |
| 1182 | /** |
| 1183 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1184 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1185 | * @peer_addr: peer mac address |
| 1186 | * @param: pointer to sta_ps parameter structure |
| 1187 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1188 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1189 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1190 | 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] | 1191 | struct sta_ps_params *param) |
| 1192 | { |
| 1193 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1194 | wmi_buf_t buf; |
| 1195 | int32_t len = sizeof(*cmd); |
| 1196 | |
| 1197 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1198 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1199 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1200 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1201 | } |
| 1202 | |
| 1203 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1204 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1205 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1206 | WMITLV_GET_STRUCT_TLVLEN |
| 1207 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1208 | cmd->vdev_id = param->vdev_id; |
| 1209 | cmd->param = param->param; |
| 1210 | cmd->value = param->value; |
| 1211 | |
| 1212 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1213 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1214 | 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] | 1215 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1216 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1217 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1218 | } |
| 1219 | |
| 1220 | return 0; |
| 1221 | } |
| 1222 | |
| 1223 | /** |
| 1224 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1225 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1226 | * @param: ponirt to crash inject paramter structure |
| 1227 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1228 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1229 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1230 | QDF_STATUS send_crash_inject_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1231 | struct crash_inject *param) |
| 1232 | { |
| 1233 | int32_t ret = 0; |
| 1234 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1235 | uint16_t len = sizeof(*cmd); |
| 1236 | wmi_buf_t buf; |
| 1237 | |
| 1238 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1239 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1240 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1241 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1242 | } |
| 1243 | |
| 1244 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1245 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1246 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1247 | WMITLV_GET_STRUCT_TLVLEN |
| 1248 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1249 | cmd->type = param->type; |
| 1250 | cmd->delay_time_ms = param->delay_time_ms; |
| 1251 | |
| 1252 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1253 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1254 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1255 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1256 | __func__, ret); |
| 1257 | wmi_buf_free(buf); |
| 1258 | } |
| 1259 | |
| 1260 | return ret; |
| 1261 | } |
| 1262 | |
| 1263 | /** |
| 1264 | * send_dbglog_cmd_tlv() - set debug log level |
| 1265 | * @param wmi_handle : handle to WMI. |
| 1266 | * @param param : pointer to hold dbglog level parameter |
| 1267 | * |
| 1268 | * Return: 0 on success and -ve on failure. |
| 1269 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1270 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1271 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1272 | struct dbglog_params *dbglog_param) |
| 1273 | { |
| 1274 | wmi_buf_t buf; |
| 1275 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
| 1276 | A_STATUS status = A_OK; |
| 1277 | int32_t i; |
| 1278 | int32_t len; |
| 1279 | int8_t *buf_ptr; |
| 1280 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1281 | |
| 1282 | ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
| 1283 | |
| 1284 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1285 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1286 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1287 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1288 | if (buf == NULL) |
| 1289 | return A_NO_MEMORY; |
| 1290 | |
| 1291 | configmsg = |
| 1292 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1293 | buf_ptr = (int8_t *) configmsg; |
| 1294 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1295 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1296 | WMITLV_GET_STRUCT_TLVLEN |
| 1297 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1298 | configmsg->dbg_log_param = dbglog_param->param; |
| 1299 | configmsg->value = dbglog_param->val; |
| 1300 | /* Filling in the data part of second tlv -- should |
| 1301 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1302 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1303 | sizeof |
| 1304 | (wmi_debug_log_config_cmd_fixed_param) |
| 1305 | + WMI_TLV_HDR_SIZE); |
| 1306 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1307 | WMITLV_TAG_ARRAY_UINT32, |
| 1308 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1309 | if (dbglog_param->module_id_bitmap) { |
| 1310 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1311 | module_id_bitmap_array[i] = |
| 1312 | dbglog_param->module_id_bitmap[i]; |
| 1313 | } |
| 1314 | } |
| 1315 | |
| 1316 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1317 | len, WMI_DBGLOG_CFG_CMDID); |
| 1318 | |
| 1319 | if (status != A_OK) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1320 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1321 | |
| 1322 | return status; |
| 1323 | } |
| 1324 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1325 | #ifdef CONFIG_MCL |
| 1326 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1327 | uint32_t host_param) |
| 1328 | { |
| 1329 | return host_param; |
| 1330 | } |
| 1331 | #else |
| 1332 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1333 | uint32_t host_param) |
| 1334 | { |
| 1335 | if (host_param < wmi_vdev_param_max) |
| 1336 | return wmi_handle->vdev_param[host_param]; |
| 1337 | |
| 1338 | return WMI_UNAVAILABLE_PARAM; |
| 1339 | } |
| 1340 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1341 | /** |
| 1342 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1343 | * @param wmi_handle : handle to WMI. |
| 1344 | * @param macaddr : MAC address |
| 1345 | * @param param : pointer to hold vdev set parameter |
| 1346 | * |
| 1347 | * Return: 0 on success and -ve on failure. |
| 1348 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1349 | 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] | 1350 | struct vdev_set_params *param) |
| 1351 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1352 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1353 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1354 | wmi_buf_t buf; |
| 1355 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1356 | uint32_t vdev_param; |
| 1357 | |
| 1358 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1359 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1360 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1361 | param->param_id); |
| 1362 | return QDF_STATUS_E_INVAL; |
| 1363 | |
| 1364 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1365 | |
| 1366 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1367 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1368 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1369 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1370 | } |
| 1371 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1372 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1373 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1374 | WMITLV_GET_STRUCT_TLVLEN |
| 1375 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1376 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1377 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1378 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1379 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1380 | param->if_id, param->param_id, param->param_value); |
| 1381 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1382 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1383 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1384 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1385 | wmi_buf_free(buf); |
| 1386 | } |
| 1387 | |
| 1388 | return ret; |
| 1389 | } |
| 1390 | |
| 1391 | /** |
| 1392 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1393 | * @param wmi_handle : handle to WMI. |
| 1394 | * @param macaddr : MAC address |
| 1395 | * @param param : pointer to hold stats request parameter |
| 1396 | * |
| 1397 | * Return: 0 on success and -ve on failure. |
| 1398 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1399 | QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1400 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1401 | struct stats_request_params *param) |
| 1402 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1403 | int32_t ret; |
| 1404 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1405 | wmi_buf_t buf; |
| 1406 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1407 | |
| 1408 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1409 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1410 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1411 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1412 | } |
| 1413 | |
| 1414 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1415 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1416 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1417 | WMITLV_GET_STRUCT_TLVLEN |
| 1418 | (wmi_request_stats_cmd_fixed_param)); |
| 1419 | cmd->stats_id = param->stats_id; |
| 1420 | cmd->vdev_id = param->vdev_id; |
| 1421 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1422 | WMI_REQUEST_STATS_CMDID); |
| 1423 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1424 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1425 | wmi_buf_free(buf); |
| 1426 | } |
| 1427 | |
| 1428 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1429 | } |
| 1430 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1431 | #ifdef CONFIG_WIN |
| 1432 | /** |
| 1433 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1434 | * @param wmi_handle : handle to WMI. |
| 1435 | * @param macaddr : MAC address |
| 1436 | * @param param : pointer to hold stats request parameter |
| 1437 | * |
| 1438 | * Return: 0 on success and -ve on failure. |
| 1439 | */ |
| 1440 | QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1441 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT) |
| 1442 | { |
| 1443 | return 0; |
| 1444 | } |
| 1445 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1446 | /** |
| 1447 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1448 | * @param wmi_handle : handle to WMI. |
| 1449 | * @param macaddr : MAC address |
| 1450 | * @param param : pointer to hold stats request parameter |
| 1451 | * |
| 1452 | * Return: 0 on success and -ve on failure. |
| 1453 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1454 | 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] | 1455 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1456 | struct packet_enable_params *param) |
| 1457 | { |
| 1458 | return 0; |
| 1459 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1460 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1461 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1462 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1463 | /** |
| 1464 | * send_beacon_send_cmd_tlv() - WMI beacon send function |
| 1465 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1466 | * @param param : pointer to hold beacon send cmd parameter |
| 1467 | * |
| 1468 | * Return: 0 on success and -ve on failure. |
| 1469 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1470 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1471 | struct beacon_params *param) |
| 1472 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1473 | int32_t ret; |
| 1474 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1475 | wmi_bcn_prb_info *bcn_prb_info; |
| 1476 | wmi_buf_t wmi_buf; |
| 1477 | uint8_t *buf_ptr; |
| 1478 | uint32_t wmi_buf_len; |
| 1479 | |
| 1480 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1481 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1482 | param->tmpl_len_aligned; |
| 1483 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1484 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1485 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1486 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1487 | } |
| 1488 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1489 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1490 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1491 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1492 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1493 | cmd->vdev_id = param->vdev_id; |
| 1494 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1495 | cmd->buf_len = param->tmpl_len; |
| 1496 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1497 | |
| 1498 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1499 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1500 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1501 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1502 | bcn_prb_info->caps = 0; |
| 1503 | bcn_prb_info->erp = 0; |
| 1504 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1505 | |
| 1506 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1507 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1508 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1509 | |
| 1510 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1511 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1512 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1513 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1514 | wmi_buf_free(wmi_buf); |
| 1515 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1516 | return 0; |
| 1517 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1518 | #else |
| 1519 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1520 | struct beacon_params *param) |
| 1521 | { |
| 1522 | return 0; |
| 1523 | } |
| 1524 | |
| 1525 | /** |
| 1526 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1527 | * @param wmi_handle : handle to WMI. |
| 1528 | * @param param : pointer to hold beacon send cmd parameter |
| 1529 | * |
| 1530 | * Return: 0 on success and -ve on failure. |
| 1531 | */ |
| 1532 | QDF_STATUS send_beacon_tmpl_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 1533 | struct beacon_tmpl_params *param) |
| 1534 | { |
| 1535 | int32_t ret; |
| 1536 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1537 | wmi_bcn_prb_info *bcn_prb_info; |
| 1538 | wmi_buf_t wmi_buf; |
| 1539 | uint8_t *buf_ptr; |
| 1540 | uint32_t wmi_buf_len; |
| 1541 | |
| 1542 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1543 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1544 | param->tmpl_len_aligned; |
| 1545 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1546 | if (!wmi_buf) { |
| 1547 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1548 | return QDF_STATUS_E_NOMEM; |
| 1549 | } |
| 1550 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1551 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1552 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1553 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1554 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1555 | cmd->vdev_id = param->vdev_id; |
| 1556 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1557 | cmd->buf_len = param->tmpl_len; |
| 1558 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1559 | |
| 1560 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1561 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1562 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1563 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1564 | bcn_prb_info->caps = 0; |
| 1565 | bcn_prb_info->erp = 0; |
| 1566 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1567 | |
| 1568 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1569 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1570 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1571 | |
| 1572 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1573 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1574 | if (ret) { |
| 1575 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1576 | wmi_buf_free(wmi_buf); |
| 1577 | } |
| 1578 | return 0; |
| 1579 | } |
| 1580 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1581 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1582 | #ifdef CONFIG_MCL |
| 1583 | static inline void copy_peer_flags_tlv( |
| 1584 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1585 | struct peer_assoc_params *param) |
| 1586 | { |
| 1587 | cmd->peer_flags = param->peer_flags; |
| 1588 | } |
| 1589 | #else |
| 1590 | static inline void copy_peer_flags_tlv( |
| 1591 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1592 | struct peer_assoc_params *param) |
| 1593 | { |
| 1594 | /* |
| 1595 | * The target only needs a subset of the flags maintained in the host. |
| 1596 | * Just populate those flags and send it down |
| 1597 | */ |
| 1598 | cmd->peer_flags = 0; |
| 1599 | |
| 1600 | /* |
| 1601 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1602 | */ |
| 1603 | if (param->is_wme_set) { |
| 1604 | |
| 1605 | if (param->qos_flag) |
| 1606 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1607 | if (param->apsd_flag) |
| 1608 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1609 | if (param->ht_flag) |
| 1610 | cmd->peer_flags |= WMI_PEER_HT; |
| 1611 | if (param->bw_40) |
| 1612 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1613 | if (param->bw_80) |
| 1614 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1615 | if (param->bw_160) |
| 1616 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1617 | |
| 1618 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1619 | * for HT as well |
| 1620 | **/ |
| 1621 | if (param->stbc_flag) |
| 1622 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1623 | |
| 1624 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1625 | * for HT as well |
| 1626 | **/ |
| 1627 | if (param->ldpc_flag) |
| 1628 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1629 | |
| 1630 | if (param->static_mimops_flag) |
| 1631 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1632 | if (param->dynamic_mimops_flag) |
| 1633 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1634 | if (param->spatial_mux_flag) |
| 1635 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1636 | if (param->vht_flag) |
| 1637 | cmd->peer_flags |= WMI_PEER_VHT; |
| 1638 | } |
| 1639 | /* |
| 1640 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1641 | * (during re-association). |
| 1642 | * Authorization will be done for these modes on key installation. |
| 1643 | */ |
| 1644 | if (param->auth_flag) |
| 1645 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1646 | if (param->need_ptk_4_way) |
| 1647 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1648 | else |
| 1649 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1650 | if (param->need_gtk_2_way) |
| 1651 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1652 | /* safe mode bypass the 4-way handshake */ |
| 1653 | if (param->safe_mode_enabled) |
| 1654 | cmd->peer_flags &= |
| 1655 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1656 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1657 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1658 | * it |
| 1659 | * if (param->amsdu_disable) Add after FW support |
| 1660 | **/ |
| 1661 | |
| 1662 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1663 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1664 | * iwpriv |
| 1665 | **/ |
| 1666 | if (param->peer_ht_rates.num_rates == 0) |
| 1667 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1668 | } |
| 1669 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1670 | |
| 1671 | #ifdef CONFIG_MCL |
| 1672 | static inline void copy_peer_mac_addr_tlv( |
| 1673 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1674 | struct peer_assoc_params *param) |
| 1675 | { |
| 1676 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1677 | sizeof(param->peer_macaddr)); |
| 1678 | } |
| 1679 | #else |
| 1680 | static inline void copy_peer_mac_addr_tlv( |
| 1681 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1682 | struct peer_assoc_params *param) |
| 1683 | { |
| 1684 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 1685 | } |
| 1686 | #endif |
| 1687 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1688 | /** |
| 1689 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1690 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1691 | * @param param : pointer to peer assoc parameter |
| 1692 | * |
| 1693 | * Return: 0 on success and -ve on failure. |
| 1694 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1695 | QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1696 | struct peer_assoc_params *param) |
| 1697 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1698 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1699 | wmi_vht_rate_set *mcs; |
| 1700 | wmi_buf_t buf; |
| 1701 | int32_t len; |
| 1702 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1703 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1704 | uint32_t peer_legacy_rates_align; |
| 1705 | uint32_t peer_ht_rates_align; |
| 1706 | |
| 1707 | |
| 1708 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1709 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1710 | |
| 1711 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1712 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1713 | WMI_TLV_HDR_SIZE + |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1714 | (peer_ht_rates_align * sizeof(uint8_t)) + |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1715 | sizeof(wmi_vht_rate_set); |
| 1716 | |
| 1717 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1718 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1719 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1720 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1721 | } |
| 1722 | |
| 1723 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1724 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1725 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1726 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1727 | WMITLV_GET_STRUCT_TLVLEN |
| 1728 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1729 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1730 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1731 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1732 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1733 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1734 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1735 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1736 | copy_peer_mac_addr_tlv(cmd, param); |
| 1737 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1738 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1739 | cmd->peer_caps = param->peer_caps; |
| 1740 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1741 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1742 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1743 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1744 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1745 | cmd->peer_phymode = param->peer_phymode; |
| 1746 | |
| 1747 | /* Update peer legacy rate information */ |
| 1748 | buf_ptr += sizeof(*cmd); |
| 1749 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1750 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1751 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1752 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1753 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1754 | param->peer_legacy_rates.num_rates); |
| 1755 | |
| 1756 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1757 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1758 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1759 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1760 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1761 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1762 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1763 | param->peer_ht_rates.num_rates); |
| 1764 | |
| 1765 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1766 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1767 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 1768 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 1769 | |
| 1770 | cmd->peer_nss = param->peer_nss; |
| 1771 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 1772 | if (param->vht_capable) { |
| 1773 | mcs->rx_max_rate = param->rx_max_rate; |
| 1774 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 1775 | mcs->tx_max_rate = param->tx_max_rate; |
| 1776 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 1777 | } |
| 1778 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1779 | 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] | 1780 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 1781 | "nss %d phymode %d peer_mpdu_density %d " |
| 1782 | "cmd->peer_vht_caps %x", __func__, |
| 1783 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 1784 | cmd->peer_rate_caps, cmd->peer_caps, |
| 1785 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 1786 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 1787 | cmd->peer_mpdu_density, |
| 1788 | cmd->peer_vht_caps); |
| 1789 | |
| 1790 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1791 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1792 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1793 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1794 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1795 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1796 | } |
| 1797 | |
| 1798 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1799 | } |
| 1800 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1801 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 1802 | */ |
| 1803 | #ifdef CONFIG_MCL |
| 1804 | static inline void copy_scan_notify_ev_flags( |
| 1805 | wmi_start_scan_cmd_fixed_param * cmd, |
| 1806 | struct scan_start_params *params) |
| 1807 | { |
| 1808 | cmd->notify_scan_events = params->notify_scan_events; |
| 1809 | cmd->scan_ctrl_flags = params->scan_ctrl_flags; |
| 1810 | } |
| 1811 | #else |
| 1812 | static inline void copy_scan_notify_ev_flags( |
| 1813 | wmi_start_scan_cmd_fixed_param * cmd, |
| 1814 | struct scan_start_params *params) |
| 1815 | { |
| 1816 | cmd->notify_scan_events = WMI_SCAN_EVENT_STARTED | |
| 1817 | WMI_SCAN_EVENT_COMPLETED | |
| 1818 | WMI_SCAN_EVENT_BSS_CHANNEL | |
| 1819 | WMI_SCAN_EVENT_FOREIGN_CHANNEL | |
| 1820 | WMI_SCAN_EVENT_DEQUEUED |
| 1821 | ; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1822 | |
| 1823 | cmd->scan_ctrl_flags = (params->passive_flag) ? |
| 1824 | WMI_SCAN_FLAG_PASSIVE : 0; |
| 1825 | |
| 1826 | if (params->is_strict_pscan_en) |
| 1827 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1828 | |
| 1829 | if (params->is_phy_error) |
| 1830 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1831 | |
| 1832 | if (params->half_rate) |
| 1833 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
| 1834 | |
| 1835 | if (params->quarter_rate) |
| 1836 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
| 1837 | |
| 1838 | if (params->is_phy_error) |
| 1839 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
| 1840 | |
| 1841 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 1842 | /* add cck rates if required */ |
| 1843 | if (params->add_cck_rates) |
| 1844 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
| 1845 | /** It enables the Channel stat event indication to host */ |
| 1846 | if (params->chan_stat_enable) |
| 1847 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
| 1848 | if (params->add_bcast_probe_reqd) |
| 1849 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
| 1850 | /* off channel TX control */ |
| 1851 | if (params->offchan_tx_mgmt) |
| 1852 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
| 1853 | if (params->offchan_tx_data) |
| 1854 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1855 | } |
| 1856 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1857 | /** |
| 1858 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 1859 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1860 | * @param param : pointer to hold scan start cmd parameter |
| 1861 | * |
| 1862 | * Return: 0 on success and -ve on failure. |
| 1863 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1864 | QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1865 | struct scan_start_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1866 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1867 | int32_t ret = 0; |
| 1868 | int32_t i; |
| 1869 | wmi_buf_t wmi_buf; |
| 1870 | wmi_start_scan_cmd_fixed_param *cmd; |
| 1871 | uint8_t *buf_ptr; |
| 1872 | uint32_t *tmp_ptr; |
| 1873 | wmi_ssid *ssid = NULL; |
| 1874 | wmi_mac_addr *bssid; |
| 1875 | int len = sizeof(*cmd); |
| 1876 | |
| 1877 | /* Length TLV placeholder for array of uint32_t */ |
| 1878 | len += WMI_TLV_HDR_SIZE; |
| 1879 | /* calculate the length of buffer required */ |
| 1880 | if (params->num_chan) |
| 1881 | len += params->num_chan * sizeof(uint32_t); |
| 1882 | |
| 1883 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 1884 | len += WMI_TLV_HDR_SIZE; |
| 1885 | if (params->num_ssids) |
| 1886 | len += params->num_ssids * sizeof(wmi_ssid); |
| 1887 | |
| 1888 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 1889 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1890 | if (params->num_bssid) |
| 1891 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1892 | |
| 1893 | /* Length TLV placeholder for array of bytes */ |
| 1894 | len += WMI_TLV_HDR_SIZE; |
| 1895 | if (params->ie_len) |
| 1896 | len += roundup(params->ie_len, sizeof(uint32_t)); |
| 1897 | |
| 1898 | /* Allocate the memory */ |
| 1899 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1900 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1901 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1902 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1903 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1904 | } |
| 1905 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1906 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 1907 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1908 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 1909 | WMITLV_GET_STRUCT_TLVLEN |
| 1910 | (wmi_start_scan_cmd_fixed_param)); |
| 1911 | |
| 1912 | cmd->scan_id = params->scan_id; |
| 1913 | cmd->scan_req_id = params->scan_req_id; |
| 1914 | cmd->vdev_id = params->vdev_id; |
| 1915 | cmd->scan_priority = params->scan_priority; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1916 | copy_scan_notify_ev_flags(cmd, params); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1917 | cmd->dwell_time_active = params->dwell_time_active; |
| 1918 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 1919 | cmd->min_rest_time = params->min_rest_time; |
| 1920 | cmd->max_rest_time = params->max_rest_time; |
| 1921 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 1922 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 1923 | cmd->idle_time = params->idle_time; |
| 1924 | cmd->max_scan_time = params->max_scan_time; |
| 1925 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1926 | cmd->burst_duration = params->burst_duration; |
| 1927 | cmd->num_chan = params->num_chan; |
| 1928 | cmd->num_bssid = params->num_bssid; |
| 1929 | cmd->num_ssids = params->num_ssids; |
| 1930 | cmd->ie_len = params->ie_len; |
| 1931 | cmd->n_probes = params->n_probes; |
| 1932 | buf_ptr += sizeof(*cmd); |
| 1933 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1934 | for (i = 0; i < params->num_chan; ++i) |
| 1935 | tmp_ptr[i] = params->chan_list[i]; |
| 1936 | |
| 1937 | WMITLV_SET_HDR(buf_ptr, |
| 1938 | WMITLV_TAG_ARRAY_UINT32, |
| 1939 | (params->num_chan * sizeof(uint32_t))); |
| 1940 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 1941 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1942 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1943 | goto error; |
| 1944 | } |
| 1945 | |
| 1946 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1947 | (params->num_ssids * sizeof(wmi_ssid))); |
| 1948 | |
| 1949 | if (params->num_ssids) { |
| 1950 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1951 | for (i = 0; i < params->num_ssids; ++i) { |
| 1952 | ssid->ssid_len = params->ssid[i].length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1953 | qdf_mem_copy(ssid->ssid, params->ssid[i].mac_ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1954 | params->ssid[i].length); |
| 1955 | ssid++; |
| 1956 | } |
| 1957 | } |
| 1958 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 1959 | |
| 1960 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1961 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 1962 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1963 | #if CONFIG_MCL |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1964 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->mac_add_bytes, bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1965 | #else |
| 1966 | if (params->num_bssid) { |
| 1967 | for (i = 0; i < params->num_bssid; ++i) { |
| 1968 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->bssid_list[i], |
| 1969 | bssid); |
| 1970 | bssid++; |
| 1971 | } |
| 1972 | } |
| 1973 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1974 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_bssid * sizeof(wmi_mac_addr)); |
| 1975 | |
| 1976 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, params->ie_len_with_pad); |
| 1977 | if (params->ie_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1978 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1979 | (uint8_t *) params->ie_base + |
| 1980 | (params->uie_fieldOffset), params->ie_len); |
| 1981 | } |
| 1982 | buf_ptr += WMI_TLV_HDR_SIZE + params->ie_len_with_pad; |
| 1983 | |
| 1984 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 1985 | len, WMI_START_SCAN_CMDID); |
| 1986 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1987 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1988 | wmi_buf_free(wmi_buf); |
| 1989 | } |
| 1990 | return ret; |
| 1991 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1992 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1993 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1994 | } |
| 1995 | |
| 1996 | /** |
| 1997 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 1998 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1999 | * @param param : pointer to hold scan start cmd parameter |
| 2000 | * |
| 2001 | * Return: 0 on success and -ve on failure. |
| 2002 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2003 | QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2004 | struct scan_stop_params *param) |
| 2005 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2006 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2007 | int ret; |
| 2008 | int len = sizeof(*cmd); |
| 2009 | wmi_buf_t wmi_buf; |
| 2010 | |
| 2011 | /* Allocate the memory */ |
| 2012 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2013 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2014 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2015 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2016 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2017 | goto error; |
| 2018 | } |
| 2019 | |
| 2020 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2021 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2022 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2023 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2024 | cmd->vdev_id = param->vdev_id; |
| 2025 | cmd->requestor = param->requestor; |
| 2026 | cmd->scan_id = param->scan_id; |
| 2027 | /* stop the scan with the corresponding scan_id */ |
| 2028 | cmd->req_type = param->req_type; |
| 2029 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 2030 | len, WMI_STOP_SCAN_CMDID); |
| 2031 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2032 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2033 | wmi_buf_free(wmi_buf); |
| 2034 | } |
| 2035 | |
| 2036 | error: |
| 2037 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2038 | } |
| 2039 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2040 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2041 | /** |
| 2042 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2043 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2044 | * @param param : pointer to hold scan channel list parameter |
| 2045 | * |
| 2046 | * Return: 0 on success and -ve on failure. |
| 2047 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2048 | 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] | 2049 | struct scan_chan_list_params *chan_list) |
| 2050 | { |
| 2051 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2052 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2053 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2054 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2055 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2056 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2057 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2058 | |
| 2059 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2060 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2061 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2062 | WMI_LOGE("Failed to allocate memory"); |
| 2063 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2064 | goto end; |
| 2065 | } |
| 2066 | |
| 2067 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2068 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2069 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2070 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2071 | WMITLV_GET_STRUCT_TLVLEN |
| 2072 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2073 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2074 | 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] | 2075 | |
| 2076 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2077 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2078 | WMITLV_TAG_ARRAY_STRUC, |
| 2079 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2080 | chan_info = (wmi_channel_param *) |
| 2081 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2082 | tchan_info = chan_list->chan_info; |
| 2083 | |
| 2084 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2085 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2086 | WMITLV_TAG_STRUC_wmi_channel, |
| 2087 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2088 | chan_info->mhz = tchan_info->mhz; |
| 2089 | chan_info->band_center_freq1 = |
| 2090 | tchan_info->band_center_freq1; |
| 2091 | chan_info->band_center_freq2 = |
| 2092 | tchan_info->band_center_freq2; |
| 2093 | chan_info->info = tchan_info->info; |
| 2094 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2095 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2096 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2097 | |
| 2098 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2099 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2100 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2101 | tchan_info++; |
| 2102 | chan_info++; |
| 2103 | } |
| 2104 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2105 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2106 | WMI_SCAN_CHAN_LIST_CMDID); |
| 2107 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2108 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2109 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2110 | wmi_buf_free(buf); |
| 2111 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2112 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2113 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2114 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2115 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2116 | #else |
| 2117 | QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle, |
| 2118 | struct scan_chan_list_params *chan_list) |
| 2119 | { |
| 2120 | wmi_buf_t buf; |
| 2121 | QDF_STATUS qdf_status; |
| 2122 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2123 | int i; |
| 2124 | uint8_t *buf_ptr; |
| 2125 | wmi_channel *chan_info; |
| 2126 | struct channel_param *tchan_info; |
| 2127 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2128 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2129 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2130 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2131 | if (!buf) { |
| 2132 | WMI_LOGE("Failed to allocate memory"); |
| 2133 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2134 | goto end; |
| 2135 | } |
| 2136 | |
| 2137 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2138 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2139 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2140 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2141 | WMITLV_GET_STRUCT_TLVLEN |
| 2142 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2143 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2144 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2145 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2146 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2147 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2148 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2149 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2150 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2151 | tchan_info = &(chan_list->ch_param[0]); |
| 2152 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2153 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2154 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2155 | WMITLV_TAG_STRUC_wmi_channel, |
| 2156 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2157 | chan_info->mhz = tchan_info->mhz; |
| 2158 | chan_info->band_center_freq1 = |
| 2159 | tchan_info->cfreq1; |
| 2160 | chan_info->band_center_freq2 = |
| 2161 | tchan_info->cfreq2; |
| 2162 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2163 | if (tchan_info->is_chan_passive) |
| 2164 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2165 | WMI_CHAN_FLAG_PASSIVE); |
| 2166 | |
| 2167 | if (tchan_info->allow_vht) |
| 2168 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2169 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2170 | else if (tchan_info->allow_ht) |
| 2171 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2172 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2173 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2174 | tchan_info->phy_mode); |
| 2175 | |
| 2176 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2177 | * after FW support |
| 2178 | */ |
| 2179 | |
| 2180 | /* also fill in power information */ |
| 2181 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2182 | tchan_info->minpower); |
| 2183 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2184 | tchan_info->maxpower); |
| 2185 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2186 | tchan_info->maxregpower); |
| 2187 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2188 | tchan_info->antennamax); |
| 2189 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2190 | tchan_info->reg_class_id); |
| 2191 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2192 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2193 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2194 | tchan_info++; |
| 2195 | chan_info++; |
| 2196 | } |
| 2197 | |
| 2198 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2199 | WMI_SCAN_CHAN_LIST_CMDID); |
| 2200 | |
| 2201 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2202 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2203 | wmi_buf_free(buf); |
| 2204 | } |
| 2205 | |
| 2206 | end: |
| 2207 | return qdf_status; |
| 2208 | } |
| 2209 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2210 | /** |
| 2211 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2212 | * @wmi_handle : handle to WMI. |
| 2213 | * @param : pointer to hold mgmt cmd parameter |
| 2214 | * |
| 2215 | * Return: 0 on success and -ve on failure. |
| 2216 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2217 | QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2218 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2219 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2220 | wmi_buf_t buf; |
| 2221 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2222 | int32_t cmd_len; |
| 2223 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2224 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2225 | uint8_t *bufp; |
| 2226 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2227 | mgmt_tx_dl_frm_len; |
| 2228 | |
| 2229 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 2230 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 2231 | |
| 2232 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2233 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2234 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2235 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2236 | } |
| 2237 | |
| 2238 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2239 | bufp = (uint8_t *) cmd; |
| 2240 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2241 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2242 | WMITLV_GET_STRUCT_TLVLEN |
| 2243 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2244 | |
| 2245 | cmd->vdev_id = param->vdev_id; |
| 2246 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2247 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2248 | cmd->chanfreq = param->chanfreq; |
| 2249 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2250 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2251 | sizeof(uint32_t))); |
| 2252 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2253 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2254 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2255 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2256 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 2257 | #if defined(HELIUMPLUS_PADDR64) |
| 2258 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2259 | #endif |
| 2260 | cmd->frame_len = param->frm_len; |
| 2261 | cmd->buf_len = bufp_len; |
| 2262 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2263 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2264 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2265 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2266 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2267 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2268 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2269 | goto err1; |
| 2270 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2271 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2272 | |
| 2273 | err1: |
| 2274 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2275 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2276 | } |
| 2277 | |
| 2278 | /** |
| 2279 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2280 | * @wmi_handle: wmi handle |
| 2281 | * @param_value: parameter value |
| 2282 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2283 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2284 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2285 | 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] | 2286 | uint32_t param_value) |
| 2287 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2288 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2289 | wmi_modem_power_state_cmd_param *cmd; |
| 2290 | wmi_buf_t buf; |
| 2291 | uint16_t len = sizeof(*cmd); |
| 2292 | |
| 2293 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2294 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2295 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2296 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2297 | } |
| 2298 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2299 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2300 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2301 | WMITLV_GET_STRUCT_TLVLEN |
| 2302 | (wmi_modem_power_state_cmd_param)); |
| 2303 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2304 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2305 | param_value); |
| 2306 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2307 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2308 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2309 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2310 | wmi_buf_free(buf); |
| 2311 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2312 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2313 | return ret; |
| 2314 | } |
| 2315 | |
| 2316 | /** |
| 2317 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2318 | * @wmi_handle: wmi handle |
| 2319 | * @vdev_id: vdev id |
| 2320 | * @val: value |
| 2321 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2322 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2323 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2324 | 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] | 2325 | uint32_t vdev_id, uint8_t val) |
| 2326 | { |
| 2327 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2328 | wmi_buf_t buf; |
| 2329 | int32_t len = sizeof(*cmd); |
| 2330 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2331 | 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] | 2332 | |
| 2333 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2334 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2335 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2336 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2337 | } |
| 2338 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2339 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2340 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2341 | WMITLV_GET_STRUCT_TLVLEN |
| 2342 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2343 | cmd->vdev_id = vdev_id; |
| 2344 | if (val) |
| 2345 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2346 | else |
| 2347 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2348 | |
| 2349 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2350 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2351 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2352 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2353 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2354 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2355 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2356 | return 0; |
| 2357 | } |
| 2358 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2359 | /** |
| 2360 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2361 | * @wmi_handle: wmi handle |
| 2362 | * @vdev_id: vdev id |
| 2363 | * @value: value |
| 2364 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2365 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2366 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2367 | QDF_STATUS send_set_mimops_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2368 | uint8_t vdev_id, int value) |
| 2369 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2370 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2371 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2372 | wmi_buf_t buf; |
| 2373 | uint16_t len = sizeof(*cmd); |
| 2374 | |
| 2375 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2376 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2377 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2378 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2379 | } |
| 2380 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2381 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2382 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2383 | WMITLV_GET_STRUCT_TLVLEN |
| 2384 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2385 | |
| 2386 | cmd->vdev_id = vdev_id; |
| 2387 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2388 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2389 | * to SM power save values defined in the specification. |
| 2390 | * Make sure to send the right mapping. |
| 2391 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2392 | switch (value) { |
| 2393 | case 0: |
| 2394 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 2395 | break; |
| 2396 | case 1: |
| 2397 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 2398 | break; |
| 2399 | case 2: |
| 2400 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 2401 | break; |
| 2402 | case 3: |
| 2403 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 2404 | break; |
| 2405 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2406 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 2407 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2408 | } |
| 2409 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2410 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2411 | |
| 2412 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2413 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2414 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2415 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2416 | wmi_buf_free(buf); |
| 2417 | } |
| 2418 | |
| 2419 | return ret; |
| 2420 | } |
| 2421 | |
| 2422 | /** |
| 2423 | * send_set_smps_params_cmd_tlv() - set smps params |
| 2424 | * @wmi_handle: wmi handle |
| 2425 | * @vdev_id: vdev id |
| 2426 | * @value: value |
| 2427 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2428 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2429 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2430 | 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] | 2431 | int value) |
| 2432 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2433 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2434 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 2435 | wmi_buf_t buf; |
| 2436 | uint16_t len = sizeof(*cmd); |
| 2437 | |
| 2438 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2439 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2440 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2441 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2442 | } |
| 2443 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 2444 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2445 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 2446 | WMITLV_GET_STRUCT_TLVLEN |
| 2447 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 2448 | |
| 2449 | cmd->vdev_id = vdev_id; |
| 2450 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 2451 | cmd->param = |
| 2452 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 2453 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2454 | 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] | 2455 | cmd->param); |
| 2456 | |
| 2457 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2458 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2459 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2460 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2461 | wmi_buf_free(buf); |
| 2462 | } |
| 2463 | |
| 2464 | return ret; |
| 2465 | } |
| 2466 | |
| 2467 | /** |
| 2468 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 2469 | * @wmi_handle: wmi handle |
| 2470 | * @noa: p2p power save parameters |
| 2471 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2472 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2473 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2474 | 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] | 2475 | struct p2p_ps_params *noa) |
| 2476 | { |
| 2477 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 2478 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 2479 | wmi_buf_t buf; |
| 2480 | uint8_t *buf_ptr; |
| 2481 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2482 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2483 | uint32_t duration; |
| 2484 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2485 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2486 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 2487 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2488 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2489 | WMI_LOGE("Failed to allocate memory"); |
| 2490 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2491 | goto end; |
| 2492 | } |
| 2493 | |
| 2494 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2495 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 2496 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2497 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 2498 | WMITLV_GET_STRUCT_TLVLEN |
| 2499 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 2500 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 2501 | cmd->vdev_id = noa->session_id; |
| 2502 | cmd->enable = (duration) ? true : false; |
| 2503 | cmd->num_noa = 1; |
| 2504 | |
| 2505 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 2506 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 2507 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 2508 | sizeof |
| 2509 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 2510 | + WMI_TLV_HDR_SIZE); |
| 2511 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 2512 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 2513 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 2514 | noa_discriptor->type_count = noa->count; |
| 2515 | noa_discriptor->duration = duration; |
| 2516 | noa_discriptor->interval = noa->interval; |
| 2517 | noa_discriptor->start_time = 0; |
| 2518 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2519 | 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] | 2520 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 2521 | noa->interval); |
| 2522 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2523 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2524 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2525 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2526 | wmi_buf_free(buf); |
| 2527 | } |
| 2528 | |
| 2529 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2530 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2531 | return status; |
| 2532 | } |
| 2533 | |
| 2534 | |
| 2535 | /** |
| 2536 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 2537 | * @wmi_handle: wmi handle |
| 2538 | * @noa: p2p opp power save parameters |
| 2539 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2540 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2541 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2542 | 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] | 2543 | struct p2p_ps_params *oppps) |
| 2544 | { |
| 2545 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 2546 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2547 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2548 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2549 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2550 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2551 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2552 | WMI_LOGE("Failed to allocate memory"); |
| 2553 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2554 | goto end; |
| 2555 | } |
| 2556 | |
| 2557 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 2558 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2559 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 2560 | WMITLV_GET_STRUCT_TLVLEN |
| 2561 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 2562 | cmd->vdev_id = oppps->session_id; |
| 2563 | if (oppps->ctwindow) |
| 2564 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 2565 | |
| 2566 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2567 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2568 | cmd->vdev_id, oppps->ctwindow); |
| 2569 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 2570 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2571 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2572 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2573 | wmi_buf_free(buf); |
| 2574 | } |
| 2575 | |
| 2576 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2577 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2578 | return status; |
| 2579 | } |
| 2580 | |
| 2581 | /** |
| 2582 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 2583 | * @wmi_handle: wmi handle |
| 2584 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2585 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2586 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2587 | QDF_STATUS send_get_temperature_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2588 | { |
| 2589 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 2590 | wmi_buf_t wmi_buf; |
| 2591 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 2592 | uint8_t *buf_ptr; |
| 2593 | |
| 2594 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2595 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 2596 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2597 | } |
| 2598 | |
| 2599 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2600 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2601 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2602 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2603 | } |
| 2604 | |
| 2605 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2606 | |
| 2607 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 2608 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2609 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 2610 | WMITLV_GET_STRUCT_TLVLEN |
| 2611 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 2612 | |
| 2613 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 2614 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2615 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2616 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2617 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2618 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2619 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2620 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2621 | } |
| 2622 | |
| 2623 | /** |
| 2624 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 2625 | * @wmi_handle: wmi handle |
| 2626 | * @vdevid: vdev id |
| 2627 | * @peer_addr: peer mac address |
| 2628 | * @auto_triggerparam: auto trigger parameters |
| 2629 | * @num_ac: number of access category |
| 2630 | * |
| 2631 | * This function sets the trigger |
| 2632 | * uapsd params such as service interval, delay interval |
| 2633 | * and suspend interval which will be used by the firmware |
| 2634 | * to send trigger frames periodically when there is no |
| 2635 | * traffic on the transmit side. |
| 2636 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2637 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2638 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2639 | 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] | 2640 | struct sta_uapsd_trig_params *param) |
| 2641 | { |
| 2642 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2643 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2644 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 2645 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 2646 | uint32_t i; |
| 2647 | wmi_buf_t buf; |
| 2648 | uint8_t *buf_ptr; |
| 2649 | |
| 2650 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2651 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2652 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2653 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2654 | } |
| 2655 | |
| 2656 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2657 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 2658 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2659 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 2660 | WMITLV_GET_STRUCT_TLVLEN |
| 2661 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 2662 | cmd->vdev_id = param->vdevid; |
| 2663 | cmd->num_ac = param->num_ac; |
| 2664 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 2665 | |
| 2666 | /* TLV indicating array of structures to follow */ |
| 2667 | buf_ptr += sizeof(*cmd); |
| 2668 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 2669 | |
| 2670 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2671 | qdf_mem_copy(buf_ptr, param->auto_triggerparam, param_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2672 | |
| 2673 | /* |
| 2674 | * Update tag and length for uapsd auto trigger params (this will take |
| 2675 | * care of updating tag and length if it is not pre-filled by caller). |
| 2676 | */ |
| 2677 | for (i = 0; i < param->num_ac; i++) { |
| 2678 | WMITLV_SET_HDR((buf_ptr + |
| 2679 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 2680 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 2681 | WMITLV_GET_STRUCT_TLVLEN |
| 2682 | (wmi_sta_uapsd_auto_trig_param)); |
| 2683 | } |
| 2684 | |
| 2685 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2686 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2687 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2688 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2689 | wmi_buf_free(buf); |
| 2690 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2691 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2692 | return ret; |
| 2693 | } |
| 2694 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2695 | /** |
| 2696 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 2697 | * @wmi_handle: pointer to the wmi handle |
| 2698 | * @utc: pointer to the UTC time struct |
| 2699 | * |
| 2700 | * Return: 0 on succes |
| 2701 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2702 | 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] | 2703 | struct ocb_utc_param *utc) |
| 2704 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2705 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2706 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 2707 | uint8_t *buf_ptr; |
| 2708 | uint32_t len, i; |
| 2709 | wmi_buf_t buf; |
| 2710 | |
| 2711 | len = sizeof(*cmd); |
| 2712 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2713 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2714 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2715 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2716 | } |
| 2717 | |
| 2718 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2719 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 2720 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2721 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 2722 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 2723 | cmd->vdev_id = utc->vdev_id; |
| 2724 | |
| 2725 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 2726 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 2727 | |
| 2728 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 2729 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 2730 | |
| 2731 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2732 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2733 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2734 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2735 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2736 | } |
| 2737 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2738 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2739 | } |
| 2740 | |
| 2741 | /** |
| 2742 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 2743 | * frames on a channel |
| 2744 | * @wmi_handle: pointer to the wmi handle |
| 2745 | * @timing_advert: pointer to the timing advertisement struct |
| 2746 | * |
| 2747 | * Return: 0 on succes |
| 2748 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2749 | 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] | 2750 | struct ocb_timing_advert_param *timing_advert) |
| 2751 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2752 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2753 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 2754 | uint8_t *buf_ptr; |
| 2755 | uint32_t len, len_template; |
| 2756 | wmi_buf_t buf; |
| 2757 | |
| 2758 | len = sizeof(*cmd) + |
| 2759 | WMI_TLV_HDR_SIZE; |
| 2760 | |
| 2761 | len_template = timing_advert->template_length; |
| 2762 | /* Add padding to the template if needed */ |
| 2763 | if (len_template % 4 != 0) |
| 2764 | len_template += 4 - (len_template % 4); |
| 2765 | len += len_template; |
| 2766 | |
| 2767 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2768 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2769 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2770 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2771 | } |
| 2772 | |
| 2773 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2774 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 2775 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2776 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 2777 | WMITLV_GET_STRUCT_TLVLEN( |
| 2778 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 2779 | cmd->vdev_id = timing_advert->vdev_id; |
| 2780 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 2781 | cmd->channel_freq = timing_advert->chan_freq; |
| 2782 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 2783 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 2784 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 2785 | buf_ptr += sizeof(*cmd); |
| 2786 | |
| 2787 | /* Add the timing advert template */ |
| 2788 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2789 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2790 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2791 | (uint8_t *)timing_advert->template_value, |
| 2792 | timing_advert->template_length); |
| 2793 | |
| 2794 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2795 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2796 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2797 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2798 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2799 | } |
| 2800 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2801 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2802 | } |
| 2803 | |
| 2804 | /** |
| 2805 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 2806 | * on a channel |
| 2807 | * @wmi_handle: pointer to the wmi handle |
| 2808 | * @timing_advert: pointer to the timing advertisement struct |
| 2809 | * |
| 2810 | * Return: 0 on succes |
| 2811 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2812 | 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] | 2813 | struct ocb_timing_advert_param *timing_advert) |
| 2814 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2815 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2816 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 2817 | uint8_t *buf_ptr; |
| 2818 | uint32_t len; |
| 2819 | wmi_buf_t buf; |
| 2820 | |
| 2821 | len = sizeof(*cmd); |
| 2822 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2823 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2824 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2825 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2826 | } |
| 2827 | |
| 2828 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2829 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 2830 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2831 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 2832 | WMITLV_GET_STRUCT_TLVLEN( |
| 2833 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 2834 | cmd->vdev_id = timing_advert->vdev_id; |
| 2835 | cmd->channel_freq = timing_advert->chan_freq; |
| 2836 | |
| 2837 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2838 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2839 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2840 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2841 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2842 | } |
| 2843 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2844 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2845 | } |
| 2846 | |
| 2847 | /** |
| 2848 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 2849 | * @wmi_handle: pointer to the wmi handle |
| 2850 | * @request: pointer to the request |
| 2851 | * |
| 2852 | * Return: 0 on succes |
| 2853 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2854 | 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] | 2855 | uint8_t vdev_id) |
| 2856 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2857 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2858 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 2859 | uint8_t *buf_ptr; |
| 2860 | wmi_buf_t buf; |
| 2861 | int32_t len; |
| 2862 | |
| 2863 | len = sizeof(*cmd); |
| 2864 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2865 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2866 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2867 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2868 | } |
| 2869 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2870 | |
| 2871 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2872 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2873 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2874 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 2875 | WMITLV_GET_STRUCT_TLVLEN( |
| 2876 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 2877 | cmd->vdev_id = vdev_id; |
| 2878 | |
| 2879 | /* Send the WMI command */ |
| 2880 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2881 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 2882 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2883 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2884 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2885 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2886 | } |
| 2887 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2888 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2889 | } |
| 2890 | |
| 2891 | /** |
| 2892 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 2893 | * @wmi_handle: pointer to the wmi handle |
| 2894 | * @get_stats_param: pointer to the dcc stats |
| 2895 | * |
| 2896 | * Return: 0 on succes |
| 2897 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2898 | 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] | 2899 | struct dcc_get_stats_param *get_stats_param) |
| 2900 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2901 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2902 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 2903 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 2904 | wmi_buf_t buf; |
| 2905 | uint8_t *buf_ptr; |
| 2906 | uint32_t len; |
| 2907 | uint32_t i; |
| 2908 | |
| 2909 | /* Validate the input */ |
| 2910 | if (get_stats_param->request_array_len != |
| 2911 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2912 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2913 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2914 | } |
| 2915 | |
| 2916 | /* Allocate memory for the WMI command */ |
| 2917 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 2918 | get_stats_param->request_array_len; |
| 2919 | |
| 2920 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2921 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2922 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2923 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2924 | } |
| 2925 | |
| 2926 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2927 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2928 | |
| 2929 | /* Populate the WMI command */ |
| 2930 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 2931 | buf_ptr += sizeof(*cmd); |
| 2932 | |
| 2933 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2934 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 2935 | WMITLV_GET_STRUCT_TLVLEN( |
| 2936 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 2937 | cmd->vdev_id = get_stats_param->vdev_id; |
| 2938 | cmd->num_channels = get_stats_param->channel_count; |
| 2939 | |
| 2940 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2941 | get_stats_param->request_array_len); |
| 2942 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2943 | |
| 2944 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2945 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2946 | get_stats_param->request_array_len); |
| 2947 | for (i = 0; i < cmd->num_channels; i++) |
| 2948 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 2949 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 2950 | WMITLV_GET_STRUCT_TLVLEN( |
| 2951 | wmi_dcc_channel_stats_request)); |
| 2952 | |
| 2953 | /* Send the WMI command */ |
| 2954 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2955 | WMI_DCC_GET_STATS_CMDID); |
| 2956 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2957 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2958 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2959 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2960 | } |
| 2961 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2962 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2963 | } |
| 2964 | |
| 2965 | /** |
| 2966 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 2967 | * @wmi_handle: pointer to the wmi handle |
| 2968 | * @vdev_id: vdev id |
| 2969 | * @dcc_stats_bitmap: dcc status bitmap |
| 2970 | * |
| 2971 | * Return: 0 on succes |
| 2972 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2973 | 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] | 2974 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 2975 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2976 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2977 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 2978 | wmi_buf_t buf; |
| 2979 | uint8_t *buf_ptr; |
| 2980 | uint32_t len; |
| 2981 | |
| 2982 | /* Allocate memory for the WMI command */ |
| 2983 | len = sizeof(*cmd); |
| 2984 | |
| 2985 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2986 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2987 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2988 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2989 | } |
| 2990 | |
| 2991 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2992 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2993 | |
| 2994 | /* Populate the WMI command */ |
| 2995 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 2996 | |
| 2997 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2998 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 2999 | WMITLV_GET_STRUCT_TLVLEN( |
| 3000 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 3001 | cmd->vdev_id = vdev_id; |
| 3002 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 3003 | |
| 3004 | /* Send the WMI command */ |
| 3005 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3006 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3007 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3008 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3009 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3010 | } |
| 3011 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3012 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3013 | } |
| 3014 | |
| 3015 | /** |
| 3016 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 3017 | * @wmi_handle: pointer to the wmi handle |
| 3018 | * @update_ndl_param: pointer to the request parameters |
| 3019 | * |
| 3020 | * Return: 0 on success |
| 3021 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3022 | 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] | 3023 | struct dcc_update_ndl_param *update_ndl_param) |
| 3024 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3025 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3026 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 3027 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 3028 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 3029 | uint32_t active_state_count; |
| 3030 | wmi_buf_t buf; |
| 3031 | uint8_t *buf_ptr; |
| 3032 | uint32_t len; |
| 3033 | uint32_t i; |
| 3034 | |
| 3035 | /* validate the input */ |
| 3036 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 3037 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3038 | WMI_LOGE(FL("Invalid parameter")); |
| 3039 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3040 | } |
| 3041 | active_state_count = 0; |
| 3042 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 3043 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 3044 | active_state_count += |
| 3045 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 3046 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 3047 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3048 | WMI_LOGE(FL("Invalid parameter")); |
| 3049 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3050 | } |
| 3051 | |
| 3052 | /* Allocate memory for the WMI command */ |
| 3053 | len = sizeof(*cmd) + |
| 3054 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 3055 | WMI_TLV_HDR_SIZE + |
| 3056 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 3057 | |
| 3058 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3059 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3060 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3061 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3062 | } |
| 3063 | |
| 3064 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3065 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3066 | |
| 3067 | /* Populate the WMI command */ |
| 3068 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3069 | buf_ptr += sizeof(*cmd); |
| 3070 | |
| 3071 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3072 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3073 | WMITLV_GET_STRUCT_TLVLEN( |
| 3074 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3075 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3076 | cmd->num_channel = update_ndl_param->channel_count; |
| 3077 | |
| 3078 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3079 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3080 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3081 | |
| 3082 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3083 | 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] | 3084 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3085 | for (i = 0; i < cmd->num_channel; i++) |
| 3086 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3087 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3088 | WMITLV_GET_STRUCT_TLVLEN( |
| 3089 | wmi_dcc_ndl_chan)); |
| 3090 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3091 | |
| 3092 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3093 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3094 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3095 | |
| 3096 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3097 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3098 | update_ndl_param->dcc_ndl_active_state_list, |
| 3099 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3100 | for (i = 0; i < active_state_count; i++) { |
| 3101 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3102 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3103 | WMITLV_GET_STRUCT_TLVLEN( |
| 3104 | wmi_dcc_ndl_active_state_config)); |
| 3105 | } |
| 3106 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3107 | |
| 3108 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3109 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3110 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3111 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3112 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3113 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3114 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3115 | } |
| 3116 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3117 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3118 | } |
| 3119 | |
| 3120 | /** |
| 3121 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3122 | * @wmi_handle: pointer to the wmi handle |
| 3123 | * @config: the OCB configuration |
| 3124 | * |
| 3125 | * Return: 0 on success |
| 3126 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3127 | 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] | 3128 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3129 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3130 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3131 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3132 | wmi_channel *chan; |
| 3133 | wmi_ocb_channel *ocb_chan; |
| 3134 | wmi_qos_parameter *qos_param; |
| 3135 | wmi_dcc_ndl_chan *ndl_chan; |
| 3136 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3137 | wmi_ocb_schedule_element *sched_elem; |
| 3138 | uint8_t *buf_ptr; |
| 3139 | wmi_buf_t buf; |
| 3140 | int32_t len; |
| 3141 | int32_t i, j, active_state_count; |
| 3142 | |
| 3143 | /* |
| 3144 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3145 | * states. Validate dcc_ndl_active_state_list_len. |
| 3146 | */ |
| 3147 | active_state_count = 0; |
| 3148 | if (config->dcc_ndl_chan_list_len) { |
| 3149 | if (!config->dcc_ndl_chan_list || |
| 3150 | config->dcc_ndl_chan_list_len != |
| 3151 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3152 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3153 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3154 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3155 | } |
| 3156 | |
| 3157 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3158 | i < config->channel_count; ++i, ++ndl_chan) |
| 3159 | active_state_count += |
| 3160 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3161 | |
| 3162 | if (active_state_count) { |
| 3163 | if (!config->dcc_ndl_active_state_list || |
| 3164 | config->dcc_ndl_active_state_list_len != |
| 3165 | active_state_count * |
| 3166 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3167 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3168 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3169 | } |
| 3170 | } |
| 3171 | } |
| 3172 | |
| 3173 | len = sizeof(*cmd) + |
| 3174 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3175 | sizeof(wmi_channel) + |
| 3176 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3177 | sizeof(wmi_ocb_channel) + |
| 3178 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3179 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3180 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3181 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3182 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3183 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3184 | sizeof(wmi_ocb_schedule_element); |
| 3185 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3186 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3187 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3188 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3189 | } |
| 3190 | |
| 3191 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3192 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3193 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3194 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3195 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3196 | cmd->vdev_id = config->session_id; |
| 3197 | cmd->channel_count = config->channel_count; |
| 3198 | cmd->schedule_size = config->schedule_size; |
| 3199 | cmd->flags = config->flags; |
| 3200 | buf_ptr += sizeof(*cmd); |
| 3201 | |
| 3202 | /* Add the wmi_channel info */ |
| 3203 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3204 | config->channel_count*sizeof(wmi_channel)); |
| 3205 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3206 | for (i = 0; i < config->channel_count; i++) { |
| 3207 | chan = (wmi_channel *)buf_ptr; |
| 3208 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3209 | WMITLV_TAG_STRUC_wmi_channel, |
| 3210 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3211 | chan->mhz = config->channels[i].chan_freq; |
| 3212 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3213 | chan->band_center_freq2 = 0; |
| 3214 | chan->info = 0; |
| 3215 | |
| 3216 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3217 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3218 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3219 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3220 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3221 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3222 | config->channels[i].antenna_max); |
| 3223 | |
| 3224 | if (config->channels[i].bandwidth < 10) |
| 3225 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3226 | else if (config->channels[i].bandwidth < 20) |
| 3227 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3228 | buf_ptr += sizeof(*chan); |
| 3229 | } |
| 3230 | |
| 3231 | /* Add the wmi_ocb_channel info */ |
| 3232 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3233 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3234 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3235 | for (i = 0; i < config->channel_count; i++) { |
| 3236 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3237 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3238 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 3239 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 3240 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 3241 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 3242 | config->channels[i].mac_address.bytes, |
| 3243 | &ocb_chan->mac_address); |
| 3244 | buf_ptr += sizeof(*ocb_chan); |
| 3245 | } |
| 3246 | |
| 3247 | /* Add the wmi_qos_parameter info */ |
| 3248 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3249 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 3250 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3251 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 3252 | for (i = 0; i < config->channel_count; i++) { |
| 3253 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 3254 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 3255 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 3256 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 3257 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 3258 | qos_param->aifsn = |
| 3259 | config->channels[i].qos_params[j].aifsn; |
| 3260 | qos_param->cwmin = |
| 3261 | config->channels[i].qos_params[j].cwmin; |
| 3262 | qos_param->cwmax = |
| 3263 | config->channels[i].qos_params[j].cwmax; |
| 3264 | buf_ptr += sizeof(*qos_param); |
| 3265 | } |
| 3266 | } |
| 3267 | |
| 3268 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 3269 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3270 | config->dcc_ndl_chan_list_len); |
| 3271 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3272 | if (config->dcc_ndl_chan_list_len) { |
| 3273 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3274 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3275 | config->dcc_ndl_chan_list_len); |
| 3276 | for (i = 0; i < config->channel_count; i++) |
| 3277 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 3278 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3279 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 3280 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 3281 | } |
| 3282 | |
| 3283 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 3284 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 3285 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 3286 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3287 | if (active_state_count) { |
| 3288 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3289 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3290 | config->dcc_ndl_active_state_list, |
| 3291 | active_state_count * sizeof(*ndl_active_config)); |
| 3292 | for (i = 0; i < active_state_count; ++i) |
| 3293 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 3294 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3295 | WMITLV_GET_STRUCT_TLVLEN( |
| 3296 | wmi_dcc_ndl_active_state_config)); |
| 3297 | buf_ptr += active_state_count * |
| 3298 | sizeof(*ndl_active_config); |
| 3299 | } |
| 3300 | |
| 3301 | /* Add the wmi_ocb_schedule_element info */ |
| 3302 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3303 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 3304 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3305 | for (i = 0; i < config->schedule_size; i++) { |
| 3306 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 3307 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 3308 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 3309 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 3310 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 3311 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 3312 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 3313 | buf_ptr += sizeof(*sched_elem); |
| 3314 | } |
| 3315 | |
| 3316 | |
| 3317 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3318 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3319 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3320 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3321 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3322 | } |
| 3323 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3324 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3325 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3326 | |
| 3327 | /** |
| 3328 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 3329 | * @wmi_handle: wmi handle |
| 3330 | * @mcc_adaptive_scheduler: enable/disable |
| 3331 | * |
| 3332 | * This function enable/disable mcc adaptive scheduler in fw. |
| 3333 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3334 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3335 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3336 | QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3337 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 3338 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3339 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3340 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3341 | wmi_buf_t buf = 0; |
| 3342 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 3343 | uint16_t len = |
| 3344 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 3345 | |
| 3346 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3347 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3348 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 3349 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3350 | } |
| 3351 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 3352 | wmi_buf_data(buf); |
| 3353 | |
| 3354 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3355 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 3356 | WMITLV_GET_STRUCT_TLVLEN |
| 3357 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 3358 | cmd->enable = mcc_adaptive_scheduler; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3359 | cmd->pdev_id = pdev_id; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3360 | |
| 3361 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3362 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3363 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3364 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3365 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3366 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3367 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3368 | |
| 3369 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3370 | } |
| 3371 | |
| 3372 | /** |
| 3373 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 3374 | * @wmi: wmi handle |
| 3375 | * @mcc_channel: mcc channel |
| 3376 | * @mcc_channel_time_latency: MCC channel time latency. |
| 3377 | * |
| 3378 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 3379 | * channel of it and channel number. The info is provided run time using |
| 3380 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 3381 | * |
| 3382 | * Return: CDF status |
| 3383 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3384 | 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] | 3385 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 3386 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3387 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3388 | wmi_buf_t buf = 0; |
| 3389 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 3390 | uint16_t len = 0; |
| 3391 | uint8_t *buf_ptr = NULL; |
| 3392 | wmi_resmgr_chan_latency chan_latency; |
| 3393 | /* Note: we only support MCC time latency for a single channel */ |
| 3394 | uint32_t num_channels = 1; |
| 3395 | uint32_t chan1_freq = mcc_channel_freq; |
| 3396 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 3397 | |
| 3398 | |
| 3399 | /* If 0ms latency is provided, then FW will set to a default. |
| 3400 | * Otherwise, latency must be at least 30ms. |
| 3401 | */ |
| 3402 | if ((latency_chan1 > 0) && |
| 3403 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3404 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3405 | "Minimum is 30ms (or 0 to use default value by " |
| 3406 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3407 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3408 | } |
| 3409 | |
| 3410 | /* Set WMI CMD for channel time latency here */ |
| 3411 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 3412 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 3413 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 3414 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3415 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3416 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3417 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3418 | } |
| 3419 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3420 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 3421 | wmi_buf_data(buf); |
| 3422 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 3423 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 3424 | WMITLV_GET_STRUCT_TLVLEN |
| 3425 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 3426 | cmdTL->num_chans = num_channels; |
| 3427 | /* Update channel time latency information for home channel(s) */ |
| 3428 | buf_ptr += sizeof(*cmdTL); |
| 3429 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3430 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 3431 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3432 | chan_latency.chan_mhz = chan1_freq; |
| 3433 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3434 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3435 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3436 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3437 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3438 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3439 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3440 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3441 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3442 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3443 | |
| 3444 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3445 | } |
| 3446 | |
| 3447 | /** |
| 3448 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 3449 | * @wmi: wmi handle |
| 3450 | * @adapter_1_chan_number: adapter 1 channel number |
| 3451 | * @adapter_1_quota: adapter 1 quota |
| 3452 | * @adapter_2_chan_number: adapter 2 channel number |
| 3453 | * |
| 3454 | * Return: CDF status |
| 3455 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3456 | 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] | 3457 | uint32_t adapter_1_chan_freq, |
| 3458 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 3459 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3460 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3461 | wmi_buf_t buf = 0; |
| 3462 | uint16_t len = 0; |
| 3463 | uint8_t *buf_ptr = NULL; |
| 3464 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 3465 | wmi_resmgr_chan_time_quota chan_quota; |
| 3466 | uint32_t quota_chan1 = adapter_1_quota; |
| 3467 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 3468 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 3469 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 3470 | uint32_t num_channels = 2; |
| 3471 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 3472 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 3473 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3474 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3475 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 3476 | chan1_freq, quota_chan1, chan2_freq, |
| 3477 | quota_chan2); |
| 3478 | |
| 3479 | /* |
| 3480 | * Perform sanity check on time quota values provided. |
| 3481 | */ |
| 3482 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 3483 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3484 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3485 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3486 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3487 | } |
| 3488 | /* Set WMI CMD for channel time quota here */ |
| 3489 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 3490 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 3491 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 3492 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3493 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3494 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3495 | QDF_ASSERT(0); |
| 3496 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3497 | } |
| 3498 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3499 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 3500 | wmi_buf_data(buf); |
| 3501 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 3502 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 3503 | WMITLV_GET_STRUCT_TLVLEN |
| 3504 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 3505 | cmdTQ->num_chans = num_channels; |
| 3506 | |
| 3507 | /* Update channel time quota information for home channel(s) */ |
| 3508 | buf_ptr += sizeof(*cmdTQ); |
| 3509 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3510 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 3511 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3512 | chan_quota.chan_mhz = chan1_freq; |
| 3513 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3514 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3515 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 3516 | buf_ptr += sizeof(chan_quota); |
| 3517 | chan_quota.chan_mhz = chan2_freq; |
| 3518 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3519 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3520 | |
| 3521 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3522 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3523 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3524 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3525 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3526 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3527 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3528 | |
| 3529 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3530 | } |
| 3531 | |
| 3532 | /** |
| 3533 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 3534 | * @wmi_handle: Pointer to wmi handle |
| 3535 | * @thermal_info: Thermal command information |
| 3536 | * |
| 3537 | * This function sends the thermal management command |
| 3538 | * to the firmware |
| 3539 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3540 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3541 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3542 | 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] | 3543 | struct thermal_cmd_params *thermal_info) |
| 3544 | { |
| 3545 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 3546 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3547 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3548 | uint32_t len = 0; |
| 3549 | |
| 3550 | len = sizeof(*cmd); |
| 3551 | |
| 3552 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3553 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3554 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3555 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3556 | } |
| 3557 | |
| 3558 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 3559 | |
| 3560 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3561 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 3562 | WMITLV_GET_STRUCT_TLVLEN |
| 3563 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 3564 | |
| 3565 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 3566 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 3567 | cmd->enable = thermal_info->thermal_enable; |
| 3568 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3569 | 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] | 3570 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 3571 | |
| 3572 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3573 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3574 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3575 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3576 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3577 | } |
| 3578 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3579 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3580 | } |
| 3581 | |
| 3582 | |
| 3583 | /** |
| 3584 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3585 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3586 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 3587 | * |
| 3588 | * This function sends down the LRO configuration parameters to |
| 3589 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 3590 | * seed values for the toeplitz hash generation |
| 3591 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3592 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3593 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3594 | QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3595 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 3596 | { |
| 3597 | wmi_lro_info_cmd_fixed_param *cmd; |
| 3598 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3599 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3600 | |
| 3601 | |
| 3602 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3603 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3604 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3605 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3606 | } |
| 3607 | |
| 3608 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 3609 | |
| 3610 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3611 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 3612 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 3613 | |
| 3614 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 3615 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 3616 | wmi_lro_cmd->tcp_flag); |
| 3617 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 3618 | wmi_lro_cmd->tcp_flag_mask); |
| 3619 | cmd->toeplitz_hash_ipv4_0_3 = |
| 3620 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 3621 | cmd->toeplitz_hash_ipv4_4_7 = |
| 3622 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 3623 | cmd->toeplitz_hash_ipv4_8_11 = |
| 3624 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 3625 | cmd->toeplitz_hash_ipv4_12_15 = |
| 3626 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 3627 | cmd->toeplitz_hash_ipv4_16 = |
| 3628 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 3629 | |
| 3630 | cmd->toeplitz_hash_ipv6_0_3 = |
| 3631 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 3632 | cmd->toeplitz_hash_ipv6_4_7 = |
| 3633 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 3634 | cmd->toeplitz_hash_ipv6_8_11 = |
| 3635 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 3636 | cmd->toeplitz_hash_ipv6_12_15 = |
| 3637 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 3638 | cmd->toeplitz_hash_ipv6_16_19 = |
| 3639 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 3640 | cmd->toeplitz_hash_ipv6_20_23 = |
| 3641 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 3642 | cmd->toeplitz_hash_ipv6_24_27 = |
| 3643 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 3644 | cmd->toeplitz_hash_ipv6_28_31 = |
| 3645 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 3646 | cmd->toeplitz_hash_ipv6_32_35 = |
| 3647 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 3648 | cmd->toeplitz_hash_ipv6_36_39 = |
| 3649 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 3650 | cmd->toeplitz_hash_ipv6_40 = |
| 3651 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 3652 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3653 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3654 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 3655 | |
| 3656 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 3657 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3658 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3659 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3660 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3661 | } |
| 3662 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3663 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3664 | } |
| 3665 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3666 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3667 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 3668 | * @wmi_handle: Pointer to wmi handle |
| 3669 | * @rate_report_params: Pointer to peer rate report parameters |
| 3670 | * |
| 3671 | * |
| 3672 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 3673 | */ |
| 3674 | QDF_STATUS send_peer_rate_report_cmd_tlv(wmi_unified_t wmi_handle, |
| 3675 | struct wmi_peer_rate_report_params *rate_report_params) |
| 3676 | { |
| 3677 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 3678 | wmi_buf_t buf = NULL; |
| 3679 | QDF_STATUS status = 0; |
| 3680 | uint32_t len = 0; |
| 3681 | uint32_t i, j; |
| 3682 | |
| 3683 | len = sizeof(*cmd); |
| 3684 | |
| 3685 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3686 | if (!buf) { |
| 3687 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 3688 | return QDF_STATUS_E_FAILURE; |
| 3689 | } |
| 3690 | |
| 3691 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 3692 | wmi_buf_data(buf); |
| 3693 | |
| 3694 | WMITLV_SET_HDR( |
| 3695 | &cmd->tlv_header, |
| 3696 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 3697 | WMITLV_GET_STRUCT_TLVLEN( |
| 3698 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 3699 | |
| 3700 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 3701 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 3702 | cmd->report_timer_period = rate_report_params->timer_period; |
| 3703 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 3704 | cmd->cond_per_phy[i].val_cond_flags = |
| 3705 | rate_report_params->report_per_phy[i].cond_flags; |
| 3706 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 3707 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 3708 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 3709 | rate_report_params->report_per_phy[i].delta.percent; |
| 3710 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 3711 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 3712 | rate_report_params->report_per_phy[i]. |
| 3713 | report_rate_threshold[j]; |
| 3714 | } |
| 3715 | } |
| 3716 | |
| 3717 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 3718 | cmd->enable_rate_report, |
| 3719 | cmd->report_backoff_time, cmd->report_timer_period); |
| 3720 | |
| 3721 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3722 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 3723 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3724 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 3725 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 3726 | __func__); |
| 3727 | } |
| 3728 | return status; |
| 3729 | } |
| 3730 | |
| 3731 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3732 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 3733 | * @wmi_handle: wmi handle |
| 3734 | * @param: bcn ll cmd parameter |
| 3735 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3736 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3737 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3738 | 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] | 3739 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 3740 | { |
| 3741 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 3742 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3743 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3744 | |
| 3745 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3746 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3747 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3748 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3749 | } |
| 3750 | |
| 3751 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 3752 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3753 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 3754 | WMITLV_GET_STRUCT_TLVLEN |
| 3755 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 3756 | cmd->vdev_id = param->vdev_id; |
| 3757 | cmd->data_len = param->data_len; |
| 3758 | cmd->frame_ctrl = param->frame_ctrl; |
| 3759 | cmd->frag_ptr = param->frag_ptr; |
| 3760 | cmd->dtim_flag = param->dtim_flag; |
| 3761 | |
| 3762 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 3763 | WMI_PDEV_SEND_BCN_CMDID); |
| 3764 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3765 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3766 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3767 | wmi_buf_free(wmi_buf); |
| 3768 | } |
| 3769 | |
| 3770 | return ret; |
| 3771 | } |
| 3772 | |
| 3773 | /** |
| 3774 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 3775 | * @wmi_handle: wmi handle |
| 3776 | * @vdev_id: vdev id |
| 3777 | * @max_retries: max retries |
| 3778 | * @retry_interval: retry interval |
| 3779 | * This function sets sta query related parameters in fw. |
| 3780 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3781 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3782 | */ |
| 3783 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3784 | 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] | 3785 | uint8_t vdev_id, uint32_t max_retries, |
| 3786 | uint32_t retry_interval) |
| 3787 | { |
| 3788 | wmi_buf_t buf; |
| 3789 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 3790 | int len; |
| 3791 | |
| 3792 | len = sizeof(*cmd); |
| 3793 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3794 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3795 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3796 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3797 | } |
| 3798 | |
| 3799 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 3800 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3801 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 3802 | WMITLV_GET_STRUCT_TLVLEN |
| 3803 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 3804 | |
| 3805 | |
| 3806 | cmd->vdev_id = vdev_id; |
| 3807 | cmd->sa_query_max_retry_count = max_retries; |
| 3808 | cmd->sa_query_retry_interval = retry_interval; |
| 3809 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3810 | 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] | 3811 | vdev_id, retry_interval, max_retries); |
| 3812 | |
| 3813 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3814 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3815 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3816 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3817 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3818 | } |
| 3819 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3820 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3821 | return 0; |
| 3822 | } |
| 3823 | |
| 3824 | /** |
| 3825 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 3826 | * @wmi_handle: wmi handle |
| 3827 | * @params: sta keep alive parameter |
| 3828 | * |
| 3829 | * This function sets keep alive related parameters in fw. |
| 3830 | * |
| 3831 | * Return: CDF status |
| 3832 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3833 | 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] | 3834 | struct sta_params *params) |
| 3835 | { |
| 3836 | wmi_buf_t buf; |
| 3837 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 3838 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 3839 | uint8_t *buf_ptr; |
| 3840 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3841 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3842 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3843 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3844 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3845 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 3846 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3847 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3848 | WMI_LOGE("wmi_buf_alloc failed"); |
| 3849 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3850 | } |
| 3851 | |
| 3852 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 3853 | buf_ptr = (uint8_t *) cmd; |
| 3854 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3855 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 3856 | WMITLV_GET_STRUCT_TLVLEN |
| 3857 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 3858 | cmd->interval = params->timeperiod; |
| 3859 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 3860 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3861 | 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] | 3862 | params->timeperiod, params->method); |
| 3863 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 3864 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 3865 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 3866 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 3867 | |
| 3868 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 3869 | if ((NULL == params->hostv4addr) || |
| 3870 | (NULL == params->destv4addr) || |
| 3871 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3872 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3873 | "destv4addr:%p destmac:%p ", __func__, |
| 3874 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3875 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3876 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3877 | } |
| 3878 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3879 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3880 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3881 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3882 | WMI_IPV4_ADDR_LEN); |
| 3883 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 3884 | } else { |
| 3885 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 3886 | } |
| 3887 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3888 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3889 | WMI_STA_KEEPALIVE_CMDID); |
| 3890 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3891 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3892 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3893 | } |
| 3894 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3895 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3896 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3897 | } |
| 3898 | |
| 3899 | /** |
| 3900 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 3901 | * @wmi_handle: wmi handle |
| 3902 | * @if_id: vdev id |
| 3903 | * @gtx_info: GTX config params |
| 3904 | * |
| 3905 | * This function set GTX related params in firmware. |
| 3906 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3907 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3908 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3909 | 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] | 3910 | struct wmi_gtx_config *gtx_info) |
| 3911 | { |
| 3912 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 3913 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3914 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3915 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3916 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3917 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3918 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3919 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3920 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3921 | } |
| 3922 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 3923 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3924 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 3925 | WMITLV_GET_STRUCT_TLVLEN |
| 3926 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 3927 | cmd->vdev_id = if_id; |
| 3928 | |
| 3929 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 3930 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 3931 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 3932 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 3933 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 3934 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 3935 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 3936 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 3937 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3938 | 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] | 3939 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 3940 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 3941 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 3942 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 3943 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3944 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3945 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3946 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 3947 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 3948 | wmi_buf_free(buf); |
| 3949 | } |
| 3950 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3951 | } |
| 3952 | |
| 3953 | /** |
| 3954 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 3955 | * @wmi_handle: wmi handle |
| 3956 | * @edca_params: edca parameters |
| 3957 | * |
| 3958 | * This function updates EDCA parameters to the target |
| 3959 | * |
| 3960 | * Return: CDF Status |
| 3961 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3962 | 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] | 3963 | uint8_t vdev_id, |
| 3964 | wmi_wmm_vparams gwmm_param[WMI_MAX_NUM_AC]) |
| 3965 | { |
| 3966 | uint8_t *buf_ptr; |
| 3967 | wmi_buf_t buf; |
| 3968 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
| 3969 | wmi_wmm_vparams *wmm_param, *twmm_param; |
| 3970 | int len = sizeof(*cmd); |
| 3971 | int ac; |
| 3972 | |
| 3973 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3974 | |
| 3975 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3976 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3977 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3978 | } |
| 3979 | |
| 3980 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3981 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 3982 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3983 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3984 | WMITLV_GET_STRUCT_TLVLEN |
| 3985 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 3986 | cmd->vdev_id = vdev_id; |
| 3987 | |
| 3988 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 3989 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
| 3990 | twmm_param = (wmi_wmm_vparams *) (&gwmm_param[ac]); |
| 3991 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 3992 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3993 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 3994 | wmm_param->cwmin = twmm_param->cwmin; |
| 3995 | wmm_param->cwmax = twmm_param->cwmax; |
| 3996 | wmm_param->aifs = twmm_param->aifs; |
| 3997 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 3998 | wmm_param->acm = twmm_param->acm; |
| 3999 | wmm_param->no_ack = twmm_param->no_ack; |
| 4000 | } |
| 4001 | |
| 4002 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4003 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 4004 | goto fail; |
| 4005 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4006 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4007 | |
| 4008 | fail: |
| 4009 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4010 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 4011 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4012 | } |
| 4013 | |
| 4014 | /** |
| 4015 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 4016 | * @wmi_handle: wmi handle |
| 4017 | * @vdev_id: vdev id |
| 4018 | * @probe_rsp_info: probe response info |
| 4019 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4020 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4021 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4022 | 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] | 4023 | uint8_t vdev_id, |
| 4024 | struct wmi_probe_resp_params *probe_rsp_info, |
| 4025 | uint8_t *frm) |
| 4026 | { |
| 4027 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 4028 | wmi_bcn_prb_info *bcn_prb_info; |
| 4029 | wmi_buf_t wmi_buf; |
| 4030 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 4031 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4032 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4033 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4034 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4035 | |
| 4036 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 4037 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 4038 | |
| 4039 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 4040 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 4041 | tmpl_len_aligned; |
| 4042 | |
| 4043 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4044 | 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] | 4045 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4046 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4047 | } |
| 4048 | |
| 4049 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4050 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4051 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4052 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4053 | } |
| 4054 | |
| 4055 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4056 | |
| 4057 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 4058 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4059 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 4060 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 4061 | cmd->vdev_id = vdev_id; |
| 4062 | cmd->buf_len = tmpl_len; |
| 4063 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 4064 | |
| 4065 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4066 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4067 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4068 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4069 | bcn_prb_info->caps = 0; |
| 4070 | bcn_prb_info->erp = 0; |
| 4071 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4072 | |
| 4073 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4074 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4075 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4076 | |
| 4077 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4078 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4079 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4080 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4081 | wmi_buf_free(wmi_buf); |
| 4082 | } |
| 4083 | |
| 4084 | return ret; |
| 4085 | } |
| 4086 | |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4087 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4088 | #define WPI_IV_LEN 16 |
| 4089 | |
| 4090 | /** |
| 4091 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4092 | * |
| 4093 | * @dest_tx: destination address of tsc key counter |
| 4094 | * @src_tx: source address of tsc key counter |
| 4095 | * @dest_rx: destination address of rsc key counter |
| 4096 | * @src_rx: source address of rsc key counter |
| 4097 | * |
| 4098 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4099 | * |
| 4100 | * Return: None |
| 4101 | * |
| 4102 | */ |
| 4103 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4104 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4105 | { |
| 4106 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4107 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4108 | } |
| 4109 | #else |
| 4110 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4111 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4112 | { |
| 4113 | return; |
| 4114 | } |
| 4115 | #endif |
| 4116 | |
| 4117 | /** |
| 4118 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4119 | * @wmi_handle: wmi handle |
| 4120 | * @key_params: key parameters |
| 4121 | * |
| 4122 | * This function fills structure from information |
| 4123 | * passed in key_params. |
| 4124 | * |
| 4125 | * Return: QDF_STATUS_SUCCESS - success |
| 4126 | * QDF_STATUS_E_FAILURE - failure |
| 4127 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4128 | */ |
| 4129 | QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle, |
| 4130 | struct set_key_params *key_params) |
| 4131 | { |
| 4132 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4133 | wmi_buf_t buf; |
| 4134 | uint8_t *buf_ptr; |
| 4135 | uint32_t len; |
| 4136 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4137 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4138 | |
| 4139 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4140 | WMI_TLV_HDR_SIZE; |
| 4141 | |
| 4142 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4143 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4144 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4145 | return QDF_STATUS_E_NOMEM; |
| 4146 | } |
| 4147 | |
| 4148 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4149 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4150 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4151 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4152 | WMITLV_GET_STRUCT_TLVLEN |
| 4153 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4154 | cmd->vdev_id = key_params->vdev_id; |
| 4155 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4156 | |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4157 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4158 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4159 | cmd->key_flags |= key_params->key_flags; |
| 4160 | cmd->key_cipher = key_params->key_cipher; |
| 4161 | if ((key_params->key_txmic_len) && |
| 4162 | (key_params->key_rxmic_len)) { |
| 4163 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4164 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4165 | } |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4166 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4167 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4168 | key_params->tx_iv, |
| 4169 | cmd->wpi_key_rsc_counter, |
| 4170 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4171 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4172 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4173 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4174 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4175 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4176 | qdf_mem_copy((void *)key_data, |
| 4177 | (const void *)key_params->key_data, key_params->key_len); |
| 4178 | cmd->key_len = key_params->key_len; |
| 4179 | |
| 4180 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4181 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4182 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4183 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4184 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4185 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4186 | } |
| 4187 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4188 | /** |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 4189 | * send_sar_limit_cmd_tlv() - send sar limit cmd to fw |
| 4190 | * @wmi_handle: wmi handle |
| 4191 | * @params: sar limit params |
| 4192 | * |
| 4193 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4194 | */ |
| 4195 | static QDF_STATUS send_sar_limit_cmd_tlv(wmi_unified_t wmi_handle, |
| 4196 | struct sar_limit_cmd_params *sar_limit_params) |
| 4197 | { |
| 4198 | wmi_buf_t buf; |
| 4199 | QDF_STATUS qdf_status; |
| 4200 | wmi_sar_limits_cmd_fixed_param *cmd; |
| 4201 | int i; |
| 4202 | uint8_t *buf_ptr; |
| 4203 | wmi_sar_limit_cmd_row *wmi_sar_rows_list; |
| 4204 | struct sar_limit_cmd_row *sar_rows_list; |
| 4205 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4206 | |
| 4207 | len += sizeof(wmi_sar_limit_cmd_row) * sar_limit_params->num_limit_rows; |
| 4208 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4209 | if (!buf) { |
| 4210 | WMI_LOGE("Failed to allocate memory"); |
| 4211 | qdf_status = QDF_STATUS_E_NOMEM; |
| 4212 | goto end; |
| 4213 | } |
| 4214 | |
| 4215 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4216 | cmd = (wmi_sar_limits_cmd_fixed_param *) buf_ptr; |
| 4217 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4218 | WMITLV_TAG_STRUC_wmi_sar_limits_cmd_fixed_param, |
| 4219 | WMITLV_GET_STRUCT_TLVLEN |
| 4220 | (wmi_sar_limits_cmd_fixed_param)); |
| 4221 | cmd->sar_enable = sar_limit_params->sar_enable; |
| 4222 | cmd->commit_limits = sar_limit_params->commit_limits; |
| 4223 | cmd->num_limit_rows = sar_limit_params->num_limit_rows; |
| 4224 | |
| 4225 | WMI_LOGD("no of sar rows = %d, len = %d", |
| 4226 | sar_limit_params->num_limit_rows, len); |
| 4227 | buf_ptr += sizeof(*cmd); |
| 4228 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4229 | sizeof(wmi_sar_limit_cmd_row) * |
| 4230 | sar_limit_params->num_limit_rows); |
| 4231 | if (cmd->num_limit_rows == 0) |
| 4232 | goto send_sar_limits; |
| 4233 | |
| 4234 | wmi_sar_rows_list = (wmi_sar_limit_cmd_row *) |
| 4235 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4236 | sar_rows_list = sar_limit_params->sar_limit_row_list; |
| 4237 | |
| 4238 | for (i = 0; i < sar_limit_params->num_limit_rows; i++) { |
| 4239 | WMITLV_SET_HDR(&wmi_sar_rows_list->tlv_header, |
| 4240 | WMITLV_TAG_STRUC_wmi_sar_limit_cmd_row, |
| 4241 | WMITLV_GET_STRUCT_TLVLEN(wmi_sar_limit_cmd_row)); |
| 4242 | wmi_sar_rows_list->band_id = sar_rows_list->band_id; |
| 4243 | wmi_sar_rows_list->chain_id = sar_rows_list->chain_id; |
| 4244 | wmi_sar_rows_list->mod_id = sar_rows_list->mod_id; |
| 4245 | wmi_sar_rows_list->limit_value = sar_rows_list->limit_value; |
| 4246 | wmi_sar_rows_list->validity_bitmap = |
| 4247 | sar_rows_list->validity_bitmap; |
| 4248 | WMI_LOGD("row %d, band_id = %d, chain_id = %d, mod_id = %d, limit_value = %d, validity_bitmap = %d", |
| 4249 | i, wmi_sar_rows_list->band_id, |
| 4250 | wmi_sar_rows_list->chain_id, |
| 4251 | wmi_sar_rows_list->mod_id, |
| 4252 | wmi_sar_rows_list->limit_value, |
| 4253 | wmi_sar_rows_list->validity_bitmap); |
| 4254 | sar_rows_list++; |
| 4255 | wmi_sar_rows_list++; |
| 4256 | } |
| 4257 | send_sar_limits: |
| 4258 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4259 | WMI_SAR_LIMITS_CMDID); |
| 4260 | |
| 4261 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 4262 | WMI_LOGE("Failed to send WMI_SAR_LIMITS_CMDID"); |
| 4263 | wmi_buf_free(buf); |
| 4264 | } |
| 4265 | |
| 4266 | end: |
| 4267 | return qdf_status; |
| 4268 | } |
| 4269 | |
| 4270 | /** |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4271 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 4272 | * @wmi_handle: wmi handle |
| 4273 | * @params: encrypt/decrypt params |
| 4274 | * |
| 4275 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4276 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 4277 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4278 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 4279 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 4280 | { |
| 4281 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 4282 | wmi_buf_t wmi_buf; |
| 4283 | uint8_t *buf_ptr; |
| 4284 | QDF_STATUS ret; |
| 4285 | uint32_t len; |
| 4286 | |
| 4287 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 4288 | |
| 4289 | len = sizeof(*cmd) + |
| 4290 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 4291 | WMI_TLV_HDR_SIZE; |
| 4292 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4293 | if (!wmi_buf) { |
| 4294 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 4295 | __func__); |
| 4296 | return QDF_STATUS_E_NOMEM; |
| 4297 | } |
| 4298 | |
| 4299 | buf_ptr = wmi_buf_data(wmi_buf); |
| 4300 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 4301 | |
| 4302 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4303 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 4304 | WMITLV_GET_STRUCT_TLVLEN( |
| 4305 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 4306 | |
| 4307 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 4308 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 4309 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 4310 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 4311 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 4312 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 4313 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 4314 | |
| 4315 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 4316 | encrypt_decrypt_params->key_len); |
| 4317 | |
| 4318 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 4319 | MAX_MAC_HEADER_LEN); |
| 4320 | |
| 4321 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 4322 | |
| 4323 | if (cmd->data_len) { |
| 4324 | buf_ptr += sizeof(*cmd); |
| 4325 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4326 | roundup(encrypt_decrypt_params->data_len, |
| 4327 | sizeof(A_UINT32))); |
| 4328 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4329 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 4330 | encrypt_decrypt_params->data_len); |
| 4331 | } |
| 4332 | |
| 4333 | /* This conversion is to facilitate data to FW in little endian */ |
| 4334 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 4335 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 4336 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 4337 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 4338 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 4339 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 4340 | |
| 4341 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4342 | wmi_buf, len, |
| 4343 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 4344 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4345 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 4346 | wmi_buf_free(wmi_buf); |
| 4347 | } |
| 4348 | |
| 4349 | return ret; |
| 4350 | } |
| 4351 | |
| 4352 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4353 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4354 | /** |
| 4355 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 4356 | * @wmi_handle: wmi handle |
| 4357 | * @vdev_id: vdev id |
| 4358 | * @p2p_ie: p2p IE |
| 4359 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4360 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4361 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4362 | 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] | 4363 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 4364 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4365 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4366 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 4367 | wmi_buf_t wmi_buf; |
| 4368 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 4369 | uint8_t *buf_ptr; |
| 4370 | |
| 4371 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 4372 | |
| 4373 | /* More than one P2P IE may be included in a single frame. |
| 4374 | If multiple P2P IEs are present, the complete P2P attribute |
| 4375 | data consists of the concatenation of the P2P Attribute |
| 4376 | fields of the P2P IEs. The P2P Attributes field of each |
| 4377 | P2P IE may be any length up to the maximum (251 octets). |
| 4378 | In this case host sends one P2P IE to firmware so the length |
| 4379 | should not exceed more than 251 bytes |
| 4380 | */ |
| 4381 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4382 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4383 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4384 | } |
| 4385 | |
| 4386 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 4387 | |
| 4388 | wmi_buf_len = |
| 4389 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 4390 | WMI_TLV_HDR_SIZE; |
| 4391 | |
| 4392 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4393 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4394 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4395 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4396 | } |
| 4397 | |
| 4398 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4399 | |
| 4400 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 4401 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4402 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 4403 | WMITLV_GET_STRUCT_TLVLEN |
| 4404 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 4405 | cmd->vdev_id = vdev_id; |
| 4406 | cmd->ie_buf_len = ie_len; |
| 4407 | |
| 4408 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 4409 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 4410 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4411 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4412 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4413 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4414 | |
| 4415 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4416 | wmi_buf, wmi_buf_len, |
| 4417 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4418 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4419 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4420 | wmi_buf_free(wmi_buf); |
| 4421 | } |
| 4422 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4423 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4424 | return ret; |
| 4425 | } |
| 4426 | |
| 4427 | /** |
| 4428 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 4429 | * @wmi_handle: wmi handle |
| 4430 | * @req: gateway parameter update request structure |
| 4431 | * |
| 4432 | * This function reads the incoming @req and fill in the destination |
| 4433 | * WMI structure and sends down the gateway configs down to the firmware |
| 4434 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4435 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4436 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4437 | 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] | 4438 | struct gateway_update_req_param *req) |
| 4439 | { |
| 4440 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 4441 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4442 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4443 | int len = sizeof(*cmd); |
| 4444 | |
| 4445 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4446 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4447 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4448 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4449 | } |
| 4450 | |
| 4451 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 4452 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4453 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 4454 | WMITLV_GET_STRUCT_TLVLEN( |
| 4455 | wmi_roam_subnet_change_config_fixed_param)); |
| 4456 | |
| 4457 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4458 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 4459 | QDF_IPV4_ADDR_SIZE); |
| 4460 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 4461 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4462 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 4463 | &cmd->inet_gw_mac_addr); |
| 4464 | cmd->max_retries = req->max_retries; |
| 4465 | cmd->timeout = req->timeout; |
| 4466 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 4467 | cmd->flag = 0; |
| 4468 | if (req->ipv4_addr_type) |
| 4469 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 4470 | |
| 4471 | if (req->ipv6_addr_type) |
| 4472 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 4473 | |
| 4474 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4475 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4476 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4477 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4478 | ret); |
| 4479 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4480 | } |
| 4481 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4482 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4483 | } |
| 4484 | |
| 4485 | /** |
| 4486 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 4487 | * @wmi_handle: wmi handle |
| 4488 | * @req: rssi monitoring request structure |
| 4489 | * |
| 4490 | * This function reads the incoming @req and fill in the destination |
| 4491 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 4492 | * |
| 4493 | * Return: 0 on success; error number otherwise |
| 4494 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4495 | 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] | 4496 | struct rssi_monitor_param *req) |
| 4497 | { |
| 4498 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 4499 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4500 | QDF_STATUS ret; |
| 4501 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4502 | |
| 4503 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4504 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4505 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4506 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4507 | } |
| 4508 | |
| 4509 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 4510 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4511 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 4512 | WMITLV_GET_STRUCT_TLVLEN( |
| 4513 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 4514 | |
| 4515 | cmd->vdev_id = req->session_id; |
| 4516 | cmd->request_id = req->request_id; |
| 4517 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 4518 | cmd->hi_rssi_reenable_histeresis = 0; |
| 4519 | cmd->min_report_interval = 0; |
| 4520 | cmd->max_num_report = 1; |
| 4521 | if (req->control) { |
| 4522 | /* enable one threshold for each min/max */ |
| 4523 | cmd->enabled_bitmap = 0x09; |
| 4524 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 4525 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 4526 | } else { |
| 4527 | cmd->enabled_bitmap = 0; |
| 4528 | cmd->low_rssi_breach_threshold[0] = 0; |
| 4529 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 4530 | } |
| 4531 | |
| 4532 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4533 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4534 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4535 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4536 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4537 | } |
| 4538 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4539 | WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4540 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4541 | } |
| 4542 | |
| 4543 | /** |
| 4544 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 4545 | * @wmi_handle: wmi handle |
| 4546 | * @psetoui: OUI parameters |
| 4547 | * |
| 4548 | * set scan probe OUI parameters in firmware |
| 4549 | * |
| 4550 | * Return: CDF status |
| 4551 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4552 | 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] | 4553 | struct scan_mac_oui *psetoui) |
| 4554 | { |
| 4555 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 4556 | wmi_buf_t wmi_buf; |
| 4557 | uint32_t len; |
| 4558 | uint8_t *buf_ptr; |
| 4559 | uint32_t *oui_buf; |
| 4560 | |
| 4561 | len = sizeof(*cmd); |
| 4562 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4563 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4564 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4565 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4566 | } |
| 4567 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4568 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 4569 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4570 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 4571 | WMITLV_GET_STRUCT_TLVLEN |
| 4572 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 4573 | |
| 4574 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4575 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4576 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 4577 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4578 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4579 | cmd->prob_req_oui); |
| 4580 | |
| 4581 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4582 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4583 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4584 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4585 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4586 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4587 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4588 | } |
| 4589 | |
| 4590 | /** |
| 4591 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 4592 | * @wmi_handle: wmi handle |
| 4593 | * @req: passpoint network request structure |
| 4594 | * |
| 4595 | * This function sends down WMI command with network id set to wildcard id. |
| 4596 | * firmware shall clear all the config entries |
| 4597 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4598 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4599 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4600 | 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] | 4601 | struct wifi_passpoint_req_param *req) |
| 4602 | { |
| 4603 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 4604 | wmi_buf_t buf; |
| 4605 | uint32_t len; |
| 4606 | int ret; |
| 4607 | |
| 4608 | len = sizeof(*cmd); |
| 4609 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4610 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4611 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4612 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4613 | } |
| 4614 | |
| 4615 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 4616 | |
| 4617 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4618 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 4619 | WMITLV_GET_STRUCT_TLVLEN( |
| 4620 | wmi_passpoint_config_cmd_fixed_param)); |
| 4621 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 4622 | |
| 4623 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4624 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 4625 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4626 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4627 | __func__); |
| 4628 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4629 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4630 | } |
| 4631 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4632 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4633 | } |
| 4634 | |
| 4635 | /** |
| 4636 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 4637 | * @wmi_handle: wmi handle |
| 4638 | * @req: passpoint network request structure |
| 4639 | * |
| 4640 | * This function reads the incoming @req and fill in the destination |
| 4641 | * WMI structure and send down the passpoint configs down to the firmware |
| 4642 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4643 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4644 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4645 | 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] | 4646 | struct wifi_passpoint_req_param *req) |
| 4647 | { |
| 4648 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 4649 | u_int8_t i, j, *bytes; |
| 4650 | wmi_buf_t buf; |
| 4651 | uint32_t len; |
| 4652 | int ret; |
| 4653 | |
| 4654 | len = sizeof(*cmd); |
| 4655 | for (i = 0; i < req->num_networks; i++) { |
| 4656 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4657 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4658 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4659 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4660 | } |
| 4661 | |
| 4662 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 4663 | wmi_buf_data(buf); |
| 4664 | |
| 4665 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4666 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 4667 | WMITLV_GET_STRUCT_TLVLEN( |
| 4668 | wmi_passpoint_config_cmd_fixed_param)); |
| 4669 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4670 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 4671 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4672 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4673 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4674 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 4675 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4676 | 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] | 4677 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 4678 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 4679 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4680 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4681 | &req->networks[i].roaming_consortium_ids[j], |
| 4682 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 4683 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4684 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4685 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4686 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4687 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 4688 | |
| 4689 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4690 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 4691 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4692 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4693 | __func__); |
| 4694 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4695 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4696 | } |
| 4697 | } |
| 4698 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4699 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4700 | } |
| 4701 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4702 | /** |
| 4703 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 4704 | * @wmi_handle: wmi handle |
| 4705 | * @scan_cmd_fp: start scan command ptr |
| 4706 | * @roam_req: roam request param |
| 4707 | * |
| 4708 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 4709 | * of WMI_ROAM_SCAN_MODE. |
| 4710 | * |
| 4711 | * Return: QDF status |
| 4712 | */ |
| 4713 | QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 4714 | wmi_start_scan_cmd_fixed_param * |
| 4715 | scan_cmd_fp, |
| 4716 | struct roam_offload_scan_params *roam_req) |
| 4717 | { |
| 4718 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4719 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4720 | int len; |
| 4721 | uint8_t *buf_ptr; |
| 4722 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4723 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4724 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4725 | int auth_mode = roam_req->auth_mode; |
| 4726 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 4727 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 4728 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 4729 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4730 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4731 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4732 | /* Need to create a buf with roam_scan command at |
| 4733 | * front and piggyback with scan command */ |
| 4734 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 4735 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4736 | (2 * WMI_TLV_HDR_SIZE) + |
| 4737 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4738 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 4739 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4740 | if (roam_req->is_roam_req_valid && |
| 4741 | roam_req->roam_offload_enabled) { |
| 4742 | len += sizeof(wmi_roam_offload_tlv_param); |
| 4743 | len += WMI_TLV_HDR_SIZE; |
| 4744 | if ((auth_mode != WMI_AUTH_NONE) && |
| 4745 | ((auth_mode != WMI_AUTH_OPEN) || |
| 4746 | (auth_mode == WMI_AUTH_OPEN && |
| 4747 | roam_req->mdid.mdie_present) || |
| 4748 | roam_req->is_ese_assoc)) { |
| 4749 | len += WMI_TLV_HDR_SIZE; |
| 4750 | if (roam_req->is_ese_assoc) |
| 4751 | len += |
| 4752 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 4753 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 4754 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 4755 | (auth_mode == WMI_AUTH_OPEN && |
| 4756 | roam_req->mdid.mdie_present)) |
| 4757 | len += |
| 4758 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 4759 | else |
| 4760 | len += |
| 4761 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 4762 | } else { |
| 4763 | len += WMI_TLV_HDR_SIZE; |
| 4764 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4765 | |
| 4766 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 4767 | + roundup(roam_req->assoc_ie_length, |
| 4768 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4769 | } else { |
| 4770 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4771 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4772 | __func__, roam_req->roam_offload_enabled); |
| 4773 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4774 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4775 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4776 | } |
| 4777 | if (roam_req->is_roam_req_valid && |
| 4778 | roam_req->roam_offload_enabled) { |
| 4779 | roam_req->mode = roam_req->mode | |
| 4780 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 4781 | } |
| 4782 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 4783 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4784 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 4785 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 4786 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 4787 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4788 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4789 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4790 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4791 | return QDF_STATUS_E_NOMEM; |
| 4792 | } |
| 4793 | |
| 4794 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4795 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4796 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 4797 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 4798 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 4799 | WMITLV_GET_STRUCT_TLVLEN |
| 4800 | (wmi_roam_scan_mode_fixed_param)); |
| 4801 | |
| 4802 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 4803 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4804 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 4805 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 4806 | goto send_roam_scan_mode_cmd; |
| 4807 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4808 | /* Fill in scan parameters suitable for roaming scan */ |
| 4809 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 4810 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4811 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 4812 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 4813 | /* Ensure there is no additional IEs */ |
| 4814 | scan_cmd_fp->ie_len = 0; |
| 4815 | WMITLV_SET_HDR(buf_ptr, |
| 4816 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 4817 | WMITLV_GET_STRUCT_TLVLEN |
| 4818 | (wmi_start_scan_cmd_fixed_param)); |
| 4819 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4820 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 4821 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 4822 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4823 | sizeof(wmi_roam_offload_tlv_param)); |
| 4824 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4825 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 4826 | WMITLV_SET_HDR(buf_ptr, |
| 4827 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 4828 | WMITLV_GET_STRUCT_TLVLEN |
| 4829 | (wmi_roam_offload_tlv_param)); |
| 4830 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 4831 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 4832 | roam_offload_params->select_5g_margin = |
| 4833 | roam_req->select_5ghz_margin; |
| 4834 | roam_offload_params->reassoc_failure_timeout = |
| 4835 | roam_req->reassoc_failure_timeout; |
| 4836 | |
| 4837 | /* Fill the capabilities */ |
| 4838 | roam_offload_params->capability = |
| 4839 | roam_req->roam_offload_params.capability; |
| 4840 | roam_offload_params->ht_caps_info = |
| 4841 | roam_req->roam_offload_params.ht_caps_info; |
| 4842 | roam_offload_params->ampdu_param = |
| 4843 | roam_req->roam_offload_params.ampdu_param; |
| 4844 | roam_offload_params->ht_ext_cap = |
| 4845 | roam_req->roam_offload_params.ht_ext_cap; |
| 4846 | roam_offload_params->ht_txbf = |
| 4847 | roam_req->roam_offload_params.ht_txbf; |
| 4848 | roam_offload_params->asel_cap = |
| 4849 | roam_req->roam_offload_params.asel_cap; |
| 4850 | roam_offload_params->qos_caps = |
| 4851 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 4852 | roam_offload_params->qos_enabled = |
| 4853 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4854 | roam_offload_params->wmm_caps = |
| 4855 | roam_req->roam_offload_params.wmm_caps; |
| 4856 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 4857 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 4858 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 4859 | |
| 4860 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 4861 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 4862 | * they are filled in the same order.Depending on the |
| 4863 | * authentication type, the other mode TLV's are nullified |
| 4864 | * and only headers are filled.*/ |
| 4865 | if ((auth_mode != WMI_AUTH_NONE) && |
| 4866 | ((auth_mode != WMI_AUTH_OPEN) || |
| 4867 | (auth_mode == WMI_AUTH_OPEN |
| 4868 | && roam_req->mdid.mdie_present) || |
| 4869 | roam_req->is_ese_assoc)) { |
| 4870 | if (roam_req->is_ese_assoc) { |
| 4871 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4872 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4873 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4874 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4875 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4876 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4877 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4878 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 4879 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4880 | roam_offload_ese = |
| 4881 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 4882 | qdf_mem_copy(roam_offload_ese->krk, |
| 4883 | roam_req->krk, |
| 4884 | sizeof(roam_req->krk)); |
| 4885 | qdf_mem_copy(roam_offload_ese->btk, |
| 4886 | roam_req->btk, |
| 4887 | sizeof(roam_req->btk)); |
| 4888 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 4889 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 4890 | WMITLV_GET_STRUCT_TLVLEN |
| 4891 | (wmi_roam_ese_offload_tlv_param)); |
| 4892 | buf_ptr += |
| 4893 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 4894 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 4895 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 4896 | || (auth_mode == WMI_AUTH_OPEN |
| 4897 | && roam_req->mdid.mdie_present)) { |
| 4898 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4899 | 0); |
| 4900 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4901 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4902 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 4903 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4904 | roam_offload_11r = |
| 4905 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 4906 | roam_offload_11r->r0kh_id_len = |
| 4907 | roam_req->rokh_id_length; |
| 4908 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 4909 | roam_req->rokh_id, |
| 4910 | roam_offload_11r->r0kh_id_len); |
| 4911 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 4912 | roam_req->psk_pmk, |
| 4913 | sizeof(roam_req->psk_pmk)); |
| 4914 | roam_offload_11r->psk_msk_len = |
| 4915 | roam_req->pmk_len; |
| 4916 | roam_offload_11r->mdie_present = |
| 4917 | roam_req->mdid.mdie_present; |
| 4918 | roam_offload_11r->mdid = |
| 4919 | roam_req->mdid.mobility_domain; |
| 4920 | if (auth_mode == WMI_AUTH_OPEN) { |
| 4921 | /* If FT-Open ensure pmk length |
| 4922 | and r0khid len are zero */ |
| 4923 | roam_offload_11r->r0kh_id_len = 0; |
| 4924 | roam_offload_11r->psk_msk_len = 0; |
| 4925 | } |
| 4926 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 4927 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 4928 | WMITLV_GET_STRUCT_TLVLEN |
| 4929 | (wmi_roam_11r_offload_tlv_param)); |
| 4930 | buf_ptr += |
| 4931 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 4932 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4933 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4934 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4935 | } else { |
| 4936 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4937 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 4938 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4939 | roam_offload_11i = |
| 4940 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 4941 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 4942 | roam_req->okc_enabled) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4943 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 4944 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4945 | WMI_LOGE("LFR3:OKC Enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4946 | } else { |
| 4947 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 4948 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4949 | WMI_LOGE("LFR3:OKC Disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4950 | } |
| 4951 | |
| 4952 | qdf_mem_copy(roam_offload_11i->pmk, |
| 4953 | roam_req->psk_pmk, |
| 4954 | sizeof(roam_req->psk_pmk)); |
| 4955 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 4956 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 4957 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 4958 | WMITLV_GET_STRUCT_TLVLEN |
| 4959 | (wmi_roam_11i_offload_tlv_param)); |
| 4960 | buf_ptr += |
| 4961 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 4962 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4963 | 0); |
| 4964 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4965 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4966 | 0); |
| 4967 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4968 | } |
| 4969 | } else { |
| 4970 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4971 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4972 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4973 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4974 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 4975 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4976 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4977 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4978 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 4979 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 4980 | |
| 4981 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4982 | sizeof(*assoc_ies)); |
| 4983 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4984 | |
| 4985 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 4986 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 4987 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 4988 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 4989 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 4990 | |
| 4991 | buf_ptr += sizeof(*assoc_ies); |
| 4992 | |
| 4993 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4994 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 4995 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4996 | |
| 4997 | if (assoc_ies->buf_len != 0) { |
| 4998 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 4999 | assoc_ies->buf_len); |
| 5000 | } |
| 5001 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5002 | } else { |
| 5003 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5004 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5005 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5006 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5007 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5008 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5009 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5010 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5011 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5012 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5013 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5014 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5015 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5016 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5017 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5018 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5019 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5020 | } |
| 5021 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5022 | |
| 5023 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5024 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5025 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5026 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5027 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5028 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 5029 | status); |
| 5030 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5031 | } |
| 5032 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5033 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5034 | } |
| 5035 | |
| 5036 | |
| 5037 | /** |
| 5038 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 5039 | * rssi threashold |
| 5040 | * @wmi_handle: wmi handle |
| 5041 | * @roam_req: Roaming request buffer |
| 5042 | * |
| 5043 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 5044 | * |
| 5045 | * Return: QDF status |
| 5046 | */ |
| 5047 | QDF_STATUS send_roam_scan_offload_rssi_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
| 5048 | struct roam_offload_scan_rssi_params *roam_req) |
| 5049 | { |
| 5050 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5051 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5052 | int len; |
| 5053 | uint8_t *buf_ptr; |
| 5054 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 5055 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 5056 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5057 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5058 | |
| 5059 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5060 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5061 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5062 | len += WMI_TLV_HDR_SIZE; |
| 5063 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5064 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 5065 | len += sizeof(wmi_roam_dense_thres_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5066 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5067 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5068 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5069 | return QDF_STATUS_E_NOMEM; |
| 5070 | } |
| 5071 | |
| 5072 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5073 | rssi_threshold_fp = |
| 5074 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 5075 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 5076 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 5077 | WMITLV_GET_STRUCT_TLVLEN |
| 5078 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 5079 | /* fill in threshold values */ |
| 5080 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 5081 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 5082 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 5083 | rssi_threshold_fp->hirssi_scan_max_count = |
| 5084 | roam_req->hi_rssi_scan_max_count; |
| 5085 | rssi_threshold_fp->hirssi_scan_delta = |
| 5086 | roam_req->hi_rssi_scan_rssi_delta; |
| 5087 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
| 5088 | |
| 5089 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5090 | WMITLV_SET_HDR(buf_ptr, |
| 5091 | WMITLV_TAG_ARRAY_STRUC, |
| 5092 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 5093 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5094 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 5095 | |
| 5096 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 5097 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 5098 | ext_thresholds->boost_threshold_5g = |
| 5099 | roam_req->boost_threshold_5g; |
| 5100 | |
| 5101 | ext_thresholds->boost_algorithm_5g = |
| 5102 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5103 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 5104 | ext_thresholds->penalty_algorithm_5g = |
| 5105 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5106 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 5107 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 5108 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 5109 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 5110 | |
| 5111 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 5112 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 5113 | WMITLV_GET_STRUCT_TLVLEN |
| 5114 | (wmi_roam_scan_extended_threshold_param)); |
| 5115 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5116 | WMITLV_SET_HDR(buf_ptr, |
| 5117 | WMITLV_TAG_ARRAY_STRUC, |
| 5118 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 5119 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5120 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 5121 | early_stop_thresholds->roam_earlystop_thres_min = |
| 5122 | roam_req->roam_earlystop_thres_min; |
| 5123 | early_stop_thresholds->roam_earlystop_thres_max = |
| 5124 | roam_req->roam_earlystop_thres_max; |
| 5125 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 5126 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 5127 | WMITLV_GET_STRUCT_TLVLEN |
| 5128 | (wmi_roam_earlystop_rssi_thres_param)); |
| 5129 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5130 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 5131 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5132 | sizeof(wmi_roam_dense_thres_param)); |
| 5133 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5134 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 5135 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 5136 | roam_req->dense_rssi_thresh_offset; |
| 5137 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 5138 | dense_thresholds->roam_dense_traffic_thres = |
| 5139 | roam_req->traffic_threshold; |
| 5140 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 5141 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 5142 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 5143 | WMITLV_GET_STRUCT_TLVLEN |
| 5144 | (wmi_roam_dense_thres_param)); |
| 5145 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5146 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5147 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5148 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5149 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5150 | status); |
| 5151 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5152 | } |
| 5153 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5154 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5155 | } |
| 5156 | |
| 5157 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5158 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 5159 | * configuration params |
| 5160 | * @wma_handle: wma handler |
| 5161 | * @dwelltime_params: pointer to dwelltime_params |
| 5162 | * |
| 5163 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 5164 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5165 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5166 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5167 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 5168 | { |
| 5169 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 5170 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 5171 | wmi_buf_t buf; |
| 5172 | uint8_t *buf_ptr; |
| 5173 | int32_t err; |
| 5174 | int len; |
| 5175 | |
| 5176 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5177 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5178 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 5179 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5180 | if (!buf) { |
| 5181 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 5182 | __func__); |
| 5183 | return QDF_STATUS_E_NOMEM; |
| 5184 | } |
| 5185 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5186 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 5187 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 5188 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 5189 | WMITLV_GET_STRUCT_TLVLEN |
| 5190 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 5191 | |
| 5192 | dwell_param->enable = dwelltime_params->is_enabled; |
| 5193 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5194 | WMITLV_SET_HDR(buf_ptr, |
| 5195 | WMITLV_TAG_ARRAY_STRUC, |
| 5196 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5197 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5198 | |
| 5199 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 5200 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5201 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 5202 | WMITLV_GET_STRUCT_TLVLEN( |
| 5203 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5204 | |
| 5205 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 5206 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 5207 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 5208 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 5209 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 5210 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 5211 | if (err) { |
| 5212 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 5213 | wmi_buf_free(buf); |
| 5214 | return QDF_STATUS_E_FAILURE; |
| 5215 | } |
| 5216 | |
| 5217 | return QDF_STATUS_SUCCESS; |
| 5218 | } |
| 5219 | |
| 5220 | |
| 5221 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5222 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 5223 | * @wmi_handle: wmi handle |
| 5224 | * @roam_req: Request which contains the filters |
| 5225 | * |
| 5226 | * There are filters such as whitelist, blacklist and preferred |
| 5227 | * list that need to be applied to the scan results to form the |
| 5228 | * probable candidates for roaming. |
| 5229 | * |
| 5230 | * Return: Return success upon succesfully passing the |
| 5231 | * parameters to the firmware, otherwise failure. |
| 5232 | */ |
| 5233 | QDF_STATUS send_roam_scan_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 5234 | struct roam_scan_filter_params *roam_req) |
| 5235 | { |
| 5236 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5237 | QDF_STATUS status; |
| 5238 | uint32_t i; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5239 | uint32_t len; |
| 5240 | uint8_t *buf_ptr; |
| 5241 | wmi_roam_filter_fixed_param *roam_filter; |
| 5242 | uint8_t *bssid_src_ptr = NULL; |
| 5243 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 5244 | wmi_ssid *ssid_ptr = NULL; |
| 5245 | uint32_t *bssid_preferred_factor_ptr = NULL; |
| 5246 | |
| 5247 | len = sizeof(wmi_roam_filter_fixed_param); |
| 5248 | len += WMI_TLV_HDR_SIZE; |
| 5249 | len += roam_req->len; |
| 5250 | |
| 5251 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5252 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5253 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5254 | return QDF_STATUS_E_NOMEM; |
| 5255 | } |
| 5256 | |
| 5257 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 5258 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 5259 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 5260 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 5261 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 5262 | /* fill in fixed values */ |
| 5263 | roam_filter->vdev_id = roam_req->session_id; |
| 5264 | roam_filter->flags = 0; |
| 5265 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 5266 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 5267 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 5268 | roam_filter->num_bssid_preferred_list = |
| 5269 | roam_req->num_bssid_preferred_list; |
| 5270 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 5271 | |
| 5272 | WMITLV_SET_HDR((buf_ptr), |
| 5273 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5274 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 5275 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 5276 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5277 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 5278 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 5279 | bssid_src_ptr += ATH_MAC_LEN; |
| 5280 | bssid_dst_ptr++; |
| 5281 | } |
| 5282 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5283 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 5284 | WMITLV_SET_HDR((buf_ptr), |
| 5285 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5286 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 5287 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5288 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 5289 | qdf_mem_copy(&ssid_ptr->ssid, |
| 5290 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 5291 | roam_req->ssid_allowed_list[i].length); |
| 5292 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 5293 | ssid_ptr++; |
| 5294 | } |
| 5295 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 5296 | sizeof(wmi_ssid)); |
| 5297 | WMITLV_SET_HDR((buf_ptr), |
| 5298 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5299 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 5300 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 5301 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5302 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5303 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 5304 | (wmi_mac_addr *)bssid_dst_ptr); |
| 5305 | bssid_src_ptr += ATH_MAC_LEN; |
| 5306 | bssid_dst_ptr++; |
| 5307 | } |
| 5308 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5309 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 5310 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 5311 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 5312 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5313 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5314 | *bssid_preferred_factor_ptr = |
| 5315 | roam_req->bssid_favored_factor[i]; |
| 5316 | bssid_preferred_factor_ptr++; |
| 5317 | } |
| 5318 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5319 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 5320 | |
| 5321 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5322 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5323 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5324 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5325 | status); |
| 5326 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5327 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5328 | |
| 5329 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5330 | } |
| 5331 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5332 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 5333 | * @wmi_handle: wmi handle |
| 5334 | * @req: epno config params request structure |
| 5335 | * |
| 5336 | * This function reads the incoming epno config request structure |
| 5337 | * and constructs the WMI message to the firmware. |
| 5338 | * |
| 5339 | * Returns: 0 on success, error number otherwise |
| 5340 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5341 | 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] | 5342 | struct wifi_enhanched_pno_params *req) |
| 5343 | { |
| 5344 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 5345 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5346 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5347 | u_int8_t i, *buf_ptr; |
| 5348 | wmi_buf_t buf; |
| 5349 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5350 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5351 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5352 | /* Fixed Params */ |
| 5353 | len = sizeof(*cmd); |
| 5354 | if (req->num_networks) { |
| 5355 | /* TLV place holder for array of structures |
| 5356 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 5357 | */ |
| 5358 | len += WMI_TLV_HDR_SIZE; |
| 5359 | len += (sizeof(nlo_configured_parameters) |
| 5360 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 5361 | /* TLV for array of uint32 channel_list */ |
| 5362 | len += WMI_TLV_HDR_SIZE; |
| 5363 | /* TLV for nlo_channel_prediction_cfg */ |
| 5364 | len += WMI_TLV_HDR_SIZE; |
| 5365 | /* TLV for candidate score params */ |
| 5366 | len += sizeof(enlo_candidate_score_params); |
| 5367 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5368 | |
| 5369 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5370 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5371 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5372 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5373 | } |
| 5374 | |
| 5375 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5376 | |
| 5377 | buf_ptr = (u_int8_t *) cmd; |
| 5378 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5379 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5380 | WMITLV_GET_STRUCT_TLVLEN( |
| 5381 | wmi_nlo_config_cmd_fixed_param)); |
| 5382 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5383 | |
| 5384 | /* set flag to reset if num of networks are 0 */ |
| 5385 | cmd->flags = (req->num_networks == 0 ? |
| 5386 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5387 | |
| 5388 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 5389 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5390 | 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] | 5391 | WMI_LOGD("SSID count: %d flags: %d", |
| 5392 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5393 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5394 | /* Fill nlo_config only when num_networks are non zero */ |
| 5395 | if (cmd->no_of_ssids) { |
| 5396 | /* Fill networks */ |
| 5397 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5398 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 5399 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5400 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5401 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 5402 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 5403 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 5404 | WMITLV_TAG_ARRAY_BYTE, |
| 5405 | WMITLV_GET_STRUCT_TLVLEN( |
| 5406 | nlo_configured_parameters)); |
| 5407 | /* Copy ssid and it's length */ |
| 5408 | nlo_list[i].ssid.valid = true; |
| 5409 | nlo_list[i].ssid.ssid.ssid_len = |
| 5410 | req->networks[i].ssid.length; |
| 5411 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 5412 | req->networks[i].ssid.mac_ssid, |
| 5413 | nlo_list[i].ssid.ssid.ssid_len); |
| 5414 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 5415 | nlo_list[i].ssid.ssid.ssid_len, |
| 5416 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 5417 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5418 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5419 | /* Copy pno flags */ |
| 5420 | nlo_list[i].bcast_nw_type.valid = true; |
| 5421 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 5422 | req->networks[i].flags; |
| 5423 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5424 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 5425 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5426 | /* Copy auth bit field */ |
| 5427 | nlo_list[i].auth_type.valid = true; |
| 5428 | nlo_list[i].auth_type.auth_type = |
| 5429 | req->networks[i].auth_bit_field; |
| 5430 | WMI_LOGD("Auth bit field (%u)", |
| 5431 | nlo_list[i].auth_type.auth_type); |
| 5432 | } |
| 5433 | |
| 5434 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 5435 | /* Fill the channel list */ |
| 5436 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 5437 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5438 | |
| 5439 | /* Fill prediction_param */ |
| 5440 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5441 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5442 | |
| 5443 | /* Fill epno candidate score params */ |
| 5444 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 5445 | WMITLV_SET_HDR(buf_ptr, |
| 5446 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 5447 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 5448 | cand_score_params->min5GHz_rssi = |
| 5449 | req->min_5ghz_rssi; |
| 5450 | cand_score_params->min24GHz_rssi = |
| 5451 | req->min_24ghz_rssi; |
| 5452 | cand_score_params->initial_score_max = |
| 5453 | req->initial_score_max; |
| 5454 | cand_score_params->current_connection_bonus = |
| 5455 | req->current_connection_bonus; |
| 5456 | cand_score_params->same_network_bonus = |
| 5457 | req->same_network_bonus; |
| 5458 | cand_score_params->secure_bonus = |
| 5459 | req->secure_bonus; |
| 5460 | cand_score_params->band5GHz_bonus = |
| 5461 | req->band_5ghz_bonus; |
| 5462 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5463 | } |
| 5464 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5465 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5466 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5467 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5468 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5469 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5470 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5471 | } |
| 5472 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5473 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5474 | req->session_id); |
| 5475 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5476 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5477 | } |
| 5478 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5479 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5480 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 5481 | * @wmi_handle: wmi handle |
| 5482 | * @ipa_offload: ipa offload control parameter |
| 5483 | * |
| 5484 | * Returns: 0 on success, error number otherwise |
| 5485 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5486 | 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] | 5487 | struct ipa_offload_control_params *ipa_offload) |
| 5488 | { |
| 5489 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 5490 | wmi_buf_t wmi_buf; |
| 5491 | uint32_t len; |
| 5492 | u_int8_t *buf_ptr; |
| 5493 | |
| 5494 | len = sizeof(*cmd); |
| 5495 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5496 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5497 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 5498 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5499 | } |
| 5500 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5501 | WMI_LOGE("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5502 | ipa_offload->offload_type, ipa_offload->enable); |
| 5503 | |
| 5504 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 5505 | |
| 5506 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 5507 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5508 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 5509 | WMITLV_GET_STRUCT_TLVLEN( |
| 5510 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 5511 | |
| 5512 | cmd->offload_type = ipa_offload->offload_type; |
| 5513 | cmd->vdev_id = ipa_offload->vdev_id; |
| 5514 | cmd->enable = ipa_offload->enable; |
| 5515 | |
| 5516 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5517 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5518 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5519 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5520 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5521 | } |
| 5522 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5523 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5524 | } |
| 5525 | |
| 5526 | /** |
| 5527 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 5528 | * @wmi_handle: wmi handle |
| 5529 | * @pgetcapab: get capabilities params |
| 5530 | * |
| 5531 | * This function send request to fw to get extscan capabilities. |
| 5532 | * |
| 5533 | * Return: CDF status |
| 5534 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5535 | 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] | 5536 | struct extscan_capabilities_params *pgetcapab) |
| 5537 | { |
| 5538 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 5539 | wmi_buf_t wmi_buf; |
| 5540 | uint32_t len; |
| 5541 | uint8_t *buf_ptr; |
| 5542 | |
| 5543 | len = sizeof(*cmd); |
| 5544 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5545 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5546 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5547 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5548 | } |
| 5549 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5550 | |
| 5551 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 5552 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5553 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 5554 | WMITLV_GET_STRUCT_TLVLEN |
| 5555 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 5556 | |
| 5557 | cmd->request_id = pgetcapab->request_id; |
| 5558 | |
| 5559 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5560 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5561 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5562 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5563 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5564 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5565 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5566 | } |
| 5567 | |
| 5568 | /** |
| 5569 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 5570 | * @wmi_handle: wmi handle |
| 5571 | * @pcached_results: cached results parameters |
| 5572 | * |
| 5573 | * This function send request to fw to get cached results. |
| 5574 | * |
| 5575 | * Return: CDF status |
| 5576 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5577 | 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] | 5578 | struct extscan_cached_result_params *pcached_results) |
| 5579 | { |
| 5580 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 5581 | wmi_buf_t wmi_buf; |
| 5582 | uint32_t len; |
| 5583 | uint8_t *buf_ptr; |
| 5584 | |
| 5585 | len = sizeof(*cmd); |
| 5586 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5587 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5588 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5589 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5590 | } |
| 5591 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5592 | |
| 5593 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 5594 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5595 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 5596 | WMITLV_GET_STRUCT_TLVLEN |
| 5597 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 5598 | |
| 5599 | cmd->request_id = pcached_results->request_id; |
| 5600 | cmd->vdev_id = pcached_results->session_id; |
| 5601 | cmd->control_flags = pcached_results->flush; |
| 5602 | |
| 5603 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5604 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5605 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5606 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5607 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5608 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5609 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5610 | } |
| 5611 | |
| 5612 | /** |
| 5613 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 5614 | * @wmi_handle: wmi handle |
| 5615 | * @reset_req: Reset change request params |
| 5616 | * |
| 5617 | * This function sends stop change monitor request to fw. |
| 5618 | * |
| 5619 | * Return: CDF status |
| 5620 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5621 | 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] | 5622 | struct extscan_capabilities_reset_params *reset_req) |
| 5623 | { |
| 5624 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 5625 | wmi_buf_t wmi_buf; |
| 5626 | uint32_t len; |
| 5627 | uint8_t *buf_ptr; |
| 5628 | int change_list = 0; |
| 5629 | |
| 5630 | len = sizeof(*cmd); |
| 5631 | |
| 5632 | /* reset significant change tlv is set to 0 */ |
| 5633 | len += WMI_TLV_HDR_SIZE; |
| 5634 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 5635 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5636 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5637 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5638 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5639 | } |
| 5640 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5641 | |
| 5642 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 5643 | buf_ptr; |
| 5644 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5645 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 5646 | WMITLV_GET_STRUCT_TLVLEN |
| 5647 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 5648 | |
| 5649 | cmd->request_id = reset_req->request_id; |
| 5650 | cmd->vdev_id = reset_req->session_id; |
| 5651 | cmd->mode = 0; |
| 5652 | |
| 5653 | buf_ptr += sizeof(*cmd); |
| 5654 | WMITLV_SET_HDR(buf_ptr, |
| 5655 | WMITLV_TAG_ARRAY_STRUC, |
| 5656 | change_list * |
| 5657 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5658 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 5659 | sizeof |
| 5660 | (wmi_extscan_wlan_change_bssid_param)); |
| 5661 | |
| 5662 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5663 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5664 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5665 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5666 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5667 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5668 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5669 | } |
| 5670 | |
| 5671 | /** |
| 5672 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 5673 | * @wmi_handle: wmi handle |
| 5674 | * @psigchange: change monitor request params |
| 5675 | * @buf: wmi buffer |
| 5676 | * @buf_len: buffer length |
| 5677 | * |
| 5678 | * This function fills elements of change monitor request buffer. |
| 5679 | * |
| 5680 | * Return: CDF status |
| 5681 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5682 | 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] | 5683 | struct extscan_set_sig_changereq_params |
| 5684 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 5685 | { |
| 5686 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 5687 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 5688 | uint8_t *buf_ptr; |
| 5689 | int j; |
| 5690 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 5691 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5692 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 5693 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 5694 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5695 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 5696 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5697 | } |
| 5698 | len += WMI_TLV_HDR_SIZE; |
| 5699 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 5700 | |
| 5701 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 5702 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5703 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5704 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5705 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5706 | } |
| 5707 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 5708 | cmd = |
| 5709 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 5710 | buf_ptr; |
| 5711 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5712 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 5713 | WMITLV_GET_STRUCT_TLVLEN |
| 5714 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 5715 | |
| 5716 | cmd->request_id = psigchange->request_id; |
| 5717 | cmd->vdev_id = psigchange->session_id; |
| 5718 | cmd->total_entries = numap; |
| 5719 | cmd->mode = 1; |
| 5720 | cmd->num_entries_in_page = numap; |
| 5721 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 5722 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 5723 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 5724 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 5725 | |
| 5726 | buf_ptr += sizeof(*cmd); |
| 5727 | WMITLV_SET_HDR(buf_ptr, |
| 5728 | WMITLV_TAG_ARRAY_STRUC, |
| 5729 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5730 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 5731 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 5732 | |
| 5733 | for (j = 0; j < numap; j++) { |
| 5734 | WMITLV_SET_HDR(dest_chglist, |
| 5735 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 5736 | WMITLV_GET_STRUCT_TLVLEN |
| 5737 | (wmi_extscan_wlan_change_bssid_param)); |
| 5738 | |
| 5739 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 5740 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 5741 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 5742 | &dest_chglist->bssid); |
| 5743 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5744 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5745 | dest_chglist->lower_rssi_limit); |
| 5746 | dest_chglist++; |
| 5747 | src_ap++; |
| 5748 | } |
| 5749 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5750 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 5751 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5752 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5753 | } |
| 5754 | |
| 5755 | /** |
| 5756 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 5757 | * @wmi_handle: wmi handle |
| 5758 | * @psigchange: change monitor request params |
| 5759 | * |
| 5760 | * This function sends start change monitor request to fw. |
| 5761 | * |
| 5762 | * Return: CDF status |
| 5763 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5764 | 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] | 5765 | struct extscan_set_sig_changereq_params * |
| 5766 | psigchange) |
| 5767 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5768 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5769 | wmi_buf_t buf; |
| 5770 | int len; |
| 5771 | |
| 5772 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5773 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5774 | psigchange, &buf, |
| 5775 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5776 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 5777 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5778 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5779 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5780 | } |
| 5781 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5782 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 5783 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5784 | } |
| 5785 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5786 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5787 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5788 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5789 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5790 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5791 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5792 | } |
| 5793 | |
| 5794 | /** |
| 5795 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 5796 | * @wmi_handle: wmi handle |
| 5797 | * @photlist_reset: hotlist reset params |
| 5798 | * |
| 5799 | * This function configures hotlist monitor to stop in fw. |
| 5800 | * |
| 5801 | * Return: CDF status |
| 5802 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5803 | 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] | 5804 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 5805 | { |
| 5806 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 5807 | wmi_buf_t wmi_buf; |
| 5808 | uint32_t len; |
| 5809 | uint8_t *buf_ptr; |
| 5810 | int hotlist_entries = 0; |
| 5811 | |
| 5812 | len = sizeof(*cmd); |
| 5813 | |
| 5814 | /* reset bssid hotlist with tlv set to 0 */ |
| 5815 | len += WMI_TLV_HDR_SIZE; |
| 5816 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 5817 | |
| 5818 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5819 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5820 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5821 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5822 | } |
| 5823 | |
| 5824 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5825 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 5826 | buf_ptr; |
| 5827 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5828 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 5829 | WMITLV_GET_STRUCT_TLVLEN |
| 5830 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 5831 | |
| 5832 | cmd->request_id = photlist_reset->request_id; |
| 5833 | cmd->vdev_id = photlist_reset->session_id; |
| 5834 | cmd->mode = 0; |
| 5835 | |
| 5836 | buf_ptr += sizeof(*cmd); |
| 5837 | WMITLV_SET_HDR(buf_ptr, |
| 5838 | WMITLV_TAG_ARRAY_STRUC, |
| 5839 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 5840 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5841 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 5842 | |
| 5843 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5844 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5845 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5846 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5847 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5848 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5849 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5850 | } |
| 5851 | |
| 5852 | /** |
| 5853 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 5854 | * @wmi_handle: wmi handle |
| 5855 | * @pstopcmd: stop scan command request params |
| 5856 | * |
| 5857 | * This function sends stop extscan request to fw. |
| 5858 | * |
| 5859 | * Return: CDF Status. |
| 5860 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5861 | QDF_STATUS send_stop_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5862 | struct extscan_stop_req_params *pstopcmd) |
| 5863 | { |
| 5864 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 5865 | wmi_buf_t wmi_buf; |
| 5866 | uint32_t len; |
| 5867 | uint8_t *buf_ptr; |
| 5868 | |
| 5869 | len = sizeof(*cmd); |
| 5870 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5871 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5872 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5873 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5874 | } |
| 5875 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5876 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 5877 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5878 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 5879 | WMITLV_GET_STRUCT_TLVLEN |
| 5880 | (wmi_extscan_stop_cmd_fixed_param)); |
| 5881 | |
| 5882 | cmd->request_id = pstopcmd->request_id; |
| 5883 | cmd->vdev_id = pstopcmd->session_id; |
| 5884 | |
| 5885 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5886 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5887 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5888 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5889 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5890 | } |
| 5891 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5892 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5893 | } |
| 5894 | |
| 5895 | /** |
| 5896 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 5897 | * @wmi_handle: wmi handle |
| 5898 | * @pstart: scan command request params |
| 5899 | * @buf: event buffer |
| 5900 | * @buf_len: length of buffer |
| 5901 | * |
| 5902 | * This function fills individual elements of extscan request and |
| 5903 | * TLV for buckets, channel list. |
| 5904 | * |
| 5905 | * Return: CDF Status. |
| 5906 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5907 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5908 | 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] | 5909 | struct wifi_scan_cmd_req_params *pstart, |
| 5910 | wmi_buf_t *buf, int *buf_len) |
| 5911 | { |
| 5912 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 5913 | wmi_extscan_bucket *dest_blist; |
| 5914 | wmi_extscan_bucket_channel *dest_clist; |
| 5915 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 5916 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 5917 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 5918 | |
| 5919 | uint8_t *buf_ptr; |
| 5920 | int i, k, count = 0; |
| 5921 | int len = sizeof(*cmd); |
| 5922 | int nbuckets = pstart->numBuckets; |
| 5923 | int nchannels = 0; |
| 5924 | |
| 5925 | /* These TLV's are are NULL by default */ |
| 5926 | uint32_t ie_len_with_pad = 0; |
| 5927 | int num_ssid = 0; |
| 5928 | int num_bssid = 0; |
| 5929 | int ie_len = 0; |
| 5930 | |
| 5931 | uint32_t base_period = pstart->basePeriod; |
| 5932 | |
| 5933 | /* TLV placeholder for ssid_list (NULL) */ |
| 5934 | len += WMI_TLV_HDR_SIZE; |
| 5935 | len += num_ssid * sizeof(wmi_ssid); |
| 5936 | |
| 5937 | /* TLV placeholder for bssid_list (NULL) */ |
| 5938 | len += WMI_TLV_HDR_SIZE; |
| 5939 | len += num_bssid * sizeof(wmi_mac_addr); |
| 5940 | |
| 5941 | /* TLV placeholder for ie_data (NULL) */ |
| 5942 | len += WMI_TLV_HDR_SIZE; |
| 5943 | len += ie_len * sizeof(uint32_t); |
| 5944 | |
| 5945 | /* TLV placeholder for bucket */ |
| 5946 | len += WMI_TLV_HDR_SIZE; |
| 5947 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 5948 | |
| 5949 | /* TLV channel placeholder */ |
| 5950 | len += WMI_TLV_HDR_SIZE; |
| 5951 | for (i = 0; i < nbuckets; i++) { |
| 5952 | nchannels += src_bucket->numChannels; |
| 5953 | src_bucket++; |
| 5954 | } |
| 5955 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5956 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5957 | __func__, nbuckets, nchannels); |
| 5958 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 5959 | /* Allocate the memory */ |
| 5960 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 5961 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5962 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5963 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5964 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5965 | } |
| 5966 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 5967 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 5968 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5969 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 5970 | WMITLV_GET_STRUCT_TLVLEN |
| 5971 | (wmi_extscan_start_cmd_fixed_param)); |
| 5972 | |
| 5973 | cmd->request_id = pstart->requestId; |
| 5974 | cmd->vdev_id = pstart->sessionId; |
| 5975 | cmd->base_period = pstart->basePeriod; |
| 5976 | cmd->num_buckets = nbuckets; |
| 5977 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 5978 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5979 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5980 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5981 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5982 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5983 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 5984 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 5985 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 5986 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 5987 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5988 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 5989 | |
| 5990 | /* The max dwell time is retrieved from the first channel |
| 5991 | * of the first bucket and kept common for all channels. |
| 5992 | */ |
| 5993 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 5994 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 5995 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 5996 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 5997 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 5998 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 5999 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 6000 | |
| 6001 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6002 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6003 | cmd->probe_delay = 0; |
| 6004 | cmd->probe_spacing_time = 0; |
| 6005 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6006 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 6007 | WMI_SCAN_ADD_CCK_RATES | |
| 6008 | WMI_SCAN_ADD_OFDM_RATES | |
| 6009 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 6010 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6011 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 6012 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 6013 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6014 | cmd->num_ssids = 0; |
| 6015 | cmd->num_bssid = 0; |
| 6016 | cmd->ie_len = 0; |
| 6017 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 6018 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 6019 | |
| 6020 | buf_ptr += sizeof(*cmd); |
| 6021 | WMITLV_SET_HDR(buf_ptr, |
| 6022 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6023 | num_ssid * sizeof(wmi_ssid)); |
| 6024 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 6025 | |
| 6026 | WMITLV_SET_HDR(buf_ptr, |
| 6027 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6028 | num_bssid * sizeof(wmi_mac_addr)); |
| 6029 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 6030 | |
| 6031 | ie_len_with_pad = 0; |
| 6032 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 6033 | ie_len_with_pad); |
| 6034 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 6035 | |
| 6036 | WMITLV_SET_HDR(buf_ptr, |
| 6037 | WMITLV_TAG_ARRAY_STRUC, |
| 6038 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 6039 | dest_blist = (wmi_extscan_bucket *) |
| 6040 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6041 | src_bucket = pstart->buckets; |
| 6042 | |
| 6043 | /* Retrieve scanning information from each bucket and |
| 6044 | * channels and send it to the target |
| 6045 | */ |
| 6046 | for (i = 0; i < nbuckets; i++) { |
| 6047 | WMITLV_SET_HDR(dest_blist, |
| 6048 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6049 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 6050 | |
| 6051 | dest_blist->bucket_id = src_bucket->bucket; |
| 6052 | dest_blist->base_period_multiplier = |
| 6053 | src_bucket->period / base_period; |
| 6054 | dest_blist->min_period = src_bucket->period; |
| 6055 | dest_blist->max_period = src_bucket->max_period; |
| 6056 | dest_blist->exp_backoff = src_bucket->exponent; |
| 6057 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 6058 | dest_blist->channel_band = src_bucket->band; |
| 6059 | dest_blist->num_channels = src_bucket->numChannels; |
| 6060 | dest_blist->notify_extscan_events = 0; |
| 6061 | |
| 6062 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 6063 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 6064 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 6065 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6066 | |
| 6067 | if (src_bucket->reportEvents & |
| 6068 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 6069 | dest_blist->forwarding_flags = |
| 6070 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 6071 | dest_blist->notify_extscan_events |= |
| 6072 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 6073 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 6074 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 6075 | } else { |
| 6076 | dest_blist->forwarding_flags = |
| 6077 | WMI_EXTSCAN_NO_FORWARDING; |
| 6078 | } |
| 6079 | |
| 6080 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 6081 | dest_blist->configuration_flags = 0; |
| 6082 | else |
| 6083 | dest_blist->configuration_flags = |
| 6084 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 6085 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6086 | 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] | 6087 | __func__, dest_blist->notify_extscan_events, |
| 6088 | dest_blist->configuration_flags, |
| 6089 | dest_blist->forwarding_flags); |
| 6090 | |
| 6091 | dest_blist->min_dwell_time_active = |
| 6092 | src_bucket->min_dwell_time_active; |
| 6093 | dest_blist->max_dwell_time_active = |
| 6094 | src_bucket->max_dwell_time_active; |
| 6095 | dest_blist->min_dwell_time_passive = |
| 6096 | src_bucket->min_dwell_time_passive; |
| 6097 | dest_blist->max_dwell_time_passive = |
| 6098 | src_bucket->max_dwell_time_passive; |
| 6099 | src_channel = src_bucket->channels; |
| 6100 | |
| 6101 | /* save the channel info to later populate |
| 6102 | * the channel TLV |
| 6103 | */ |
| 6104 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 6105 | save_channel[count++].channel = src_channel->channel; |
| 6106 | src_channel++; |
| 6107 | } |
| 6108 | dest_blist++; |
| 6109 | src_bucket++; |
| 6110 | } |
| 6111 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 6112 | WMITLV_SET_HDR(buf_ptr, |
| 6113 | WMITLV_TAG_ARRAY_STRUC, |
| 6114 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6115 | dest_clist = (wmi_extscan_bucket_channel *) |
| 6116 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6117 | |
| 6118 | /* Active or passive scan is based on the bucket dwell time |
| 6119 | * and channel specific active,passive scans are not |
| 6120 | * supported yet |
| 6121 | */ |
| 6122 | for (i = 0; i < nchannels; i++) { |
| 6123 | WMITLV_SET_HDR(dest_clist, |
| 6124 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 6125 | WMITLV_GET_STRUCT_TLVLEN |
| 6126 | (wmi_extscan_bucket_channel)); |
| 6127 | dest_clist->channel = save_channel[i].channel; |
| 6128 | dest_clist++; |
| 6129 | } |
| 6130 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6131 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6132 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6133 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6134 | } |
| 6135 | |
| 6136 | /** |
| 6137 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 6138 | * @wmi_handle: wmi handle |
| 6139 | * @pstart: scan command request params |
| 6140 | * |
| 6141 | * This function sends start extscan request to fw. |
| 6142 | * |
| 6143 | * Return: CDF Status. |
| 6144 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6145 | QDF_STATUS send_start_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6146 | struct wifi_scan_cmd_req_params *pstart) |
| 6147 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6148 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6149 | wmi_buf_t buf; |
| 6150 | int len; |
| 6151 | |
| 6152 | /* Fill individual elements of extscan request and |
| 6153 | * TLV for buckets, channel list. |
| 6154 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6155 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6156 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6157 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6158 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 6159 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6160 | } |
| 6161 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6162 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6163 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6164 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6165 | } |
| 6166 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 6167 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6168 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6169 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6170 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6171 | } |
| 6172 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6173 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6174 | } |
| 6175 | |
| 6176 | /** |
| 6177 | * send_plm_stop_cmd_tlv() - plm stop request |
| 6178 | * @wmi_handle: wmi handle |
| 6179 | * @plm: plm request parameters |
| 6180 | * |
| 6181 | * This function request FW to stop PLM. |
| 6182 | * |
| 6183 | * Return: CDF status |
| 6184 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6185 | QDF_STATUS send_plm_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6186 | const struct plm_req_params *plm) |
| 6187 | { |
| 6188 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 6189 | int32_t len; |
| 6190 | wmi_buf_t buf; |
| 6191 | uint8_t *buf_ptr; |
| 6192 | int ret; |
| 6193 | |
| 6194 | len = sizeof(*cmd); |
| 6195 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6196 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6197 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6198 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6199 | } |
| 6200 | |
| 6201 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 6202 | |
| 6203 | buf_ptr = (uint8_t *) cmd; |
| 6204 | |
| 6205 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6206 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 6207 | WMITLV_GET_STRUCT_TLVLEN |
| 6208 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 6209 | |
| 6210 | cmd->vdev_id = plm->session_id; |
| 6211 | |
| 6212 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6213 | 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] | 6214 | |
| 6215 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6216 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 6217 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6218 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6219 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6220 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6221 | } |
| 6222 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6223 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6224 | } |
| 6225 | |
| 6226 | /** |
| 6227 | * send_plm_start_cmd_tlv() - plm start request |
| 6228 | * @wmi_handle: wmi handle |
| 6229 | * @plm: plm request parameters |
| 6230 | * |
| 6231 | * This function request FW to start PLM. |
| 6232 | * |
| 6233 | * Return: CDF status |
| 6234 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6235 | QDF_STATUS send_plm_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6236 | const struct plm_req_params *plm, |
| 6237 | uint32_t *gchannel_list) |
| 6238 | { |
| 6239 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 6240 | uint32_t *channel_list; |
| 6241 | int32_t len; |
| 6242 | wmi_buf_t buf; |
| 6243 | uint8_t *buf_ptr; |
| 6244 | uint8_t count; |
| 6245 | int ret; |
| 6246 | |
| 6247 | /* TLV place holder for channel_list */ |
| 6248 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 6249 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 6250 | |
| 6251 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6252 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6253 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6254 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6255 | } |
| 6256 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 6257 | |
| 6258 | buf_ptr = (uint8_t *) cmd; |
| 6259 | |
| 6260 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6261 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 6262 | WMITLV_GET_STRUCT_TLVLEN |
| 6263 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 6264 | |
| 6265 | cmd->vdev_id = plm->session_id; |
| 6266 | |
| 6267 | cmd->meas_token = plm->meas_token; |
| 6268 | cmd->dialog_token = plm->diag_token; |
| 6269 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6270 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6271 | cmd->off_duration = plm->meas_duration; |
| 6272 | cmd->burst_cycle = plm->burst_len; |
| 6273 | cmd->tx_power = plm->desired_tx_pwr; |
| 6274 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 6275 | cmd->num_chans = plm->plm_num_ch; |
| 6276 | |
| 6277 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 6278 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6279 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 6280 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 6281 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 6282 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 6283 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 6284 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 6285 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 6286 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6287 | |
| 6288 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6289 | (cmd->num_chans * sizeof(uint32_t))); |
| 6290 | |
| 6291 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6292 | if (cmd->num_chans) { |
| 6293 | channel_list = (uint32_t *) buf_ptr; |
| 6294 | for (count = 0; count < cmd->num_chans; count++) { |
| 6295 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6296 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6297 | channel_list[count] = |
| 6298 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6299 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6300 | } |
| 6301 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 6302 | } |
| 6303 | |
| 6304 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6305 | WMI_VDEV_PLMREQ_START_CMDID); |
| 6306 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6307 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6308 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6309 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6310 | } |
| 6311 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6312 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6313 | } |
| 6314 | |
| 6315 | /** |
| 6316 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 6317 | * @wmi_handle: wmi handle |
| 6318 | * @vdev_id: vdev id |
| 6319 | * |
| 6320 | * This function request FW to stop ongoing PNO operation. |
| 6321 | * |
| 6322 | * Return: CDF status |
| 6323 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6324 | 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] | 6325 | { |
| 6326 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6327 | int32_t len = sizeof(*cmd); |
| 6328 | wmi_buf_t buf; |
| 6329 | uint8_t *buf_ptr; |
| 6330 | int ret; |
| 6331 | |
| 6332 | /* |
| 6333 | * TLV place holder for array of structures nlo_configured_parameters |
| 6334 | * TLV place holder for array of uint32_t channel_list |
| 6335 | * TLV place holder for chnl prediction cfg |
| 6336 | */ |
| 6337 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6338 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6339 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6340 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6341 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6342 | } |
| 6343 | |
| 6344 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6345 | buf_ptr = (uint8_t *) cmd; |
| 6346 | |
| 6347 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6348 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6349 | WMITLV_GET_STRUCT_TLVLEN |
| 6350 | (wmi_nlo_config_cmd_fixed_param)); |
| 6351 | |
| 6352 | cmd->vdev_id = vdev_id; |
| 6353 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 6354 | buf_ptr += sizeof(*cmd); |
| 6355 | |
| 6356 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6357 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6358 | |
| 6359 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6360 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6361 | |
| 6362 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6363 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6364 | |
| 6365 | |
| 6366 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6367 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6368 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6369 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6370 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6371 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6372 | } |
| 6373 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6374 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6375 | } |
| 6376 | |
| 6377 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6378 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 6379 | * @buf_ptr: Buffer passed by upper layers |
| 6380 | * @pno: Buffer to be sent to the firmware |
| 6381 | * |
| 6382 | * Copy the PNO Channel prediction configuration parameters |
| 6383 | * passed by the upper layers to a WMI format TLV and send it |
| 6384 | * down to the firmware. |
| 6385 | * |
| 6386 | * Return: None |
| 6387 | */ |
| 6388 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 6389 | struct pno_scan_req_params *pno) |
| 6390 | { |
| 6391 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 6392 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 6393 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 6394 | WMITLV_TAG_ARRAY_BYTE, |
| 6395 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6396 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6397 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 6398 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 6399 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 6400 | channel_prediction_cfg->full_scan_period_ms = |
| 6401 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6402 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6403 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 6404 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 6405 | channel_prediction_cfg->enable, |
| 6406 | channel_prediction_cfg->top_k_num, |
| 6407 | channel_prediction_cfg->stationary_threshold, |
| 6408 | channel_prediction_cfg->full_scan_period_ms); |
| 6409 | } |
| 6410 | |
| 6411 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6412 | * send_pno_start_cmd_tlv() - PNO start request |
| 6413 | * @wmi_handle: wmi handle |
| 6414 | * @pno: PNO request |
| 6415 | * |
| 6416 | * This function request FW to start PNO request. |
| 6417 | * Request: CDF status |
| 6418 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6419 | QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6420 | struct pno_scan_req_params *pno, |
| 6421 | uint32_t *gchannel_freq_list) |
| 6422 | { |
| 6423 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6424 | nlo_configured_parameters *nlo_list; |
| 6425 | uint32_t *channel_list; |
| 6426 | int32_t len; |
| 6427 | wmi_buf_t buf; |
| 6428 | uint8_t *buf_ptr; |
| 6429 | uint8_t i; |
| 6430 | int ret; |
| 6431 | |
| 6432 | /* |
| 6433 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 6434 | * TLV place holder for array of uint32_t channel_list |
| 6435 | * TLV place holder for chnnl prediction cfg |
| 6436 | */ |
| 6437 | len = sizeof(*cmd) + |
| 6438 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6439 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6440 | len += sizeof(uint32_t) * QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6441 | WMI_NLO_MAX_CHAN); |
| 6442 | len += sizeof(nlo_configured_parameters) * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6443 | QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6444 | len += sizeof(nlo_channel_prediction_cfg); |
| 6445 | |
| 6446 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6447 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6448 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6449 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6450 | } |
| 6451 | |
| 6452 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6453 | |
| 6454 | buf_ptr = (uint8_t *) cmd; |
| 6455 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6456 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6457 | WMITLV_GET_STRUCT_TLVLEN |
| 6458 | (wmi_nlo_config_cmd_fixed_param)); |
| 6459 | cmd->vdev_id = pno->sessionId; |
| 6460 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 6461 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6462 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6463 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
| 6464 | pno->pnoscan_adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6465 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6466 | /* Current FW does not support min-max range for dwell time */ |
| 6467 | cmd->active_dwell_time = pno->active_max_time; |
| 6468 | cmd->passive_dwell_time = pno->passive_max_time; |
| 6469 | |
| 6470 | /* Copy scan interval */ |
| 6471 | cmd->fast_scan_period = pno->fast_scan_period; |
| 6472 | cmd->slow_scan_period = pno->slow_scan_period; |
| 6473 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6474 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6475 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6476 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6477 | |
| 6478 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6479 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6480 | cmd->no_of_ssids = QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
| 6481 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6482 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6483 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6484 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6485 | |
| 6486 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6487 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6488 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6489 | WMITLV_TAG_ARRAY_BYTE, |
| 6490 | WMITLV_GET_STRUCT_TLVLEN |
| 6491 | (nlo_configured_parameters)); |
| 6492 | /* Copy ssid and it's length */ |
| 6493 | nlo_list[i].ssid.valid = true; |
| 6494 | nlo_list[i].ssid.ssid.ssid_len = pno->aNetworks[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6495 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6496 | pno->aNetworks[i].ssid.mac_ssid, |
| 6497 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6498 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6499 | nlo_list[i].ssid.ssid.ssid_len, |
| 6500 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 6501 | nlo_list[i].ssid.ssid.ssid_len); |
| 6502 | |
| 6503 | /* Copy rssi threshold */ |
| 6504 | if (pno->aNetworks[i].rssiThreshold && |
| 6505 | pno->aNetworks[i].rssiThreshold > WMI_RSSI_THOLD_DEFAULT) { |
| 6506 | nlo_list[i].rssi_cond.valid = true; |
| 6507 | nlo_list[i].rssi_cond.rssi = |
| 6508 | pno->aNetworks[i].rssiThreshold; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6509 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6510 | nlo_list[i].rssi_cond.rssi); |
| 6511 | } |
| 6512 | nlo_list[i].bcast_nw_type.valid = true; |
| 6513 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6514 | pno->aNetworks[i].bcastNetwType; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6515 | WMI_LOGI("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6516 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6517 | } |
| 6518 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6519 | |
| 6520 | /* Copy channel info */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6521 | cmd->num_of_channels = QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6522 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6523 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6524 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6525 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 6526 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6527 | |
| 6528 | channel_list = (uint32_t *) buf_ptr; |
| 6529 | for (i = 0; i < cmd->num_of_channels; i++) { |
| 6530 | channel_list[i] = pno->aNetworks[0].aChannels[i]; |
| 6531 | |
| 6532 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
| 6533 | channel_list[i] = gchannel_freq_list[i]; |
| 6534 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6535 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6536 | } |
| 6537 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 6538 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6539 | sizeof(nlo_channel_prediction_cfg)); |
| 6540 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6541 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6542 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6543 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 6544 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 6545 | */ |
| 6546 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6547 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6548 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6549 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6550 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6551 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6552 | } |
| 6553 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6554 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6555 | } |
| 6556 | |
| 6557 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 6558 | * @wmi_handle: wmi handle |
| 6559 | * @msg: message |
| 6560 | * @is_add_ts: is addts required |
| 6561 | * |
| 6562 | * This function sets ric request element for 11r roaming. |
| 6563 | * |
| 6564 | * Return: CDF status |
| 6565 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6566 | 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] | 6567 | void *msg, uint8_t is_add_ts) |
| 6568 | { |
| 6569 | wmi_ric_request_fixed_param *cmd; |
| 6570 | wmi_ric_tspec *tspec_param; |
| 6571 | wmi_buf_t buf; |
| 6572 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6573 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6574 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 6575 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 6576 | |
| 6577 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6578 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6579 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6580 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6581 | } |
| 6582 | |
| 6583 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6584 | |
| 6585 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 6586 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6587 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 6588 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 6589 | if (is_add_ts) |
| 6590 | cmd->vdev_id = ((struct add_ts_param *) msg)->sessionId; |
| 6591 | else |
| 6592 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 6593 | cmd->num_ric_request = 1; |
| 6594 | cmd->is_add_ric = is_add_ts; |
| 6595 | |
| 6596 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 6597 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 6598 | |
| 6599 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6600 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 6601 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 6602 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 6603 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 6604 | |
| 6605 | if (is_add_ts) |
| 6606 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6607 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6608 | else |
| 6609 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6610 | #endif |
| 6611 | if (ptspecIE) { |
| 6612 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6613 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6614 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 6615 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6616 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6617 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 6618 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6619 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 6620 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6621 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 6622 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 6623 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 6624 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 6625 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 6626 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 6627 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 6628 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 6629 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 6630 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 6631 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 6632 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 6633 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 6634 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 6635 | tspec_param->medium_time = 0; |
| 6636 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6637 | 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] | 6638 | |
| 6639 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6640 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6641 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6642 | __func__); |
| 6643 | if (is_add_ts) |
| 6644 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6645 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6646 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6647 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6648 | } |
| 6649 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6650 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6651 | } |
| 6652 | |
| 6653 | /** |
| 6654 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 6655 | * @wmi_handle: wmi handle |
| 6656 | * @clear_req: ll stats clear request command params |
| 6657 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6658 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6659 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6660 | 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] | 6661 | const struct ll_stats_clear_params *clear_req, |
| 6662 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6663 | { |
| 6664 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 6665 | int32_t len; |
| 6666 | wmi_buf_t buf; |
| 6667 | uint8_t *buf_ptr; |
| 6668 | int ret; |
| 6669 | |
| 6670 | len = sizeof(*cmd); |
| 6671 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6672 | |
| 6673 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6674 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6675 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6676 | } |
| 6677 | |
| 6678 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6679 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6680 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 6681 | |
| 6682 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6683 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 6684 | WMITLV_GET_STRUCT_TLVLEN |
| 6685 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 6686 | |
| 6687 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 6688 | cmd->vdev_id = clear_req->sta_id; |
| 6689 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 6690 | |
| 6691 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 6692 | &cmd->peer_macaddr); |
| 6693 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6694 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 6695 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 6696 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 6697 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 6698 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6699 | cmd->peer_macaddr); */ |
| 6700 | |
| 6701 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6702 | WMI_CLEAR_LINK_STATS_CMDID); |
| 6703 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6704 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6705 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6706 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6707 | } |
| 6708 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6709 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 6710 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6711 | } |
| 6712 | |
| 6713 | /** |
| 6714 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 6715 | * @wmi_handle: wmi handle |
| 6716 | * @setReq: ll stats set request command params |
| 6717 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6718 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6719 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6720 | 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] | 6721 | const struct ll_stats_set_params *set_req) |
| 6722 | { |
| 6723 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 6724 | int32_t len; |
| 6725 | wmi_buf_t buf; |
| 6726 | uint8_t *buf_ptr; |
| 6727 | int ret; |
| 6728 | |
| 6729 | len = sizeof(*cmd); |
| 6730 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6731 | |
| 6732 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6733 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6734 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6735 | } |
| 6736 | |
| 6737 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6738 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6739 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 6740 | |
| 6741 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6742 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 6743 | WMITLV_GET_STRUCT_TLVLEN |
| 6744 | (wmi_start_link_stats_cmd_fixed_param)); |
| 6745 | |
| 6746 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 6747 | cmd->aggressive_statistics_gathering = |
| 6748 | set_req->aggressive_statistics_gathering; |
| 6749 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6750 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 6751 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 6752 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6753 | |
| 6754 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6755 | WMI_START_LINK_STATS_CMDID); |
| 6756 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6757 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6758 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6759 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6760 | } |
| 6761 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6762 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6763 | } |
| 6764 | |
| 6765 | /** |
| 6766 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 6767 | * @wmi_handle:wmi handle |
| 6768 | * @get_req:ll stats get request command params |
| 6769 | * @addr: mac address |
| 6770 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6771 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6772 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6773 | 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] | 6774 | const struct ll_stats_get_params *get_req, |
| 6775 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6776 | { |
| 6777 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 6778 | int32_t len; |
| 6779 | wmi_buf_t buf; |
| 6780 | uint8_t *buf_ptr; |
| 6781 | int ret; |
| 6782 | |
| 6783 | len = sizeof(*cmd); |
| 6784 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6785 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 6786 | if (!buf) { |
| 6787 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 6788 | return QDF_STATUS_E_NOMEM; |
| 6789 | } |
| 6790 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6791 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6792 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6793 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 6794 | |
| 6795 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6796 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 6797 | WMITLV_GET_STRUCT_TLVLEN |
| 6798 | (wmi_request_link_stats_cmd_fixed_param)); |
| 6799 | |
| 6800 | cmd->request_id = get_req->req_id; |
| 6801 | cmd->stats_type = get_req->param_id_mask; |
| 6802 | cmd->vdev_id = get_req->sta_id; |
| 6803 | |
| 6804 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 6805 | &cmd->peer_macaddr); |
| 6806 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6807 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
| 6808 | WMI_LOGD("Request ID : %d", cmd->request_id); |
| 6809 | WMI_LOGD("Stats Type : %d", cmd->stats_type); |
| 6810 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 6811 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6812 | |
| 6813 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6814 | WMI_REQUEST_LINK_STATS_CMDID); |
| 6815 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6816 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6817 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6818 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6819 | } |
| 6820 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6821 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6822 | } |
| 6823 | |
| 6824 | /** |
| 6825 | * send_get_stats_cmd_tlv() - get stats request |
| 6826 | * @wmi_handle: wmi handle |
| 6827 | * @get_stats_param: stats params |
| 6828 | * @addr: mac address |
| 6829 | * |
| 6830 | * Return: CDF status |
| 6831 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6832 | QDF_STATUS send_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6833 | struct pe_stats_req *get_stats_param, |
| 6834 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 6835 | { |
| 6836 | wmi_buf_t buf; |
| 6837 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6838 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6839 | |
| 6840 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6841 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6842 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 6843 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6844 | } |
| 6845 | |
| 6846 | |
| 6847 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6848 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6849 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6850 | WMITLV_GET_STRUCT_TLVLEN |
| 6851 | (wmi_request_stats_cmd_fixed_param)); |
| 6852 | cmd->stats_id = |
| 6853 | WMI_REQUEST_PEER_STAT | WMI_REQUEST_PDEV_STAT | |
Himanshu Agarwal | c9fc2a3 | 2016-07-21 14:46:58 +0530 | [diff] [blame] | 6854 | WMI_REQUEST_VDEV_STAT | WMI_REQUEST_RSSI_PER_CHAIN_STAT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6855 | cmd->vdev_id = get_stats_param->session_id; |
| 6856 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6857 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6858 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6859 | WMI_REQUEST_STATS_CMDID)) { |
| 6860 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6861 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6862 | __func__); |
| 6863 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6864 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6865 | } |
| 6866 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6867 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6868 | |
| 6869 | } |
| 6870 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6871 | /** |
| 6872 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 6873 | * @wmi_handle: wmi handle |
| 6874 | * @rssi_req: get RSSI request |
| 6875 | * |
| 6876 | * Return: CDF status |
| 6877 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6878 | QDF_STATUS send_snr_request_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6879 | { |
| 6880 | wmi_buf_t buf; |
| 6881 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6882 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6883 | |
| 6884 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6885 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6886 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6887 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6888 | } |
| 6889 | |
| 6890 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6891 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6892 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6893 | WMITLV_GET_STRUCT_TLVLEN |
| 6894 | (wmi_request_stats_cmd_fixed_param)); |
| 6895 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 6896 | if (wmi_unified_cmd_send |
| 6897 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6898 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6899 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6900 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6901 | } |
| 6902 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6903 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6904 | } |
| 6905 | |
| 6906 | /** |
| 6907 | * send_snr_cmd_tlv() - get RSSI from fw |
| 6908 | * @wmi_handle: wmi handle |
| 6909 | * @vdev_id: vdev id |
| 6910 | * |
| 6911 | * Return: CDF status |
| 6912 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6913 | 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] | 6914 | { |
| 6915 | wmi_buf_t buf; |
| 6916 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6917 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6918 | |
| 6919 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6920 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6921 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6922 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6923 | } |
| 6924 | |
| 6925 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6926 | cmd->vdev_id = vdev_id; |
| 6927 | |
| 6928 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6929 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6930 | WMITLV_GET_STRUCT_TLVLEN |
| 6931 | (wmi_request_stats_cmd_fixed_param)); |
| 6932 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 6933 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6934 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6935 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6936 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6937 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6938 | } |
| 6939 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6940 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6941 | } |
| 6942 | |
| 6943 | /** |
| 6944 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 6945 | * @wmi_handle: wmi handle |
| 6946 | * @link_status: get link params |
| 6947 | * |
| 6948 | * Return: CDF status |
| 6949 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6950 | 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] | 6951 | struct link_status_params *link_status) |
| 6952 | { |
| 6953 | wmi_buf_t buf; |
| 6954 | wmi_request_stats_cmd_fixed_param *cmd; |
| 6955 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 6956 | |
| 6957 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6958 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6959 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6960 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6961 | } |
| 6962 | |
| 6963 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 6964 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6965 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 6966 | WMITLV_GET_STRUCT_TLVLEN |
| 6967 | (wmi_request_stats_cmd_fixed_param)); |
| 6968 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 6969 | cmd->vdev_id = link_status->session_id; |
| 6970 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6971 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6972 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6973 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6974 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6975 | } |
| 6976 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6977 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6978 | } |
| 6979 | |
| 6980 | #ifdef FEATURE_WLAN_LPHB |
| 6981 | |
| 6982 | /** |
| 6983 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 6984 | * @wmi_handle: wmi handle |
| 6985 | * @lphb_conf_req: configuration info |
| 6986 | * |
| 6987 | * Return: CDF status |
| 6988 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6989 | 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] | 6990 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 6991 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6992 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6993 | wmi_buf_t buf = NULL; |
| 6994 | uint8_t *buf_ptr; |
| 6995 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 6996 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 6997 | |
| 6998 | |
| 6999 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7000 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7001 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7002 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7003 | } |
| 7004 | |
| 7005 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7006 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 7007 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 7008 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 7009 | WMITLV_GET_STRUCT_TLVLEN |
| 7010 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 7011 | |
| 7012 | /* fill in values */ |
| 7013 | hb_enable_fp->vdev_id = params->session; |
| 7014 | hb_enable_fp->enable = params->enable; |
| 7015 | hb_enable_fp->item = params->item; |
| 7016 | hb_enable_fp->session = params->session; |
| 7017 | |
| 7018 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7019 | len, WMI_HB_SET_ENABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7020 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7021 | 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] | 7022 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7023 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7024 | } |
| 7025 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7026 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7027 | } |
| 7028 | |
| 7029 | /** |
| 7030 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 7031 | * @wmi_handle: wmi handle |
| 7032 | * @lphb_conf_req: lphb config request |
| 7033 | * |
| 7034 | * Return: CDF status |
| 7035 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7036 | 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] | 7037 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 7038 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7039 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7040 | wmi_buf_t buf = NULL; |
| 7041 | uint8_t *buf_ptr; |
| 7042 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 7043 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 7044 | |
| 7045 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7046 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7047 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7048 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7049 | } |
| 7050 | |
| 7051 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7052 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 7053 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 7054 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 7055 | WMITLV_GET_STRUCT_TLVLEN |
| 7056 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 7057 | |
| 7058 | /* fill in values */ |
| 7059 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7060 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 7061 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 7062 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 7063 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 7064 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 7065 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 7066 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 7067 | hb_tcp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7068 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7069 | &lphb_conf_req->gateway_mac, |
| 7070 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 7071 | |
| 7072 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7073 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7074 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7075 | 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] | 7076 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7077 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7078 | } |
| 7079 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7080 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7081 | } |
| 7082 | |
| 7083 | /** |
| 7084 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 7085 | * @wmi_handle: wmi handle |
| 7086 | * @lphb_conf_req: lphb config request |
| 7087 | * |
| 7088 | * Return: CDF status |
| 7089 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7090 | 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] | 7091 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 7092 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7093 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7094 | wmi_buf_t buf = NULL; |
| 7095 | uint8_t *buf_ptr; |
| 7096 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 7097 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 7098 | |
| 7099 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7100 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7101 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7102 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7103 | } |
| 7104 | |
| 7105 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7106 | hb_tcp_filter_fp = |
| 7107 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 7108 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 7109 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 7110 | WMITLV_GET_STRUCT_TLVLEN |
| 7111 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 7112 | |
| 7113 | /* fill in values */ |
| 7114 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 7115 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 7116 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 7117 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 7118 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 7119 | (void *)&g_hb_tcp_filter_fp->filter, |
| 7120 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 7121 | |
| 7122 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7123 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7124 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7125 | 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] | 7126 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7127 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7128 | } |
| 7129 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7130 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7131 | } |
| 7132 | |
| 7133 | /** |
| 7134 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 7135 | * @wmi_handle: wmi handle |
| 7136 | * @lphb_conf_req: lphb config request |
| 7137 | * |
| 7138 | * Return: CDF status |
| 7139 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7140 | 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] | 7141 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 7142 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7143 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7144 | wmi_buf_t buf = NULL; |
| 7145 | uint8_t *buf_ptr; |
| 7146 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 7147 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 7148 | |
| 7149 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7150 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7151 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7152 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7153 | } |
| 7154 | |
| 7155 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7156 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 7157 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 7158 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 7159 | WMITLV_GET_STRUCT_TLVLEN |
| 7160 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 7161 | |
| 7162 | /* fill in values */ |
| 7163 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7164 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 7165 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 7166 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 7167 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 7168 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 7169 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 7170 | hb_udp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7171 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7172 | &lphb_conf_req->gateway_mac, |
| 7173 | sizeof(lphb_conf_req->gateway_mac)); |
| 7174 | |
| 7175 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7176 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7177 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7178 | 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] | 7179 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7180 | wmi_buf_free(buf); |
| 7181 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7182 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7183 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7184 | } |
| 7185 | |
| 7186 | /** |
| 7187 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 7188 | * @wmi_handle: wmi handle |
| 7189 | * @lphb_conf_req: lphb config request |
| 7190 | * |
| 7191 | * Return: CDF status |
| 7192 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7193 | 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] | 7194 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 7195 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7196 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7197 | wmi_buf_t buf = NULL; |
| 7198 | uint8_t *buf_ptr; |
| 7199 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 7200 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 7201 | |
| 7202 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7203 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7204 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7205 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7206 | } |
| 7207 | |
| 7208 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7209 | hb_udp_filter_fp = |
| 7210 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 7211 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 7212 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 7213 | WMITLV_GET_STRUCT_TLVLEN |
| 7214 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 7215 | |
| 7216 | /* fill in values */ |
| 7217 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 7218 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 7219 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 7220 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 7221 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 7222 | (void *)&lphb_conf_req->filter, |
| 7223 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 7224 | |
| 7225 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7226 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7227 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7228 | 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] | 7229 | status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7230 | wmi_buf_free(buf); |
| 7231 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7232 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7233 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7234 | } |
| 7235 | #endif /* FEATURE_WLAN_LPHB */ |
| 7236 | |
| 7237 | /** |
| 7238 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 7239 | * @wmi_handle: wmi handle |
| 7240 | * @ta_dhcp_ind: DHCP indication parameter |
| 7241 | * |
| 7242 | * Return: CDF Status |
| 7243 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7244 | 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] | 7245 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 7246 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7247 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7248 | wmi_buf_t buf = NULL; |
| 7249 | uint8_t *buf_ptr; |
| 7250 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 7251 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 7252 | |
| 7253 | |
| 7254 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7255 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7256 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7257 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7258 | } |
| 7259 | |
| 7260 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7261 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 7262 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 7263 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 7264 | WMITLV_GET_STRUCT_TLVLEN |
| 7265 | (wmi_peer_set_param_cmd_fixed_param)); |
| 7266 | |
| 7267 | /* fill in values */ |
| 7268 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 7269 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 7270 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7271 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7272 | &ta_dhcp_ind->peer_macaddr, |
| 7273 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 7274 | |
| 7275 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7276 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7277 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7278 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7279 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7280 | wmi_buf_free(buf); |
| 7281 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7282 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7283 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7284 | } |
| 7285 | |
| 7286 | /** |
| 7287 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 7288 | * @wmi_handle: wmi handle |
| 7289 | * @pLinkSpeed: link speed info |
| 7290 | * |
| 7291 | * Return: CDF status |
| 7292 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7293 | 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] | 7294 | wmi_mac_addr peer_macaddr) |
| 7295 | { |
| 7296 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 7297 | wmi_buf_t wmi_buf; |
| 7298 | uint32_t len; |
| 7299 | uint8_t *buf_ptr; |
| 7300 | |
| 7301 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 7302 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7303 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7304 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7305 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7306 | } |
| 7307 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7308 | |
| 7309 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 7310 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7311 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 7312 | WMITLV_GET_STRUCT_TLVLEN |
| 7313 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 7314 | |
| 7315 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7316 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7317 | &peer_macaddr, |
| 7318 | sizeof(peer_macaddr)); |
| 7319 | |
| 7320 | |
| 7321 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7322 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7323 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7324 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7325 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7326 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7327 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7328 | } |
| 7329 | |
| 7330 | /** |
| 7331 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 7332 | * @wmi_handle: wmi handler |
| 7333 | * @egap_params: pointer to egap_params |
| 7334 | * |
| 7335 | * Return: 0 for success, otherwise appropriate error code |
| 7336 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7337 | 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] | 7338 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 7339 | { |
| 7340 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 7341 | wmi_buf_t buf; |
| 7342 | int32_t err; |
| 7343 | |
| 7344 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7345 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7346 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 7347 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7348 | } |
| 7349 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 7350 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7351 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 7352 | WMITLV_GET_STRUCT_TLVLEN( |
| 7353 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 7354 | |
| 7355 | cmd->enable = egap_params->enable; |
| 7356 | cmd->inactivity_time = egap_params->inactivity_time; |
| 7357 | cmd->wait_time = egap_params->wait_time; |
| 7358 | cmd->flags = egap_params->flags; |
| 7359 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7360 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 7361 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7362 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7363 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7364 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7365 | } |
| 7366 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7367 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7368 | } |
| 7369 | |
| 7370 | /** |
Paul Zhang | d19abd8 | 2017-01-04 16:45:42 +0800 | [diff] [blame] | 7371 | * send_action_frame_patterns_cmd_tlv() - send wmi cmd of action filter params |
| 7372 | * @wmi_handle: wmi handler |
| 7373 | * @action_params: pointer to action_params |
| 7374 | * |
| 7375 | * Return: 0 for success, otherwise appropriate error code |
| 7376 | */ |
| 7377 | QDF_STATUS send_action_frame_patterns_cmd_tlv(wmi_unified_t wmi_handle, |
| 7378 | struct action_wakeup_set_param *action_params) |
| 7379 | { |
| 7380 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *cmd; |
| 7381 | wmi_buf_t buf; |
| 7382 | int i; |
| 7383 | int32_t err; |
| 7384 | |
| 7385 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7386 | if (!buf) { |
| 7387 | WMI_LOGE("Failed to allocate buffer to send action filter cmd"); |
| 7388 | return QDF_STATUS_E_NOMEM; |
| 7389 | } |
| 7390 | cmd = (WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *) wmi_buf_data(buf); |
| 7391 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7392 | WMITLV_TAG_STRUC_wmi_wow_set_action_wake_up_cmd_fixed_param, |
| 7393 | WMITLV_GET_STRUCT_TLVLEN( |
| 7394 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param)); |
| 7395 | |
| 7396 | cmd->vdev_id = action_params->vdev_id; |
| 7397 | cmd->operation = action_params->operation; |
| 7398 | |
| 7399 | for (i = 0; i < MAX_SUPPORTED_ACTION_CATEGORY_ELE_LIST; i++) |
| 7400 | cmd->action_category_map[i] = |
| 7401 | action_params->action_category_map[i]; |
| 7402 | |
| 7403 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7404 | sizeof(*cmd), WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
| 7405 | if (err) { |
| 7406 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
| 7407 | wmi_buf_free(buf); |
| 7408 | return QDF_STATUS_E_FAILURE; |
| 7409 | } |
| 7410 | |
| 7411 | return QDF_STATUS_SUCCESS; |
| 7412 | } |
| 7413 | |
| 7414 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7415 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 7416 | * @wmi_handl: wmi handle |
| 7417 | * @cmd: Profiling command index |
| 7418 | * @value1: parameter1 value |
| 7419 | * @value2: parameter2 value |
| 7420 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7421 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7422 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7423 | QDF_STATUS send_fw_profiling_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7424 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 7425 | { |
| 7426 | wmi_buf_t buf; |
| 7427 | int32_t len = 0; |
| 7428 | int ret; |
| 7429 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 7430 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 7431 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 7432 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 7433 | |
| 7434 | switch (cmd) { |
| 7435 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 7436 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 7437 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7438 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7439 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7440 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7441 | } |
| 7442 | prof_trig_cmd = |
| 7443 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 7444 | wmi_buf_data(buf); |
| 7445 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 7446 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 7447 | WMITLV_GET_STRUCT_TLVLEN |
| 7448 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 7449 | prof_trig_cmd->enable = value1; |
| 7450 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7451 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 7452 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7453 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7454 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7455 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7456 | return ret; |
| 7457 | } |
| 7458 | break; |
| 7459 | |
| 7460 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 7461 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 7462 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7463 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7464 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7465 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7466 | } |
| 7467 | profile_getdata_cmd = |
| 7468 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 7469 | wmi_buf_data(buf); |
| 7470 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 7471 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 7472 | WMITLV_GET_STRUCT_TLVLEN |
| 7473 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 7474 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7475 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 7476 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7477 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7478 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7479 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7480 | return ret; |
| 7481 | } |
| 7482 | break; |
| 7483 | |
| 7484 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 7485 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 7486 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7487 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7488 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7489 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7490 | } |
| 7491 | hist_intvl_cmd = |
| 7492 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 7493 | wmi_buf_data(buf); |
| 7494 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 7495 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 7496 | WMITLV_GET_STRUCT_TLVLEN |
| 7497 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 7498 | hist_intvl_cmd->profile_id = value1; |
| 7499 | hist_intvl_cmd->value = value2; |
| 7500 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7501 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 7502 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7503 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7504 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7505 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7506 | return ret; |
| 7507 | } |
| 7508 | break; |
| 7509 | |
| 7510 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 7511 | len = |
| 7512 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 7513 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7514 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7515 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7516 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7517 | } |
| 7518 | profile_enable_cmd = |
| 7519 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 7520 | wmi_buf_data(buf); |
| 7521 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 7522 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 7523 | WMITLV_GET_STRUCT_TLVLEN |
| 7524 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 7525 | profile_enable_cmd->profile_id = value1; |
| 7526 | profile_enable_cmd->enable = value2; |
| 7527 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7528 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 7529 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7530 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7531 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7532 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7533 | return ret; |
| 7534 | } |
| 7535 | break; |
| 7536 | |
| 7537 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7538 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7539 | break; |
| 7540 | } |
| 7541 | |
| 7542 | return 0; |
| 7543 | } |
| 7544 | |
| 7545 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 7546 | /** |
| 7547 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 7548 | * @wmi_handle: wmi handle |
| 7549 | * @vdev_id: vdev id |
| 7550 | * |
| 7551 | * Return: CDF status |
| 7552 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7553 | 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] | 7554 | uint8_t vdev_id, uint8_t default_pattern, |
| 7555 | uint16_t rate_limit_interval) |
| 7556 | { |
| 7557 | |
| 7558 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 7559 | wmi_buf_t buf; |
| 7560 | uint8_t *buf_ptr; |
| 7561 | int32_t len; |
| 7562 | int ret; |
| 7563 | |
| 7564 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 7565 | WMI_TLV_HDR_SIZE + |
| 7566 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 7567 | WMI_TLV_HDR_SIZE + |
| 7568 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 7569 | WMI_TLV_HDR_SIZE + |
| 7570 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 7571 | WMI_TLV_HDR_SIZE + |
| 7572 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 7573 | WMI_TLV_HDR_SIZE + |
| 7574 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 7575 | |
| 7576 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7577 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7578 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7579 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7580 | } |
| 7581 | |
| 7582 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7583 | buf_ptr = (uint8_t *) cmd; |
| 7584 | |
| 7585 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7586 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 7587 | WMITLV_GET_STRUCT_TLVLEN |
| 7588 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 7589 | cmd->vdev_id = vdev_id; |
| 7590 | cmd->pattern_id = default_pattern, |
| 7591 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 7592 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 7593 | |
| 7594 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 7595 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7596 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7597 | |
| 7598 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 7599 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7600 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7601 | |
| 7602 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 7603 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7604 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7605 | |
| 7606 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 7607 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7608 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7609 | |
| 7610 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 7611 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7612 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7613 | |
| 7614 | /* Fill TLV for ra_ratelimit_interval. */ |
| 7615 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 7616 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7617 | |
| 7618 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 7619 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7620 | 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] | 7621 | rate_limit_interval, vdev_id); |
| 7622 | |
| 7623 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7624 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 7625 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7626 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7627 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7628 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7629 | } |
| 7630 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7631 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7632 | |
| 7633 | } |
| 7634 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 7635 | |
| 7636 | /** |
| 7637 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 7638 | * @wmi_handle: wmi handle |
| 7639 | * @vdev_id: vdev id |
| 7640 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7641 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7642 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7643 | 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] | 7644 | { |
| 7645 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 7646 | wmi_buf_t buf; |
| 7647 | int32_t len = sizeof(*cmd); |
| 7648 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7649 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7650 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7651 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7652 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7653 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7654 | } |
| 7655 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 7656 | wmi_buf_data(buf); |
| 7657 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7658 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 7659 | WMITLV_GET_STRUCT_TLVLEN |
| 7660 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 7661 | cmd->vdev_id = vdev_id; |
| 7662 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 7663 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7664 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7665 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7666 | __func__); |
| 7667 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7668 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7669 | } |
| 7670 | |
| 7671 | return 0; |
| 7672 | } |
| 7673 | |
| 7674 | /** |
| 7675 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 7676 | * @wmi_handle: wmi handle |
| 7677 | * @vdev_id: vdev id |
| 7678 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7679 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7680 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7681 | 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] | 7682 | uint8_t vdev_id) |
| 7683 | { |
| 7684 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 7685 | wmi_buf_t buf; |
| 7686 | int32_t len = sizeof(*cmd); |
| 7687 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7688 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7689 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7690 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7691 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7692 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7693 | } |
| 7694 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 7695 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7696 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 7697 | WMITLV_GET_STRUCT_TLVLEN |
| 7698 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 7699 | cmd->vdev_id = vdev_id; |
| 7700 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 7701 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7702 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7703 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7704 | __func__); |
| 7705 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7706 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7707 | } |
| 7708 | |
| 7709 | return 0; |
| 7710 | } |
| 7711 | |
| 7712 | /** |
| 7713 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 7714 | * @wmi_handle: wmi handle |
| 7715 | * @startOemDataReq: start request params |
| 7716 | * |
| 7717 | * Return: CDF status |
| 7718 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7719 | 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] | 7720 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7721 | uint8_t *data) |
| 7722 | { |
| 7723 | wmi_buf_t buf; |
| 7724 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7725 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7726 | |
| 7727 | buf = wmi_buf_alloc(wmi_handle, |
| 7728 | (data_len + WMI_TLV_HDR_SIZE)); |
| 7729 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7730 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 7731 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7732 | } |
| 7733 | |
| 7734 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 7735 | |
| 7736 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 7737 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7738 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7739 | data_len); |
| 7740 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7741 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7742 | data_len); |
| 7743 | |
| 7744 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 7745 | (data_len + |
| 7746 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 7747 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7748 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7749 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7750 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7751 | } |
| 7752 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7753 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7754 | } |
| 7755 | |
| 7756 | /** |
| 7757 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 7758 | * @wmi_handle: wmi handle |
| 7759 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 7760 | * |
| 7761 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 7762 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 7763 | * to firmware based on phyerr filtering |
| 7764 | * offload status. |
| 7765 | * |
| 7766 | * Return: 1 success, 0 failure |
| 7767 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7768 | QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7769 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 7770 | bool dfs_phyerr_filter_offload) |
| 7771 | { |
| 7772 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 7773 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 7774 | wmi_buf_t buf; |
| 7775 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7776 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7777 | |
| 7778 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 7779 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7780 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7781 | __func__); |
| 7782 | len = sizeof(*disable_phyerr_offload_cmd); |
| 7783 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7784 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7785 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7786 | return 0; |
| 7787 | } |
| 7788 | disable_phyerr_offload_cmd = |
| 7789 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 7790 | wmi_buf_data(buf); |
| 7791 | |
| 7792 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 7793 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 7794 | WMITLV_GET_STRUCT_TLVLEN |
| 7795 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 7796 | |
| 7797 | /* |
| 7798 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 7799 | * to the firmware to disable the phyerror |
| 7800 | * filtering offload. |
| 7801 | */ |
| 7802 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7803 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7804 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7805 | 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] | 7806 | __func__, ret); |
| 7807 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7808 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7809 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7810 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7811 | __func__); |
| 7812 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7813 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7814 | __func__); |
| 7815 | |
| 7816 | len = sizeof(*enable_phyerr_offload_cmd); |
| 7817 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7818 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7819 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7820 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7821 | } |
| 7822 | |
| 7823 | enable_phyerr_offload_cmd = |
| 7824 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 7825 | wmi_buf_data(buf); |
| 7826 | |
| 7827 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 7828 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 7829 | WMITLV_GET_STRUCT_TLVLEN |
| 7830 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 7831 | |
| 7832 | /* |
| 7833 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 7834 | * to the firmware to enable the phyerror |
| 7835 | * filtering offload. |
| 7836 | */ |
| 7837 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7838 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 7839 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7840 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7841 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7842 | __func__, ret); |
| 7843 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7844 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7845 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7846 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7847 | __func__); |
| 7848 | } |
| 7849 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7850 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7851 | } |
| 7852 | |
| 7853 | #if !defined(REMOVE_PKT_LOG) |
| 7854 | /** |
| 7855 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 7856 | * @wmi_handle: wmi handle |
| 7857 | * @pktlog_event: pktlog event |
| 7858 | * @cmd_id: pktlog cmd id |
| 7859 | * |
| 7860 | * Return: CDF status |
| 7861 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7862 | 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] | 7863 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7864 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7865 | { |
| 7866 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 7867 | WMI_CMD_ID CMD_ID; |
| 7868 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 7869 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 7870 | int len = 0; |
| 7871 | wmi_buf_t buf; |
| 7872 | |
| 7873 | PKTLOG_EVENT = pktlog_event; |
| 7874 | CMD_ID = cmd_id; |
| 7875 | |
| 7876 | switch (CMD_ID) { |
| 7877 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 7878 | len = sizeof(*cmd); |
| 7879 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7880 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7881 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7882 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7883 | } |
| 7884 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 7885 | wmi_buf_data(buf); |
| 7886 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7887 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 7888 | WMITLV_GET_STRUCT_TLVLEN |
| 7889 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 7890 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7891 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 7892 | : WMI_PKTLOG_ENABLE_AUTO; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7893 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7894 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7895 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7896 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7897 | goto wmi_send_failed; |
| 7898 | } |
| 7899 | break; |
| 7900 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 7901 | len = sizeof(*disable_cmd); |
| 7902 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7903 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7904 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7905 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7906 | } |
| 7907 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 7908 | wmi_buf_data(buf); |
| 7909 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 7910 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 7911 | WMITLV_GET_STRUCT_TLVLEN |
| 7912 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7913 | disable_cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7914 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7915 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7916 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7917 | goto wmi_send_failed; |
| 7918 | } |
| 7919 | break; |
| 7920 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7921 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7922 | break; |
| 7923 | } |
| 7924 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7925 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7926 | |
| 7927 | wmi_send_failed: |
| 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 | #endif /* REMOVE_PKT_LOG */ |
| 7932 | |
| 7933 | /** |
| 7934 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 7935 | * @wmi_handle: wmi handle |
| 7936 | * @vdev_id: vdev id |
| 7937 | * @bitmap: Event bitmap |
| 7938 | * @enable: enable/disable |
| 7939 | * |
| 7940 | * Return: CDF status |
| 7941 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7942 | 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] | 7943 | uint32_t vdev_id, |
| 7944 | uint32_t bitmap, |
| 7945 | bool enable) |
| 7946 | { |
| 7947 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 7948 | uint16_t len; |
| 7949 | wmi_buf_t buf; |
| 7950 | int ret; |
| 7951 | |
| 7952 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 7953 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7954 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7955 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7956 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7957 | } |
| 7958 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 7959 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7960 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 7961 | WMITLV_GET_STRUCT_TLVLEN |
| 7962 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 7963 | cmd->vdev_id = vdev_id; |
| 7964 | cmd->is_add = enable; |
| 7965 | cmd->event_bitmap = bitmap; |
| 7966 | |
| 7967 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7968 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 7969 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7970 | WMI_LOGE("Failed to config wow wakeup event"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7971 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7972 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7973 | } |
| 7974 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7975 | WMI_LOGD("Wakeup pattern 0x%x %s in fw", bitmap, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7976 | enable ? "enabled" : "disabled"); |
| 7977 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7978 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7979 | } |
| 7980 | |
| 7981 | /** |
| 7982 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 7983 | * @wmi_handle: wmi handle |
| 7984 | * @vdev_id: vdev id |
| 7985 | * @ptrn_id: pattern id |
| 7986 | * @ptrn: pattern |
| 7987 | * @ptrn_len: pattern length |
| 7988 | * @ptrn_offset: pattern offset |
| 7989 | * @mask: mask |
| 7990 | * @mask_len: mask length |
| 7991 | * @user: true for user configured pattern and false for default pattern |
| 7992 | * @default_patterns: default patterns |
| 7993 | * |
| 7994 | * Return: CDF status |
| 7995 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7996 | 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] | 7997 | uint8_t vdev_id, uint8_t ptrn_id, |
| 7998 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 7999 | uint8_t ptrn_offset, const uint8_t *mask, |
| 8000 | uint8_t mask_len, bool user, |
| 8001 | uint8_t default_patterns) |
| 8002 | { |
| 8003 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 8004 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 8005 | wmi_buf_t buf; |
| 8006 | uint8_t *buf_ptr; |
| 8007 | int32_t len; |
| 8008 | int ret; |
| 8009 | |
| 8010 | |
| 8011 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 8012 | WMI_TLV_HDR_SIZE + |
| 8013 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 8014 | WMI_TLV_HDR_SIZE + |
| 8015 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 8016 | WMI_TLV_HDR_SIZE + |
| 8017 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 8018 | WMI_TLV_HDR_SIZE + |
| 8019 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 8020 | WMI_TLV_HDR_SIZE + |
| 8021 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 8022 | |
| 8023 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8024 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8025 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8026 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8027 | } |
| 8028 | |
| 8029 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 8030 | buf_ptr = (uint8_t *) cmd; |
| 8031 | |
| 8032 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8033 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 8034 | WMITLV_GET_STRUCT_TLVLEN |
| 8035 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 8036 | cmd->vdev_id = vdev_id; |
| 8037 | cmd->pattern_id = ptrn_id; |
| 8038 | |
| 8039 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 8040 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 8041 | |
| 8042 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 8043 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 8044 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8045 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 8046 | |
| 8047 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 8048 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 8049 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 8050 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8051 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 8052 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8053 | |
| 8054 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 8055 | bitmap_pattern->pattern_len = ptrn_len; |
| 8056 | |
| 8057 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 8058 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 8059 | |
| 8060 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 8061 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 8062 | |
| 8063 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 8064 | bitmap_pattern->pattern_id = ptrn_id; |
| 8065 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8066 | 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] | 8067 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 8068 | bitmap_pattern->pattern_offset, user); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8069 | #ifdef CONFIG_MCL |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8070 | WMI_LOGI("Pattern : "); |
| 8071 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8072 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 8073 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8074 | WMI_LOGI("Mask : "); |
| 8075 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8076 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 8077 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8078 | |
| 8079 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 8080 | |
| 8081 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 8082 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 8083 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8084 | |
| 8085 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 8086 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 8087 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8088 | |
| 8089 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 8090 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 8091 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8092 | |
| 8093 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 8094 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 8095 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8096 | |
| 8097 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 8098 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 8099 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8100 | *(A_UINT32 *) buf_ptr = 0; |
| 8101 | |
| 8102 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8103 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 8104 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8105 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8106 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8107 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8108 | } |
| 8109 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8110 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8111 | } |
| 8112 | |
| 8113 | /** |
| 8114 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 8115 | * @wmi_handle: wmi handle |
| 8116 | * @ptrn_id: pattern id |
| 8117 | * @vdev_id: vdev id |
| 8118 | * |
| 8119 | * Return: CDF status |
| 8120 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8121 | 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] | 8122 | uint8_t vdev_id) |
| 8123 | { |
| 8124 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 8125 | wmi_buf_t buf; |
| 8126 | int32_t len; |
| 8127 | int ret; |
| 8128 | |
| 8129 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 8130 | |
| 8131 | |
| 8132 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8133 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8134 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8135 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8136 | } |
| 8137 | |
| 8138 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 8139 | |
| 8140 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8141 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 8142 | WMITLV_GET_STRUCT_TLVLEN( |
| 8143 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 8144 | cmd->vdev_id = vdev_id; |
| 8145 | cmd->pattern_id = ptrn_id; |
| 8146 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 8147 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8148 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8149 | cmd->pattern_id, vdev_id); |
| 8150 | |
| 8151 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8152 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 8153 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8154 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8155 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8156 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8157 | } |
| 8158 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8159 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8160 | } |
| 8161 | |
| 8162 | /** |
| 8163 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 8164 | * @wmi_handle: wmi handle |
| 8165 | * |
| 8166 | * Sends host wakeup indication to FW. On receiving this indication, |
| 8167 | * FW will come out of WOW. |
| 8168 | * |
| 8169 | * Return: CDF status |
| 8170 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8171 | 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] | 8172 | { |
| 8173 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 8174 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8175 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8176 | int32_t len; |
| 8177 | int ret; |
| 8178 | |
| 8179 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 8180 | |
| 8181 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8182 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8183 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8184 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8185 | } |
| 8186 | |
| 8187 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 8188 | wmi_buf_data(buf); |
| 8189 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8190 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 8191 | WMITLV_GET_STRUCT_TLVLEN |
| 8192 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 8193 | |
| 8194 | |
| 8195 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8196 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 8197 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8198 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8199 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8200 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8201 | } |
| 8202 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8203 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8204 | } |
| 8205 | |
| 8206 | /** |
| 8207 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8208 | * @wmi_handle: wmi handle |
| 8209 | * @msg: delts params |
| 8210 | * |
| 8211 | * Return: CDF status |
| 8212 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8213 | 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] | 8214 | uint8_t ac) |
| 8215 | { |
| 8216 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8217 | wmi_buf_t buf; |
| 8218 | int32_t len = sizeof(*cmd); |
| 8219 | |
| 8220 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8221 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8222 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8223 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8224 | } |
| 8225 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8226 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8227 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8228 | WMITLV_GET_STRUCT_TLVLEN |
| 8229 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8230 | cmd->vdev_id = vdev_id; |
| 8231 | cmd->ac = ac; |
| 8232 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8233 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8234 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8235 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8236 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8237 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8238 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8239 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8240 | } |
| 8241 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8242 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8243 | } |
| 8244 | |
| 8245 | /** |
| 8246 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8247 | * @wmi_handle: handle to wmi |
| 8248 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8249 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8250 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8251 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8252 | * active flow. |
| 8253 | * |
| 8254 | * Return: CDF status |
| 8255 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8256 | QDF_STATUS send_aggr_qos_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8257 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8258 | { |
| 8259 | int i = 0; |
| 8260 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8261 | wmi_buf_t buf; |
| 8262 | int32_t len = sizeof(*cmd); |
| 8263 | |
| 8264 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 8265 | /* if flow in this AC is active */ |
| 8266 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 8267 | /* |
| 8268 | * as per implementation of wma_add_ts_req() we |
| 8269 | * are not waiting any response from firmware so |
| 8270 | * apart from sending ADDTS to firmware just send |
| 8271 | * success to upper layers |
| 8272 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8273 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8274 | |
| 8275 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8276 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8277 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8278 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8279 | } |
| 8280 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 8281 | wmi_buf_data(buf); |
| 8282 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8283 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8284 | WMITLV_GET_STRUCT_TLVLEN |
| 8285 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8286 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 8287 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 8288 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8289 | traffic.userPrio); |
| 8290 | cmd->medium_time_us = |
| 8291 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 8292 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8293 | 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] | 8294 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 8295 | cmd->medium_time_us, cmd->downgrade_type); |
| 8296 | if (wmi_unified_cmd_send |
| 8297 | (wmi_handle, buf, len, |
| 8298 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8299 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8300 | __func__); |
| 8301 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8302 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8303 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8304 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8305 | } |
| 8306 | } |
| 8307 | } |
| 8308 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8309 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8310 | } |
| 8311 | |
| 8312 | /** |
| 8313 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 8314 | * @wmi_handle: wmi handle |
| 8315 | * @msg: ADDTS params |
| 8316 | * |
| 8317 | * Return: CDF status |
| 8318 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8319 | QDF_STATUS send_add_ts_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8320 | struct add_ts_param *msg) |
| 8321 | { |
| 8322 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8323 | wmi_buf_t buf; |
| 8324 | int32_t len = sizeof(*cmd); |
| 8325 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8326 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8327 | |
| 8328 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8329 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8330 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8331 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8332 | } |
| 8333 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8334 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8335 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8336 | WMITLV_GET_STRUCT_TLVLEN |
| 8337 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8338 | cmd->vdev_id = msg->sme_session_id; |
| 8339 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 8340 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 8341 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8342 | 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] | 8343 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 8344 | cmd->downgrade_type, __func__, __LINE__); |
| 8345 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8346 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8347 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 8348 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8349 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8350 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8351 | } |
| 8352 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8353 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8354 | } |
| 8355 | |
| 8356 | /** |
| 8357 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter in target |
| 8358 | * @wmi_handle: wmi handle |
| 8359 | * @vdev_id: vdev id |
| 8360 | * @enable: Flag to enable/disable packet filter |
| 8361 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8362 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8363 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8364 | 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] | 8365 | uint8_t vdev_id, bool enable) |
| 8366 | { |
| 8367 | int32_t len; |
| 8368 | int ret = 0; |
| 8369 | wmi_buf_t buf; |
| 8370 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 8371 | |
| 8372 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 8373 | |
| 8374 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8375 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8376 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8377 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8378 | } |
| 8379 | |
| 8380 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 8381 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8382 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 8383 | WMITLV_GET_STRUCT_TLVLEN( |
| 8384 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 8385 | |
| 8386 | cmd->vdev_id = vdev_id; |
| 8387 | if (enable) |
| 8388 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 8389 | else |
| 8390 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 8391 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8392 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8393 | __func__, cmd->enable, vdev_id); |
| 8394 | |
| 8395 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8396 | WMI_PACKET_FILTER_ENABLE_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8397 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8398 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8399 | wmi_buf_free(buf); |
| 8400 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8401 | |
| 8402 | return ret; |
| 8403 | } |
| 8404 | |
| 8405 | /** |
| 8406 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 8407 | * @wmi_handle: wmi handle |
| 8408 | * @vdev_id: vdev id |
| 8409 | * @rcv_filter_param: Packet filter parameters |
| 8410 | * @filter_id: Filter id |
| 8411 | * @enable: Flag to add/delete packet filter configuration |
| 8412 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8413 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8414 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8415 | 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] | 8416 | uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param, |
| 8417 | uint8_t filter_id, bool enable) |
| 8418 | { |
| 8419 | int len, i; |
| 8420 | int err = 0; |
| 8421 | wmi_buf_t buf; |
| 8422 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 8423 | |
| 8424 | |
| 8425 | /* allocate the memory */ |
| 8426 | len = sizeof(*cmd); |
| 8427 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8428 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8429 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8430 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8431 | } |
| 8432 | |
| 8433 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 8434 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8435 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 8436 | WMITLV_GET_STRUCT_TLVLEN |
| 8437 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 8438 | |
| 8439 | cmd->vdev_id = vdev_id; |
| 8440 | cmd->filter_id = filter_id; |
| 8441 | if (enable) |
| 8442 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 8443 | else |
| 8444 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 8445 | |
| 8446 | if (enable) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8447 | cmd->num_params = QDF_MIN( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8448 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 8449 | rcv_filter_param->numFieldParams); |
| 8450 | cmd->filter_type = rcv_filter_param->filterType; |
| 8451 | cmd->coalesce_time = rcv_filter_param->coalesceTime; |
| 8452 | |
| 8453 | for (i = 0; i < cmd->num_params; i++) { |
| 8454 | cmd->paramsData[i].proto_type = |
| 8455 | rcv_filter_param->paramsData[i].protocolLayer; |
| 8456 | cmd->paramsData[i].cmp_type = |
| 8457 | rcv_filter_param->paramsData[i].cmpFlag; |
| 8458 | cmd->paramsData[i].data_length = |
| 8459 | rcv_filter_param->paramsData[i].dataLength; |
| 8460 | cmd->paramsData[i].data_offset = |
| 8461 | rcv_filter_param->paramsData[i].dataOffset; |
| 8462 | memcpy(&cmd->paramsData[i].compareData, |
| 8463 | rcv_filter_param->paramsData[i].compareData, |
| 8464 | sizeof(cmd->paramsData[i].compareData)); |
| 8465 | memcpy(&cmd->paramsData[i].dataMask, |
| 8466 | rcv_filter_param->paramsData[i].dataMask, |
| 8467 | sizeof(cmd->paramsData[i].dataMask)); |
| 8468 | } |
| 8469 | } |
| 8470 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8471 | 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] | 8472 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 8473 | /* send the command along with data */ |
| 8474 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8475 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 8476 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8477 | WMI_LOGE("Failed to send pkt_filter cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8478 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8479 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8480 | } |
| 8481 | |
| 8482 | |
| 8483 | return 0; |
| 8484 | } |
| 8485 | |
| 8486 | /** |
| 8487 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 8488 | * @wmi_handle: wmi handle |
| 8489 | * @vdev_id: vdev id |
| 8490 | * @multicastAddr: mcast address |
| 8491 | * @clearList: clear list flag |
| 8492 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8493 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8494 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8495 | 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] | 8496 | uint8_t vdev_id, |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8497 | struct qdf_mac_addr multicast_addr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8498 | bool clearList) |
| 8499 | { |
| 8500 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 8501 | wmi_buf_t buf; |
| 8502 | int err; |
| 8503 | |
| 8504 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8505 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8506 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8507 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8508 | } |
| 8509 | |
| 8510 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8511 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8512 | |
| 8513 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8514 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 8515 | WMITLV_GET_STRUCT_TLVLEN |
| 8516 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 8517 | cmd->action = |
| 8518 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 8519 | cmd->vdev_id = vdev_id; |
| 8520 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8521 | |
| 8522 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 8523 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 8524 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8525 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 8526 | sizeof(*cmd), |
| 8527 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 8528 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8529 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8530 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8531 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8532 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8533 | |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8534 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8535 | } |
| 8536 | |
| 8537 | /** |
| 8538 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 8539 | * @wmi_handle: wmi handle |
| 8540 | * @vdev_id: vdev id |
| 8541 | * @params: GTK offload parameters |
| 8542 | * |
| 8543 | * Return: CDF status |
| 8544 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8545 | 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] | 8546 | struct gtk_offload_params *params, |
| 8547 | bool enable_offload, |
| 8548 | uint32_t gtk_offload_opcode) |
| 8549 | { |
| 8550 | int len; |
| 8551 | wmi_buf_t buf; |
| 8552 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8553 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8554 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8555 | WMI_LOGD("%s Enter", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8556 | |
| 8557 | len = sizeof(*cmd); |
| 8558 | |
| 8559 | /* alloc wmi buffer */ |
| 8560 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8561 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8562 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 8563 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8564 | goto out; |
| 8565 | } |
| 8566 | |
| 8567 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 8568 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8569 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 8570 | WMITLV_GET_STRUCT_TLVLEN |
| 8571 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 8572 | |
| 8573 | cmd->vdev_id = vdev_id; |
| 8574 | |
| 8575 | /* Request target to enable GTK offload */ |
Siddarth Poddar | 9500f2e | 2016-04-01 17:45:06 +0530 | [diff] [blame] | 8576 | if (enable_offload == WMI_GTK_OFFLOAD_ENABLE) { |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8577 | cmd->flags = gtk_offload_opcode; |
| 8578 | |
| 8579 | /* Copy the keys and replay counter */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8580 | qdf_mem_copy(cmd->KCK, params->aKCK, WMI_GTK_OFFLOAD_KCK_BYTES); |
| 8581 | qdf_mem_copy(cmd->KEK, params->aKEK, WMI_GTK_OFFLOAD_KEK_BYTES); |
| 8582 | qdf_mem_copy(cmd->replay_counter, ¶ms->ullKeyReplayCounter, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8583 | GTK_REPLAY_COUNTER_BYTES); |
| 8584 | } else { |
| 8585 | cmd->flags = gtk_offload_opcode; |
| 8586 | } |
| 8587 | |
Dustin Brown | 4103e4a | 2016-11-14 16:11:26 -0800 | [diff] [blame] | 8588 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 8589 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8590 | /* send the wmi command */ |
| 8591 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8592 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8593 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8594 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8595 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8596 | } |
| 8597 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8598 | out: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8599 | WMI_LOGD("%s Exit", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8600 | return status; |
| 8601 | } |
| 8602 | |
| 8603 | /** |
| 8604 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 8605 | * @wmi_handle: wmi handle |
| 8606 | * @params: GTK offload params |
| 8607 | * |
| 8608 | * Return: CDF status |
| 8609 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8610 | 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] | 8611 | uint8_t vdev_id, |
| 8612 | uint64_t offload_req_opcode) |
| 8613 | { |
| 8614 | int len; |
| 8615 | wmi_buf_t buf; |
| 8616 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8617 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8618 | |
| 8619 | len = sizeof(*cmd); |
| 8620 | |
| 8621 | /* alloc wmi buffer */ |
| 8622 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8623 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8624 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 8625 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8626 | goto out; |
| 8627 | } |
| 8628 | |
| 8629 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 8630 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8631 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 8632 | WMITLV_GET_STRUCT_TLVLEN |
| 8633 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 8634 | |
| 8635 | /* Request for GTK offload status */ |
| 8636 | cmd->flags = offload_req_opcode; |
| 8637 | cmd->vdev_id = vdev_id; |
| 8638 | |
| 8639 | /* send the wmi command */ |
| 8640 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8641 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8642 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8643 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8644 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8645 | } |
| 8646 | |
| 8647 | out: |
| 8648 | return status; |
| 8649 | } |
| 8650 | |
| 8651 | /** |
| 8652 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 8653 | * @wmi_handle: wmi handle |
| 8654 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 8655 | * |
| 8656 | * Retrun: CDF status |
| 8657 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8658 | 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] | 8659 | struct periodic_tx_pattern * |
| 8660 | pAddPeriodicTxPtrnParams, |
| 8661 | uint8_t vdev_id) |
| 8662 | { |
| 8663 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8664 | wmi_buf_t wmi_buf; |
| 8665 | uint32_t len; |
| 8666 | uint8_t *buf_ptr; |
| 8667 | uint32_t ptrn_len, ptrn_len_aligned; |
| 8668 | int j; |
| 8669 | |
| 8670 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8671 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 8672 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 8673 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 8674 | |
| 8675 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8676 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8677 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8678 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8679 | } |
| 8680 | |
| 8681 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8682 | |
| 8683 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 8684 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8685 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8686 | WMITLV_GET_STRUCT_TLVLEN |
| 8687 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8688 | |
| 8689 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8690 | cmd->vdev_id = vdev_id; |
| 8691 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 8692 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 8693 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8694 | |
| 8695 | /* Pattern info */ |
| 8696 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8697 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 8698 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8699 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8700 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8701 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8702 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8703 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8704 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8705 | |
| 8706 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8707 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8708 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8709 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8710 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8711 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8712 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8713 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8714 | } |
| 8715 | |
| 8716 | /** |
| 8717 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 8718 | * @wmi_handle: wmi handle |
| 8719 | * @vdev_id: vdev id |
| 8720 | * @pattern_id: pattern id |
| 8721 | * |
| 8722 | * Retrun: CDF status |
| 8723 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8724 | 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] | 8725 | uint8_t vdev_id, |
| 8726 | uint8_t pattern_id) |
| 8727 | { |
| 8728 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8729 | wmi_buf_t wmi_buf; |
| 8730 | uint32_t len = |
| 8731 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8732 | |
| 8733 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8734 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8735 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8736 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8737 | } |
| 8738 | |
| 8739 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 8740 | wmi_buf_data(wmi_buf); |
| 8741 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8742 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8743 | WMITLV_GET_STRUCT_TLVLEN |
| 8744 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8745 | |
| 8746 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8747 | cmd->vdev_id = vdev_id; |
| 8748 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8749 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8750 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8751 | |
| 8752 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8753 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8754 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8755 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8756 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8757 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8758 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8759 | } |
| 8760 | |
| 8761 | /** |
| 8762 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 8763 | * @wmi_handle: wmi handle |
| 8764 | * @preq: stats ext params |
| 8765 | * |
| 8766 | * Return: CDF status |
| 8767 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8768 | 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] | 8769 | struct stats_ext_params *preq) |
| 8770 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8771 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8772 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 8773 | wmi_buf_t buf; |
| 8774 | uint16_t len; |
| 8775 | uint8_t *buf_ptr; |
| 8776 | |
| 8777 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 8778 | |
| 8779 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8780 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8781 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8782 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8783 | } |
| 8784 | |
| 8785 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8786 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 8787 | |
| 8788 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8789 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 8790 | WMITLV_GET_STRUCT_TLVLEN |
| 8791 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 8792 | cmd->vdev_id = preq->vdev_id; |
| 8793 | cmd->data_len = preq->request_data_len; |
| 8794 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8795 | 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] | 8796 | __func__, preq->request_data_len, preq->vdev_id); |
| 8797 | |
| 8798 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 8799 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 8800 | |
| 8801 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8802 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8803 | |
| 8804 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8805 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8806 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8807 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8808 | ret); |
| 8809 | wmi_buf_free(buf); |
| 8810 | } |
| 8811 | |
| 8812 | return ret; |
| 8813 | } |
| 8814 | |
| 8815 | /** |
| 8816 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 8817 | * @wmi_handle: wmi handle |
| 8818 | * @params: ext wow params |
| 8819 | * |
| 8820 | * Return:0 for success or error code |
| 8821 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8822 | 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] | 8823 | struct ext_wow_params *params) |
| 8824 | { |
| 8825 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 8826 | wmi_buf_t buf; |
| 8827 | int32_t len; |
| 8828 | int ret; |
| 8829 | |
| 8830 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 8831 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8832 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8833 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8834 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8835 | } |
| 8836 | |
| 8837 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8838 | |
| 8839 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8840 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 8841 | WMITLV_GET_STRUCT_TLVLEN |
| 8842 | (wmi_extwow_enable_cmd_fixed_param)); |
| 8843 | |
| 8844 | cmd->vdev_id = params->vdev_id; |
| 8845 | cmd->type = params->type; |
| 8846 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 8847 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8848 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8849 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 8850 | |
| 8851 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8852 | WMI_EXTWOW_ENABLE_CMDID); |
| 8853 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8854 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8855 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8856 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8857 | } |
| 8858 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8859 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8860 | |
| 8861 | } |
| 8862 | |
| 8863 | /** |
| 8864 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 8865 | * @wmi_handle: wmi handle |
| 8866 | * @app_type1_params: app type1 params |
| 8867 | * |
| 8868 | * Return: CDF status |
| 8869 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8870 | 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] | 8871 | struct app_type1_params *app_type1_params) |
| 8872 | { |
| 8873 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 8874 | wmi_buf_t buf; |
| 8875 | int32_t len; |
| 8876 | int ret; |
| 8877 | |
| 8878 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 8879 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8880 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8881 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8882 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8883 | } |
| 8884 | |
| 8885 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 8886 | wmi_buf_data(buf); |
| 8887 | |
| 8888 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8889 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 8890 | WMITLV_GET_STRUCT_TLVLEN |
| 8891 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 8892 | |
| 8893 | cmd->vdev_id = app_type1_params->vdev_id; |
| 8894 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 8895 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8896 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8897 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8898 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8899 | cmd->passwd_len = app_type1_params->pass_length; |
| 8900 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8901 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8902 | "identification_id %.8s id_length %u " |
| 8903 | "password %.16s pass_length %u", |
| 8904 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 8905 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 8906 | |
| 8907 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8908 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 8909 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8910 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8911 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8912 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8913 | } |
| 8914 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8915 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8916 | } |
| 8917 | |
| 8918 | /** |
| 8919 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 8920 | * @wmi_handle: wmi handle |
| 8921 | * @appType2Params: app type2 params |
| 8922 | * |
| 8923 | * Return: CDF status |
| 8924 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8925 | 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] | 8926 | struct app_type2_params *appType2Params) |
| 8927 | { |
| 8928 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 8929 | wmi_buf_t buf; |
| 8930 | int32_t len; |
| 8931 | int ret; |
| 8932 | |
| 8933 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 8934 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8935 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8936 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8937 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8938 | } |
| 8939 | |
| 8940 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 8941 | wmi_buf_data(buf); |
| 8942 | |
| 8943 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8944 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 8945 | WMITLV_GET_STRUCT_TLVLEN |
| 8946 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 8947 | |
| 8948 | cmd->vdev_id = appType2Params->vdev_id; |
| 8949 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8950 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8951 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 8952 | |
| 8953 | cmd->ip_id = appType2Params->ip_id; |
| 8954 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 8955 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 8956 | |
| 8957 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 8958 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 8959 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 8960 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 8961 | |
| 8962 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 8963 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 8964 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 8965 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 8966 | |
| 8967 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 8968 | &cmd->gateway_mac); |
| 8969 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 8970 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 8971 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8972 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8973 | "rc4_key %.16s rc4_key_len %u " |
| 8974 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 8975 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 8976 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 8977 | "keepalive_max %u keepalive_inc %u " |
| 8978 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 8979 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 8980 | cmd->rc4_key, cmd->rc4_key_len, |
| 8981 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 8982 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 8983 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 8984 | cmd->keepalive_max, cmd->keepalive_inc, |
| 8985 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 8986 | |
| 8987 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8988 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 8989 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8990 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8991 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8992 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8993 | } |
| 8994 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8995 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8996 | |
| 8997 | } |
| 8998 | |
| 8999 | /** |
| 9000 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 9001 | * @wmi_handle: wmi handle |
| 9002 | * @timer_val: auto shutdown timer value |
| 9003 | * |
| 9004 | * Return: CDF status |
| 9005 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9006 | 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] | 9007 | uint32_t timer_val) |
| 9008 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9009 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9010 | wmi_buf_t buf = NULL; |
| 9011 | uint8_t *buf_ptr; |
| 9012 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 9013 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 9014 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9015 | 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] | 9016 | __func__, timer_val); |
| 9017 | |
| 9018 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9019 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9020 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9021 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9022 | } |
| 9023 | |
| 9024 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9025 | wmi_auto_sh_cmd = |
| 9026 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 9027 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 9028 | |
| 9029 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 9030 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 9031 | WMITLV_GET_STRUCT_TLVLEN |
| 9032 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 9033 | |
| 9034 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9035 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9036 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9037 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9038 | __func__, status); |
| 9039 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9040 | } |
| 9041 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9042 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9043 | } |
| 9044 | |
| 9045 | /** |
| 9046 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 9047 | * @wmi_handle: wmi handle |
| 9048 | * @nan_req: request data which will be non-null |
| 9049 | * |
| 9050 | * Return: CDF status |
| 9051 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9052 | QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9053 | struct nan_req_params *nan_req) |
| 9054 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9055 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9056 | wmi_nan_cmd_param *cmd; |
| 9057 | wmi_buf_t buf; |
| 9058 | uint16_t len = sizeof(*cmd); |
| 9059 | uint16_t nan_data_len, nan_data_len_aligned; |
| 9060 | uint8_t *buf_ptr; |
| 9061 | |
| 9062 | /* |
| 9063 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 9064 | * +------------+----------+-----------------------+--------------+ |
| 9065 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 9066 | * +------------+----------+-----------------------+--------------+ |
| 9067 | */ |
| 9068 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9069 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 9070 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9071 | } |
| 9072 | nan_data_len = nan_req->request_data_len; |
| 9073 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 9074 | sizeof(uint32_t)); |
| 9075 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 9076 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9077 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9078 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 9079 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9080 | } |
| 9081 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9082 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 9083 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9084 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 9085 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 9086 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9087 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9088 | __func__, nan_req->request_data_len); |
| 9089 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 9090 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 9091 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9092 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9093 | |
| 9094 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9095 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9096 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9097 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9098 | __func__, ret); |
| 9099 | wmi_buf_free(buf); |
| 9100 | } |
| 9101 | |
| 9102 | return ret; |
| 9103 | } |
| 9104 | |
| 9105 | /** |
| 9106 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 9107 | * @wmi_handle: wmi handle |
| 9108 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 9109 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9110 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9111 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9112 | 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] | 9113 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 9114 | { |
| 9115 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 9116 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9117 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9118 | |
| 9119 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 9120 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9121 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9122 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9123 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9124 | } |
| 9125 | |
| 9126 | 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] | 9127 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9128 | |
| 9129 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9130 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 9131 | WMITLV_GET_STRUCT_TLVLEN |
| 9132 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 9133 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 9134 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 9135 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 9136 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 9137 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9138 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9139 | sizeof(*cmd), |
| 9140 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9141 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9142 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9143 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9144 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9145 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9146 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9147 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9148 | |
| 9149 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9150 | } |
| 9151 | |
| 9152 | /** |
| 9153 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 9154 | * @wmi_handle: wmi handle |
| 9155 | * @flashing: flashing request |
| 9156 | * |
| 9157 | * Return: CDF status |
| 9158 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9159 | 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] | 9160 | struct flashing_req_params *flashing) |
| 9161 | { |
| 9162 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9163 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9164 | wmi_buf_t buf; |
| 9165 | uint8_t *buf_ptr; |
| 9166 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 9167 | |
| 9168 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9169 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9170 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9171 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9172 | } |
| 9173 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9174 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 9175 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9176 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 9177 | WMITLV_GET_STRUCT_TLVLEN |
| 9178 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 9179 | cmd->pattern_id = flashing->pattern_id; |
| 9180 | cmd->led_x0 = flashing->led_x0; |
| 9181 | cmd->led_x1 = flashing->led_x1; |
| 9182 | |
| 9183 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9184 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9185 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9186 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9187 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9188 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9189 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9190 | |
| 9191 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9192 | } |
| 9193 | |
| 9194 | /** |
| 9195 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 9196 | * @wmi_handle: wmi handle |
| 9197 | * @ch_avoid_update_req: channel avoid update params |
| 9198 | * |
| 9199 | * Return: CDF status |
| 9200 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9201 | 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] | 9202 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9203 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9204 | wmi_buf_t buf = NULL; |
| 9205 | uint8_t *buf_ptr; |
| 9206 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 9207 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 9208 | |
| 9209 | |
| 9210 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9211 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9212 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9213 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9214 | } |
| 9215 | |
| 9216 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9217 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 9218 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 9219 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 9220 | WMITLV_GET_STRUCT_TLVLEN |
| 9221 | (wmi_chan_avoid_update_cmd_param)); |
| 9222 | |
| 9223 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9224 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9225 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9226 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9227 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 9228 | " returned Error %d", status); |
| 9229 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9230 | } |
| 9231 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9232 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9233 | } |
| 9234 | |
| 9235 | /** |
| 9236 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 9237 | * @wmi_handle: wmi handle |
| 9238 | * @reg_dmn: reg domain |
| 9239 | * @regdmn2G: 2G reg domain |
| 9240 | * @regdmn5G: 5G reg domain |
| 9241 | * @ctl2G: 2G test limit |
| 9242 | * @ctl5G: 5G test limit |
| 9243 | * |
| 9244 | * Return: none |
| 9245 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9246 | 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] | 9247 | uint32_t reg_dmn, uint16_t regdmn2G, |
| 9248 | uint16_t regdmn5G, int8_t ctl2G, |
| 9249 | int8_t ctl5G) |
| 9250 | { |
| 9251 | wmi_buf_t buf; |
| 9252 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9253 | int32_t len = sizeof(*cmd); |
| 9254 | |
| 9255 | |
| 9256 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9257 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9258 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9259 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9260 | } |
| 9261 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9262 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9263 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9264 | WMITLV_GET_STRUCT_TLVLEN |
| 9265 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9266 | cmd->reg_domain = reg_dmn; |
| 9267 | cmd->reg_domain_2G = regdmn2G; |
| 9268 | cmd->reg_domain_5G = regdmn5G; |
| 9269 | cmd->conformance_test_limit_2G = ctl2G; |
| 9270 | cmd->conformance_test_limit_5G = ctl5G; |
| 9271 | |
| 9272 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9273 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9274 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9275 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9276 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9277 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9278 | } |
| 9279 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9280 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9281 | } |
| 9282 | |
| 9283 | |
| 9284 | /** |
| 9285 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 9286 | * @wmi_handle: wmi handle |
| 9287 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 9288 | * |
| 9289 | * This function sets tdls off channel mode |
| 9290 | * |
| 9291 | * Return: 0 on success; Negative errno otherwise |
| 9292 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9293 | 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] | 9294 | struct tdls_channel_switch_params *chan_switch_params) |
| 9295 | { |
| 9296 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9297 | wmi_buf_t wmi_buf; |
| 9298 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9299 | |
| 9300 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9301 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9302 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9303 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9304 | } |
| 9305 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9306 | wmi_buf_data(wmi_buf); |
| 9307 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9308 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9309 | WMITLV_GET_STRUCT_TLVLEN( |
| 9310 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9311 | |
| 9312 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9313 | &cmd->peer_macaddr); |
| 9314 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9315 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9316 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9317 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9318 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9319 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9320 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9321 | 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] | 9322 | cmd->peer_macaddr.mac_addr31to0, |
| 9323 | cmd->peer_macaddr.mac_addr47to32); |
| 9324 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9325 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9326 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9327 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9328 | ), |
| 9329 | cmd->vdev_id, |
| 9330 | cmd->offchan_mode, |
| 9331 | cmd->offchan_num, |
| 9332 | cmd->offchan_bw_bitmap, |
| 9333 | cmd->is_peer_responder, |
| 9334 | cmd->offchan_oper_class); |
| 9335 | |
| 9336 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9337 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9338 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9339 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9340 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9341 | } |
| 9342 | |
| 9343 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9344 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9345 | } |
| 9346 | |
| 9347 | /** |
| 9348 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9349 | * @wmi_handle: wmi handle |
| 9350 | * @pwmaTdlsparams: TDLS params |
| 9351 | * |
| 9352 | * Return: 0 for sucess or error code |
| 9353 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9354 | 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] | 9355 | void *tdls_param, uint8_t tdls_state) |
| 9356 | { |
| 9357 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9358 | wmi_buf_t wmi_buf; |
| 9359 | |
| 9360 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9361 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9362 | |
| 9363 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9364 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9365 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9366 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9367 | } |
| 9368 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9369 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9370 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9371 | WMITLV_GET_STRUCT_TLVLEN |
| 9372 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9373 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9374 | cmd->state = tdls_state; |
| 9375 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9376 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9377 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9378 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9379 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9380 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9381 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9382 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9383 | wmi_tdls->peer_traffic_response_timeout; |
| 9384 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9385 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9386 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9387 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9388 | cmd->teardown_notification_ms = |
| 9389 | wmi_tdls->teardown_notification_ms; |
| 9390 | cmd->tdls_peer_kickout_threshold = |
| 9391 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9392 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9393 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9394 | "notification_interval_ms: %d, " |
| 9395 | "tx_discovery_threshold: %d, " |
| 9396 | "tx_teardown_threshold: %d, " |
| 9397 | "rssi_teardown_threshold: %d, " |
| 9398 | "rssi_delta: %d, " |
| 9399 | "tdls_options: 0x%x, " |
| 9400 | "tdls_peer_traffic_ind_window: %d, " |
| 9401 | "tdls_peer_traffic_response_timeout: %d, " |
| 9402 | "tdls_puapsd_mask: 0x%x, " |
| 9403 | "tdls_puapsd_inactivity_time: %d, " |
| 9404 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9405 | "teardown_notification_ms: %d, " |
| 9406 | "tdls_peer_kickout_threshold: %d", |
| 9407 | __func__, tdls_state, cmd->state, |
| 9408 | cmd->notification_interval_ms, |
| 9409 | cmd->tx_discovery_threshold, |
| 9410 | cmd->tx_teardown_threshold, |
| 9411 | cmd->rssi_teardown_threshold, |
| 9412 | cmd->rssi_delta, |
| 9413 | cmd->tdls_options, |
| 9414 | cmd->tdls_peer_traffic_ind_window, |
| 9415 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9416 | cmd->tdls_puapsd_mask, |
| 9417 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9418 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9419 | cmd->teardown_notification_ms, |
| 9420 | cmd->tdls_peer_kickout_threshold); |
| 9421 | |
| 9422 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9423 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9424 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9425 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9426 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9427 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9428 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9429 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9430 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9431 | } |
| 9432 | |
| 9433 | /** |
| 9434 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9435 | * @wmi_handle: wmi handle |
| 9436 | * @peerStateParams: TDLS peer state params |
| 9437 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9438 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9439 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9440 | 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] | 9441 | struct tdls_peer_state_params *peerStateParams, |
| 9442 | uint32_t *ch_mhz) |
| 9443 | { |
| 9444 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9445 | wmi_tdls_peer_capabilities *peer_cap; |
| 9446 | wmi_channel *chan_info; |
| 9447 | wmi_buf_t wmi_buf; |
| 9448 | uint8_t *buf_ptr; |
| 9449 | uint32_t i; |
| 9450 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9451 | sizeof(wmi_tdls_peer_capabilities); |
| 9452 | |
| 9453 | |
| 9454 | len += WMI_TLV_HDR_SIZE + |
| 9455 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9456 | |
| 9457 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9458 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9459 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9460 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9461 | } |
| 9462 | |
| 9463 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9464 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9465 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9466 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9467 | WMITLV_GET_STRUCT_TLVLEN |
| 9468 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9469 | |
| 9470 | cmd->vdev_id = peerStateParams->vdevId; |
| 9471 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9472 | &cmd->peer_macaddr); |
| 9473 | |
| 9474 | |
| 9475 | cmd->peer_state = peerStateParams->peerState; |
| 9476 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9477 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9478 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9479 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9480 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9481 | cmd->peer_macaddr.mac_addr31to0, |
| 9482 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9483 | |
| 9484 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9485 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9486 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9487 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9488 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9489 | |
| 9490 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9491 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9492 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9493 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9494 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9495 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9496 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9497 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9498 | |
| 9499 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9500 | * but fill SP |
| 9501 | */ |
| 9502 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9503 | peerStateParams->peerCap.peerMaxSp); |
| 9504 | |
| 9505 | peer_cap->buff_sta_support = |
| 9506 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9507 | peer_cap->off_chan_support = |
| 9508 | peerStateParams->peerCap.peerOffChanSupport; |
| 9509 | peer_cap->peer_curr_operclass = |
| 9510 | peerStateParams->peerCap.peerCurrOperClass; |
| 9511 | /* self curr operclass is not being used and so pass op class for |
| 9512 | * preferred off chan in it. |
| 9513 | */ |
| 9514 | peer_cap->self_curr_operclass = |
| 9515 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 9516 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 9517 | peer_cap->peer_operclass_len = |
| 9518 | peerStateParams->peerCap.peerOperClassLen; |
| 9519 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9520 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9521 | __func__, peer_cap->peer_operclass_len); |
| 9522 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 9523 | peer_cap->peer_operclass[i] = |
| 9524 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9525 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9526 | __func__, i, peer_cap->peer_operclass[i]); |
| 9527 | } |
| 9528 | |
| 9529 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 9530 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 9531 | peer_cap->pref_offchan_bw = |
| 9532 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 9533 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9534 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9535 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 9536 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 9537 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 9538 | " %d, pref_offchan_bw: %d", |
| 9539 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 9540 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 9541 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 9542 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 9543 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 9544 | |
| 9545 | /* next fill variable size array of peer chan info */ |
| 9546 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 9547 | WMITLV_SET_HDR(buf_ptr, |
| 9548 | WMITLV_TAG_ARRAY_STRUC, |
| 9549 | sizeof(wmi_channel) * |
| 9550 | peerStateParams->peerCap.peerChanLen); |
| 9551 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9552 | |
| 9553 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 9554 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 9555 | WMITLV_TAG_STRUC_wmi_channel, |
| 9556 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 9557 | chan_info->mhz = ch_mhz[i]; |
| 9558 | chan_info->band_center_freq1 = chan_info->mhz; |
| 9559 | chan_info->band_center_freq2 = 0; |
| 9560 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9561 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9562 | |
| 9563 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 9564 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9565 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9566 | peerStateParams->peerCap.peerChan[i].chanId, |
| 9567 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 9568 | } |
| 9569 | |
| 9570 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 9571 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 9572 | else |
| 9573 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 9574 | |
| 9575 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 9576 | peerStateParams->peerCap. |
| 9577 | peerChan[i].pwr); |
| 9578 | |
| 9579 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 9580 | peerStateParams->peerCap.peerChan[i]. |
| 9581 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9582 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9583 | peerStateParams->peerCap.peerChan[i].pwr); |
| 9584 | |
| 9585 | chan_info++; |
| 9586 | } |
| 9587 | |
| 9588 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9589 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9590 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9591 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9592 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9593 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9594 | } |
| 9595 | |
| 9596 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9597 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9598 | } |
| 9599 | |
| 9600 | /* |
| 9601 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 9602 | * firmware |
| 9603 | * @wmi_handle: Pointer to wmi handle |
| 9604 | * @mem_dump_req: Pointer for mem_dump_req |
| 9605 | * |
| 9606 | * This function sends memory dump request to firmware |
| 9607 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9608 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9609 | * |
| 9610 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9611 | 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] | 9612 | struct fw_dump_req_param *mem_dump_req) |
| 9613 | { |
| 9614 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 9615 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9616 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9617 | int32_t len; |
| 9618 | wmi_buf_t buf; |
| 9619 | u_int8_t *buf_ptr; |
| 9620 | int ret, loop; |
| 9621 | |
| 9622 | /* |
| 9623 | * len = sizeof(fixed param) that includes tlv header + |
| 9624 | * tlv header for array of struc + |
| 9625 | * sizeof (each struct) |
| 9626 | */ |
| 9627 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9628 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 9629 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9630 | |
| 9631 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9632 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 9633 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9634 | } |
| 9635 | |
| 9636 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9637 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9638 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 9639 | |
| 9640 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9641 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 9642 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 9643 | |
| 9644 | cmd->request_id = mem_dump_req->request_id; |
| 9645 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 9646 | |
| 9647 | /* TLV indicating array of structures to follow */ |
| 9648 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 9649 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9650 | sizeof(wmi_fw_mem_dump) * |
| 9651 | cmd->num_fw_mem_dump_segs); |
| 9652 | |
| 9653 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9654 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 9655 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9656 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9657 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 9658 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9659 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9660 | ((uint8_t *)(mem_dump_req->segment) + |
| 9661 | loop * sizeof(*seg_req)); |
| 9662 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 9663 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 9664 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 9665 | dump_params->seg_id = seg_req->seg_id; |
| 9666 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 9667 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 9668 | dump_params->seg_length = seg_req->seg_length; |
| 9669 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 9670 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9671 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 9672 | 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] | 9673 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 9674 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9675 | 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] | 9676 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 9677 | dump_params->dest_addr_hi); |
| 9678 | dump_params++; |
| 9679 | } |
| 9680 | |
| 9681 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9682 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 9683 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9684 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9685 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9686 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9687 | } |
| 9688 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9689 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 9690 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9691 | } |
| 9692 | |
| 9693 | /* |
| 9694 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 9695 | * @wmi_handle: Pointer to WMi handle |
| 9696 | * @ie_data: Pointer for ie data |
| 9697 | * |
| 9698 | * This function sends IE information to firmware |
| 9699 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9700 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9701 | * |
| 9702 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9703 | 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] | 9704 | struct vdev_ie_info_param *ie_info) |
| 9705 | { |
| 9706 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 9707 | wmi_buf_t buf; |
| 9708 | uint8_t *buf_ptr; |
| 9709 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9710 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9711 | |
| 9712 | |
| 9713 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 9714 | /* Allocate memory for the WMI command */ |
| 9715 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 9716 | |
| 9717 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9718 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9719 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9720 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9721 | } |
| 9722 | |
| 9723 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9724 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9725 | |
| 9726 | /* Populate the WMI command */ |
| 9727 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 9728 | |
| 9729 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9730 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 9731 | WMITLV_GET_STRUCT_TLVLEN( |
| 9732 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 9733 | cmd->vdev_id = ie_info->vdev_id; |
| 9734 | cmd->ie_id = ie_info->ie_id; |
| 9735 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 9736 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9737 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9738 | 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] | 9739 | ie_info->length, ie_info->vdev_id); |
| 9740 | |
| 9741 | buf_ptr += sizeof(*cmd); |
| 9742 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 9743 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9744 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9745 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9746 | |
| 9747 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9748 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9749 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9750 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9751 | wmi_buf_free(buf); |
| 9752 | } |
| 9753 | |
| 9754 | return ret; |
| 9755 | } |
| 9756 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 9757 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9758 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9759 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9760 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9761 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9762 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 9763 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 9764 | resource_cfg->num_offload_reorder_buffs = |
| 9765 | tgt_res_cfg->num_offload_reorder_buffs; |
| 9766 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 9767 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 9768 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 9769 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 9770 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 9771 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 9772 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 9773 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 9774 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 9775 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 9776 | resource_cfg->scan_max_pending_req = |
| 9777 | tgt_res_cfg->scan_max_pending_req; |
| 9778 | resource_cfg->bmiss_offload_max_vdev = |
| 9779 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 9780 | resource_cfg->roam_offload_max_vdev = |
| 9781 | tgt_res_cfg->roam_offload_max_vdev; |
| 9782 | resource_cfg->roam_offload_max_ap_profiles = |
| 9783 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 9784 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 9785 | resource_cfg->num_mcast_table_elems = |
| 9786 | tgt_res_cfg->num_mcast_table_elems; |
| 9787 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 9788 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 9789 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 9790 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 9791 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 9792 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 9793 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 9794 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 9795 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 9796 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 9797 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 9798 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 9799 | resource_cfg->num_tdls_conn_table_entries = |
| 9800 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 9801 | resource_cfg->beacon_tx_offload_max_vdev = |
| 9802 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 9803 | resource_cfg->num_multicast_filter_entries = |
| 9804 | tgt_res_cfg->num_multicast_filter_entries; |
| 9805 | resource_cfg->num_wow_filters = |
| 9806 | tgt_res_cfg->num_wow_filters; |
| 9807 | resource_cfg->num_keep_alive_pattern = |
| 9808 | tgt_res_cfg->num_keep_alive_pattern; |
| 9809 | resource_cfg->keep_alive_pattern_size = |
| 9810 | tgt_res_cfg->keep_alive_pattern_size; |
| 9811 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 9812 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 9813 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 9814 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 9815 | resource_cfg->wmi_send_separate = |
| 9816 | tgt_res_cfg->wmi_send_separate; |
| 9817 | resource_cfg->num_ocb_vdevs = |
| 9818 | tgt_res_cfg->num_ocb_vdevs; |
| 9819 | resource_cfg->num_ocb_channels = |
| 9820 | tgt_res_cfg->num_ocb_channels; |
| 9821 | resource_cfg->num_ocb_schedules = |
| 9822 | tgt_res_cfg->num_ocb_schedules; |
| 9823 | |
| 9824 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 9825 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9826 | /** |
| 9827 | * send_init_cmd_tlv() - wmi init command |
| 9828 | * @wmi_handle: pointer to wmi handle |
| 9829 | * @res_cfg: resource config |
| 9830 | * @num_mem_chunks: no of mem chunck |
| 9831 | * @mem_chunk: pointer to mem chunck structure |
| 9832 | * |
| 9833 | * This function sends IE information to firmware |
| 9834 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9835 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9836 | * |
| 9837 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9838 | QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9839 | wmi_resource_config *tgt_res_cfg, |
| 9840 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 9841 | bool action) |
| 9842 | { |
| 9843 | wmi_buf_t buf; |
| 9844 | wmi_init_cmd_fixed_param *cmd; |
| 9845 | wmi_abi_version my_vers; |
| 9846 | int num_whitelist; |
| 9847 | uint8_t *buf_ptr; |
| 9848 | wmi_resource_config *resource_cfg; |
| 9849 | wlan_host_memory_chunk *host_mem_chunks; |
| 9850 | uint32_t mem_chunk_len = 0; |
| 9851 | uint16_t idx; |
| 9852 | int len; |
| 9853 | int ret; |
| 9854 | |
| 9855 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 9856 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 9857 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 9858 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9859 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 9860 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9861 | } |
| 9862 | |
| 9863 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9864 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 9865 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 9866 | |
| 9867 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 9868 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 9869 | + WMI_TLV_HDR_SIZE); |
| 9870 | |
| 9871 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9872 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 9873 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 9874 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9875 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9876 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 9877 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 9878 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 9879 | |
| 9880 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 9881 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 9882 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 9883 | WMITLV_GET_STRUCT_TLVLEN |
| 9884 | (wlan_host_memory_chunk)); |
| 9885 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 9886 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 9887 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9888 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9889 | idx, host_mem_chunks[idx].size, |
| 9890 | host_mem_chunks[idx].ptr); |
| 9891 | } |
| 9892 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 9893 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 9894 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 9895 | WMITLV_TAG_ARRAY_STRUC, |
| 9896 | (sizeof(wlan_host_memory_chunk) * |
| 9897 | num_mem_chunks)); |
| 9898 | |
| 9899 | num_whitelist = sizeof(version_whitelist) / |
| 9900 | sizeof(wmi_whitelist_version_info); |
| 9901 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 9902 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 9903 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 9904 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 9905 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 9906 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9907 | #ifdef CONFIG_MCL |
| 9908 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 9909 | * 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] | 9910 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 9911 | &my_vers, |
| 9912 | &wmi_handle->fw_abi_version, |
| 9913 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9914 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9915 | 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] | 9916 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 9917 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 9918 | cmd->host_abi_vers.abi_version_ns_0, |
| 9919 | cmd->host_abi_vers.abi_version_ns_1, |
| 9920 | cmd->host_abi_vers.abi_version_ns_2, |
| 9921 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9922 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9923 | /* Save version sent from host - |
| 9924 | * Will be used to check ready event |
| 9925 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9926 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9927 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9928 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9929 | if (action) { |
| 9930 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9931 | WMI_INIT_CMDID); |
| 9932 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9933 | 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] | 9934 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9935 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9936 | } |
| 9937 | } else { |
| 9938 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 9939 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 9940 | } |
| 9941 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9942 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9943 | |
| 9944 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 9945 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9946 | /** |
| 9947 | * send_saved_init_cmd_tlv() - wmi init command |
| 9948 | * @wmi_handle: pointer to wmi handle |
| 9949 | * |
| 9950 | * This function sends IE information to firmware |
| 9951 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9952 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9953 | * |
| 9954 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9955 | QDF_STATUS send_saved_init_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9956 | { |
| 9957 | int status; |
| 9958 | |
| 9959 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 9960 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9961 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 9962 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9963 | } |
| 9964 | status = wmi_unified_cmd_send(wmi_handle, |
| 9965 | wmi_handle->saved_wmi_init_cmd.buf, |
| 9966 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 9967 | WMI_INIT_CMDID); |
| 9968 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9969 | 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] | 9970 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9971 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9972 | } |
| 9973 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 9974 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 9975 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9976 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9977 | } |
| 9978 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9979 | 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] | 9980 | { |
| 9981 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 9982 | wmi_service_ready_event_fixed_param *ev; |
| 9983 | |
| 9984 | |
| 9985 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 9986 | |
| 9987 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 9988 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9989 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9990 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9991 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9992 | /*Save fw version from service ready message */ |
| 9993 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9994 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9995 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 9996 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9997 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 9998 | } |
| 9999 | |
| 10000 | /** |
| 10001 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 10002 | * @wmi_handle: pointer to wmi handle |
| 10003 | * @res_cfg: resource config |
| 10004 | * @num_mem_chunks: no of mem chunck |
| 10005 | * @mem_chunk: pointer to mem chunck structure |
| 10006 | * |
| 10007 | * This function sends IE information to firmware |
| 10008 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10009 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10010 | * |
| 10011 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10012 | 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] | 10013 | void *evt_buf) |
| 10014 | { |
| 10015 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 10016 | wmi_ready_event_fixed_param *ev = NULL; |
| 10017 | |
| 10018 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 10019 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10020 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10021 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 10022 | &ev->fw_abi_vers)) { |
| 10023 | /* |
| 10024 | * Error: Our host version and the given firmware version |
| 10025 | * are incompatible. |
| 10026 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10027 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10028 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 10029 | __func__, |
| 10030 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 10031 | abi_version_0), |
| 10032 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 10033 | abi_version_0), |
| 10034 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 10035 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 10036 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 10037 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 10038 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 10039 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 10040 | ev->fw_abi_vers.abi_version_ns_0, |
| 10041 | ev->fw_abi_vers.abi_version_ns_1, |
| 10042 | ev->fw_abi_vers.abi_version_ns_2, |
| 10043 | ev->fw_abi_vers.abi_version_ns_3); |
| 10044 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10045 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10046 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10047 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10048 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10049 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10050 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10051 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10052 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10053 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10054 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10055 | |
| 10056 | /** |
| 10057 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 10058 | * @wmi_handle: wmi handle |
| 10059 | * @custom_addr: base mac address |
| 10060 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10061 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10062 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10063 | 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] | 10064 | uint8_t *custom_addr) |
| 10065 | { |
| 10066 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 10067 | wmi_buf_t buf; |
| 10068 | int err; |
| 10069 | |
| 10070 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 10071 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10072 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10073 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10074 | } |
| 10075 | |
| 10076 | 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] | 10077 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10078 | |
| 10079 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10080 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 10081 | WMITLV_GET_STRUCT_TLVLEN |
| 10082 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 10083 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 10084 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10085 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 10086 | sizeof(*cmd), |
| 10087 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 10088 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10089 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10090 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10091 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10092 | } |
| 10093 | |
| 10094 | return 0; |
| 10095 | } |
| 10096 | |
| 10097 | /** |
| 10098 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 10099 | * @handle: wmi handle |
| 10100 | * @event: Event received from FW |
| 10101 | * @len: Length of the event |
| 10102 | * |
| 10103 | * Enables the low frequency events and disables the high frequency |
| 10104 | * events. Bit 17 indicates if the event if low/high frequency. |
| 10105 | * 1 - high frequency, 0 - low frequency |
| 10106 | * |
| 10107 | * Return: 0 on successfully enabling/disabling the events |
| 10108 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10109 | 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] | 10110 | uint8_t *event, |
| 10111 | uint32_t len) |
| 10112 | { |
| 10113 | uint32_t num_of_diag_events_logs; |
| 10114 | wmi_diag_event_log_config_fixed_param *cmd; |
| 10115 | wmi_buf_t buf; |
| 10116 | uint8_t *buf_ptr; |
| 10117 | uint32_t *cmd_args, *evt_args; |
| 10118 | uint32_t buf_len, i; |
| 10119 | |
| 10120 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 10121 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 10122 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10123 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10124 | |
| 10125 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 10126 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10127 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10128 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10129 | } |
| 10130 | wmi_event = param_buf->fixed_param; |
| 10131 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 10132 | evt_args = param_buf->diag_events_logs_list; |
| 10133 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10134 | 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] | 10135 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10136 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10137 | } |
| 10138 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10139 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10140 | __func__, num_of_diag_events_logs); |
| 10141 | |
| 10142 | /* Free any previous allocation */ |
| 10143 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10144 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10145 | |
| 10146 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10147 | 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] | 10148 | sizeof(uint32_t)); |
| 10149 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10150 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10151 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10152 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10153 | } |
| 10154 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 10155 | |
| 10156 | /* Prepare the send buffer */ |
| 10157 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10158 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 10159 | |
| 10160 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 10161 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10162 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10163 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10164 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10165 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10166 | } |
| 10167 | |
| 10168 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 10169 | buf_ptr = (uint8_t *) cmd; |
| 10170 | |
| 10171 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10172 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 10173 | WMITLV_GET_STRUCT_TLVLEN( |
| 10174 | wmi_diag_event_log_config_fixed_param)); |
| 10175 | |
| 10176 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 10177 | |
| 10178 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 10179 | |
| 10180 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10181 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 10182 | |
| 10183 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10184 | |
| 10185 | /* Populate the events */ |
| 10186 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 10187 | /* Low freq (0) - Enable (1) the event |
| 10188 | * High freq (1) - Disable (0) the event |
| 10189 | */ |
| 10190 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 10191 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 10192 | /* Set the event ID */ |
| 10193 | WMI_DIAG_ID_SET(cmd_args[i], |
| 10194 | WMI_DIAG_ID_GET(evt_args[i])); |
| 10195 | /* Set the type */ |
| 10196 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 10197 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10198 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10199 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 10200 | } |
| 10201 | |
| 10202 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 10203 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10204 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10205 | __func__); |
| 10206 | wmi_buf_free(buf); |
| 10207 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 10208 | * Host can still have this list |
| 10209 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10210 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10211 | } |
| 10212 | |
| 10213 | return 0; |
| 10214 | } |
| 10215 | |
| 10216 | /** |
| 10217 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 10218 | * @wmi_handle: wmi handle |
| 10219 | * @start_log: Start logging related parameters |
| 10220 | * |
| 10221 | * Send the command to the FW based on which specific logging of diag |
| 10222 | * event/log id can be started/stopped |
| 10223 | * |
| 10224 | * Return: None |
| 10225 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10226 | 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] | 10227 | struct wmi_wifi_start_log *start_log) |
| 10228 | { |
| 10229 | wmi_diag_event_log_config_fixed_param *cmd; |
| 10230 | wmi_buf_t buf; |
| 10231 | uint8_t *buf_ptr; |
| 10232 | uint32_t len, count, log_level, i; |
| 10233 | uint32_t *cmd_args; |
| 10234 | uint32_t total_len; |
| 10235 | count = 0; |
| 10236 | |
| 10237 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10238 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10239 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10240 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10241 | } |
| 10242 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 10243 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 10244 | */ |
| 10245 | total_len = 0; |
| 10246 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 10247 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 10248 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 10249 | total_len++; |
| 10250 | } |
| 10251 | |
| 10252 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10253 | (total_len * sizeof(uint32_t)); |
| 10254 | |
| 10255 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10256 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10257 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10258 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10259 | } |
| 10260 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 10261 | buf_ptr = (uint8_t *) cmd; |
| 10262 | |
| 10263 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10264 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 10265 | WMITLV_GET_STRUCT_TLVLEN( |
| 10266 | wmi_diag_event_log_config_fixed_param)); |
| 10267 | |
| 10268 | cmd->num_of_diag_events_logs = total_len; |
| 10269 | |
| 10270 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 10271 | |
| 10272 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10273 | (total_len * sizeof(uint32_t))); |
| 10274 | |
| 10275 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10276 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10277 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10278 | log_level = 1; |
| 10279 | else |
| 10280 | log_level = 0; |
| 10281 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10282 | 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] | 10283 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 10284 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 10285 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 10286 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 10287 | |
| 10288 | WMI_DIAG_ID_SET(cmd_args[count], |
| 10289 | WMI_DIAG_ID_GET(val)); |
| 10290 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 10291 | WMI_DIAG_TYPE_GET(val)); |
| 10292 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 10293 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10294 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10295 | count++; |
| 10296 | } |
| 10297 | } |
| 10298 | |
| 10299 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10300 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10301 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10302 | __func__); |
| 10303 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10304 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10305 | } |
| 10306 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10307 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10308 | } |
| 10309 | |
| 10310 | /** |
| 10311 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 10312 | * @wmi_handle: WMI handle |
| 10313 | * |
| 10314 | * This function is used to send the flush command to the FW, |
| 10315 | * that will flush the fw logs that are residue in the FW |
| 10316 | * |
| 10317 | * Return: None |
| 10318 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10319 | 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] | 10320 | { |
| 10321 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 10322 | wmi_buf_t buf; |
| 10323 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10324 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10325 | |
| 10326 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10327 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10328 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10329 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10330 | } |
| 10331 | |
| 10332 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 10333 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10334 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 10335 | WMITLV_GET_STRUCT_TLVLEN( |
| 10336 | wmi_debug_mesg_flush_fixed_param)); |
| 10337 | cmd->reserved0 = 0; |
| 10338 | |
| 10339 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10340 | buf, |
| 10341 | len, |
| 10342 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10343 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10344 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10345 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10346 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10347 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10348 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10349 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10350 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10351 | } |
| 10352 | |
| 10353 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10354 | * 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] | 10355 | * @wmi_handle: wmi handle |
| 10356 | * @msg: PCL structure containing the PCL and the number of channels |
| 10357 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10358 | * 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] | 10359 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 10360 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 10361 | * to migrate to a new channel without host driver involvement. An example of |
| 10362 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 10363 | * manage the channel selection without firmware involvement. |
| 10364 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10365 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 10366 | * channel list. The weights corresponds to the channels sent in |
| 10367 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 10368 | * weightage compared to the non PCL channels. |
| 10369 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10370 | * Return: Success if the cmd is sent successfully to the firmware |
| 10371 | */ |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10372 | QDF_STATUS send_pdev_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10373 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10374 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10375 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10376 | wmi_buf_t buf; |
| 10377 | uint8_t *buf_ptr; |
| 10378 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10379 | uint32_t chan_len; |
| 10380 | |
| 10381 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10382 | |
| 10383 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10384 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10385 | |
| 10386 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10387 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10388 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10389 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10390 | } |
| 10391 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10392 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10393 | buf_ptr = (uint8_t *) cmd; |
| 10394 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10395 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 10396 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10397 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10398 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 10399 | cmd->num_chan = chan_len; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10400 | WMI_LOGI("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10401 | |
| 10402 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10403 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10404 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10405 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10406 | for (i = 0; i < chan_len ; i++) { |
| 10407 | cmd_args[i] = msg->weighed_valid_list[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10408 | WMI_LOGI("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10409 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10410 | } |
| 10411 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 10412 | WMI_PDEV_SET_PCL_CMDID)) { |
| 10413 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10414 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10415 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10416 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10417 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10418 | } |
| 10419 | |
| 10420 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10421 | * 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] | 10422 | * @wmi_handle: wmi handle |
| 10423 | * @msg: Structure containing the following parameters |
| 10424 | * |
| 10425 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 10426 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 10427 | * |
| 10428 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 10429 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 10430 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 10431 | * |
| 10432 | * Return: Success if the cmd is sent successfully to the firmware |
| 10433 | */ |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10434 | 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] | 10435 | uint32_t hw_mode_index) |
| 10436 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10437 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10438 | wmi_buf_t buf; |
| 10439 | uint32_t len; |
| 10440 | |
| 10441 | len = sizeof(*cmd); |
| 10442 | |
| 10443 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10444 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10445 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10446 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10447 | } |
| 10448 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10449 | 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] | 10450 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10451 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 10452 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 10453 | |
| 10454 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10455 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10456 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10457 | |
| 10458 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 10459 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 10460 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10461 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10462 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10463 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10464 | } |
| 10465 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10466 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10467 | } |
| 10468 | |
| 10469 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10470 | * 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] | 10471 | * @wmi_handle: wmi handle |
| 10472 | * @msg: Dual MAC config parameters |
| 10473 | * |
| 10474 | * Configures WLAN firmware with the dual MAC features |
| 10475 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10476 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10477 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 10478 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10479 | 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] | 10480 | struct wmi_dual_mac_config *msg) |
| 10481 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10482 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10483 | wmi_buf_t buf; |
| 10484 | uint32_t len; |
| 10485 | |
| 10486 | len = sizeof(*cmd); |
| 10487 | |
| 10488 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10489 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10490 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10491 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10492 | } |
| 10493 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10494 | 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] | 10495 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10496 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10497 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10498 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 10499 | |
| 10500 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10501 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 10502 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10503 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10504 | __func__, msg->scan_config, msg->fw_mode_config); |
| 10505 | |
| 10506 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 10507 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 10508 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10509 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10510 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10511 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10512 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10513 | } |
| 10514 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 10515 | #ifdef BIG_ENDIAN_HOST |
| 10516 | /** |
| 10517 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 10518 | * @param data_len - data length |
| 10519 | * @param data - pointer to data |
| 10520 | * |
| 10521 | * Return: QDF_STATUS - success or error status |
| 10522 | */ |
| 10523 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 10524 | struct fips_params *param) |
| 10525 | { |
| 10526 | unsigned char *key_unaligned, *data_unaligned; |
| 10527 | int c; |
| 10528 | u_int8_t *key_aligned = NULL; |
| 10529 | u_int8_t *data_aligned = NULL; |
| 10530 | |
| 10531 | /* Assigning unaligned space to copy the key */ |
| 10532 | key_unaligned = qdf_mem_malloc( |
| 10533 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 10534 | data_unaligned = qdf_mem_malloc( |
| 10535 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 10536 | |
| 10537 | /* Checking if kmalloc is succesful to allocate space */ |
| 10538 | if (key_unaligned == NULL) |
| 10539 | return QDF_STATUS_SUCCESS; |
| 10540 | /* Checking if space is aligned */ |
| 10541 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 10542 | /* align to 4 */ |
| 10543 | key_aligned = |
| 10544 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 10545 | FIPS_ALIGN); |
| 10546 | } else { |
| 10547 | key_aligned = (u_int8_t *)key_unaligned; |
| 10548 | } |
| 10549 | |
| 10550 | /* memset and copy content from key to key aligned */ |
| 10551 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 10552 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 10553 | |
| 10554 | /* print a hexdump for host debug */ |
| 10555 | print_hex_dump(KERN_DEBUG, |
| 10556 | "\t Aligned and Copied Key:@@@@ ", |
| 10557 | DUMP_PREFIX_NONE, |
| 10558 | 16, 1, key_aligned, param->key_len, true); |
| 10559 | |
| 10560 | /* Checking if kmalloc is succesful to allocate space */ |
| 10561 | if (data_unaligned == NULL) |
| 10562 | return QDF_STATUS_SUCCESS; |
| 10563 | /* Checking of space is aligned */ |
| 10564 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 10565 | /* align to 4 */ |
| 10566 | data_aligned = |
| 10567 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 10568 | FIPS_ALIGN); |
| 10569 | } else { |
| 10570 | data_aligned = (u_int8_t *)data_unaligned; |
| 10571 | } |
| 10572 | |
| 10573 | /* memset and copy content from data to data aligned */ |
| 10574 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 10575 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 10576 | |
| 10577 | /* print a hexdump for host debug */ |
| 10578 | print_hex_dump(KERN_DEBUG, |
| 10579 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 10580 | DUMP_PREFIX_NONE, |
| 10581 | 16, 1, data_aligned, param->data_len, true); |
| 10582 | |
| 10583 | /* converting to little Endian both key_aligned and |
| 10584 | * data_aligned*/ |
| 10585 | for (c = 0; c < param->key_len/4; c++) { |
| 10586 | *((u_int32_t *)key_aligned+c) = |
| 10587 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 10588 | } |
| 10589 | for (c = 0; c < param->data_len/4; c++) { |
| 10590 | *((u_int32_t *)data_aligned+c) = |
| 10591 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 10592 | } |
| 10593 | |
| 10594 | /* update endian data to key and data vectors */ |
| 10595 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 10596 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 10597 | |
| 10598 | /* clean up allocated spaces */ |
| 10599 | qdf_mem_free(key_unaligned); |
| 10600 | key_unaligned = NULL; |
| 10601 | key_aligned = NULL; |
| 10602 | |
| 10603 | qdf_mem_free(data_unaligned); |
| 10604 | data_unaligned = NULL; |
| 10605 | data_aligned = NULL; |
| 10606 | |
| 10607 | return QDF_STATUS_SUCCESS; |
| 10608 | } |
| 10609 | #else |
| 10610 | /** |
| 10611 | * fips_align_data_be() - DUMMY for LE platform |
| 10612 | * |
| 10613 | * Return: QDF_STATUS - success |
| 10614 | */ |
| 10615 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 10616 | struct fips_params *param) |
| 10617 | { |
| 10618 | return QDF_STATUS_SUCCESS; |
| 10619 | } |
| 10620 | #endif |
| 10621 | |
| 10622 | |
| 10623 | /** |
| 10624 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 10625 | * @wmi_handle: wmi handle |
| 10626 | * @param: pointer to hold pdev fips param |
| 10627 | * |
| 10628 | * Return: 0 for success or error code |
| 10629 | */ |
| 10630 | QDF_STATUS |
| 10631 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 10632 | struct fips_params *param) |
| 10633 | { |
| 10634 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 10635 | wmi_buf_t buf; |
| 10636 | uint8_t *buf_ptr; |
| 10637 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 10638 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 10639 | |
| 10640 | /* Length TLV placeholder for array of bytes */ |
| 10641 | len += WMI_TLV_HDR_SIZE; |
| 10642 | if (param->data_len) |
| 10643 | len += (param->data_len*sizeof(uint8_t)); |
| 10644 | |
| 10645 | /* |
| 10646 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 10647 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 10648 | * wmi_pdev_fips_cmd structure |
| 10649 | */ |
| 10650 | |
| 10651 | /* do sanity on the input */ |
| 10652 | if (!(((param->data_len & 0xF) == 0) && |
| 10653 | ((param->data_len > 0) && |
| 10654 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 10655 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 10656 | return QDF_STATUS_E_INVAL; |
| 10657 | } |
| 10658 | |
| 10659 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10660 | if (!buf) { |
| 10661 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 10662 | return QDF_STATUS_E_FAILURE; |
| 10663 | } |
| 10664 | |
| 10665 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10666 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 10667 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10668 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 10669 | WMITLV_GET_STRUCT_TLVLEN |
| 10670 | (wmi_pdev_fips_cmd_fixed_param)); |
| 10671 | |
| 10672 | cmd->pdev_id = param->pdev_id; |
| 10673 | if (param->key != NULL && param->data != NULL) { |
| 10674 | cmd->key_len = param->key_len; |
| 10675 | cmd->data_len = param->data_len; |
| 10676 | cmd->fips_cmd = !!(param->op); |
| 10677 | |
| 10678 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 10679 | return QDF_STATUS_E_FAILURE; |
| 10680 | |
| 10681 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 10682 | |
| 10683 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 10684 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 10685 | cmd->mode = param->mode; |
| 10686 | } else { |
| 10687 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 10688 | } |
| 10689 | qdf_print(KERN_ERR "Key len = %d, Data len = %d\n", |
| 10690 | cmd->key_len, cmd->data_len); |
| 10691 | |
| 10692 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 10693 | cmd->key, cmd->key_len, true); |
| 10694 | buf_ptr += sizeof(*cmd); |
| 10695 | |
| 10696 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 10697 | |
| 10698 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10699 | if (param->data_len) |
| 10700 | qdf_mem_copy(buf_ptr, |
| 10701 | (uint8_t *) param->data, param->data_len); |
| 10702 | |
| 10703 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 10704 | 16, 1, buf_ptr, cmd->data_len, true); |
| 10705 | |
| 10706 | buf_ptr += param->data_len; |
| 10707 | |
| 10708 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10709 | WMI_PDEV_FIPS_CMDID); |
| 10710 | qdf_print("%s return value %d\n", __func__, retval); |
| 10711 | } else { |
| 10712 | qdf_print("\n%s:%d Key or Data is NULL\n", __func__, __LINE__); |
| 10713 | wmi_buf_free(buf); |
| 10714 | retval = -QDF_STATUS_E_BADMSG; |
| 10715 | } |
| 10716 | |
| 10717 | return retval; |
| 10718 | } |
| 10719 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10720 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10721 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 10722 | * @wmi_handle: wmi handle |
| 10723 | * @offload_req: offload request |
| 10724 | * @buf_ptr: buffer pointer |
| 10725 | * |
| 10726 | * To fill ARP offload data to firmware |
| 10727 | * when target goes to wow mode. |
| 10728 | * |
| 10729 | * Return: None |
| 10730 | */ |
| 10731 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10732 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10733 | { |
| 10734 | |
| 10735 | int i; |
| 10736 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
| 10737 | bool enable_or_disable = offload_req->enableOrDisable; |
| 10738 | |
| 10739 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10740 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 10741 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10742 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 10743 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 10744 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 10745 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 10746 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 10747 | |
| 10748 | /* Fill data for ARP and NS in the first tupple for LA */ |
| 10749 | if ((enable_or_disable & WMI_OFFLOAD_ENABLE) && (i == 0)) { |
| 10750 | /* Copy the target ip addr and flags */ |
| 10751 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 10752 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
| 10753 | offload_req->params.hostIpv4Addr, |
| 10754 | WMI_IPV4_ADDR_LEN); |
| 10755 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
| 10756 | offload_req->params.hostIpv4Addr); |
| 10757 | } |
| 10758 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 10759 | } |
| 10760 | } |
| 10761 | |
| 10762 | #ifdef WLAN_NS_OFFLOAD |
| 10763 | /** |
| 10764 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 10765 | * @wmi|_handle: wmi handle |
| 10766 | * @offload_req: offload request |
| 10767 | * @buf_ptr: buffer pointer |
| 10768 | * |
| 10769 | * To fill NS offload data to firmware |
| 10770 | * when target goes to wow mode. |
| 10771 | * |
| 10772 | * Return: None |
| 10773 | */ |
| 10774 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10775 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10776 | { |
| 10777 | |
| 10778 | int i; |
| 10779 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 10780 | struct ns_offload_req_params ns_req; |
| 10781 | |
| 10782 | ns_req = offload_req->nsOffloadInfo; |
| 10783 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10784 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 10785 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10786 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 10787 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 10788 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 10789 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 10790 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 10791 | |
| 10792 | /* |
| 10793 | * Fill data only for NS offload in the first ARP tuple for LA |
| 10794 | */ |
| 10795 | if ((offload_req->enableOrDisable & WMI_OFFLOAD_ENABLE)) { |
| 10796 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 10797 | /* Copy the target/solicitation/remote ip addr */ |
| 10798 | if (ns_req.targetIPv6AddrValid[i]) |
| 10799 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
| 10800 | &ns_req.targetIPv6Addr[i], |
| 10801 | sizeof(WMI_IPV6_ADDR)); |
| 10802 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
| 10803 | &ns_req.selfIPv6Addr[i], |
| 10804 | sizeof(WMI_IPV6_ADDR)); |
| 10805 | if (ns_req.target_ipv6_addr_ac_type[i]) { |
| 10806 | ns_tuple->flags |= |
| 10807 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 10808 | } |
| 10809 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
| 10810 | i, &ns_req.selfIPv6Addr[i], |
| 10811 | &ns_req.targetIPv6Addr[i]); |
| 10812 | |
| 10813 | /* target MAC is optional, check if it is valid, |
| 10814 | * if this is not valid, the target will use the known |
| 10815 | * local MAC address rather than the tuple |
| 10816 | */ |
| 10817 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 10818 | ns_req.self_macaddr.bytes, |
| 10819 | &ns_tuple->target_mac); |
| 10820 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 10821 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 10822 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 10823 | } |
| 10824 | } |
| 10825 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 10826 | } |
| 10827 | } |
| 10828 | |
| 10829 | |
| 10830 | /** |
| 10831 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 10832 | * @wmi: wmi handle |
| 10833 | * @offload_req: offload request |
| 10834 | * @buf_ptr: buffer pointer |
| 10835 | * |
| 10836 | * To fill extended NS offload extended data to firmware |
| 10837 | * when target goes to wow mode. |
| 10838 | * |
| 10839 | * Return: None |
| 10840 | */ |
| 10841 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
| 10842 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10843 | { |
| 10844 | int i; |
| 10845 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 10846 | uint32_t count, num_ns_ext_tuples; |
| 10847 | struct ns_offload_req_params ns_req; |
| 10848 | |
| 10849 | ns_req = offload_req->nsOffloadInfo; |
| 10850 | count = offload_req->num_ns_offload_count; |
| 10851 | num_ns_ext_tuples = offload_req->num_ns_offload_count - |
| 10852 | WMI_MAX_NS_OFFLOADS; |
| 10853 | |
| 10854 | /* Populate extended NS offload tuples */ |
| 10855 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10856 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 10857 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 10858 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 10859 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 10860 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 10861 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 10862 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 10863 | |
| 10864 | /* |
| 10865 | * Fill data only for NS offload in the first ARP tuple for LA |
| 10866 | */ |
| 10867 | if ((offload_req->enableOrDisable & WMI_OFFLOAD_ENABLE)) { |
| 10868 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 10869 | /* Copy the target/solicitation/remote ip addr */ |
| 10870 | if (ns_req.targetIPv6AddrValid[i]) |
| 10871 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
| 10872 | &ns_req.targetIPv6Addr[i], |
| 10873 | sizeof(WMI_IPV6_ADDR)); |
| 10874 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
| 10875 | &ns_req.selfIPv6Addr[i], |
| 10876 | sizeof(WMI_IPV6_ADDR)); |
| 10877 | if (ns_req.target_ipv6_addr_ac_type[i]) { |
| 10878 | ns_tuple->flags |= |
| 10879 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 10880 | } |
| 10881 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
| 10882 | i, &ns_req.selfIPv6Addr[i], |
| 10883 | &ns_req.targetIPv6Addr[i]); |
| 10884 | |
| 10885 | /* target MAC is optional, check if it is valid, |
| 10886 | * if this is not valid, the target will use the |
| 10887 | * known local MAC address rather than the tuple |
| 10888 | */ |
| 10889 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 10890 | ns_req.self_macaddr.bytes, |
| 10891 | &ns_tuple->target_mac); |
| 10892 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 10893 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 10894 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 10895 | } |
| 10896 | } |
| 10897 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 10898 | } |
| 10899 | } |
| 10900 | #else |
| 10901 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
| 10902 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10903 | { |
| 10904 | return; |
| 10905 | } |
| 10906 | |
| 10907 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
| 10908 | struct host_offload_req_param *offload_req, uint8_t **buf_ptr) |
| 10909 | { |
| 10910 | return; |
| 10911 | } |
| 10912 | #endif |
| 10913 | |
| 10914 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10915 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 10916 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10917 | * @arp_offload_req: arp offload request |
| 10918 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10919 | * @arp_only: flag |
| 10920 | * |
| 10921 | * To configure ARP NS off load data to firmware |
| 10922 | * when target goes to wow mode. |
| 10923 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10924 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10925 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10926 | 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] | 10927 | struct host_offload_req_param *arp_offload_req, |
| 10928 | struct host_offload_req_param *ns_offload_req, |
| 10929 | bool arp_only, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10930 | uint8_t vdev_id) |
| 10931 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10932 | int32_t res; |
| 10933 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10934 | A_UINT8 *buf_ptr; |
| 10935 | wmi_buf_t buf; |
| 10936 | int32_t len; |
| 10937 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 10938 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10939 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10940 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10941 | /* |
| 10942 | * TLV place holder size for array of NS tuples |
| 10943 | * TLV place holder size for array of ARP tuples |
| 10944 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10945 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 10946 | WMI_TLV_HDR_SIZE + |
| 10947 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 10948 | WMI_TLV_HDR_SIZE + |
| 10949 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10950 | |
| 10951 | /* |
| 10952 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 10953 | * extra length for extended NS offload tuples which follows ARP offload |
| 10954 | * tuples. Host needs to fill this structure in following format: |
| 10955 | * 2 NS ofload tuples |
| 10956 | * 2 ARP offload tuples |
| 10957 | * N numbers of extended NS offload tuples if HDD has given more than |
| 10958 | * 2 NS offload addresses |
| 10959 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10960 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10961 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10962 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 10963 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10964 | } |
| 10965 | |
| 10966 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10967 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10968 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10969 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10970 | } |
| 10971 | |
| 10972 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 10973 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 10974 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10975 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 10976 | WMITLV_GET_STRUCT_TLVLEN |
| 10977 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 10978 | cmd->flags = 0; |
| 10979 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10980 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10981 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10982 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10983 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10984 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 10985 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 10986 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 10987 | if (num_ns_ext_tuples) |
| 10988 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10989 | |
| 10990 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10991 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 10992 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10993 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10994 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10995 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10996 | } |
| 10997 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10998 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10999 | } |
| 11000 | |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 11001 | QDF_STATUS send_enable_broadcast_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 11002 | uint8_t vdev_id, bool enable) |
| 11003 | { |
| 11004 | int32_t res; |
| 11005 | wmi_hw_data_filter_cmd_fixed_param *cmd; |
| 11006 | A_UINT8 *buf_ptr; |
| 11007 | wmi_buf_t buf; |
| 11008 | int32_t len; |
| 11009 | |
| 11010 | /* |
| 11011 | * TLV place holder size for array of ARP tuples |
| 11012 | */ |
| 11013 | len = sizeof(wmi_hw_data_filter_cmd_fixed_param); |
| 11014 | |
| 11015 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11016 | if (!buf) { |
| 11017 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11018 | return QDF_STATUS_E_NOMEM; |
| 11019 | } |
| 11020 | |
| 11021 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 11022 | cmd = (wmi_hw_data_filter_cmd_fixed_param *) buf_ptr; |
| 11023 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11024 | WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param, |
| 11025 | WMITLV_GET_STRUCT_TLVLEN |
| 11026 | (wmi_hw_data_filter_cmd_fixed_param)); |
| 11027 | cmd->vdev_id = vdev_id; |
| 11028 | cmd->enable = enable; |
| 11029 | cmd->hw_filter_bitmap = WMI_HW_DATA_FILTER_DROP_NON_ARP_BC; |
| 11030 | |
| 11031 | WMI_LOGD("HW Broadcast Filter vdev_id: %d", cmd->vdev_id); |
| 11032 | |
| 11033 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11034 | WMI_HW_DATA_FILTER_CMDID); |
| 11035 | if (res) { |
| 11036 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
| 11037 | wmi_buf_free(buf); |
| 11038 | return QDF_STATUS_E_FAILURE; |
| 11039 | } |
| 11040 | |
| 11041 | return QDF_STATUS_SUCCESS; |
| 11042 | } |
| 11043 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11044 | /** |
| 11045 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 11046 | * @wmi_handle: wmi handle |
| 11047 | * @request: SSID hotlist set request |
| 11048 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11049 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11050 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11051 | QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11052 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 11053 | struct ssid_hotlist_request_params *request) |
| 11054 | { |
| 11055 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 11056 | wmi_buf_t wmi_buf; |
| 11057 | uint32_t len; |
| 11058 | uint32_t array_size; |
| 11059 | uint8_t *buf_ptr; |
| 11060 | |
| 11061 | /* length of fixed portion */ |
| 11062 | len = sizeof(*cmd); |
| 11063 | |
| 11064 | /* length of variable portion */ |
| 11065 | array_size = |
| 11066 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 11067 | len += WMI_TLV_HDR_SIZE + array_size; |
| 11068 | |
| 11069 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 11070 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11071 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11072 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11073 | } |
| 11074 | |
| 11075 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 11076 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 11077 | buf_ptr; |
| 11078 | WMITLV_SET_HDR |
| 11079 | (&cmd->tlv_header, |
| 11080 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 11081 | WMITLV_GET_STRUCT_TLVLEN |
| 11082 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 11083 | |
| 11084 | cmd->request_id = request->request_id; |
| 11085 | cmd->requestor_id = 0; |
| 11086 | cmd->vdev_id = request->session_id; |
| 11087 | cmd->table_id = 0; |
| 11088 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 11089 | cmd->total_entries = request->ssid_count; |
| 11090 | cmd->num_entries_in_page = request->ssid_count; |
| 11091 | cmd->first_entry_index = 0; |
| 11092 | |
| 11093 | buf_ptr += sizeof(*cmd); |
| 11094 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 11095 | |
| 11096 | if (request->ssid_count) { |
| 11097 | wmi_extscan_hotlist_ssid_entry *entry; |
| 11098 | int i; |
| 11099 | |
| 11100 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11101 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 11102 | for (i = 0; i < request->ssid_count; i++) { |
| 11103 | WMITLV_SET_HDR |
| 11104 | (entry, |
| 11105 | WMITLV_TAG_ARRAY_STRUC, |
| 11106 | WMITLV_GET_STRUCT_TLVLEN |
| 11107 | (wmi_extscan_hotlist_ssid_entry)); |
| 11108 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11109 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11110 | request->ssids[i].ssid.mac_ssid, |
| 11111 | request->ssids[i].ssid.length); |
| 11112 | entry->band = request->ssids[i].band; |
| 11113 | entry->min_rssi = request->ssids[i].rssi_low; |
| 11114 | entry->max_rssi = request->ssids[i].rssi_high; |
| 11115 | entry++; |
| 11116 | } |
| 11117 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 11118 | } else { |
| 11119 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 11120 | } |
| 11121 | |
| 11122 | if (wmi_unified_cmd_send |
| 11123 | (wmi_handle, wmi_buf, len, |
| 11124 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11125 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11126 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11127 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11128 | } |
| 11129 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11130 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11131 | } |
| 11132 | |
| 11133 | /** |
| 11134 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 11135 | * @wmi_handle: wmi handle |
| 11136 | * @vdev_id: vdev id |
| 11137 | * |
| 11138 | * This function sends roam synch complete event to fw. |
| 11139 | * |
| 11140 | * Return: CDF STATUS |
| 11141 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11142 | 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] | 11143 | uint8_t vdev_id) |
| 11144 | { |
| 11145 | wmi_roam_synch_complete_fixed_param *cmd; |
| 11146 | wmi_buf_t wmi_buf; |
| 11147 | uint8_t *buf_ptr; |
| 11148 | uint16_t len; |
| 11149 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 11150 | |
| 11151 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 11152 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11153 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11154 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11155 | } |
| 11156 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 11157 | buf_ptr = (uint8_t *) cmd; |
| 11158 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11159 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 11160 | WMITLV_GET_STRUCT_TLVLEN |
| 11161 | (wmi_roam_synch_complete_fixed_param)); |
| 11162 | cmd->vdev_id = vdev_id; |
| 11163 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 11164 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11165 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11166 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11167 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11168 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11169 | } |
| 11170 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11171 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11172 | } |
| 11173 | |
| 11174 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 11175 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 11176 | * @wmi_handle: wmi handle |
| 11177 | * @wmi_fwtest: fw test command |
| 11178 | * |
| 11179 | * This function sends fw test command to fw. |
| 11180 | * |
| 11181 | * Return: CDF STATUS |
| 11182 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11183 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 11184 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 11185 | struct set_fwtest_params *wmi_fwtest) |
| 11186 | { |
| 11187 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 11188 | wmi_buf_t wmi_buf; |
| 11189 | uint16_t len; |
| 11190 | |
| 11191 | len = sizeof(*cmd); |
| 11192 | |
| 11193 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 11194 | if (!wmi_buf) { |
| 11195 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 11196 | return QDF_STATUS_E_NOMEM; |
| 11197 | } |
| 11198 | |
| 11199 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 11200 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11201 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 11202 | WMITLV_GET_STRUCT_TLVLEN( |
| 11203 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 11204 | cmd->param_id = wmi_fwtest->arg; |
| 11205 | cmd->param_value = wmi_fwtest->value; |
| 11206 | |
| 11207 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 11208 | WMI_FWTEST_CMDID)) { |
| 11209 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 11210 | qdf_nbuf_free(wmi_buf); |
| 11211 | return QDF_STATUS_E_FAILURE; |
| 11212 | } |
| 11213 | |
| 11214 | return QDF_STATUS_SUCCESS; |
| 11215 | } |
| 11216 | |
| 11217 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11218 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 11219 | * @wmi_handle: wmi handle |
| 11220 | * @wmi_utest: unit test command |
| 11221 | * |
| 11222 | * This function send unit test command to fw. |
| 11223 | * |
| 11224 | * Return: CDF STATUS |
| 11225 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11226 | QDF_STATUS send_unit_test_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11227 | struct wmi_unit_test_cmd *wmi_utest) |
| 11228 | { |
| 11229 | wmi_unit_test_cmd_fixed_param *cmd; |
| 11230 | wmi_buf_t wmi_buf; |
| 11231 | uint8_t *buf_ptr; |
| 11232 | int i; |
| 11233 | uint16_t len, args_tlv_len; |
| 11234 | A_UINT32 *unit_test_cmd_args; |
| 11235 | |
| 11236 | args_tlv_len = |
| 11237 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 11238 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 11239 | |
| 11240 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 11241 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11242 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 11243 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11244 | } |
| 11245 | |
| 11246 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 11247 | buf_ptr = (uint8_t *) cmd; |
| 11248 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11249 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 11250 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 11251 | cmd->vdev_id = wmi_utest->vdev_id; |
| 11252 | cmd->module_id = wmi_utest->module_id; |
| 11253 | cmd->num_args = wmi_utest->num_args; |
| 11254 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 11255 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11256 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 11257 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11258 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11259 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 11260 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11261 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11262 | } |
| 11263 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 11264 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11265 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11266 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11267 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11268 | } |
| 11269 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11270 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11271 | } |
| 11272 | |
| 11273 | /** |
| 11274 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 11275 | * @wmi_handle: wma handle |
| 11276 | * @roaminvoke: roam invoke command |
| 11277 | * |
| 11278 | * Send roam invoke command to fw for fastreassoc. |
| 11279 | * |
| 11280 | * Return: CDF STATUS |
| 11281 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11282 | QDF_STATUS send_roam_invoke_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11283 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 11284 | uint32_t ch_hz) |
| 11285 | { |
| 11286 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 11287 | wmi_buf_t wmi_buf; |
| 11288 | u_int8_t *buf_ptr; |
| 11289 | u_int16_t len, args_tlv_len; |
| 11290 | A_UINT32 *channel_list; |
| 11291 | wmi_mac_addr *bssid_list; |
| 11292 | |
| 11293 | /* Host sends only one channel and one bssid */ |
| 11294 | args_tlv_len = 2 * WMI_TLV_HDR_SIZE + sizeof(A_UINT32) + |
| 11295 | sizeof(wmi_mac_addr); |
| 11296 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 11297 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 11298 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11299 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 11300 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11301 | } |
| 11302 | |
| 11303 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 11304 | buf_ptr = (u_int8_t *) cmd; |
| 11305 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11306 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 11307 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 11308 | cmd->vdev_id = roaminvoke->vdev_id; |
| 11309 | cmd->flags = 0; |
| 11310 | cmd->roam_scan_mode = 0; |
| 11311 | cmd->roam_ap_sel_mode = 0; |
| 11312 | cmd->roam_delay = 0; |
| 11313 | cmd->num_chan = 1; |
| 11314 | cmd->num_bssid = 1; |
| 11315 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 11316 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11317 | (sizeof(u_int32_t))); |
| 11318 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 11319 | *channel_list = ch_hz; |
| 11320 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 11321 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 11322 | (sizeof(wmi_mac_addr))); |
| 11323 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 11324 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
| 11325 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 11326 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11327 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11328 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11329 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11330 | } |
| 11331 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11332 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11333 | } |
| 11334 | |
| 11335 | /** |
| 11336 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 11337 | * @wmi_handle: wmi handle |
| 11338 | * @command: command |
| 11339 | * @vdev_id: vdev id |
| 11340 | * |
| 11341 | * This function set roam offload command to fw. |
| 11342 | * |
| 11343 | * Return: CDF status |
| 11344 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11345 | 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] | 11346 | uint32_t command, uint32_t vdev_id) |
| 11347 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11348 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11349 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 11350 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11351 | int len; |
| 11352 | uint8_t *buf_ptr; |
| 11353 | |
| 11354 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 11355 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11356 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11357 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11358 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11359 | } |
| 11360 | |
| 11361 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11362 | |
| 11363 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 11364 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 11365 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 11366 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 11367 | cmd_fp->vdev_id = vdev_id; |
| 11368 | cmd_fp->command_arg = command; |
| 11369 | |
| 11370 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11371 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11372 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11373 | 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] | 11374 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11375 | goto error; |
| 11376 | } |
| 11377 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11378 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 11379 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11380 | |
| 11381 | error: |
| 11382 | wmi_buf_free(buf); |
| 11383 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11384 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11385 | } |
| 11386 | |
| 11387 | /** |
| 11388 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 11389 | * @wmi_handle: wmi handle |
| 11390 | * @ap_profile_p: ap profile |
| 11391 | * @vdev_id: vdev id |
| 11392 | * |
| 11393 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 11394 | * |
| 11395 | * Return: CDF status |
| 11396 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11397 | 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] | 11398 | wmi_ap_profile *ap_profile_p, |
| 11399 | uint32_t vdev_id) |
| 11400 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11401 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11402 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11403 | int len; |
| 11404 | uint8_t *buf_ptr; |
| 11405 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 11406 | |
| 11407 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 11408 | |
| 11409 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11410 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11411 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11412 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11413 | } |
| 11414 | |
| 11415 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11416 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 11417 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 11418 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 11419 | WMITLV_GET_STRUCT_TLVLEN |
| 11420 | (wmi_roam_ap_profile_fixed_param)); |
| 11421 | /* fill in threshold values */ |
| 11422 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 11423 | roam_ap_profile_fp->id = 0; |
| 11424 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 11425 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11426 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11427 | WMITLV_SET_HDR(buf_ptr, |
| 11428 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 11429 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 11430 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11431 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11432 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11433 | 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] | 11434 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11435 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11436 | } |
| 11437 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11438 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11439 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11440 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11441 | } |
| 11442 | |
| 11443 | /** |
| 11444 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 11445 | * @wmi_handle: wmi handle |
| 11446 | * @scan_period: scan period |
| 11447 | * @scan_age: scan age |
| 11448 | * @vdev_id: vdev id |
| 11449 | * |
| 11450 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 11451 | * |
| 11452 | * Return: CDF status |
| 11453 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11454 | 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] | 11455 | uint32_t scan_period, |
| 11456 | uint32_t scan_age, |
| 11457 | uint32_t vdev_id) |
| 11458 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11459 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11460 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11461 | int len; |
| 11462 | uint8_t *buf_ptr; |
| 11463 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 11464 | |
| 11465 | /* Send scan period values */ |
| 11466 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 11467 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11468 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11469 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11470 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11471 | } |
| 11472 | |
| 11473 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11474 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 11475 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 11476 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 11477 | WMITLV_GET_STRUCT_TLVLEN |
| 11478 | (wmi_roam_scan_period_fixed_param)); |
| 11479 | /* fill in scan period values */ |
| 11480 | scan_period_fp->vdev_id = vdev_id; |
| 11481 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 11482 | scan_period_fp->roam_scan_age = scan_age; |
| 11483 | |
| 11484 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11485 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11486 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11487 | 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] | 11488 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11489 | goto error; |
| 11490 | } |
| 11491 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11492 | 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] | 11493 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11494 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11495 | error: |
| 11496 | wmi_buf_free(buf); |
| 11497 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11498 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11499 | } |
| 11500 | |
| 11501 | /** |
| 11502 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 11503 | * @wmi_handle: wmi handle |
| 11504 | * @chan_count: channel count |
| 11505 | * @chan_list: channel list |
| 11506 | * @list_type: list type |
| 11507 | * @vdev_id: vdev id |
| 11508 | * |
| 11509 | * Set roam offload channel list. |
| 11510 | * |
| 11511 | * Return: CDF status |
| 11512 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11513 | 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] | 11514 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 11515 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11516 | uint8_t list_type, uint32_t vdev_id) |
| 11517 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11518 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11519 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11520 | int len, list_tlv_len; |
| 11521 | int i; |
| 11522 | uint8_t *buf_ptr; |
| 11523 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 11524 | A_UINT32 *roam_chan_list_array; |
| 11525 | |
| 11526 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11527 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11528 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11529 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11530 | } |
| 11531 | /* Channel list is a table of 2 TLV's */ |
| 11532 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 11533 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 11534 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11535 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11536 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11537 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11538 | } |
| 11539 | |
| 11540 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11541 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 11542 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 11543 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 11544 | WMITLV_GET_STRUCT_TLVLEN |
| 11545 | (wmi_roam_chan_list_fixed_param)); |
| 11546 | chan_list_fp->vdev_id = vdev_id; |
| 11547 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 11548 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11549 | /* external app is controlling channel list */ |
| 11550 | chan_list_fp->chan_list_type = |
| 11551 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 11552 | } else { |
| 11553 | /* umac supplied occupied channel list in LFR */ |
| 11554 | chan_list_fp->chan_list_type = |
| 11555 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 11556 | } |
| 11557 | |
| 11558 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 11559 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11560 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 11561 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11562 | WMI_LOGI("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11563 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 11564 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 11565 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11566 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11567 | } |
| 11568 | |
| 11569 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11570 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11571 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11572 | 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] | 11573 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11574 | goto error; |
| 11575 | } |
| 11576 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11577 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
| 11578 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11579 | error: |
| 11580 | wmi_buf_free(buf); |
| 11581 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11582 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11583 | } |
| 11584 | |
| 11585 | /** |
| 11586 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 11587 | * @wmi_handle: wmi handle |
| 11588 | * @rssi_change_thresh: RSSI Change threshold |
| 11589 | * @bcn_rssi_weight: beacon RSSI weight |
| 11590 | * @vdev_id: vdev id |
| 11591 | * |
| 11592 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 11593 | * |
| 11594 | * Return: CDF status |
| 11595 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11596 | 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] | 11597 | uint32_t vdev_id, |
| 11598 | int32_t rssi_change_thresh, |
| 11599 | uint32_t bcn_rssi_weight, |
| 11600 | uint32_t hirssi_delay_btw_scans) |
| 11601 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11602 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11603 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11604 | int len; |
| 11605 | uint8_t *buf_ptr; |
| 11606 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 11607 | |
| 11608 | /* Send rssi change parameters */ |
| 11609 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 11610 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11611 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11612 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11613 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11614 | } |
| 11615 | |
| 11616 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11617 | rssi_change_fp = |
| 11618 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 11619 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 11620 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 11621 | WMITLV_GET_STRUCT_TLVLEN |
| 11622 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 11623 | /* fill in rssi change threshold (hysteresis) values */ |
| 11624 | rssi_change_fp->vdev_id = vdev_id; |
| 11625 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 11626 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 11627 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 11628 | |
| 11629 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11630 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11631 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11632 | 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] | 11633 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11634 | goto error; |
| 11635 | } |
| 11636 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11637 | 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] | 11638 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11639 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 11640 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11641 | error: |
| 11642 | wmi_buf_free(buf); |
| 11643 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11644 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11645 | } |
| 11646 | |
| 11647 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 11648 | * @wmi_handle: wmi handle. |
| 11649 | * @cmd: size of command structure. |
| 11650 | * @per_entry_size: per entry size. |
| 11651 | * |
| 11652 | * This utility function calculates how many hotlist entries can |
| 11653 | * fit in one page. |
| 11654 | * |
| 11655 | * Return: number of entries |
| 11656 | */ |
| 11657 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 11658 | size_t cmd_size, |
| 11659 | size_t per_entry_size) |
| 11660 | { |
| 11661 | uint32_t avail_space = 0; |
| 11662 | int num_entries = 0; |
| 11663 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 11664 | |
| 11665 | /* Calculate number of hotlist entries that can |
| 11666 | * be passed in wma message request. |
| 11667 | */ |
| 11668 | avail_space = max_msg_len - cmd_size; |
| 11669 | num_entries = avail_space / per_entry_size; |
| 11670 | return num_entries; |
| 11671 | } |
| 11672 | |
| 11673 | /** |
| 11674 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 11675 | * @wmi_handle: wmi handle |
| 11676 | * @photlist: hotlist command params |
| 11677 | * @buf_len: buffer length |
| 11678 | * |
| 11679 | * This function fills individual elements for hotlist request and |
| 11680 | * TLV for bssid entries |
| 11681 | * |
| 11682 | * Return: CDF Status. |
| 11683 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11684 | 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] | 11685 | struct ext_scan_setbssi_hotlist_params * |
| 11686 | photlist, int *buf_len) |
| 11687 | { |
| 11688 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 11689 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 11690 | struct ap_threshold_params *src_ap = photlist->ap; |
| 11691 | wmi_buf_t buf; |
| 11692 | uint8_t *buf_ptr; |
| 11693 | |
| 11694 | int j, index = 0; |
| 11695 | int cmd_len = 0; |
| 11696 | int num_entries; |
| 11697 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 11698 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11699 | int len = sizeof(*cmd); |
| 11700 | |
| 11701 | len += WMI_TLV_HDR_SIZE; |
| 11702 | cmd_len = len; |
| 11703 | |
| 11704 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 11705 | cmd_len, |
| 11706 | sizeof(*dest_hotlist)); |
| 11707 | /* setbssid hotlist expects the bssid list |
| 11708 | * to be non zero value |
| 11709 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 11710 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 11711 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11712 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11713 | } |
| 11714 | |
| 11715 | /* Split the hot list entry pages and send multiple command |
| 11716 | * requests if the buffer reaches the maximum request size |
| 11717 | */ |
| 11718 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11719 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11720 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 11721 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11722 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11723 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 11724 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11725 | } |
| 11726 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11727 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 11728 | buf_ptr; |
| 11729 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11730 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 11731 | WMITLV_GET_STRUCT_TLVLEN |
| 11732 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 11733 | |
| 11734 | /* Multiple requests are sent until the num_entries_in_page |
| 11735 | * matches the total_entries |
| 11736 | */ |
| 11737 | cmd->request_id = photlist->requestId; |
| 11738 | cmd->vdev_id = photlist->sessionId; |
| 11739 | cmd->total_entries = numap; |
| 11740 | cmd->mode = 1; |
| 11741 | cmd->num_entries_in_page = min_entries; |
| 11742 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 11743 | cmd->first_entry_index = index; |
| 11744 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11745 | 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] | 11746 | __func__, cmd->vdev_id, cmd->total_entries, |
| 11747 | cmd->num_entries_in_page, |
| 11748 | cmd->lost_ap_scan_count); |
| 11749 | |
| 11750 | buf_ptr += sizeof(*cmd); |
| 11751 | WMITLV_SET_HDR(buf_ptr, |
| 11752 | WMITLV_TAG_ARRAY_STRUC, |
| 11753 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 11754 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 11755 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11756 | |
| 11757 | /* Populate bssid, channel info and rssi |
| 11758 | * for the bssid's that are sent as hotlists. |
| 11759 | */ |
| 11760 | for (j = 0; j < min_entries; j++) { |
| 11761 | WMITLV_SET_HDR(dest_hotlist, |
| 11762 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 11763 | WMITLV_GET_STRUCT_TLVLEN |
| 11764 | (wmi_extscan_hotlist_entry)); |
| 11765 | |
| 11766 | dest_hotlist->min_rssi = src_ap->low; |
| 11767 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 11768 | &dest_hotlist->bssid); |
| 11769 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11770 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11771 | __func__, dest_hotlist->channel, |
| 11772 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11773 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11774 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 11775 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 11776 | dest_hotlist->bssid.mac_addr47to32); |
| 11777 | dest_hotlist++; |
| 11778 | src_ap++; |
| 11779 | } |
| 11780 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 11781 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 11782 | |
| 11783 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11784 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11785 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11786 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11787 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11788 | } |
| 11789 | index = index + min_entries; |
| 11790 | num_entries = numap - min_entries; |
| 11791 | len = cmd_len; |
| 11792 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11793 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11794 | } |
| 11795 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 11796 | /** |
| 11797 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 11798 | * @wmi_handle: wmi handle |
| 11799 | * @param: wmi power debug parameter |
| 11800 | * |
| 11801 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 11802 | * |
| 11803 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 11804 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11805 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 11806 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 11807 | { |
| 11808 | wmi_buf_t buf = NULL; |
| 11809 | QDF_STATUS status; |
| 11810 | int len, args_tlv_len; |
| 11811 | uint8_t *buf_ptr; |
| 11812 | uint8_t i; |
| 11813 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 11814 | uint32_t *cmd_args; |
| 11815 | |
| 11816 | /* Prepare and send power debug cmd parameters */ |
| 11817 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 11818 | len = sizeof(*cmd) + args_tlv_len; |
| 11819 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11820 | if (!buf) { |
| 11821 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 11822 | return QDF_STATUS_E_NOMEM; |
| 11823 | } |
| 11824 | |
| 11825 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11826 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 11827 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11828 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 11829 | WMITLV_GET_STRUCT_TLVLEN |
| 11830 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 11831 | |
| 11832 | cmd->pdev_id = param->pdev_id; |
| 11833 | cmd->module_id = param->module_id; |
| 11834 | cmd->num_args = param->num_args; |
| 11835 | buf_ptr += sizeof(*cmd); |
| 11836 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11837 | (param->num_args * sizeof(uint32_t))); |
| 11838 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11839 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 11840 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 11841 | cmd_args[i] = param->args[i]; |
| 11842 | WMI_LOGI("%d,", param->args[i]); |
| 11843 | } |
| 11844 | |
| 11845 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 11846 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 11847 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11848 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 11849 | status); |
| 11850 | goto error; |
| 11851 | } |
| 11852 | |
| 11853 | return QDF_STATUS_SUCCESS; |
| 11854 | error: |
| 11855 | wmi_buf_free(buf); |
| 11856 | |
| 11857 | return status; |
| 11858 | } |
| 11859 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11860 | /** |
| 11861 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 11862 | * @wmi_handle: wmi handle |
| 11863 | * @param tgt_res_cfg: pointer to target resource configuration |
| 11864 | * @param num_mem_chunks: Number of memory chunks |
| 11865 | * @param mem_chunks: pointer to target memory chunks |
| 11866 | * |
| 11867 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 11868 | */ |
| 11869 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
| 11870 | target_resource_config *tgt_res_cfg, uint8_t num_mem_chunks, |
| 11871 | struct wmi_host_mem_chunk *mem_chunks) |
| 11872 | { |
| 11873 | wmi_buf_t buf; |
| 11874 | wmi_init_cmd_fixed_param *cmd; |
| 11875 | wmi_abi_version my_vers; |
| 11876 | int num_whitelist; |
| 11877 | uint8_t *buf_ptr; |
| 11878 | wmi_resource_config *resource_cfg; |
| 11879 | wlan_host_memory_chunk *host_mem_chunks; |
| 11880 | uint32_t mem_chunk_len = 0; |
| 11881 | uint16_t idx; |
| 11882 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11883 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11884 | |
| 11885 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 11886 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 11887 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 11888 | if (!buf) { |
| 11889 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 11890 | return QDF_STATUS_E_FAILURE; |
| 11891 | } |
| 11892 | |
| 11893 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11894 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 11895 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 11896 | |
| 11897 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 11898 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 11899 | + WMI_TLV_HDR_SIZE); |
| 11900 | |
| 11901 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11902 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 11903 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 11904 | |
| 11905 | wmi_copy_resource_config(resource_cfg, tgt_res_cfg); |
| 11906 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 11907 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 11908 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 11909 | |
| 11910 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 11911 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 11912 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 11913 | WMITLV_GET_STRUCT_TLVLEN |
| 11914 | (wlan_host_memory_chunk)); |
| 11915 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 11916 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 11917 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
| 11918 | qdf_print("chunk %d len %d requested ,ptr 0x%x ", |
| 11919 | idx, host_mem_chunks[idx].size, |
| 11920 | host_mem_chunks[idx].ptr); |
| 11921 | } |
| 11922 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 11923 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 11924 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 11925 | WMITLV_TAG_ARRAY_STRUC, |
| 11926 | (sizeof(wlan_host_memory_chunk) * |
| 11927 | num_mem_chunks)); |
| 11928 | |
| 11929 | num_whitelist = sizeof(version_whitelist) / |
| 11930 | sizeof(wmi_whitelist_version_info); |
| 11931 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 11932 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 11933 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 11934 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 11935 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 11936 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 11937 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11938 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11939 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 11940 | &my_vers, |
| 11941 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 11942 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11943 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11944 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 11945 | __func__, |
| 11946 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 11947 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 11948 | cmd->host_abi_vers.abi_version_ns_0, |
| 11949 | cmd->host_abi_vers.abi_version_ns_1, |
| 11950 | cmd->host_abi_vers.abi_version_ns_2, |
| 11951 | cmd->host_abi_vers.abi_version_ns_3); |
| 11952 | |
| 11953 | /* Save version sent from host - |
| 11954 | * Will be used to check ready event |
| 11955 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11956 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11957 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 11958 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11959 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11960 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 11961 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 11962 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 11963 | ret); |
| 11964 | wmi_buf_free(buf); |
| 11965 | } |
| 11966 | return ret; |
| 11967 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11968 | } |
| 11969 | |
| 11970 | /** |
| 11971 | * save_service_bitmap_tlv() - save service bitmap |
| 11972 | * @wmi_handle: wmi handle |
| 11973 | * @param evt_buf: pointer to event buffer |
| 11974 | * |
| 11975 | * Return: None |
| 11976 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 11977 | #ifndef CONFIG_MCL |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11978 | static |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11979 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11980 | { |
| 11981 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11982 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11983 | |
| 11984 | qdf_mem_copy(wmi_handle->wmi_service_bitmap, |
| 11985 | param_buf->wmi_service_bitmap, |
| 11986 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
| 11987 | } |
| 11988 | #else |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11989 | static |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11990 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 11991 | { |
| 11992 | return; |
| 11993 | } |
| 11994 | |
| 11995 | #endif |
| 11996 | |
| 11997 | /** |
| 11998 | * is_service_enabled_tlv() - Check if service enabled |
| 11999 | * @param wmi_handle: wmi handle |
| 12000 | * @param service_id: service identifier |
| 12001 | * |
| 12002 | * Return: 1 enabled, 0 disabled |
| 12003 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 12004 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12005 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 12006 | uint32_t service_id) |
| 12007 | { |
| 12008 | return WMI_SERVICE_IS_ENABLED(wmi_handle->wmi_service_bitmap, |
| 12009 | service_id); |
| 12010 | } |
| 12011 | #else |
| 12012 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 12013 | uint32_t service_id) |
| 12014 | { |
| 12015 | return false; |
| 12016 | } |
| 12017 | #endif |
| 12018 | |
| 12019 | /** |
| 12020 | * extract_service_ready_tlv() - extract service ready event |
| 12021 | * @wmi_handle: wmi handle |
| 12022 | * @param evt_buf: pointer to received event buffer |
| 12023 | * @param cap: pointer to hold target capability information extracted from even |
| 12024 | * |
| 12025 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12026 | */ |
| 12027 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
| 12028 | void *evt_buf, target_capability_info *cap) |
| 12029 | { |
| 12030 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 12031 | wmi_service_ready_event_fixed_param *ev; |
| 12032 | |
| 12033 | |
| 12034 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 12035 | |
| 12036 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 12037 | if (!ev) { |
| 12038 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 12039 | return QDF_STATUS_E_FAILURE; |
| 12040 | } |
| 12041 | |
| 12042 | cap->phy_capability = ev->phy_capability; |
| 12043 | cap->max_frag_entry = ev->max_frag_entry; |
| 12044 | cap->num_rf_chains = ev->num_rf_chains; |
| 12045 | cap->ht_cap_info = ev->ht_cap_info; |
| 12046 | cap->vht_cap_info = ev->vht_cap_info; |
| 12047 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 12048 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 12049 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 12050 | cap->sys_cap_info = ev->sys_cap_info; |
| 12051 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 12052 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 12053 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 12054 | cap->max_supported_macs = ev->max_supported_macs; |
| 12055 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 12056 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 12057 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 12058 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 12059 | |
| 12060 | return QDF_STATUS_SUCCESS; |
| 12061 | } |
| 12062 | |
| 12063 | /** |
| 12064 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 12065 | * @wmi_handle: wmi handle |
| 12066 | * @param evt_buf: Pointer to event buffer |
| 12067 | * @param cap: pointer to hold HAL reg capabilities |
| 12068 | * |
| 12069 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12070 | */ |
| 12071 | static QDF_STATUS extract_hal_reg_cap_tlv(wmi_unified_t wmi_handle, |
| 12072 | void *evt_buf, TARGET_HAL_REG_CAPABILITIES *cap) |
| 12073 | { |
| 12074 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 12075 | u_int32_t wireless_modes_orig = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12076 | |
| 12077 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 12078 | |
| 12079 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 12080 | sizeof(uint32_t)), |
| 12081 | sizeof(TARGET_HAL_REG_CAPABILITIES)); |
| 12082 | |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 12083 | /* Convert REGDMN_MODE values sent by target to host internal |
| 12084 | * WMI_HOST_REGDMN_MODE values. |
| 12085 | * |
| 12086 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 12087 | * host currently. Add this in the future if required. |
| 12088 | * |
| 12089 | * 11AX TODO (Phase II) : 11ax related values are not currently |
| 12090 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 12091 | * finalize the advertisement mechanism. |
| 12092 | */ |
| 12093 | |
| 12094 | wireless_modes_orig = param_buf->hal_reg_capabilities->wireless_modes; |
| 12095 | cap->wireless_modes = 0; |
| 12096 | |
| 12097 | if (wireless_modes_orig & REGDMN_MODE_11A) |
| 12098 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 12099 | |
| 12100 | if (wireless_modes_orig & REGDMN_MODE_TURBO) |
| 12101 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 12102 | |
| 12103 | if (wireless_modes_orig & REGDMN_MODE_11B) |
| 12104 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 12105 | |
| 12106 | if (wireless_modes_orig & REGDMN_MODE_PUREG) |
| 12107 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 12108 | |
| 12109 | if (wireless_modes_orig & REGDMN_MODE_11G) |
| 12110 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 12111 | |
| 12112 | if (wireless_modes_orig & REGDMN_MODE_108G) |
| 12113 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 12114 | |
| 12115 | if (wireless_modes_orig & REGDMN_MODE_108A) |
| 12116 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 12117 | |
| 12118 | if (wireless_modes_orig & REGDMN_MODE_XR) |
| 12119 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 12120 | |
| 12121 | if (wireless_modes_orig & REGDMN_MODE_11A_HALF_RATE) |
| 12122 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 12123 | |
| 12124 | if (wireless_modes_orig & REGDMN_MODE_11A_QUARTER_RATE) |
| 12125 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 12126 | |
| 12127 | if (wireless_modes_orig & REGDMN_MODE_11NG_HT20) |
| 12128 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 12129 | |
| 12130 | if (wireless_modes_orig & REGDMN_MODE_11NA_HT20) |
| 12131 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 12132 | |
| 12133 | if (wireless_modes_orig & REGDMN_MODE_11NG_HT40PLUS) |
| 12134 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 12135 | |
| 12136 | if (wireless_modes_orig & REGDMN_MODE_11NG_HT40MINUS) |
| 12137 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 12138 | |
| 12139 | if (wireless_modes_orig & REGDMN_MODE_11NA_HT40PLUS) |
| 12140 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 12141 | |
| 12142 | if (wireless_modes_orig & REGDMN_MODE_11NA_HT40MINUS) |
| 12143 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 12144 | |
| 12145 | if (wireless_modes_orig & REGDMN_MODE_11AC_VHT20) |
| 12146 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 12147 | |
| 12148 | if (wireless_modes_orig & REGDMN_MODE_11AC_VHT40PLUS) |
| 12149 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 12150 | |
| 12151 | if (wireless_modes_orig & REGDMN_MODE_11AC_VHT40MINUS) |
| 12152 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 12153 | |
| 12154 | if (wireless_modes_orig & REGDMN_MODE_11AC_VHT80) |
| 12155 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 12156 | |
| 12157 | if (wireless_modes_orig & REGDMN_MODE_11AC_VHT160) |
| 12158 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 12159 | |
| 12160 | if (wireless_modes_orig & REGDMN_MODE_11AC_VHT80_80) |
| 12161 | cap->wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 12162 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12163 | return QDF_STATUS_SUCCESS; |
| 12164 | } |
| 12165 | |
| 12166 | /** |
| 12167 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 12168 | * @wmi_handle: wmi handle |
| 12169 | * @param evt_buf: pointer to event buffer |
| 12170 | * @param num_entries: pointer to hold number of entries requested |
| 12171 | * |
| 12172 | * Return: Number of entries requested |
| 12173 | */ |
| 12174 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 12175 | void *evt_buf, uint8_t *num_entries) |
| 12176 | { |
| 12177 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 12178 | wmi_service_ready_event_fixed_param *ev; |
| 12179 | |
| 12180 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 12181 | |
| 12182 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 12183 | if (!ev) { |
| 12184 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 12185 | return NULL; |
| 12186 | } |
| 12187 | |
| 12188 | *num_entries = ev->num_mem_reqs; |
| 12189 | |
| 12190 | return (host_mem_req *)param_buf->mem_reqs; |
| 12191 | } |
| 12192 | |
| 12193 | /** |
| 12194 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 12195 | * ready function |
| 12196 | * @wmi_handle: wmi handle |
| 12197 | * @param evt_buf: pointer to event buffer |
| 12198 | * |
| 12199 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12200 | */ |
| 12201 | static QDF_STATUS |
| 12202 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 12203 | { |
| 12204 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 12205 | wmi_service_ready_event_fixed_param *ev; |
| 12206 | |
| 12207 | |
| 12208 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 12209 | |
| 12210 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 12211 | if (!ev) { |
| 12212 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 12213 | return QDF_STATUS_E_FAILURE; |
| 12214 | } |
| 12215 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12216 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12217 | /*Save fw version from service ready message */ |
| 12218 | /*This will be used while sending INIT message */ |
| 12219 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 12220 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12221 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12222 | return QDF_STATUS_SUCCESS; |
| 12223 | } |
| 12224 | |
| 12225 | /** |
| 12226 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 12227 | * @wmi_handle: wmi handle |
| 12228 | * @param evt_buf: Pointer to event buffer |
| 12229 | * |
| 12230 | * Return: ready status |
| 12231 | */ |
| 12232 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 12233 | void *evt_buf) |
| 12234 | { |
| 12235 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 12236 | wmi_ready_event_fixed_param *ev = NULL; |
| 12237 | |
| 12238 | |
| 12239 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 12240 | ev = param_buf->fixed_param; |
| 12241 | |
| 12242 | qdf_print("%s:%d\n", __func__, ev->status); |
| 12243 | |
| 12244 | return ev->status; |
| 12245 | } |
| 12246 | |
| 12247 | /** |
| 12248 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 12249 | * @wmi_handle: wmi handle |
| 12250 | * @param evt_buf: pointer to event buffer |
| 12251 | * @param macaddr: Pointer to hold MAC address |
| 12252 | * |
| 12253 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12254 | */ |
| 12255 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 12256 | void *evt_buf, uint8_t *macaddr) |
| 12257 | { |
| 12258 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 12259 | wmi_ready_event_fixed_param *ev = NULL; |
| 12260 | |
| 12261 | |
| 12262 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 12263 | ev = param_buf->fixed_param; |
| 12264 | |
| 12265 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 12266 | |
| 12267 | return QDF_STATUS_SUCCESS; |
| 12268 | } |
| 12269 | |
| 12270 | /** |
| 12271 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 12272 | * @wmi_handle: wmi handle |
| 12273 | * @param evt_buf: pointer to event buffer |
| 12274 | * |
| 12275 | * Return: length |
| 12276 | */ |
| 12277 | static uint8_t *extract_dbglog_data_len_tlv(wmi_unified_t wmi_handle, |
| 12278 | void *evt_buf, uint16_t *len) |
| 12279 | { |
| 12280 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 12281 | |
| 12282 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 12283 | |
| 12284 | *len = param_buf->num_bufp; |
| 12285 | |
| 12286 | return param_buf->bufp; |
| 12287 | } |
| 12288 | |
| 12289 | /** |
| 12290 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 12291 | * @wmi_handle: wmi handle |
| 12292 | * @param evt_buf: pointer to event buffer |
| 12293 | * @param vdev_rsp: Pointer to hold vdev response |
| 12294 | * |
| 12295 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12296 | */ |
| 12297 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 12298 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 12299 | { |
| 12300 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 12301 | wmi_vdev_start_response_event_fixed_param *ev; |
| 12302 | |
| 12303 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 12304 | if (!param_buf) { |
| 12305 | qdf_print("Invalid start response event buffer\n"); |
| 12306 | return QDF_STATUS_E_INVAL; |
| 12307 | } |
| 12308 | |
| 12309 | ev = param_buf->fixed_param; |
| 12310 | if (!ev) { |
| 12311 | qdf_print("Invalid start response event buffer\n"); |
| 12312 | return QDF_STATUS_E_INVAL; |
| 12313 | } |
| 12314 | |
| 12315 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 12316 | |
| 12317 | vdev_rsp->vdev_id = ev->vdev_id; |
| 12318 | vdev_rsp->requestor_id = ev->requestor_id; |
| 12319 | vdev_rsp->resp_type = ev->resp_type; |
| 12320 | vdev_rsp->status = ev->status; |
| 12321 | vdev_rsp->chain_mask = ev->chain_mask; |
| 12322 | vdev_rsp->smps_mode = ev->smps_mode; |
| 12323 | vdev_rsp->mac_id = ev->mac_id; |
| 12324 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 12325 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 12326 | |
| 12327 | return QDF_STATUS_SUCCESS; |
| 12328 | } |
| 12329 | |
| 12330 | /** |
| 12331 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset update param |
| 12332 | * @wmi_handle: wmi handle |
| 12333 | * @param evt_buf: pointer to event buffer |
| 12334 | * @param vdev_map: Pointer to hold vdev map |
| 12335 | * @param tbttoffset_list: Pointer to tbtt offset list |
| 12336 | * |
| 12337 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12338 | */ |
| 12339 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 12340 | void *evt_buf, uint32_t *vdev_map, uint32_t **tbttoffset_list) |
| 12341 | { |
| 12342 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 12343 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 12344 | |
| 12345 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 12346 | if (!param_buf) { |
| 12347 | qdf_print("Invalid tbtt update event buffer\n"); |
| 12348 | return QDF_STATUS_E_INVAL; |
| 12349 | } |
| 12350 | tbtt_offset_event = param_buf->fixed_param; |
| 12351 | |
| 12352 | *vdev_map = tbtt_offset_event->vdev_map; |
| 12353 | *tbttoffset_list = param_buf->tbttoffset_list; |
| 12354 | |
| 12355 | return QDF_STATUS_SUCCESS; |
| 12356 | } |
| 12357 | |
| 12358 | /** |
| 12359 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 12360 | * @wmi_handle: wmi handle |
| 12361 | * @param evt_buf: pointer to event buffer |
| 12362 | * @param hdr: Pointer to hold header |
| 12363 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 12364 | * |
| 12365 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12366 | */ |
| 12367 | static QDF_STATUS extract_mgmt_rx_params_tlv(wmi_unified_t wmi_handle, |
| 12368 | void *evt_buf, wmi_host_mgmt_rx_hdr *hdr, uint8_t **bufp) |
| 12369 | { |
| 12370 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 12371 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 12372 | |
| 12373 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 12374 | if (!param_tlvs) { |
| 12375 | WMI_LOGE("Get NULL point message from FW"); |
| 12376 | return QDF_STATUS_E_INVAL; |
| 12377 | } |
| 12378 | |
| 12379 | ev_hdr = param_tlvs->hdr; |
| 12380 | if (!hdr) { |
| 12381 | WMI_LOGE("Rx event is NULL"); |
| 12382 | return QDF_STATUS_E_INVAL; |
| 12383 | } |
| 12384 | |
| 12385 | |
| 12386 | hdr->channel = ev_hdr->channel; |
| 12387 | hdr->snr = ev_hdr->snr; |
| 12388 | hdr->rate = ev_hdr->rate; |
| 12389 | hdr->phy_mode = ev_hdr->phy_mode; |
| 12390 | hdr->buf_len = ev_hdr->buf_len; |
| 12391 | hdr->status = ev_hdr->status; |
| 12392 | hdr->flags = ev_hdr->flags; |
| 12393 | hdr->rssi = ev_hdr->rssi; |
| 12394 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 12395 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 12396 | |
| 12397 | *bufp = param_tlvs->bufp; |
| 12398 | |
| 12399 | return QDF_STATUS_SUCCESS; |
| 12400 | } |
| 12401 | |
| 12402 | /** |
| 12403 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 12404 | * @wmi_handle: wmi handle |
| 12405 | * @param evt_buf: pointer to event buffer |
| 12406 | * @param vdev_id: Pointer to hold vdev identifier |
| 12407 | * |
| 12408 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12409 | */ |
| 12410 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 12411 | void *evt_buf, uint32_t *vdev_id) |
| 12412 | { |
| 12413 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 12414 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 12415 | |
| 12416 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 12417 | if (!param_buf) { |
| 12418 | WMI_LOGE("Invalid event buffer"); |
| 12419 | return QDF_STATUS_E_INVAL; |
| 12420 | } |
| 12421 | resp_event = param_buf->fixed_param; |
| 12422 | *vdev_id = resp_event->vdev_id; |
| 12423 | |
| 12424 | return QDF_STATUS_SUCCESS; |
| 12425 | } |
| 12426 | |
| 12427 | /** |
| 12428 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 12429 | * @wmi_handle: wmi handle |
| 12430 | * @param evt_buf: pointer to event buffer |
| 12431 | * @param param: Pointer to hold roam param |
| 12432 | * |
| 12433 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12434 | */ |
| 12435 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 12436 | void *evt_buf, wmi_host_roam_event *param) |
| 12437 | { |
| 12438 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 12439 | wmi_roam_event_fixed_param *evt; |
| 12440 | |
| 12441 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 12442 | if (!param_buf) { |
| 12443 | WMI_LOGE("Invalid roam event buffer"); |
| 12444 | return QDF_STATUS_E_INVAL; |
| 12445 | } |
| 12446 | |
| 12447 | evt = param_buf->fixed_param; |
| 12448 | qdf_mem_zero(param, sizeof(*param)); |
| 12449 | |
| 12450 | param->vdev_id = evt->vdev_id; |
| 12451 | param->reason = evt->reason; |
| 12452 | param->rssi = evt->rssi; |
| 12453 | |
| 12454 | return QDF_STATUS_SUCCESS; |
| 12455 | } |
| 12456 | |
| 12457 | /** |
| 12458 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 12459 | * @wmi_handle: wmi handle |
| 12460 | * @param evt_buf: pointer to event buffer |
| 12461 | * @param param: Pointer to hold vdev scan param |
| 12462 | * |
| 12463 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12464 | */ |
| 12465 | static QDF_STATUS extract_vdev_scan_ev_param_tlv(wmi_unified_t wmi_handle, |
| 12466 | void *evt_buf, wmi_host_scan_event *param) |
| 12467 | { |
| 12468 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 12469 | wmi_scan_event_fixed_param *evt = NULL; |
| 12470 | |
| 12471 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 12472 | evt = param_buf->fixed_param; |
| 12473 | |
| 12474 | qdf_mem_zero(param, sizeof(*param)); |
| 12475 | switch (evt->event) { |
| 12476 | case WMI_SCAN_EVENT_STARTED: |
| 12477 | param->event = WMI_HOST_SCAN_EVENT_STARTED; |
| 12478 | break; |
| 12479 | case WMI_SCAN_EVENT_COMPLETED: |
| 12480 | param->event = WMI_HOST_SCAN_EVENT_COMPLETED; |
| 12481 | break; |
| 12482 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
| 12483 | param->event = WMI_HOST_SCAN_EVENT_BSS_CHANNEL; |
| 12484 | break; |
| 12485 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
| 12486 | param->event = WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL; |
| 12487 | break; |
| 12488 | case WMI_SCAN_EVENT_DEQUEUED: |
| 12489 | param->event = WMI_HOST_SCAN_EVENT_DEQUEUED; |
| 12490 | break; |
| 12491 | case WMI_SCAN_EVENT_PREEMPTED: |
| 12492 | param->event = WMI_HOST_SCAN_EVENT_PREEMPTED; |
| 12493 | break; |
| 12494 | case WMI_SCAN_EVENT_START_FAILED: |
| 12495 | param->event = WMI_HOST_SCAN_EVENT_START_FAILED; |
| 12496 | break; |
| 12497 | case WMI_SCAN_EVENT_RESTARTED: |
| 12498 | param->event = WMI_HOST_SCAN_EVENT_RESTARTED; |
| 12499 | break; |
| 12500 | case WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
| 12501 | param->event = WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 12502 | break; |
| 12503 | case WMI_SCAN_EVENT_MAX: |
| 12504 | default: |
| 12505 | param->event = WMI_HOST_SCAN_EVENT_MAX; |
| 12506 | break; |
| 12507 | }; |
| 12508 | |
| 12509 | switch (evt->reason) { |
| 12510 | case WMI_SCAN_REASON_NONE: |
| 12511 | param->reason = WMI_HOST_SCAN_REASON_NONE; |
| 12512 | break; |
| 12513 | case WMI_SCAN_REASON_COMPLETED: |
| 12514 | param->reason = WMI_HOST_SCAN_REASON_COMPLETED; |
| 12515 | break; |
| 12516 | case WMI_SCAN_REASON_CANCELLED: |
| 12517 | param->reason = WMI_HOST_SCAN_REASON_CANCELLED; |
| 12518 | break; |
| 12519 | case WMI_SCAN_REASON_PREEMPTED: |
| 12520 | param->reason = WMI_HOST_SCAN_REASON_PREEMPTED; |
| 12521 | break; |
| 12522 | case WMI_SCAN_REASON_TIMEDOUT: |
| 12523 | param->reason = WMI_HOST_SCAN_REASON_TIMEDOUT; |
| 12524 | break; |
| 12525 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
| 12526 | param->reason = WMI_HOST_SCAN_REASON_INTERNAL_FAILURE; |
| 12527 | break; |
| 12528 | case WMI_SCAN_REASON_MAX: |
| 12529 | default: |
| 12530 | param->reason = WMI_HOST_SCAN_REASON_MAX; |
| 12531 | break; |
| 12532 | }; |
| 12533 | |
| 12534 | param->channel_freq = evt->channel_freq; |
| 12535 | param->requestor = evt->requestor; |
| 12536 | param->scan_id = evt->scan_id; |
| 12537 | param->vdev_id = evt->vdev_id; |
| 12538 | |
| 12539 | return QDF_STATUS_SUCCESS; |
| 12540 | } |
| 12541 | |
| 12542 | /** |
| 12543 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 12544 | * @wmi_handle: wmi handle |
| 12545 | * @param evt_buf: pointer to event buffer |
| 12546 | * @param param: Pointer to hold MGMT TX completion params |
| 12547 | * |
| 12548 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12549 | */ |
| 12550 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 12551 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 12552 | { |
| 12553 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 12554 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 12555 | |
| 12556 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 12557 | evt_buf; |
| 12558 | if (!param_buf) { |
| 12559 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 12560 | return QDF_STATUS_E_INVAL; |
| 12561 | } |
| 12562 | cmpl_params = param_buf->fixed_param; |
| 12563 | |
| 12564 | param->desc_id = cmpl_params->desc_id; |
| 12565 | param->status = cmpl_params->status; |
| 12566 | |
| 12567 | return QDF_STATUS_SUCCESS; |
| 12568 | } |
| 12569 | |
| 12570 | /** |
| 12571 | * extract_swba_vdev_map_tlv() - extract swba vdev map from event |
| 12572 | * @wmi_handle: wmi handle |
| 12573 | * @param evt_buf: pointer to event buffer |
| 12574 | * @param vdev_map: Pointer to hold vdev map |
| 12575 | * |
| 12576 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12577 | */ |
| 12578 | static QDF_STATUS extract_swba_vdev_map_tlv(wmi_unified_t wmi_handle, |
| 12579 | void *evt_buf, uint32_t *vdev_map) |
| 12580 | { |
| 12581 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12582 | wmi_host_swba_event_fixed_param *swba_event; |
| 12583 | |
| 12584 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12585 | if (!param_buf) { |
| 12586 | WMI_LOGE("Invalid swba event buffer"); |
| 12587 | return QDF_STATUS_E_INVAL; |
| 12588 | } |
| 12589 | swba_event = param_buf->fixed_param; |
| 12590 | *vdev_map = swba_event->vdev_map; |
| 12591 | |
| 12592 | return QDF_STATUS_SUCCESS; |
| 12593 | } |
| 12594 | |
| 12595 | /** |
| 12596 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 12597 | * @wmi_handle: wmi handle |
| 12598 | * @param evt_buf: pointer to event buffer |
| 12599 | * @param idx: Index to bcn info |
| 12600 | * @param tim_info: Pointer to hold tim info |
| 12601 | * |
| 12602 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12603 | */ |
| 12604 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 12605 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 12606 | { |
| 12607 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12608 | wmi_tim_info *tim_info_ev; |
| 12609 | |
| 12610 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12611 | if (!param_buf) { |
| 12612 | WMI_LOGE("Invalid swba event buffer"); |
| 12613 | return QDF_STATUS_E_INVAL; |
| 12614 | } |
| 12615 | |
| 12616 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 12617 | |
| 12618 | tim_info->tim_len = tim_info_ev->tim_len; |
| 12619 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 12620 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 12621 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 12622 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 12623 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
| 12624 | |
| 12625 | return QDF_STATUS_SUCCESS; |
| 12626 | } |
| 12627 | |
| 12628 | /** |
| 12629 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 12630 | * @wmi_handle: wmi handle |
| 12631 | * @param evt_buf: pointer to event buffer |
| 12632 | * @param idx: Index to bcn info |
| 12633 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 12634 | * |
| 12635 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12636 | */ |
| 12637 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 12638 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 12639 | { |
| 12640 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 12641 | wmi_p2p_noa_info *p2p_noa_info; |
| 12642 | uint8_t i = 0; |
| 12643 | |
| 12644 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 12645 | if (!param_buf) { |
| 12646 | WMI_LOGE("Invalid swba event buffer"); |
| 12647 | return QDF_STATUS_E_INVAL; |
| 12648 | } |
| 12649 | |
| 12650 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 12651 | |
| 12652 | p2p_desc->modified = false; |
| 12653 | p2p_desc->num_descriptors = 0; |
| 12654 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 12655 | p2p_desc->modified = true; |
| 12656 | p2p_desc->index = |
| 12657 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 12658 | p2p_desc->oppPS = |
| 12659 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 12660 | p2p_desc->ctwindow = |
| 12661 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 12662 | p2p_desc->num_descriptors = |
| 12663 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 12664 | (p2p_noa_info); |
| 12665 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 12666 | p2p_desc->noa_descriptors[i].type_count = |
| 12667 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 12668 | type_count; |
| 12669 | p2p_desc->noa_descriptors[i].duration = |
| 12670 | p2p_noa_info->noa_descriptors[i].duration; |
| 12671 | p2p_desc->noa_descriptors[i].interval = |
| 12672 | p2p_noa_info->noa_descriptors[i].interval; |
| 12673 | p2p_desc->noa_descriptors[i].start_time = |
| 12674 | p2p_noa_info->noa_descriptors[i].start_time; |
| 12675 | } |
| 12676 | } |
| 12677 | |
| 12678 | return QDF_STATUS_SUCCESS; |
| 12679 | } |
| 12680 | |
| 12681 | /** |
| 12682 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 12683 | * @wmi_handle: wmi handle |
| 12684 | * @param evt_buf: pointer to event buffer |
| 12685 | * @param ev: Pointer to hold peer param |
| 12686 | * |
| 12687 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12688 | */ |
| 12689 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 12690 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 12691 | { |
| 12692 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 12693 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 12694 | |
| 12695 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 12696 | kickout_event = param_buf->fixed_param; |
| 12697 | |
| 12698 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 12699 | ev->peer_macaddr); |
| 12700 | |
| 12701 | ev->reason = kickout_event->reason; |
| 12702 | ev->rssi = kickout_event->rssi; |
| 12703 | |
| 12704 | return QDF_STATUS_SUCCESS; |
| 12705 | } |
| 12706 | |
| 12707 | /** |
| 12708 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 12709 | * @wmi_handle: wmi handle |
| 12710 | * @param evt_buf: pointer to event buffer |
| 12711 | * @param stats_param: Pointer to hold stats count |
| 12712 | * |
| 12713 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12714 | */ |
| 12715 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 12716 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 12717 | { |
| 12718 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12719 | wmi_stats_event_fixed_param *ev; |
| 12720 | |
| 12721 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12722 | |
| 12723 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12724 | if (!ev) { |
| 12725 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 12726 | return QDF_STATUS_E_FAILURE; |
| 12727 | } |
| 12728 | |
| 12729 | switch (ev->stats_id) { |
| 12730 | case WMI_REQUEST_PEER_STAT: |
| 12731 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 12732 | break; |
| 12733 | |
| 12734 | case WMI_REQUEST_AP_STAT: |
| 12735 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 12736 | break; |
| 12737 | |
| 12738 | case WMI_REQUEST_PDEV_STAT: |
| 12739 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 12740 | break; |
| 12741 | |
| 12742 | case WMI_REQUEST_VDEV_STAT: |
| 12743 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 12744 | break; |
| 12745 | |
| 12746 | case WMI_REQUEST_BCNFLT_STAT: |
| 12747 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 12748 | break; |
| 12749 | |
| 12750 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 12751 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 12752 | break; |
| 12753 | |
| 12754 | default: |
| 12755 | stats_param->stats_id = 0; |
| 12756 | break; |
| 12757 | |
| 12758 | } |
| 12759 | |
| 12760 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 12761 | stats_param->num_pdev_ext_stats = 0; |
| 12762 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 12763 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 12764 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 12765 | stats_param->num_chan_stats = ev->num_chan_stats; |
| 12766 | |
| 12767 | return QDF_STATUS_SUCCESS; |
| 12768 | } |
| 12769 | |
| 12770 | /** |
| 12771 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 12772 | * @wmi_handle: wmi handle |
| 12773 | * @param evt_buf: pointer to event buffer |
| 12774 | * @param index: Index into pdev stats |
| 12775 | * @param pdev_stats: Pointer to hold pdev stats |
| 12776 | * |
| 12777 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12778 | */ |
| 12779 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 12780 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 12781 | { |
| 12782 | return QDF_STATUS_SUCCESS; |
| 12783 | } |
| 12784 | |
| 12785 | /** |
| 12786 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 12787 | * @wmi_handle: wmi handle |
| 12788 | * @param evt_buf: pointer to event buffer |
| 12789 | * @param index: Index into extended pdev stats |
| 12790 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 12791 | * |
| 12792 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12793 | */ |
| 12794 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 12795 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 12796 | { |
| 12797 | return QDF_STATUS_SUCCESS; |
| 12798 | } |
| 12799 | |
| 12800 | /** |
| 12801 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 12802 | * @wmi_handle: wmi handle |
| 12803 | * @param evt_buf: pointer to event buffer |
| 12804 | * @param index: Index into vdev stats |
| 12805 | * @param vdev_stats: Pointer to hold vdev stats |
| 12806 | * |
| 12807 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12808 | */ |
| 12809 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 12810 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 12811 | { |
| 12812 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12813 | wmi_stats_event_fixed_param *ev_param; |
| 12814 | uint8_t *data; |
| 12815 | |
| 12816 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12817 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12818 | data = (uint8_t *) param_buf->data; |
| 12819 | |
| 12820 | if (index < ev_param->num_vdev_stats) { |
| 12821 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 12822 | ((ev_param->num_pdev_stats) * |
| 12823 | sizeof(wmi_pdev_stats)) + |
| 12824 | (index * sizeof(wmi_vdev_stats))); |
| 12825 | |
| 12826 | vdev_stats->vdev_id = ev->vdev_id; |
| 12827 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 12828 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 12829 | |
| 12830 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 12831 | sizeof(ev->tx_frm_cnt)); |
| 12832 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 12833 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 12834 | ev->multiple_retry_cnt, |
| 12835 | sizeof(ev->multiple_retry_cnt)); |
| 12836 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 12837 | sizeof(ev->fail_cnt)); |
| 12838 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 12839 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 12840 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 12841 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 12842 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 12843 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 12844 | sizeof(ev->tx_rate_history)); |
| 12845 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 12846 | sizeof(ev->bcn_rssi_history)); |
| 12847 | |
| 12848 | } |
| 12849 | |
| 12850 | return QDF_STATUS_SUCCESS; |
| 12851 | } |
| 12852 | |
| 12853 | /** |
| 12854 | * extract_peer_stats_tlv() - extract peer stats from event |
| 12855 | * @wmi_handle: wmi handle |
| 12856 | * @param evt_buf: pointer to event buffer |
| 12857 | * @param index: Index into peer stats |
| 12858 | * @param peer_stats: Pointer to hold peer stats |
| 12859 | * |
| 12860 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12861 | */ |
| 12862 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 12863 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 12864 | { |
| 12865 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12866 | wmi_stats_event_fixed_param *ev_param; |
| 12867 | uint8_t *data; |
| 12868 | |
| 12869 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12870 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12871 | data = (uint8_t *) param_buf->data; |
| 12872 | |
| 12873 | if (index < ev_param->num_peer_stats) { |
| 12874 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 12875 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 12876 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 12877 | (index * sizeof(wmi_peer_stats))); |
| 12878 | |
| 12879 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 12880 | |
| 12881 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 12882 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 12883 | |
| 12884 | peer_stats->peer_rssi = ev->peer_rssi; |
| 12885 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 12886 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 12887 | } |
| 12888 | |
| 12889 | return QDF_STATUS_SUCCESS; |
| 12890 | } |
| 12891 | |
| 12892 | /** |
| 12893 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 12894 | * @wmi_handle: wmi handle |
| 12895 | * @param evt_buf: pointer to event buffer |
| 12896 | * @param index: Index into bcn fault stats |
| 12897 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 12898 | * |
| 12899 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12900 | */ |
| 12901 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 12902 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 12903 | { |
| 12904 | return QDF_STATUS_SUCCESS; |
| 12905 | } |
| 12906 | |
| 12907 | /** |
| 12908 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 12909 | * @wmi_handle: wmi handle |
| 12910 | * @param evt_buf: pointer to event buffer |
| 12911 | * @param index: Index into extended peer stats |
| 12912 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 12913 | * |
| 12914 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12915 | */ |
| 12916 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 12917 | void *evt_buf, uint32_t index, |
| 12918 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 12919 | { |
| 12920 | return QDF_STATUS_SUCCESS; |
| 12921 | } |
| 12922 | |
| 12923 | /** |
| 12924 | * extract_chan_stats_tlv() - extract chan stats from event |
| 12925 | * @wmi_handle: wmi handle |
| 12926 | * @param evt_buf: pointer to event buffer |
| 12927 | * @param index: Index into chan stats |
| 12928 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 12929 | * |
| 12930 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12931 | */ |
| 12932 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 12933 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 12934 | { |
| 12935 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 12936 | wmi_stats_event_fixed_param *ev_param; |
| 12937 | uint8_t *data; |
| 12938 | |
| 12939 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 12940 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 12941 | data = (uint8_t *) param_buf->data; |
| 12942 | |
| 12943 | if (index < ev_param->num_chan_stats) { |
| 12944 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 12945 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 12946 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 12947 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 12948 | (index * sizeof(wmi_chan_stats))); |
| 12949 | |
| 12950 | |
| 12951 | /* Non-TLV doesnt have num_chan_stats */ |
| 12952 | chan_stats->chan_mhz = ev->chan_mhz; |
| 12953 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 12954 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 12955 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 12956 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 12957 | } |
| 12958 | |
| 12959 | return QDF_STATUS_SUCCESS; |
| 12960 | } |
| 12961 | |
| 12962 | /** |
| 12963 | * extract_profile_ctx_tlv() - extract profile context from event |
| 12964 | * @wmi_handle: wmi handle |
| 12965 | * @param evt_buf: pointer to event buffer |
| 12966 | * @idx: profile stats index to extract |
| 12967 | * @param profile_ctx: Pointer to hold profile context |
| 12968 | * |
| 12969 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12970 | */ |
| 12971 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 12972 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 12973 | { |
| 12974 | return QDF_STATUS_SUCCESS; |
| 12975 | } |
| 12976 | |
| 12977 | /** |
| 12978 | * extract_profile_data_tlv() - extract profile data from event |
| 12979 | * @wmi_handle: wmi handle |
| 12980 | * @param evt_buf: pointer to event buffer |
| 12981 | * @param profile_data: Pointer to hold profile data |
| 12982 | * |
| 12983 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12984 | */ |
| 12985 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 12986 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 12987 | { |
| 12988 | |
| 12989 | return QDF_STATUS_SUCCESS; |
| 12990 | } |
| 12991 | |
| 12992 | /** |
| 12993 | * extract_chan_info_event_tlv() - extract chan information from event |
| 12994 | * @wmi_handle: wmi handle |
| 12995 | * @param evt_buf: pointer to event buffer |
| 12996 | * @param chan_info: Pointer to hold chan information |
| 12997 | * |
| 12998 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12999 | */ |
| 13000 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 13001 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 13002 | { |
| 13003 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 13004 | wmi_chan_info_event_fixed_param *ev; |
| 13005 | |
| 13006 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 13007 | |
| 13008 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 13009 | if (!ev) { |
| 13010 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 13011 | return QDF_STATUS_E_FAILURE; |
| 13012 | } |
| 13013 | |
| 13014 | chan_info->err_code = ev->err_code; |
| 13015 | chan_info->freq = ev->freq; |
| 13016 | chan_info->cmd_flags = ev->cmd_flags; |
| 13017 | chan_info->noise_floor = ev->noise_floor; |
| 13018 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 13019 | chan_info->cycle_count = ev->cycle_count; |
| 13020 | |
| 13021 | return QDF_STATUS_SUCCESS; |
| 13022 | } |
| 13023 | |
| 13024 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 13025 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 13026 | * @wmi_handle: WMI handle |
| 13027 | * @param evt_buf: Pointer to event buffer |
| 13028 | * @param param: Pointer to hold data |
| 13029 | * |
| 13030 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 13031 | */ |
| 13032 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 13033 | uint8_t *evt_buf, |
| 13034 | struct wmi_host_pdev_utf_event *event) |
| 13035 | { |
| 13036 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
| 13037 | |
| 13038 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 13039 | event->data = param_buf->data; |
| 13040 | event->datalen = param_buf->num_data; |
| 13041 | |
| 13042 | return QDF_STATUS_SUCCESS; |
| 13043 | } |
| 13044 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13045 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 13046 | * from event |
| 13047 | * @wmi_handle: wmi handle |
| 13048 | * @param evt_buf: pointer to event buffer |
| 13049 | * @param ch_hopping: Pointer to hold channel hopping param |
| 13050 | * |
| 13051 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13052 | */ |
| 13053 | static QDF_STATUS extract_channel_hopping_event_tlv(wmi_unified_t wmi_handle, |
| 13054 | void *evt_buf, wmi_host_pdev_channel_hopping_event *chan_info) |
| 13055 | { |
| 13056 | return QDF_STATUS_SUCCESS; |
| 13057 | } |
| 13058 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13059 | /** |
| 13060 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 13061 | * from event |
| 13062 | * @wmi_handle: wmi handle |
| 13063 | * @param evt_buf: pointer to event buffer |
| 13064 | * @param param: Pointer to hold evt buf |
| 13065 | * |
| 13066 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13067 | */ |
| 13068 | static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle, |
| 13069 | uint8_t *event, struct wmi_host_service_ext_param *param) |
| 13070 | { |
| 13071 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 13072 | wmi_service_ready_ext_event_fixed_param *ev; |
| 13073 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 13074 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 13075 | |
| 13076 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 13077 | if (!param_buf) |
| 13078 | return -EINVAL; |
| 13079 | |
| 13080 | ev = param_buf->fixed_param; |
| 13081 | if (!ev) |
| 13082 | return -EINVAL; |
| 13083 | |
| 13084 | /* Move this to host based bitmap */ |
| 13085 | param->default_conc_scan_config_bits = |
| 13086 | ev->default_conc_scan_config_bits; |
| 13087 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 13088 | param->he_cap_info = ev->he_cap_info; |
| 13089 | param->mpdu_density = ev->mpdu_density; |
| 13090 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 13091 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 13092 | |
| 13093 | hw_caps = param_buf->soc_hw_mode_caps; |
| 13094 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 13095 | |
| 13096 | reg_caps = param_buf->soc_hal_reg_caps; |
| 13097 | param->num_phy = reg_caps->num_phy; |
| 13098 | |
| 13099 | return QDF_STATUS_SUCCESS; |
| 13100 | } |
| 13101 | |
| 13102 | /** |
| 13103 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 13104 | * extract HW mode cap from service ready event |
| 13105 | * @wmi_handle: wmi handle |
| 13106 | * @param evt_buf: pointer to event buffer |
| 13107 | * @param param: Pointer to hold evt buf |
| 13108 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 13109 | * |
| 13110 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13111 | */ |
| 13112 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 13113 | wmi_unified_t wmi_handle, |
| 13114 | uint8_t *event, uint8_t hw_mode_idx, |
| 13115 | struct wmi_host_hw_mode_caps *param) |
| 13116 | { |
| 13117 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 13118 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 13119 | |
| 13120 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 13121 | if (!param_buf) |
| 13122 | return -EINVAL; |
| 13123 | |
| 13124 | hw_caps = param_buf->soc_hw_mode_caps; |
| 13125 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
| 13126 | return -EINVAL; |
| 13127 | |
| 13128 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 13129 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 13130 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 13131 | param->hw_mode_config_type = |
| 13132 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 13133 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13134 | return QDF_STATUS_SUCCESS; |
| 13135 | } |
| 13136 | |
| 13137 | /** |
| 13138 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 13139 | * extract MAC phy cap from service ready event |
| 13140 | * @wmi_handle: wmi handle |
| 13141 | * @param evt_buf: pointer to event buffer |
| 13142 | * @param param: Pointer to hold evt buf |
| 13143 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 13144 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13145 | * |
| 13146 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13147 | */ |
| 13148 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 13149 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 13150 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13151 | struct wmi_host_mac_phy_caps *param) |
| 13152 | { |
| 13153 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13154 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 13155 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 13156 | uint32_t phy_map; |
| 13157 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13158 | |
| 13159 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 13160 | if (!param_buf) |
| 13161 | return -EINVAL; |
| 13162 | |
| 13163 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 13164 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 13165 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 13166 | break; |
| 13167 | |
| 13168 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 13169 | while (phy_map) { |
| 13170 | phy_map >>= 1; |
| 13171 | phy_idx++; |
| 13172 | } |
| 13173 | } |
| 13174 | |
| 13175 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13176 | return -EINVAL; |
| 13177 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 13178 | phy_idx += phy_id; |
| 13179 | if (phy_idx >= param_buf->num_mac_phy_caps) |
| 13180 | return -EINVAL; |
| 13181 | |
| 13182 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13183 | |
| 13184 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
| 13185 | param->pdev_id = mac_phy_caps->pdev_id; |
| 13186 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 13187 | param->supports_11b = |
| 13188 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 13189 | param->supports_11g = |
| 13190 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 13191 | param->supports_11a = |
| 13192 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 13193 | param->supports_11n = |
| 13194 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 13195 | param->supports_11ac = |
| 13196 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 13197 | param->supports_11ax = |
| 13198 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13199 | |
| 13200 | param->supported_bands = mac_phy_caps->supported_bands; |
| 13201 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 13202 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 13203 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 13204 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 13205 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 13206 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 13207 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 13208 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 13209 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 13210 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 13211 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 13212 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 13213 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 13214 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 13215 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 13216 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 13217 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
| 13218 | |
| 13219 | return QDF_STATUS_SUCCESS; |
| 13220 | } |
| 13221 | |
| 13222 | /** |
| 13223 | * extract_reg_cap_service_ready_ext_tlv() - |
| 13224 | * extract REG cap from service ready event |
| 13225 | * @wmi_handle: wmi handle |
| 13226 | * @param evt_buf: pointer to event buffer |
| 13227 | * @param param: Pointer to hold evt buf |
| 13228 | * @param phy_idx: phy idx should be less than num_mode |
| 13229 | * |
| 13230 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13231 | */ |
| 13232 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 13233 | wmi_unified_t wmi_handle, |
| 13234 | uint8_t *event, uint8_t phy_idx, |
| 13235 | struct WMI_HOST_HAL_REG_CAPABILITIES_EXT *param) |
| 13236 | { |
| 13237 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 13238 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 13239 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 13240 | |
| 13241 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 13242 | if (!param_buf) |
| 13243 | return -EINVAL; |
| 13244 | |
| 13245 | reg_caps = param_buf->soc_hal_reg_caps; |
| 13246 | if (phy_idx >= reg_caps->num_phy) |
| 13247 | return -EINVAL; |
| 13248 | |
| 13249 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 13250 | |
| 13251 | param->phy_id = ext_reg_cap->phy_id; |
| 13252 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 13253 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 13254 | param->regcap1 = ext_reg_cap->regcap1; |
| 13255 | param->regcap2 = ext_reg_cap->regcap2; |
| 13256 | param->wireless_modes = ext_reg_cap->wireless_modes; |
| 13257 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 13258 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 13259 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 13260 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 13261 | |
| 13262 | return QDF_STATUS_SUCCESS; |
| 13263 | } |
| 13264 | |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 13265 | /** |
| 13266 | * extract_dcs_interference_type_tlv() - extract dcs interference type |
| 13267 | * from event |
| 13268 | * @wmi_handle: wmi handle |
| 13269 | * @param evt_buf: pointer to event buffer |
| 13270 | * @param param: Pointer to hold dcs interference param |
| 13271 | * |
| 13272 | * Return: 0 for success or error code |
| 13273 | */ |
| 13274 | static QDF_STATUS extract_dcs_interference_type_tlv( |
| 13275 | wmi_unified_t wmi_handle, |
| 13276 | void *evt_buf, struct wmi_host_dcs_interference_param *param) |
| 13277 | { |
| 13278 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 13279 | |
| 13280 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 13281 | if (!param_buf) |
| 13282 | return -EINVAL; |
| 13283 | |
| 13284 | param->interference_type = param_buf->fixed_param->interference_type; |
| 13285 | param->pdev_id = param_buf->fixed_param->pdev_id; |
| 13286 | |
| 13287 | return QDF_STATUS_SUCCESS; |
| 13288 | } |
| 13289 | |
| 13290 | /* |
| 13291 | * extract_dcs_cw_int_tlv() - extract dcs cw interference from event |
| 13292 | * @wmi_handle: wmi handle |
| 13293 | * @param evt_buf: pointer to event buffer |
| 13294 | * @param cw_int: Pointer to hold cw interference |
| 13295 | * |
| 13296 | * Return: 0 for success or error code |
| 13297 | */ |
| 13298 | static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle, |
| 13299 | void *evt_buf, |
| 13300 | wmi_host_ath_dcs_cw_int *cw_int) |
| 13301 | { |
| 13302 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 13303 | wlan_dcs_cw_int *ev; |
| 13304 | |
| 13305 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 13306 | if (!param_buf) |
| 13307 | return -EINVAL; |
| 13308 | |
| 13309 | ev = param_buf->cw_int; |
| 13310 | |
| 13311 | cw_int->channel = ev->channel; |
| 13312 | |
| 13313 | return QDF_STATUS_SUCCESS; |
| 13314 | } |
| 13315 | |
| 13316 | /** |
| 13317 | * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event |
| 13318 | * @wmi_handle: wmi handle |
| 13319 | * @param evt_buf: pointer to event buffer |
| 13320 | * @param wlan_stat: Pointer to hold wlan stats |
| 13321 | * |
| 13322 | * Return: 0 for success or error code |
| 13323 | */ |
| 13324 | static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle, |
| 13325 | void *evt_buf, |
| 13326 | wmi_host_dcs_im_tgt_stats_t *wlan_stat) |
| 13327 | { |
| 13328 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 13329 | wlan_dcs_im_tgt_stats_t *ev; |
| 13330 | |
| 13331 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 13332 | if (!param_buf) |
| 13333 | return -EINVAL; |
| 13334 | |
| 13335 | ev = param_buf->wlan_stat; |
| 13336 | wlan_stat->reg_tsf32 = ev->reg_tsf32; |
| 13337 | wlan_stat->last_ack_rssi = ev->last_ack_rssi; |
| 13338 | wlan_stat->tx_waste_time = ev->tx_waste_time; |
| 13339 | wlan_stat->rx_time = ev->rx_time; |
| 13340 | wlan_stat->phyerr_cnt = ev->phyerr_cnt; |
| 13341 | wlan_stat->mib_stats.listen_time = ev->listen_time; |
| 13342 | wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt; |
| 13343 | wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt; |
| 13344 | wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt; |
| 13345 | wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt; |
| 13346 | wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt; |
| 13347 | wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt; |
| 13348 | wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt; |
| 13349 | wlan_stat->chan_nf = ev->chan_nf; |
| 13350 | wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 13351 | |
| 13352 | return QDF_STATUS_SUCCESS; |
| 13353 | } |
| 13354 | |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 13355 | #ifdef BIG_ENDIAN_HOST |
| 13356 | /** |
| 13357 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 13358 | * @param data_len - data length |
| 13359 | * @param data - pointer to data |
| 13360 | * |
| 13361 | * Return: QDF_STATUS - success or error status |
| 13362 | */ |
| 13363 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 13364 | { |
| 13365 | uint8_t *data_aligned = NULL; |
| 13366 | int c; |
| 13367 | unsigned char *data_unaligned; |
| 13368 | |
| 13369 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 13370 | FIPS_ALIGN)); |
| 13371 | /* Assigning unaligned space to copy the data */ |
| 13372 | /* Checking if kmalloc does succesful allocation */ |
| 13373 | if (data_unaligned == NULL) |
| 13374 | return QDF_STATUS_E_FAILURE; |
| 13375 | |
| 13376 | /* Checking if space is alligned */ |
| 13377 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 13378 | /* align the data space */ |
| 13379 | data_aligned = |
| 13380 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 13381 | } else { |
| 13382 | data_aligned = (u_int8_t *)data_unaligned; |
| 13383 | } |
| 13384 | |
| 13385 | /* memset and copy content from data to data aligned */ |
| 13386 | OS_MEMSET(data_aligned, 0, data_len); |
| 13387 | OS_MEMCPY(data_aligned, data, data_len); |
| 13388 | /* Endianness to LE */ |
| 13389 | for (c = 0; c < data_len/4; c++) { |
| 13390 | *((u_int32_t *)data_aligned + c) = |
| 13391 | qdf_os_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
| 13392 | } |
| 13393 | |
| 13394 | /* Copy content to event->data */ |
| 13395 | OS_MEMCPY(data, data_aligned, data_len); |
| 13396 | |
| 13397 | /* clean up allocated space */ |
| 13398 | qdf_mem_free(data_unaligned); |
| 13399 | data_aligned = NULL; |
| 13400 | data_unaligned = NULL; |
| 13401 | |
| 13402 | /*************************************************************/ |
| 13403 | |
| 13404 | return QDF_STATUS_SUCCESS; |
| 13405 | } |
| 13406 | #else |
| 13407 | /** |
| 13408 | * fips_conv_data_be() - DUMMY for LE platform |
| 13409 | * |
| 13410 | * Return: QDF_STATUS - success |
| 13411 | */ |
| 13412 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 13413 | { |
| 13414 | return QDF_STATUS_SUCCESS; |
| 13415 | } |
| 13416 | #endif |
| 13417 | |
| 13418 | /** |
| 13419 | * extract_fips_event_data_tlv() - extract fips event data |
| 13420 | * @wmi_handle: wmi handle |
| 13421 | * @param evt_buf: pointer to event buffer |
| 13422 | * @param param: pointer FIPS event params |
| 13423 | * |
| 13424 | * Return: 0 for success or error code |
| 13425 | */ |
| 13426 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 13427 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 13428 | { |
| 13429 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 13430 | wmi_pdev_fips_event_fixed_param *event; |
| 13431 | |
| 13432 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 13433 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 13434 | |
| 13435 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 13436 | QDF_STATUS_SUCCESS) |
| 13437 | return QDF_STATUS_E_FAILURE; |
| 13438 | |
| 13439 | param->data = (uint32_t *)param_buf->data; |
| 13440 | param->data_len = event->data_len; |
| 13441 | param->error_status = event->error_status; |
| 13442 | |
| 13443 | return QDF_STATUS_SUCCESS; |
| 13444 | } |
| 13445 | |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 13446 | /* |
| 13447 | * extract_peer_delete_response_event_tlv() - extract peer delete response event |
| 13448 | * @wmi_handle: wmi handle |
| 13449 | * @param evt_buf: pointer to event buffer |
| 13450 | * @param vdev_id: Pointer to hold vdev_id |
| 13451 | * @param mac_addr: Pointer to hold peer mac address |
| 13452 | * |
| 13453 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13454 | */ |
| 13455 | static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl, |
| 13456 | void *evt_buf, struct wmi_host_peer_delete_response_event *param) |
| 13457 | { |
| 13458 | WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 13459 | wmi_peer_delete_resp_event_fixed_param *ev; |
| 13460 | |
| 13461 | param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf; |
| 13462 | |
| 13463 | ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param; |
| 13464 | if (!ev) { |
| 13465 | WMI_LOGE("%s: Invalid peer_delete response\n", __func__); |
| 13466 | return QDF_STATUS_E_FAILURE; |
| 13467 | } |
| 13468 | |
| 13469 | param->vdev_id = ev->vdev_id; |
| 13470 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr, |
| 13471 | ¶m->mac_address.bytes[0]); |
| 13472 | |
| 13473 | return QDF_STATUS_SUCCESS; |
| 13474 | } |
| 13475 | |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 13476 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 13477 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 13478 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 13479 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 13480 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13481 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 13482 | return false; |
| 13483 | } |
Govind Singh | 06c1839 | 2016-06-10 10:33:19 +0530 | [diff] [blame] | 13484 | #endif |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 13485 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 13486 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 13487 | { |
| 13488 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 13489 | |
| 13490 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 13491 | |
| 13492 | switch (set_cmd->param_id) { |
| 13493 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 13494 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 13495 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 13496 | default: |
| 13497 | break; |
| 13498 | } |
| 13499 | |
| 13500 | return 0; |
| 13501 | } |
| 13502 | |
| 13503 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 13504 | { |
| 13505 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 13506 | |
| 13507 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 13508 | |
| 13509 | switch (ps_cmd->param) { |
| 13510 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 13511 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 13512 | case WMI_STA_PS_ENABLE_QPOWER: |
| 13513 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 13514 | default: |
| 13515 | break; |
| 13516 | } |
| 13517 | |
| 13518 | return 0; |
| 13519 | } |
| 13520 | |
| 13521 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 13522 | uint32_t cmd_id) |
| 13523 | { |
| 13524 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 13525 | return 0; |
| 13526 | |
| 13527 | switch (cmd_id) { |
| 13528 | case WMI_VDEV_SET_PARAM_CMDID: |
| 13529 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 13530 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 13531 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 13532 | default: |
| 13533 | break; |
| 13534 | } |
| 13535 | |
| 13536 | return 0; |
| 13537 | } |
| 13538 | |
| 13539 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 13540 | { |
| 13541 | uint16_t tag = 0; |
| 13542 | |
| 13543 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
| 13544 | pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", |
| 13545 | __func__); |
| 13546 | return tag; |
| 13547 | } |
| 13548 | |
| 13549 | if (wmi_handle->tag_crash_inject) |
| 13550 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 13551 | |
| 13552 | wmi_handle->tag_crash_inject = false; |
| 13553 | return tag; |
| 13554 | } |
| 13555 | |
| 13556 | /** |
| 13557 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 13558 | * @wmi_handle: WMI handle |
| 13559 | * @buf: WMI buffer |
| 13560 | * @cmd_id: WMI command Id |
| 13561 | * |
| 13562 | * Return htc_tx_tag |
| 13563 | */ |
| 13564 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 13565 | wmi_buf_t buf, |
| 13566 | uint32_t cmd_id) |
| 13567 | { |
| 13568 | uint16_t htc_tx_tag = 0; |
| 13569 | |
| 13570 | switch (cmd_id) { |
| 13571 | case WMI_WOW_ENABLE_CMDID: |
| 13572 | case WMI_PDEV_SUSPEND_CMDID: |
| 13573 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 13574 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 13575 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 13576 | case WMI_PDEV_RESUME_CMDID: |
| 13577 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 13578 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 13579 | #ifdef FEATURE_WLAN_D0WOW |
| 13580 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 13581 | #endif |
| 13582 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 13583 | break; |
| 13584 | case WMI_FORCE_FW_HANG_CMDID: |
| 13585 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 13586 | break; |
| 13587 | case WMI_VDEV_SET_PARAM_CMDID: |
| 13588 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 13589 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 13590 | default: |
| 13591 | break; |
| 13592 | } |
| 13593 | |
| 13594 | return htc_tx_tag; |
| 13595 | } |
| 13596 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13597 | struct wmi_ops tlv_ops = { |
| 13598 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 13599 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 13600 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 13601 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 13602 | .send_hidden_ssid_vdev_restart_cmd = |
| 13603 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13604 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 13605 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 13606 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 13607 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13608 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 13609 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 13610 | .send_peer_rx_reorder_queue_setup_cmd = |
| 13611 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 13612 | .send_peer_rx_reorder_queue_remove_cmd = |
| 13613 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13614 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 13615 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 13616 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 13617 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 13618 | .send_resume_cmd = send_resume_cmd_tlv, |
| 13619 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 13620 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 13621 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 13622 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 13623 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 13624 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 13625 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 13626 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
| 13627 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 13628 | #ifndef CONFIG_MCL |
| 13629 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
| 13630 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13631 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 13632 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 13633 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 13634 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 13635 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
| 13636 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 13637 | .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] | 13638 | .send_set_sta_uapsd_auto_trig_cmd = |
| 13639 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 13640 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 13641 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 13642 | .send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv, |
| 13643 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 13644 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 13645 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 13646 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 13647 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 13648 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 13649 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 13650 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 13651 | .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] | 13652 | .send_ocb_start_timing_advert_cmd = |
| 13653 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 13654 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 13655 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 13656 | .send_set_mcc_channel_time_latency_cmd = |
| 13657 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 13658 | .send_set_mcc_channel_time_quota_cmd = |
| 13659 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 13660 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 13661 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 13662 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 13663 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 13664 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 13665 | .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] | 13666 | .send_probe_rsp_tmpl_send_cmd = |
| 13667 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 13668 | .send_p2p_go_set_beacon_ie_cmd = |
| 13669 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 13670 | .send_setup_install_key_cmd = |
| 13671 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 13672 | .send_set_gateway_params_cmd = |
| 13673 | send_set_gateway_params_cmd_tlv, |
| 13674 | .send_set_rssi_monitoring_cmd = |
| 13675 | send_set_rssi_monitoring_cmd_tlv, |
| 13676 | .send_scan_probe_setoui_cmd = |
| 13677 | send_scan_probe_setoui_cmd_tlv, |
| 13678 | .send_reset_passpoint_network_list_cmd = |
| 13679 | send_reset_passpoint_network_list_cmd_tlv, |
| 13680 | .send_set_passpoint_network_list_cmd = |
| 13681 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 13682 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 13683 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
| 13684 | .send_roam_scan_filter_cmd = |
| 13685 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 13686 | .send_set_epno_network_list_cmd = |
| 13687 | send_set_epno_network_list_cmd_tlv, |
| 13688 | .send_ipa_offload_control_cmd = |
| 13689 | send_ipa_offload_control_cmd_tlv, |
| 13690 | .send_extscan_get_capabilities_cmd = |
| 13691 | send_extscan_get_capabilities_cmd_tlv, |
| 13692 | .send_extscan_get_cached_results_cmd = |
| 13693 | send_extscan_get_cached_results_cmd_tlv, |
| 13694 | .send_extscan_stop_change_monitor_cmd = |
| 13695 | send_extscan_stop_change_monitor_cmd_tlv, |
| 13696 | .send_extscan_start_change_monitor_cmd = |
| 13697 | send_extscan_start_change_monitor_cmd_tlv, |
| 13698 | .send_extscan_stop_hotlist_monitor_cmd = |
| 13699 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 13700 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 13701 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 13702 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 13703 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 13704 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 13705 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 13706 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 13707 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 13708 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 13709 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 13710 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 13711 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 13712 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 13713 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 13714 | .send_snr_cmd = send_snr_cmd_tlv, |
| 13715 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 13716 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 13717 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 13718 | .send_lphb_config_tcp_params_cmd = send_lphb_config_tcp_params_cmd_tlv, |
| 13719 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 13720 | .send_lphb_config_udp_pkt_filter_cmd = |
| 13721 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
| 13722 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 13723 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 13724 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Paul Zhang | d19abd8 | 2017-01-04 16:45:42 +0800 | [diff] [blame] | 13725 | .send_action_frame_patterns_cmd = send_action_frame_patterns_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 13726 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
| 13727 | .send_process_update_edca_param_cmd = |
| 13728 | send_process_update_edca_param_cmd_tlv, |
| 13729 | .send_roam_scan_offload_mode_cmd = |
| 13730 | send_roam_scan_offload_mode_cmd_tlv, |
| 13731 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 13732 | .send_roam_scan_offload_ap_profile_cmd = |
| 13733 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 13734 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 13735 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 13736 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 13737 | #ifdef FEATURE_WLAN_RA_FILTERING |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 13738 | .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] | 13739 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 13740 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 13741 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
| 13742 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 13743 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 13744 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 13745 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 13746 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 13747 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 13748 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 13749 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 13750 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
| 13751 | .send_enable_disable_packet_filter_cmd = |
| 13752 | send_enable_disable_packet_filter_cmd_tlv, |
| 13753 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
| 13754 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
| 13755 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 13756 | .send_process_gtk_offload_getinfo_cmd = |
| 13757 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 13758 | .send_process_add_periodic_tx_ptrn_cmd = |
| 13759 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 13760 | .send_process_del_periodic_tx_ptrn_cmd = |
| 13761 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 13762 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 13763 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 13764 | .send_set_app_type2_params_in_fw_cmd = |
| 13765 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 13766 | .send_set_auto_shutdown_timer_cmd = |
| 13767 | send_set_auto_shutdown_timer_cmd_tlv, |
| 13768 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 13769 | .send_process_dhcpserver_offload_cmd = |
| 13770 | send_process_dhcpserver_offload_cmd_tlv, |
| 13771 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 13772 | .send_process_ch_avoid_update_cmd = |
| 13773 | send_process_ch_avoid_update_cmd_tlv, |
| 13774 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 13775 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 13776 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 13777 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 13778 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 13779 | .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] | 13780 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13781 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 13782 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13783 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13784 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13785 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 13786 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13787 | .send_set_base_macaddr_indicate_cmd = |
| 13788 | send_set_base_macaddr_indicate_cmd_tlv, |
| 13789 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 13790 | .send_enable_specific_fw_logs_cmd = |
| 13791 | send_enable_specific_fw_logs_cmd_tlv, |
| 13792 | .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] | 13793 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13794 | .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] | 13795 | .send_pdev_set_dual_mac_config_cmd = |
| 13796 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13797 | .send_enable_arp_ns_offload_cmd = |
| 13798 | send_enable_arp_ns_offload_cmd_tlv, |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 13799 | .send_enable_broadcast_filter_cmd = |
| 13800 | send_enable_broadcast_filter_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13801 | .send_app_type1_params_in_fw_cmd = |
| 13802 | send_app_type1_params_in_fw_cmd_tlv, |
| 13803 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 13804 | .send_process_roam_synch_complete_cmd = |
| 13805 | send_process_roam_synch_complete_cmd_tlv, |
| 13806 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 13807 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 13808 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13809 | .send_roam_scan_offload_scan_period_cmd = |
| 13810 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 13811 | .send_roam_scan_offload_chan_list_cmd = |
| 13812 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 13813 | .send_roam_scan_offload_rssi_change_cmd = |
| 13814 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 13815 | .send_get_buf_extscan_hotlist_cmd = |
| 13816 | send_get_buf_extscan_hotlist_cmd_tlv, |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 13817 | .send_adapt_dwelltime_params_cmd = |
| 13818 | send_adapt_dwelltime_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13819 | .init_cmd_send = init_cmd_send_tlv, |
| 13820 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 13821 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 13822 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 13823 | .save_service_bitmap = save_service_bitmap_tlv, |
| 13824 | .is_service_enabled = is_service_enabled_tlv, |
| 13825 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 13826 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 13827 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
| 13828 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 13829 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 13830 | .extract_tbttoffset_update_params = |
| 13831 | extract_tbttoffset_update_params_tlv, |
| 13832 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 13833 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 13834 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 13835 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
| 13836 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
| 13837 | .extract_swba_vdev_map = extract_swba_vdev_map_tlv, |
| 13838 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 13839 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
| 13840 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 13841 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 13842 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 13843 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 13844 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 13845 | .extract_peer_stats = extract_peer_stats_tlv, |
| 13846 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 13847 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 13848 | .extract_chan_stats = extract_chan_stats_tlv, |
| 13849 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 13850 | .extract_profile_data = extract_profile_data_tlv, |
| 13851 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 13852 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 13853 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 13854 | .send_encrypt_decrypt_send_cmd = |
| 13855 | send_encrypt_decrypt_send_cmd_tlv, |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 13856 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 13857 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 13858 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 13859 | .extract_hw_mode_cap_service_ready_ext = |
| 13860 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 13861 | .extract_mac_phy_cap_service_ready_ext = |
| 13862 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 13863 | .extract_reg_cap_service_ready_ext = |
| 13864 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 13865 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 13866 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 13867 | .extract_dcs_interference_type = extract_dcs_interference_type_tlv, |
| 13868 | .extract_dcs_cw_int = extract_dcs_cw_int_tlv, |
| 13869 | .extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 13870 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13871 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 13872 | .extract_peer_delete_response_event = |
| 13873 | extract_peer_delete_response_event_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 13874 | }; |
| 13875 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 13876 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13877 | /** |
| 13878 | * populate_tlv_service() - populates wmi services |
| 13879 | * |
| 13880 | * @param wmi_service: Pointer to hold wmi_service |
| 13881 | * Return: None |
| 13882 | */ |
| 13883 | static void populate_tlv_service(uint32_t *wmi_service) |
| 13884 | { |
| 13885 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
| 13886 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 13887 | wmi_service[wmi_service_roam_scan_offload] = |
| 13888 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 13889 | wmi_service[wmi_service_bcn_miss_offload] = |
| 13890 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 13891 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 13892 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 13893 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 13894 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 13895 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 13896 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 13897 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 13898 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 13899 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 13900 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 13901 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 13902 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 13903 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 13904 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 13905 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 13906 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 13907 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 13908 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 13909 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 13910 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 13911 | wmi_service[wmi_service_packet_power_save] = |
| 13912 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 13913 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 13914 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 13915 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 13916 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 13917 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 13918 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 13919 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 13920 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 13921 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 13922 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 13923 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 13924 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 13925 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 13926 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 13927 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 13928 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 13929 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 13930 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 13931 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 13932 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 13933 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 13934 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 13935 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 13936 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 13937 | wmi_service[wmi_service_lte_ant_share_support] = |
| 13938 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 13939 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 13940 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 13941 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 13942 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 13943 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 13944 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 13945 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 13946 | wmi_service[wmi_service_bcn_txrate_override] = |
| 13947 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 13948 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 13949 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 13950 | wmi_service[wmi_service_estimate_linkspeed] = |
| 13951 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 13952 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 13953 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 13954 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 13955 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 13956 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 13957 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 13958 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 13959 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 13960 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 13961 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 13962 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 13963 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 13964 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 13965 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 13966 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 13967 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 13968 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 13969 | wmi_service[wmi_service_sap_auth_offload] = |
| 13970 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 13971 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 13972 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 13973 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 13974 | wmi_service[wmi_service_ap_arpns_offload] = |
| 13975 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 13976 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 13977 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 13978 | wmi_service[wmi_service_packet_filter_offload] = |
| 13979 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 13980 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 13981 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 13982 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 13983 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 13984 | |
| 13985 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 13986 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 13987 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 13988 | WMI_SERVICE_UNAVAILABLE; |
| 13989 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 13990 | WMI_SERVICE_UNAVAILABLE; |
| 13991 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 13992 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
| 13993 | wmi_service[wmi_service_atf] = WMI_SERVICE_UNAVAILABLE; |
| 13994 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 13995 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 13996 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 13997 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 13998 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 13999 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 14000 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 14001 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
| 14002 | |
| 14003 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 14004 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 14005 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 14006 | WMI_SERVICE_UNAVAILABLE; |
| 14007 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 14008 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 14009 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
Sathish Kumar | 699f6b5 | 2016-11-10 15:30:22 +0530 | [diff] [blame] | 14010 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14011 | } |
| 14012 | |
| 14013 | /** |
| 14014 | * populate_tlv_event_id() - populates wmi event ids |
| 14015 | * |
| 14016 | * @param event_ids: Pointer to hold event ids |
| 14017 | * Return: None |
| 14018 | */ |
| 14019 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 14020 | { |
| 14021 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 14022 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 14023 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 14024 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 14025 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 14026 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 14027 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 14028 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 14029 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 14030 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 14031 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 14032 | event_ids[wmi_service_ready_ext_event_id] = |
| 14033 | WMI_SERVICE_READY_EXT_EVENTID; |
| 14034 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 14035 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 14036 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 14037 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 14038 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 14039 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 14040 | |
| 14041 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 14042 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 14043 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 14044 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 14045 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 14046 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 14047 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 14048 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 14049 | event_ids[wmi_peer_delete_response_event_id] = |
| 14050 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14051 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 14052 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 14053 | event_ids[wmi_tbttoffset_update_event_id] = |
| 14054 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
| 14055 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 14056 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 14057 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 14058 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 14059 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 14060 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 14061 | |
| 14062 | event_ids[wmi_tx_delba_complete_event_id] = |
| 14063 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 14064 | event_ids[wmi_tx_addba_complete_event_id] = |
| 14065 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 14066 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 14067 | |
| 14068 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 14069 | |
| 14070 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 14071 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 14072 | |
| 14073 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 14074 | |
| 14075 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 14076 | |
| 14077 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
| 14078 | |
| 14079 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 14080 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 14081 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 14082 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 14083 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 14084 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 14085 | |
| 14086 | event_ids[wmi_rtt_meas_report_event_id] = |
| 14087 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 14088 | event_ids[wmi_tsf_meas_report_event_id] = |
| 14089 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 14090 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 14091 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 14092 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 14093 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 14094 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 14095 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 14096 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 14097 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 14098 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 14099 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 14100 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 14101 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 14102 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 14103 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 14104 | |
| 14105 | event_ids[wmi_gtk_offload_status_event_id] = |
| 14106 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 14107 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 14108 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 14109 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 14110 | |
| 14111 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 14112 | |
| 14113 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 14114 | |
| 14115 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 14116 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 14117 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 14118 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 14119 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 14120 | event_ids[wmi_wlan_profile_data_event_id] = |
| 14121 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 14122 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 14123 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 14124 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 14125 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 14126 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 14127 | |
| 14128 | event_ids[wmi_diag_container_event_id] = |
| 14129 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 14130 | |
| 14131 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 14132 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 14133 | |
| 14134 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 14135 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 14136 | |
| 14137 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 14138 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 14139 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 14140 | |
| 14141 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 14142 | |
| 14143 | /** Set OCB Sched Response, deprecated */ |
| 14144 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 14145 | |
| 14146 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 14147 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 14148 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 14149 | |
| 14150 | /* GPIO Event */ |
| 14151 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 14152 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 14153 | |
| 14154 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 14155 | event_ids[wmi_rfkill_state_change_event_id] = |
| 14156 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 14157 | |
| 14158 | /* TDLS Event */ |
| 14159 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 14160 | |
| 14161 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 14162 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 14163 | event_ids[wmi_batch_scan_result_event_id] = |
| 14164 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 14165 | /* OEM Event */ |
| 14166 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 14167 | event_ids[wmi_oem_meas_report_event_id] = |
| 14168 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 14169 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 14170 | |
| 14171 | /* NAN Event */ |
| 14172 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 14173 | |
| 14174 | /* LPI Event */ |
| 14175 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 14176 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 14177 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 14178 | |
| 14179 | /* ExtScan events */ |
| 14180 | event_ids[wmi_extscan_start_stop_event_id] = |
| 14181 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 14182 | event_ids[wmi_extscan_operation_event_id] = |
| 14183 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 14184 | event_ids[wmi_extscan_table_usage_event_id] = |
| 14185 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 14186 | event_ids[wmi_extscan_cached_results_event_id] = |
| 14187 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 14188 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 14189 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 14190 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 14191 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 14192 | event_ids[wmi_extscan_capabilities_event_id] = |
| 14193 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 14194 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 14195 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 14196 | |
| 14197 | /* mDNS offload events */ |
| 14198 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 14199 | |
| 14200 | /* SAP Authentication offload events */ |
| 14201 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 14202 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 14203 | |
| 14204 | /** Out-of-context-of-bss (OCB) events */ |
| 14205 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 14206 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 14207 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 14208 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 14209 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 14210 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 14211 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 14212 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 14213 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 14214 | /* System-On-Chip events */ |
| 14215 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 14216 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 14217 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 14218 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 14219 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 14220 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 14221 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14222 | } |
| 14223 | |
| 14224 | /** |
| 14225 | * populate_pdev_param_tlv() - populates pdev params |
| 14226 | * |
| 14227 | * @param pdev_param: Pointer to hold pdev params |
| 14228 | * Return: None |
| 14229 | */ |
| 14230 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 14231 | { |
| 14232 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 14233 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 14234 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 14235 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 14236 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 14237 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 14238 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 14239 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 14240 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 14241 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 14242 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 14243 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 14244 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 14245 | pdev_param[wmi_pdev_param_protection_mode] = |
| 14246 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 14247 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 14248 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 14249 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 14250 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 14251 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 14252 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 14253 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 14254 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 14255 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 14256 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 14257 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 14258 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 14259 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 14260 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 14261 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 14262 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 14263 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 14264 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 14265 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 14266 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 14267 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 14268 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 14269 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 14270 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 14271 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 14272 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 14273 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 14274 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 14275 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 14276 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 14277 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 14278 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 14279 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 14280 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 14281 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 14282 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 14283 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 14284 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 14285 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 14286 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 14287 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 14288 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 14289 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 14290 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 14291 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 14292 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 14293 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 14294 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 14295 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 14296 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 14297 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 14298 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 14299 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 14300 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 14301 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 14302 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 14303 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 14304 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 14305 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 14306 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 14307 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 14308 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 14309 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 14310 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 14311 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 14312 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 14313 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 14314 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 14315 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 14316 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 14317 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 14318 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 14319 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 14320 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 14321 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 14322 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 14323 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 14324 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 14325 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 14326 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 14327 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 14328 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 14329 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 14330 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 14331 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 14332 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 14333 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 14334 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 14335 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 14336 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 14337 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 14338 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 14339 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 14340 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 14341 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 14342 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 14343 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 14344 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 14345 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 14346 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 14347 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 14348 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 14349 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 14350 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 14351 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 14352 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 14353 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 14354 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 14355 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 14356 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 14357 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 14358 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 14359 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 14360 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 14361 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 14362 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 14363 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
| 14364 | pdev_param[wmi_pdev_param_rx_filter] = WMI_UNAVAILABLE_PARAM; |
| 14365 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = WMI_UNAVAILABLE_PARAM; |
| 14366 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = WMI_UNAVAILABLE_PARAM; |
| 14367 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_UNAVAILABLE_PARAM; |
| 14368 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
| 14369 | WMI_UNAVAILABLE_PARAM; |
| 14370 | pdev_param[wmi_pdev_param_proxy_sta_mode] = WMI_UNAVAILABLE_PARAM; |
| 14371 | pdev_param[wmi_pdev_param_mu_group_policy] = WMI_UNAVAILABLE_PARAM; |
| 14372 | pdev_param[wmi_pdev_param_noise_detection] = WMI_UNAVAILABLE_PARAM; |
| 14373 | pdev_param[wmi_pdev_param_noise_threshold] = WMI_UNAVAILABLE_PARAM; |
| 14374 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_UNAVAILABLE_PARAM; |
| 14375 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = WMI_UNAVAILABLE_PARAM; |
| 14376 | pdev_param[wmi_pdev_param_atf_strict_sch] = WMI_UNAVAILABLE_PARAM; |
| 14377 | pdev_param[wmi_pdev_param_atf_sched_duration] = WMI_UNAVAILABLE_PARAM; |
| 14378 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_UNAVAILABLE_PARAM; |
| 14379 | pdev_param[wmi_pdev_param_sensitivity_level] = WMI_UNAVAILABLE_PARAM; |
| 14380 | pdev_param[wmi_pdev_param_signed_txpower_2g] = WMI_UNAVAILABLE_PARAM; |
| 14381 | pdev_param[wmi_pdev_param_signed_txpower_5g] = WMI_UNAVAILABLE_PARAM; |
| 14382 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = WMI_UNAVAILABLE_PARAM; |
| 14383 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = WMI_UNAVAILABLE_PARAM; |
| 14384 | pdev_param[wmi_pdev_param_cca_threshold] = WMI_UNAVAILABLE_PARAM; |
| 14385 | pdev_param[wmi_pdev_param_rts_fixed_rate] = WMI_UNAVAILABLE_PARAM; |
| 14386 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
| 14387 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_UNAVAILABLE_PARAM; |
| 14388 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = WMI_UNAVAILABLE_PARAM; |
| 14389 | pdev_param[wmi_pdev_param_arp_srcaddr] = WMI_UNAVAILABLE_PARAM; |
| 14390 | pdev_param[wmi_pdev_param_arp_dstaddr] = WMI_UNAVAILABLE_PARAM; |
| 14391 | pdev_param[wmi_pdev_param_txpower_decr_db] = WMI_UNAVAILABLE_PARAM; |
| 14392 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 14393 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
| 14394 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = WMI_UNAVAILABLE_PARAM; |
| 14395 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
| 14396 | WMI_UNAVAILABLE_PARAM; |
| 14397 | pdev_param[wmi_pdev_param_cust_txpower_scale] = WMI_UNAVAILABLE_PARAM; |
| 14398 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = WMI_UNAVAILABLE_PARAM; |
| 14399 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 14400 | WMI_UNAVAILABLE_PARAM; |
| 14401 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 14402 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
| 14403 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_UNAVAILABLE_PARAM; |
| 14404 | pdev_param[wmi_pdev_param_block_interbss] = WMI_UNAVAILABLE_PARAM; |
| 14405 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
| 14406 | WMI_UNAVAILABLE_PARAM; |
| 14407 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 14408 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
| 14409 | WMI_UNAVAILABLE_PARAM; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 14410 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 14411 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14412 | pdev_param[wmi_pdev_param_en_stats] = WMI_UNAVAILABLE_PARAM; |
| 14413 | } |
| 14414 | |
| 14415 | /** |
| 14416 | * populate_vdev_param_tlv() - populates vdev params |
| 14417 | * |
| 14418 | * @param vdev_param: Pointer to hold vdev params |
| 14419 | * Return: None |
| 14420 | */ |
| 14421 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 14422 | { |
| 14423 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 14424 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 14425 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 14426 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 14427 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 14428 | vdev_param[wmi_vdev_param_listen_interval] = |
| 14429 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 14430 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 14431 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 14432 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 14433 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 14434 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 14435 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 14436 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 14437 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 14438 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 14439 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 14440 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 14441 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 14442 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 14443 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 14444 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 14445 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 14446 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 14447 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 14448 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 14449 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 14450 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 14451 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 14452 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 14453 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 14454 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 14455 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 14456 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 14457 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 14458 | vdev_param[wmi_vdev_param_protection_mode] = |
| 14459 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 14460 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 14461 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 14462 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 14463 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 14464 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 14465 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 14466 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 14467 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 14468 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 14469 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 14470 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 14471 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 14472 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 14473 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 14474 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 14475 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 14476 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 14477 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 14478 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 14479 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 14480 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 14481 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 14482 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 14483 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 14484 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 14485 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 14486 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 14487 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 14488 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 14489 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 14490 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 14491 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 14492 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 14493 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 14494 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 14495 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 14496 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 14497 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 14498 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 14499 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 14500 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 14501 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 14502 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 14503 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 14504 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 14505 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 14506 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 14507 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 14508 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 14509 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 14510 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 14511 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 14512 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 14513 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 14514 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 14515 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 14516 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 14517 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 14518 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 14519 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 14520 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 14521 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 14522 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 14523 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 14524 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 14525 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 14526 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 14527 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 14528 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 14529 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 14530 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 14531 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 14532 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 14533 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 14534 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 14535 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 14536 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 14537 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 14538 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 14539 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 14540 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 14541 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 14542 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 14543 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 14544 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 14545 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 14546 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 14547 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 14548 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 14549 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14550 | } |
| 14551 | #endif |
| 14552 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 14553 | /** |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 14554 | * wmi_tlv_attach() - Attach TLV APIs |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 14555 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 14556 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 14557 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 14558 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14559 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
| 14560 | { |
| 14561 | wmi_handle->ops = &tlv_ops; |
| 14562 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 14563 | wmi_handle->log_info.buf_offset_command = 2; |
| 14564 | wmi_handle->log_info.buf_offset_event = 4; |
| 14565 | wmi_handle->log_info.is_management_record = |
| 14566 | is_management_record_tlv; |
| 14567 | #endif |
| 14568 | populate_tlv_service(wmi_handle->services); |
| 14569 | populate_tlv_events_id(wmi_handle->wmi_events); |
| 14570 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 14571 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 14572 | } |
| 14573 | #else |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 14574 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 14575 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 14576 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 14577 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 14578 | wmi_handle->log_info.buf_offset_command = 2; |
| 14579 | wmi_handle->log_info.buf_offset_event = 4; |
| 14580 | wmi_handle->log_info.is_management_record = |
| 14581 | is_management_record_tlv; |
| 14582 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 14583 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14584 | #endif |