Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #include "wmi_unified_tlv.h" |
| 29 | #include "wmi_unified_api.h" |
| 30 | #include "wmi.h" |
| 31 | #include "wmi_unified_priv.h" |
| 32 | #include "wma_api.h" |
| 33 | #include "wma.h" |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 34 | #include "wmi_version_whitelist.h" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 38 | * @wmi_handle: wmi handle |
| 39 | * @param: pointer to hold vdev create parameter |
| 40 | * @macaddr: vdev mac address |
| 41 | * |
| 42 | * Return: 0 for success or error code |
| 43 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 44 | QDF_STATUS send_vdev_create_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 45 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 46 | struct vdev_create_params *param) |
| 47 | { |
| 48 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 49 | wmi_buf_t buf; |
| 50 | int32_t len = sizeof(*cmd); |
| 51 | int32_t ret; |
| 52 | |
| 53 | buf = wmi_buf_alloc(wmi_handle, len); |
| 54 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 55 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 56 | return -ENOMEM; |
| 57 | } |
| 58 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 59 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 60 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 61 | WMITLV_GET_STRUCT_TLVLEN |
| 62 | (wmi_vdev_create_cmd_fixed_param)); |
| 63 | cmd->vdev_id = param->if_id; |
| 64 | cmd->vdev_type = param->type; |
| 65 | cmd->vdev_subtype = param->subtype; |
| 66 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 67 | 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] | 68 | __func__, param->if_id, |
| 69 | macaddr[0], macaddr[1], macaddr[2], |
| 70 | macaddr[3], macaddr[4], macaddr[5]); |
| 71 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_VDEV_CREATE_CMDID); |
| 72 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 73 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 74 | wmi_buf_free(buf); |
| 75 | } |
| 76 | |
| 77 | return ret; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 82 | * @wmi_handle: wmi handle |
| 83 | * @if_id: vdev id |
| 84 | * |
| 85 | * Return: 0 for success or error code |
| 86 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 87 | QDF_STATUS send_vdev_delete_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 88 | uint8_t if_id) |
| 89 | { |
| 90 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 91 | wmi_buf_t buf; |
| 92 | int32_t ret; |
| 93 | |
| 94 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 95 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 96 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 97 | return -ENOMEM; |
| 98 | } |
| 99 | |
| 100 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 101 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 102 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 103 | WMITLV_GET_STRUCT_TLVLEN |
| 104 | (wmi_vdev_delete_cmd_fixed_param)); |
| 105 | cmd->vdev_id = if_id; |
| 106 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 107 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 108 | WMI_VDEV_DELETE_CMDID); |
| 109 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 110 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 111 | wmi_buf_free(buf); |
| 112 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 113 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 114 | |
| 115 | return ret; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 120 | * @wmi: wmi handle |
| 121 | * @vdev_id: vdev id |
| 122 | * |
| 123 | * Return: 0 for success or erro code |
| 124 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 125 | QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 126 | uint8_t vdev_id) |
| 127 | { |
| 128 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 129 | wmi_buf_t buf; |
| 130 | int32_t len = sizeof(*cmd); |
| 131 | |
| 132 | buf = wmi_buf_alloc(wmi, len); |
| 133 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 134 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 135 | return -ENOMEM; |
| 136 | } |
| 137 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 138 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 139 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 140 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 141 | cmd->vdev_id = vdev_id; |
| 142 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 143 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
| 144 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 145 | return -EIO; |
| 146 | } |
| 147 | |
| 148 | return 0; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 153 | * @wmi: wmi handle |
| 154 | * @vdev_id: vdev id |
| 155 | * |
| 156 | * Return: 0 for success or error code |
| 157 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 158 | 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] | 159 | { |
| 160 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 161 | wmi_buf_t buf; |
| 162 | int32_t len = sizeof(*cmd); |
| 163 | |
| 164 | buf = wmi_buf_alloc(wmi, len); |
| 165 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 166 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 167 | return -ENOMEM; |
| 168 | } |
| 169 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 170 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 171 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 172 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 173 | cmd->vdev_id = vdev_id; |
| 174 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 175 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
| 176 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 177 | return -EIO; |
| 178 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 179 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 180 | |
| 181 | return 0; |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 186 | * @wmi: wmi handle |
| 187 | * @peer_addr: peer mac address |
| 188 | * @param: pointer to hold peer flush tid parameter |
| 189 | * |
| 190 | * Return: 0 for sucess or error code |
| 191 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 192 | QDF_STATUS send_peer_flush_tids_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 193 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 194 | struct peer_flush_params *param) |
| 195 | { |
| 196 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 197 | wmi_buf_t buf; |
| 198 | int32_t len = sizeof(*cmd); |
| 199 | |
| 200 | buf = wmi_buf_alloc(wmi, len); |
| 201 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 202 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 203 | return -ENOMEM; |
| 204 | } |
| 205 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 206 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 207 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 208 | WMITLV_GET_STRUCT_TLVLEN |
| 209 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 210 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 211 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 212 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 213 | 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] | 214 | peer_addr, param->vdev_id, |
| 215 | param->peer_tid_bitmap); |
| 216 | 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] | 217 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
| 218 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 219 | return -EIO; |
| 220 | } |
| 221 | |
| 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 227 | * @wmi: wmi handle |
| 228 | * @peer_addr: peer mac addr |
| 229 | * @vdev_id: vdev id |
| 230 | * |
| 231 | * Return: 0 for success or error code |
| 232 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 233 | QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 234 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 235 | uint8_t vdev_id) |
| 236 | { |
| 237 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 238 | wmi_buf_t buf; |
| 239 | int32_t len = sizeof(*cmd); |
| 240 | buf = wmi_buf_alloc(wmi, len); |
| 241 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 242 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 243 | return -ENOMEM; |
| 244 | } |
| 245 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 246 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 247 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 248 | WMITLV_GET_STRUCT_TLVLEN |
| 249 | (wmi_peer_delete_cmd_fixed_param)); |
| 250 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 251 | cmd->vdev_id = vdev_id; |
| 252 | |
| 253 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 254 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
| 255 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 256 | return -EIO; |
| 257 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 258 | 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] | 259 | |
| 260 | return 0; |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 265 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 266 | * @peer_addr: peer mac address |
| 267 | * @param : pointer to hold peer set parameter |
| 268 | * |
| 269 | * Return: 0 for success or error code |
| 270 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 271 | QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 272 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 273 | struct peer_set_params *param) |
| 274 | { |
| 275 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 276 | wmi_buf_t buf; |
| 277 | int32_t err; |
| 278 | |
| 279 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 280 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 281 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 282 | return -ENOMEM; |
| 283 | } |
| 284 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 285 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 286 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 287 | WMITLV_GET_STRUCT_TLVLEN |
| 288 | (wmi_peer_set_param_cmd_fixed_param)); |
| 289 | cmd->vdev_id = param->vdev_id; |
| 290 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 291 | cmd->param_id = param->param_id; |
| 292 | cmd->param_value = param->param_value; |
| 293 | err = wmi_unified_cmd_send(wmi, buf, |
| 294 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 295 | WMI_PEER_SET_PARAM_CMDID); |
| 296 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 297 | WMI_LOGE("Failed to send set_param cmd"); |
| 298 | qdf_mem_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 299 | return -EIO; |
| 300 | } |
| 301 | |
| 302 | return 0; |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 307 | * @wmi: wmi handle |
| 308 | * @bssid: bssid |
| 309 | * @vdev_up_params: pointer to hold vdev up parameter |
| 310 | * |
| 311 | * Return: 0 for success or error code |
| 312 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 313 | QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 314 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 315 | struct vdev_up_params *params) |
| 316 | { |
| 317 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 318 | wmi_buf_t buf; |
| 319 | int32_t len = sizeof(*cmd); |
| 320 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 321 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 322 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 323 | params->vdev_id, params->assoc_id, bssid); |
| 324 | buf = wmi_buf_alloc(wmi, len); |
| 325 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 326 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 327 | return -ENOMEM; |
| 328 | } |
| 329 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 330 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 331 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 332 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 333 | cmd->vdev_id = params->vdev_id; |
| 334 | cmd->vdev_assoc_id = params->assoc_id; |
| 335 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 336 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 337 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
| 338 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 339 | return -EIO; |
| 340 | } |
| 341 | |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 347 | * @wmi: wmi handle |
| 348 | * @peer_addr: peer mac address |
| 349 | * @peer_type: peer type |
| 350 | * @vdev_id: vdev id |
| 351 | * |
| 352 | * Return: 0 for success or error code |
| 353 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 354 | QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 355 | struct peer_create_params *param) |
| 356 | { |
| 357 | wmi_peer_create_cmd_fixed_param *cmd; |
| 358 | wmi_buf_t buf; |
| 359 | int32_t len = sizeof(*cmd); |
| 360 | |
| 361 | buf = wmi_buf_alloc(wmi, len); |
| 362 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 363 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 364 | return -ENOMEM; |
| 365 | } |
| 366 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 367 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 368 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 369 | WMITLV_GET_STRUCT_TLVLEN |
| 370 | (wmi_peer_create_cmd_fixed_param)); |
| 371 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 372 | cmd->peer_type = param->peer_type; |
| 373 | cmd->vdev_id = param->vdev_id; |
| 374 | |
| 375 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 376 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
| 377 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 378 | return -EIO; |
| 379 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 380 | 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] | 381 | param->vdev_id); |
| 382 | |
| 383 | return 0; |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 388 | * @wmi_handle: wmi handle |
| 389 | * @value: value |
| 390 | * @mac_id: mac id to have radio context |
| 391 | * |
| 392 | * Return: 0 for success or error code |
| 393 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 394 | 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] | 395 | uint32_t value, uint8_t mac_id) |
| 396 | { |
| 397 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 398 | wmi_buf_t buf; |
| 399 | int32_t len = sizeof(*cmd); |
| 400 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 401 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 402 | |
| 403 | buf = wmi_buf_alloc(wmi_handle, len); |
| 404 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 405 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 406 | return -ENOMEM; |
| 407 | } |
| 408 | |
| 409 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 410 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 411 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 412 | WMITLV_GET_STRUCT_TLVLEN |
| 413 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 414 | cmd->pdev_id = 0; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 415 | cmd->enable = value; |
| 416 | |
| 417 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 418 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 419 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
| 420 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 421 | return -EIO; |
| 422 | } |
| 423 | |
| 424 | return 0; |
| 425 | } |
| 426 | |
| 427 | /** |
| 428 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 429 | * @wmi_handle: wmi handle |
| 430 | * @param: pointer to pdev_utf_params |
| 431 | * @mac_id: mac id to have radio context |
| 432 | * |
| 433 | * Return: 0 for success or error code |
| 434 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 435 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 436 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 437 | struct pdev_utf_params *param, |
| 438 | uint8_t mac_id) |
| 439 | { |
| 440 | wmi_buf_t buf; |
| 441 | uint8_t *cmd; |
| 442 | int32_t ret = 0; |
| 443 | static uint8_t msgref = 1; |
| 444 | uint8_t segNumber = 0, segInfo, numSegments; |
| 445 | uint16_t chunk_len, total_bytes; |
| 446 | uint8_t *bufpos; |
| 447 | struct seg_hdr_info segHdrInfo; |
| 448 | |
| 449 | bufpos = param->utf_payload; |
| 450 | total_bytes = param->len; |
| 451 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 452 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 453 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 454 | |
| 455 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 456 | numSegments++; |
| 457 | |
| 458 | while (param->len) { |
| 459 | if (param->len > MAX_WMI_UTF_LEN) |
| 460 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 461 | else |
| 462 | chunk_len = param->len; |
| 463 | |
| 464 | buf = wmi_buf_alloc(wmi_handle, |
| 465 | (chunk_len + sizeof(segHdrInfo) + |
| 466 | WMI_TLV_HDR_SIZE)); |
| 467 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 468 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 469 | return -ENOMEM; |
| 470 | } |
| 471 | |
| 472 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 473 | |
| 474 | segHdrInfo.len = total_bytes; |
| 475 | segHdrInfo.msgref = msgref; |
| 476 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 477 | segHdrInfo.segmentInfo = segInfo; |
| 478 | segHdrInfo.pad = 0; |
| 479 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 480 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 481 | " segHdrInfo.segmentInfo = %d", |
| 482 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 483 | segHdrInfo.segmentInfo); |
| 484 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 485 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 486 | "chunk len %d", __func__, total_bytes, segNumber, |
| 487 | numSegments, chunk_len); |
| 488 | |
| 489 | segNumber++; |
| 490 | |
| 491 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 492 | (chunk_len + sizeof(segHdrInfo))); |
| 493 | cmd += WMI_TLV_HDR_SIZE; |
| 494 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 495 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 496 | |
| 497 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 498 | (chunk_len + sizeof(segHdrInfo) + |
| 499 | WMI_TLV_HDR_SIZE), |
| 500 | WMI_PDEV_UTF_CMDID); |
| 501 | |
| 502 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 503 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 504 | wmi_buf_free(buf); |
| 505 | break; |
| 506 | } |
| 507 | |
| 508 | param->len -= chunk_len; |
| 509 | bufpos += chunk_len; |
| 510 | } |
| 511 | |
| 512 | msgref++; |
| 513 | |
| 514 | return ret; |
| 515 | } |
| 516 | |
| 517 | /** |
| 518 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 519 | * @wmi_handle: wmi handle |
| 520 | * @param: pointer to pdev parameter |
| 521 | * @mac_id: radio context |
| 522 | * |
| 523 | * Return: 0 on success, errno on failure |
| 524 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 525 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 526 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 527 | struct pdev_params *param, |
| 528 | uint8_t mac_id) |
| 529 | { |
| 530 | int32_t ret; |
| 531 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 532 | wmi_buf_t buf; |
| 533 | uint16_t len = sizeof(*cmd); |
| 534 | |
| 535 | buf = wmi_buf_alloc(wmi_handle, len); |
| 536 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 537 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 538 | return -ENOMEM; |
| 539 | } |
| 540 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 541 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 542 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 543 | WMITLV_GET_STRUCT_TLVLEN |
| 544 | (wmi_pdev_set_param_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 545 | cmd->pdev_id = 0; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 546 | cmd->param_id = param->param_id; |
| 547 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 548 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 549 | param->param_value); |
| 550 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 551 | WMI_PDEV_SET_PARAM_CMDID); |
| 552 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 553 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 554 | wmi_buf_free(buf); |
| 555 | } |
| 556 | return ret; |
| 557 | } |
| 558 | |
| 559 | /** |
| 560 | * send_suspend_cmd_tlv() - WMI suspend function |
| 561 | * @param wmi_handle : handle to WMI. |
| 562 | * @param param : pointer to hold suspend parameter |
| 563 | * @mac_id: radio context |
| 564 | * |
| 565 | * Return 0 on success and -ve on failure. |
| 566 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 567 | QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 568 | struct suspend_params *param, |
| 569 | uint8_t mac_id) |
| 570 | { |
| 571 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 572 | wmi_buf_t wmibuf; |
| 573 | uint32_t len = sizeof(*cmd); |
| 574 | int32_t ret; |
| 575 | |
| 576 | /* |
| 577 | * send the comand to Target to ignore the |
| 578 | * PCIE reset so as to ensure that Host and target |
| 579 | * states are in sync |
| 580 | */ |
| 581 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 582 | if (wmibuf == NULL) |
| 583 | return -ENOMEM; |
| 584 | |
| 585 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 586 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 587 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 588 | WMITLV_GET_STRUCT_TLVLEN |
| 589 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 590 | if (param->disable_target_intr) |
| 591 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 592 | else |
| 593 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
| 594 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 595 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 596 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 597 | qdf_nbuf_free(wmibuf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 598 | WMA_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
| 599 | } |
| 600 | |
| 601 | return ret; |
| 602 | } |
| 603 | |
| 604 | /** |
| 605 | * send_resume_cmd_tlv() - WMI resume function |
| 606 | * @param wmi_handle : handle to WMI. |
| 607 | * @mac_id: radio context |
| 608 | * |
| 609 | * Return: 0 on success and -ve on failure. |
| 610 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 611 | QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 612 | uint8_t mac_id) |
| 613 | { |
| 614 | wmi_buf_t wmibuf; |
| 615 | wmi_pdev_resume_cmd_fixed_param *cmd; |
| 616 | int32_t ret; |
| 617 | |
| 618 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 619 | if (wmibuf == NULL) |
| 620 | return -ENOMEM; |
| 621 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 622 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 623 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 624 | WMITLV_GET_STRUCT_TLVLEN |
| 625 | (wmi_pdev_resume_cmd_fixed_param)); |
| 626 | cmd->reserved0 = 0; |
| 627 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 628 | WMI_PDEV_RESUME_CMDID); |
| 629 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 630 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 631 | wmi_buf_free(wmibuf); |
| 632 | } |
| 633 | |
| 634 | return ret; |
| 635 | } |
| 636 | |
| 637 | /** |
| 638 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 639 | * @param wmi_handle : handle to WMI. |
| 640 | * @param param : pointer to hold wow enable parameter |
| 641 | * @mac_id: radio context |
| 642 | * |
| 643 | * Return: 0 on success and -ve on failure. |
| 644 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 645 | QDF_STATUS send_wow_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 646 | struct wow_cmd_params *param, |
| 647 | uint8_t mac_id) |
| 648 | { |
| 649 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 650 | wmi_buf_t buf; |
| 651 | int32_t len; |
| 652 | int32_t ret; |
| 653 | |
| 654 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 655 | |
| 656 | buf = wmi_buf_alloc(wmi_handle, len); |
| 657 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 658 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 659 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 660 | } |
| 661 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 662 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 663 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 664 | WMITLV_GET_STRUCT_TLVLEN |
| 665 | (wmi_wow_enable_cmd_fixed_param)); |
| 666 | cmd->enable = param->enable; |
| 667 | if (param->can_suspend_link) |
| 668 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 669 | else |
| 670 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
| 671 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 672 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 673 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 674 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 675 | |
| 676 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 677 | WMI_WOW_ENABLE_CMDID); |
| 678 | if (ret) |
| 679 | wmi_buf_free(buf); |
| 680 | |
| 681 | return ret; |
| 682 | } |
| 683 | |
| 684 | /** |
| 685 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 686 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 687 | * @peer_addr: peer mac address |
| 688 | * @param: pointer to ap_ps parameter structure |
| 689 | * |
| 690 | * Return: 0 for success or error code |
| 691 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 692 | 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] | 693 | uint8_t *peer_addr, |
| 694 | struct ap_ps_params *param) |
| 695 | { |
| 696 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 697 | wmi_buf_t buf; |
| 698 | int32_t err; |
| 699 | |
| 700 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 701 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 702 | WMI_LOGE("Failed to allocate buffer to send set_ap_ps_param cmd"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 703 | return -ENOMEM; |
| 704 | } |
| 705 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 706 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 707 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 708 | WMITLV_GET_STRUCT_TLVLEN |
| 709 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 710 | cmd->vdev_id = param->vdev_id; |
| 711 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 712 | cmd->param = param->param; |
| 713 | cmd->value = param->value; |
| 714 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 715 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 716 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 717 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
| 718 | qdf_mem_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 719 | return -EIO; |
| 720 | } |
| 721 | |
| 722 | return 0; |
| 723 | } |
| 724 | |
| 725 | /** |
| 726 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 727 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 728 | * @peer_addr: peer mac address |
| 729 | * @param: pointer to sta_ps parameter structure |
| 730 | * |
| 731 | * Return: 0 for success or error code |
| 732 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 733 | 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] | 734 | struct sta_ps_params *param) |
| 735 | { |
| 736 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 737 | wmi_buf_t buf; |
| 738 | int32_t len = sizeof(*cmd); |
| 739 | |
| 740 | buf = wmi_buf_alloc(wmi_handle, len); |
| 741 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 742 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 743 | return -ENOMEM; |
| 744 | } |
| 745 | |
| 746 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 747 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 748 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 749 | WMITLV_GET_STRUCT_TLVLEN |
| 750 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 751 | cmd->vdev_id = param->vdev_id; |
| 752 | cmd->param = param->param; |
| 753 | cmd->value = param->value; |
| 754 | |
| 755 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 756 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 757 | 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] | 758 | param->vdev_id, param->param, param->value); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 759 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 760 | return -EIO; |
| 761 | } |
| 762 | |
| 763 | return 0; |
| 764 | } |
| 765 | |
| 766 | /** |
| 767 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 768 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 769 | * @param: ponirt to crash inject paramter structure |
| 770 | * |
| 771 | * Return: 0 for success or return error |
| 772 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 773 | QDF_STATUS send_crash_inject_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 774 | struct crash_inject *param) |
| 775 | { |
| 776 | int32_t ret = 0; |
| 777 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 778 | uint16_t len = sizeof(*cmd); |
| 779 | wmi_buf_t buf; |
| 780 | |
| 781 | buf = wmi_buf_alloc(wmi_handle, len); |
| 782 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 783 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 784 | return -ENOMEM; |
| 785 | } |
| 786 | |
| 787 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 788 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 789 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 790 | WMITLV_GET_STRUCT_TLVLEN |
| 791 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 792 | cmd->type = param->type; |
| 793 | cmd->delay_time_ms = param->delay_time_ms; |
| 794 | |
| 795 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 796 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 797 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 798 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 799 | __func__, ret); |
| 800 | wmi_buf_free(buf); |
| 801 | } |
| 802 | |
| 803 | return ret; |
| 804 | } |
| 805 | |
| 806 | /** |
| 807 | * send_dbglog_cmd_tlv() - set debug log level |
| 808 | * @param wmi_handle : handle to WMI. |
| 809 | * @param param : pointer to hold dbglog level parameter |
| 810 | * |
| 811 | * Return: 0 on success and -ve on failure. |
| 812 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 813 | QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 814 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 815 | struct dbglog_params *dbglog_param) |
| 816 | { |
| 817 | wmi_buf_t buf; |
| 818 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
| 819 | A_STATUS status = A_OK; |
| 820 | int32_t i; |
| 821 | int32_t len; |
| 822 | int8_t *buf_ptr; |
| 823 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 824 | |
| 825 | ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
| 826 | |
| 827 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 828 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 829 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 830 | buf = wmi_buf_alloc(wmi_handle, len); |
| 831 | if (buf == NULL) |
| 832 | return A_NO_MEMORY; |
| 833 | |
| 834 | configmsg = |
| 835 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 836 | buf_ptr = (int8_t *) configmsg; |
| 837 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 838 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 839 | WMITLV_GET_STRUCT_TLVLEN |
| 840 | (wmi_debug_log_config_cmd_fixed_param)); |
| 841 | configmsg->dbg_log_param = dbglog_param->param; |
| 842 | configmsg->value = dbglog_param->val; |
| 843 | /* Filling in the data part of second tlv -- should |
| 844 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 845 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 846 | sizeof |
| 847 | (wmi_debug_log_config_cmd_fixed_param) |
| 848 | + WMI_TLV_HDR_SIZE); |
| 849 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 850 | WMITLV_TAG_ARRAY_UINT32, |
| 851 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 852 | if (dbglog_param->module_id_bitmap) { |
| 853 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 854 | module_id_bitmap_array[i] = |
| 855 | dbglog_param->module_id_bitmap[i]; |
| 856 | } |
| 857 | } |
| 858 | |
| 859 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 860 | len, WMI_DBGLOG_CFG_CMDID); |
| 861 | |
| 862 | if (status != A_OK) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 863 | qdf_nbuf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 864 | |
| 865 | return status; |
| 866 | } |
| 867 | |
| 868 | /** |
| 869 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 870 | * @param wmi_handle : handle to WMI. |
| 871 | * @param macaddr : MAC address |
| 872 | * @param param : pointer to hold vdev set parameter |
| 873 | * |
| 874 | * Return: 0 on success and -ve on failure. |
| 875 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 876 | 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] | 877 | struct vdev_set_params *param) |
| 878 | { |
| 879 | int32_t ret; |
| 880 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 881 | wmi_buf_t buf; |
| 882 | uint16_t len = sizeof(*cmd); |
| 883 | |
| 884 | buf = wmi_buf_alloc(wmi_handle, len); |
| 885 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 886 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 887 | return -ENOMEM; |
| 888 | } |
| 889 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 890 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 891 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 892 | WMITLV_GET_STRUCT_TLVLEN |
| 893 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 894 | cmd->vdev_id = param->if_id; |
| 895 | cmd->param_id = param->param_id; |
| 896 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 897 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 898 | param->if_id, param->param_id, param->param_value); |
| 899 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 900 | WMI_VDEV_SET_PARAM_CMDID); |
| 901 | if (ret < 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 902 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 903 | wmi_buf_free(buf); |
| 904 | } |
| 905 | |
| 906 | return ret; |
| 907 | } |
| 908 | |
| 909 | /** |
| 910 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 911 | * @param wmi_handle : handle to WMI. |
| 912 | * @param macaddr : MAC address |
| 913 | * @param param : pointer to hold stats request parameter |
| 914 | * |
| 915 | * Return: 0 on success and -ve on failure. |
| 916 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 917 | QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 918 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 919 | struct stats_request_params *param) |
| 920 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 921 | int32_t ret; |
| 922 | wmi_request_stats_cmd_fixed_param *cmd; |
| 923 | wmi_buf_t buf; |
| 924 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 925 | |
| 926 | buf = wmi_buf_alloc(wmi_handle, len); |
| 927 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 928 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 929 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 930 | } |
| 931 | |
| 932 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 933 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 934 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 935 | WMITLV_GET_STRUCT_TLVLEN |
| 936 | (wmi_request_stats_cmd_fixed_param)); |
| 937 | cmd->stats_id = param->stats_id; |
| 938 | cmd->vdev_id = param->vdev_id; |
| 939 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 940 | WMI_REQUEST_STATS_CMDID); |
| 941 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 942 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 943 | wmi_buf_free(buf); |
| 944 | } |
| 945 | |
| 946 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 947 | } |
| 948 | |
| 949 | /** |
| 950 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 951 | * @param wmi_handle : handle to WMI. |
| 952 | * @param macaddr : MAC address |
| 953 | * @param param : pointer to hold stats request parameter |
| 954 | * |
| 955 | * Return: 0 on success and -ve on failure. |
| 956 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 957 | 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] | 958 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 959 | struct packet_enable_params *param) |
| 960 | { |
| 961 | return 0; |
| 962 | } |
| 963 | |
| 964 | /** |
| 965 | * send_beacon_send_cmd_tlv() - WMI beacon send function |
| 966 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 967 | * @param param : pointer to hold beacon send cmd parameter |
| 968 | * |
| 969 | * Return: 0 on success and -ve on failure. |
| 970 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 971 | QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 972 | struct beacon_params *param) |
| 973 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 974 | int32_t ret; |
| 975 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 976 | wmi_bcn_prb_info *bcn_prb_info; |
| 977 | wmi_buf_t wmi_buf; |
| 978 | uint8_t *buf_ptr; |
| 979 | uint32_t wmi_buf_len; |
| 980 | |
| 981 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 982 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 983 | param->tmpl_len_aligned; |
| 984 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 985 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 986 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 987 | return -ENOMEM; |
| 988 | } |
| 989 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 990 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 991 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 992 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 993 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 994 | cmd->vdev_id = param->vdev_id; |
| 995 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 996 | cmd->buf_len = param->tmpl_len; |
| 997 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 998 | |
| 999 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1000 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1001 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1002 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1003 | bcn_prb_info->caps = 0; |
| 1004 | bcn_prb_info->erp = 0; |
| 1005 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1006 | |
| 1007 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1008 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1009 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1010 | |
| 1011 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1012 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1013 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1014 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1015 | wmi_buf_free(wmi_buf); |
| 1016 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1017 | return 0; |
| 1018 | } |
| 1019 | |
| 1020 | /** |
| 1021 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1022 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1023 | * @param param : pointer to peer assoc parameter |
| 1024 | * |
| 1025 | * Return: 0 on success and -ve on failure. |
| 1026 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1027 | QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1028 | struct peer_assoc_params *param) |
| 1029 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1030 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1031 | wmi_vht_rate_set *mcs; |
| 1032 | wmi_buf_t buf; |
| 1033 | int32_t len; |
| 1034 | uint8_t *buf_ptr; |
| 1035 | int ret; |
| 1036 | |
| 1037 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 1038 | (param->num_peer_legacy_rates * sizeof(uint8_t)) + |
| 1039 | WMI_TLV_HDR_SIZE + |
| 1040 | (param->num_peer_ht_rates * sizeof(uint8_t)) + |
| 1041 | sizeof(wmi_vht_rate_set); |
| 1042 | |
| 1043 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1044 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1045 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1046 | return -ENOMEM; |
| 1047 | } |
| 1048 | |
| 1049 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1050 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1051 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1052 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1053 | WMITLV_GET_STRUCT_TLVLEN |
| 1054 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
| 1055 | cmd->vdev_id = param->vdev_id; |
| 1056 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1057 | cmd->peer_associd = param->peer_associd; |
| 1058 | cmd->peer_flags = param->peer_flags; |
| 1059 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1060 | cmd->peer_caps = param->peer_caps; |
| 1061 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1062 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1063 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1064 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
| 1065 | cmd->num_peer_legacy_rates = param->num_peer_legacy_rates; |
| 1066 | cmd->num_peer_ht_rates = param->num_peer_ht_rates; |
| 1067 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1068 | cmd->peer_phymode = param->peer_phymode; |
| 1069 | |
| 1070 | /* Update peer legacy rate information */ |
| 1071 | buf_ptr += sizeof(*cmd); |
| 1072 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 1073 | param->num_peer_legacy_rates); |
| 1074 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1075 | cmd->num_peer_legacy_rates = param->num_peer_legacy_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1076 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1077 | param->peer_legacy_rates.num_rates); |
| 1078 | |
| 1079 | /* Update peer HT rate information */ |
| 1080 | buf_ptr += param->num_peer_legacy_rates; |
| 1081 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 1082 | param->num_peer_ht_rates); |
| 1083 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1084 | cmd->num_peer_ht_rates = param->num_peer_ht_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1085 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1086 | param->peer_ht_rates.num_rates); |
| 1087 | |
| 1088 | /* VHT Rates */ |
| 1089 | buf_ptr += param->num_peer_ht_rates; |
| 1090 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 1091 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 1092 | |
| 1093 | cmd->peer_nss = param->peer_nss; |
| 1094 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 1095 | if (param->vht_capable) { |
| 1096 | mcs->rx_max_rate = param->rx_max_rate; |
| 1097 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 1098 | mcs->tx_max_rate = param->tx_max_rate; |
| 1099 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 1100 | } |
| 1101 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1102 | 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] | 1103 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 1104 | "nss %d phymode %d peer_mpdu_density %d " |
| 1105 | "cmd->peer_vht_caps %x", __func__, |
| 1106 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 1107 | cmd->peer_rate_caps, cmd->peer_caps, |
| 1108 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 1109 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 1110 | cmd->peer_mpdu_density, |
| 1111 | cmd->peer_vht_caps); |
| 1112 | |
| 1113 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1114 | WMI_PEER_ASSOC_CMDID); |
| 1115 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1116 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1117 | __func__, ret); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1118 | qdf_nbuf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1119 | } |
| 1120 | |
| 1121 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1122 | } |
| 1123 | |
| 1124 | /** |
| 1125 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 1126 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1127 | * @param param : pointer to hold scan start cmd parameter |
| 1128 | * |
| 1129 | * Return: 0 on success and -ve on failure. |
| 1130 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1131 | QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1132 | struct scan_start_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1133 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1134 | int32_t ret = 0; |
| 1135 | int32_t i; |
| 1136 | wmi_buf_t wmi_buf; |
| 1137 | wmi_start_scan_cmd_fixed_param *cmd; |
| 1138 | uint8_t *buf_ptr; |
| 1139 | uint32_t *tmp_ptr; |
| 1140 | wmi_ssid *ssid = NULL; |
| 1141 | wmi_mac_addr *bssid; |
| 1142 | int len = sizeof(*cmd); |
| 1143 | |
| 1144 | /* Length TLV placeholder for array of uint32_t */ |
| 1145 | len += WMI_TLV_HDR_SIZE; |
| 1146 | /* calculate the length of buffer required */ |
| 1147 | if (params->num_chan) |
| 1148 | len += params->num_chan * sizeof(uint32_t); |
| 1149 | |
| 1150 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 1151 | len += WMI_TLV_HDR_SIZE; |
| 1152 | if (params->num_ssids) |
| 1153 | len += params->num_ssids * sizeof(wmi_ssid); |
| 1154 | |
| 1155 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 1156 | len += WMI_TLV_HDR_SIZE; |
| 1157 | len += sizeof(wmi_mac_addr); |
| 1158 | |
| 1159 | /* Length TLV placeholder for array of bytes */ |
| 1160 | len += WMI_TLV_HDR_SIZE; |
| 1161 | if (params->ie_len) |
| 1162 | len += roundup(params->ie_len, sizeof(uint32_t)); |
| 1163 | |
| 1164 | /* Allocate the memory */ |
| 1165 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1166 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1167 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1168 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1169 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1170 | } |
| 1171 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1172 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 1173 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1174 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 1175 | WMITLV_GET_STRUCT_TLVLEN |
| 1176 | (wmi_start_scan_cmd_fixed_param)); |
| 1177 | |
| 1178 | cmd->scan_id = params->scan_id; |
| 1179 | cmd->scan_req_id = params->scan_req_id; |
| 1180 | cmd->vdev_id = params->vdev_id; |
| 1181 | cmd->scan_priority = params->scan_priority; |
| 1182 | cmd->notify_scan_events = params->notify_scan_events; |
| 1183 | cmd->dwell_time_active = params->dwell_time_active; |
| 1184 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 1185 | cmd->min_rest_time = params->min_rest_time; |
| 1186 | cmd->max_rest_time = params->max_rest_time; |
| 1187 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 1188 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 1189 | cmd->idle_time = params->idle_time; |
| 1190 | cmd->max_scan_time = params->max_scan_time; |
| 1191 | cmd->probe_delay = params->probe_delay; |
| 1192 | cmd->scan_ctrl_flags = params->scan_ctrl_flags; |
| 1193 | cmd->burst_duration = params->burst_duration; |
| 1194 | cmd->num_chan = params->num_chan; |
| 1195 | cmd->num_bssid = params->num_bssid; |
| 1196 | cmd->num_ssids = params->num_ssids; |
| 1197 | cmd->ie_len = params->ie_len; |
| 1198 | cmd->n_probes = params->n_probes; |
| 1199 | buf_ptr += sizeof(*cmd); |
| 1200 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1201 | for (i = 0; i < params->num_chan; ++i) |
| 1202 | tmp_ptr[i] = params->chan_list[i]; |
| 1203 | |
| 1204 | WMITLV_SET_HDR(buf_ptr, |
| 1205 | WMITLV_TAG_ARRAY_UINT32, |
| 1206 | (params->num_chan * sizeof(uint32_t))); |
| 1207 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 1208 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1209 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1210 | goto error; |
| 1211 | } |
| 1212 | |
| 1213 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1214 | (params->num_ssids * sizeof(wmi_ssid))); |
| 1215 | |
| 1216 | if (params->num_ssids) { |
| 1217 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1218 | for (i = 0; i < params->num_ssids; ++i) { |
| 1219 | ssid->ssid_len = params->ssid[i].length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1220 | qdf_mem_copy(ssid->ssid, params->ssid[i].mac_ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1221 | params->ssid[i].length); |
| 1222 | ssid++; |
| 1223 | } |
| 1224 | } |
| 1225 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 1226 | |
| 1227 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 1228 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 1229 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 1230 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->mac_add_bytes, bssid); |
| 1231 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_bssid * sizeof(wmi_mac_addr)); |
| 1232 | |
| 1233 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, params->ie_len_with_pad); |
| 1234 | if (params->ie_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1235 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1236 | (uint8_t *) params->ie_base + |
| 1237 | (params->uie_fieldOffset), params->ie_len); |
| 1238 | } |
| 1239 | buf_ptr += WMI_TLV_HDR_SIZE + params->ie_len_with_pad; |
| 1240 | |
| 1241 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 1242 | len, WMI_START_SCAN_CMDID); |
| 1243 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1244 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1245 | wmi_buf_free(wmi_buf); |
| 1246 | } |
| 1247 | return ret; |
| 1248 | error: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1249 | qdf_nbuf_free(wmi_buf); |
| 1250 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1251 | } |
| 1252 | |
| 1253 | /** |
| 1254 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 1255 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1256 | * @param param : pointer to hold scan start cmd parameter |
| 1257 | * |
| 1258 | * Return: 0 on success and -ve on failure. |
| 1259 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1260 | QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1261 | struct scan_stop_params *param) |
| 1262 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1263 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 1264 | int ret; |
| 1265 | int len = sizeof(*cmd); |
| 1266 | wmi_buf_t wmi_buf; |
| 1267 | |
| 1268 | /* Allocate the memory */ |
| 1269 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1270 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1271 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1272 | __func__); |
| 1273 | ret = -ENOMEM; |
| 1274 | goto error; |
| 1275 | } |
| 1276 | |
| 1277 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 1278 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1279 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 1280 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 1281 | cmd->vdev_id = param->vdev_id; |
| 1282 | cmd->requestor = param->requestor; |
| 1283 | cmd->scan_id = param->scan_id; |
| 1284 | /* stop the scan with the corresponding scan_id */ |
| 1285 | cmd->req_type = param->req_type; |
| 1286 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, |
| 1287 | len, WMI_STOP_SCAN_CMDID); |
| 1288 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1289 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1290 | wmi_buf_free(wmi_buf); |
| 1291 | } |
| 1292 | |
| 1293 | error: |
| 1294 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1295 | } |
| 1296 | |
| 1297 | /** |
| 1298 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 1299 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1300 | * @param param : pointer to hold scan channel list parameter |
| 1301 | * |
| 1302 | * Return: 0 on success and -ve on failure. |
| 1303 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1304 | 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] | 1305 | struct scan_chan_list_params *chan_list) |
| 1306 | { |
| 1307 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1308 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1309 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 1310 | int status, i; |
| 1311 | uint8_t *buf_ptr; |
| 1312 | wmi_channel *chan_info, *tchan_info; |
| 1313 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 1314 | |
| 1315 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 1316 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1317 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1318 | WMI_LOGE("Failed to allocate memory"); |
| 1319 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1320 | goto end; |
| 1321 | } |
| 1322 | |
| 1323 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1324 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 1325 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1326 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 1327 | WMITLV_GET_STRUCT_TLVLEN |
| 1328 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 1329 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1330 | 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] | 1331 | |
| 1332 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 1333 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 1334 | WMITLV_TAG_ARRAY_STRUC, |
| 1335 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
| 1336 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 1337 | tchan_info = chan_list->chan_info; |
| 1338 | |
| 1339 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 1340 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 1341 | WMITLV_TAG_STRUC_wmi_channel, |
| 1342 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 1343 | chan_info->mhz = tchan_info->mhz; |
| 1344 | chan_info->band_center_freq1 = |
| 1345 | tchan_info->band_center_freq1; |
| 1346 | chan_info->band_center_freq2 = |
| 1347 | tchan_info->band_center_freq2; |
| 1348 | chan_info->info = tchan_info->info; |
| 1349 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 1350 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1351 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1352 | |
| 1353 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 1354 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 1355 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 1356 | tchan_info++; |
| 1357 | chan_info++; |
| 1358 | } |
| 1359 | |
| 1360 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1361 | WMI_SCAN_CHAN_LIST_CMDID); |
| 1362 | |
| 1363 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1364 | qdf_status = QDF_STATUS_E_FAILURE; |
| 1365 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1366 | wmi_buf_free(buf); |
| 1367 | } |
| 1368 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1369 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1370 | } |
| 1371 | |
| 1372 | /** |
| 1373 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 1374 | * @wmi_handle : handle to WMI. |
| 1375 | * @param : pointer to hold mgmt cmd parameter |
| 1376 | * |
| 1377 | * Return: 0 on success and -ve on failure. |
| 1378 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1379 | QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1380 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1381 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1382 | wmi_buf_t buf; |
| 1383 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 1384 | int32_t cmd_len; |
| 1385 | uint64_t dma_addr; |
| 1386 | struct wmi_desc_t *wmi_desc = NULL; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1387 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1388 | uint8_t *bufp; |
| 1389 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 1390 | mgmt_tx_dl_frm_len; |
| 1391 | |
| 1392 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 1393 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 1394 | |
| 1395 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 1396 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1397 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 1398 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1399 | } |
| 1400 | |
| 1401 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 1402 | bufp = (uint8_t *) cmd; |
| 1403 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1404 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 1405 | WMITLV_GET_STRUCT_TLVLEN |
| 1406 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 1407 | |
| 1408 | cmd->vdev_id = param->vdev_id; |
| 1409 | |
| 1410 | wmi_desc = param->wmi_desc; |
| 1411 | if (!wmi_desc) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1412 | WMI_LOGE("%s: Failed to get wmi_desc", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1413 | goto err1; |
| 1414 | } |
| 1415 | wmi_desc->nbuf = param->tx_frame; |
| 1416 | wmi_desc->tx_cmpl_cb = param->tx_complete_cb; |
| 1417 | wmi_desc->ota_post_proc_cb = param->tx_ota_post_proc_cb; |
| 1418 | |
| 1419 | cmd->desc_id = wmi_desc->desc_id; |
| 1420 | cmd->chanfreq = param->chanfreq; |
| 1421 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 1422 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 1423 | sizeof(uint32_t))); |
| 1424 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1425 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 1426 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 1427 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1428 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 1429 | #if defined(HELIUMPLUS_PADDR64) |
| 1430 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 1431 | #endif |
| 1432 | cmd->frame_len = param->frm_len; |
| 1433 | cmd->buf_len = bufp_len; |
| 1434 | |
| 1435 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 1436 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1437 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1438 | goto err1; |
| 1439 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1440 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1441 | |
| 1442 | err1: |
| 1443 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1444 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1445 | } |
| 1446 | |
| 1447 | /** |
| 1448 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 1449 | * @wmi_handle: wmi handle |
| 1450 | * @param_value: parameter value |
| 1451 | * |
| 1452 | * Return: 0 for success or error code |
| 1453 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1454 | 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] | 1455 | uint32_t param_value) |
| 1456 | { |
| 1457 | int ret; |
| 1458 | wmi_modem_power_state_cmd_param *cmd; |
| 1459 | wmi_buf_t buf; |
| 1460 | uint16_t len = sizeof(*cmd); |
| 1461 | |
| 1462 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1463 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1464 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1465 | return -ENOMEM; |
| 1466 | } |
| 1467 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 1468 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1469 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 1470 | WMITLV_GET_STRUCT_TLVLEN |
| 1471 | (wmi_modem_power_state_cmd_param)); |
| 1472 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1473 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1474 | param_value); |
| 1475 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1476 | WMI_MODEM_POWER_STATE_CMDID); |
| 1477 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1478 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1479 | wmi_buf_free(buf); |
| 1480 | } |
| 1481 | return ret; |
| 1482 | } |
| 1483 | |
| 1484 | /** |
| 1485 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 1486 | * @wmi_handle: wmi handle |
| 1487 | * @vdev_id: vdev id |
| 1488 | * @val: value |
| 1489 | * |
| 1490 | * Return: 0 for success or error code. |
| 1491 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1492 | 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] | 1493 | uint32_t vdev_id, uint8_t val) |
| 1494 | { |
| 1495 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 1496 | wmi_buf_t buf; |
| 1497 | int32_t len = sizeof(*cmd); |
| 1498 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1499 | 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] | 1500 | |
| 1501 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1502 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1503 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1504 | return -ENOMEM; |
| 1505 | } |
| 1506 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 1507 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1508 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 1509 | WMITLV_GET_STRUCT_TLVLEN |
| 1510 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 1511 | cmd->vdev_id = vdev_id; |
| 1512 | if (val) |
| 1513 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 1514 | else |
| 1515 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 1516 | |
| 1517 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1518 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1519 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1520 | vdev_id, val); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1521 | qdf_nbuf_free(buf); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1522 | return -EIO; |
| 1523 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1524 | return 0; |
| 1525 | } |
| 1526 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1527 | /** |
| 1528 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 1529 | * @wmi_handle: wmi handle |
| 1530 | * @vdev_id: vdev id |
| 1531 | * @value: value |
| 1532 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1533 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1534 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1535 | QDF_STATUS send_set_mimops_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1536 | uint8_t vdev_id, int value) |
| 1537 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1538 | int ret = QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1539 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 1540 | wmi_buf_t buf; |
| 1541 | uint16_t len = sizeof(*cmd); |
| 1542 | |
| 1543 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1544 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1545 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1546 | return -ENOMEM; |
| 1547 | } |
| 1548 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 1549 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1550 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 1551 | WMITLV_GET_STRUCT_TLVLEN |
| 1552 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 1553 | |
| 1554 | cmd->vdev_id = vdev_id; |
| 1555 | |
| 1556 | switch (value) { |
| 1557 | case 0: |
| 1558 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 1559 | break; |
| 1560 | case 1: |
| 1561 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 1562 | break; |
| 1563 | case 2: |
| 1564 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 1565 | break; |
| 1566 | case 3: |
| 1567 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 1568 | break; |
| 1569 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1570 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 1571 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1572 | } |
| 1573 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1574 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1575 | |
| 1576 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1577 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
| 1578 | if (ret < 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1579 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1580 | wmi_buf_free(buf); |
| 1581 | } |
| 1582 | |
| 1583 | return ret; |
| 1584 | } |
| 1585 | |
| 1586 | /** |
| 1587 | * send_set_smps_params_cmd_tlv() - set smps params |
| 1588 | * @wmi_handle: wmi handle |
| 1589 | * @vdev_id: vdev id |
| 1590 | * @value: value |
| 1591 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1592 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1593 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1594 | 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] | 1595 | int value) |
| 1596 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1597 | int ret = QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1598 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 1599 | wmi_buf_t buf; |
| 1600 | uint16_t len = sizeof(*cmd); |
| 1601 | |
| 1602 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1603 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1604 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1605 | return -ENOMEM; |
| 1606 | } |
| 1607 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1608 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1609 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 1610 | WMITLV_GET_STRUCT_TLVLEN |
| 1611 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 1612 | |
| 1613 | cmd->vdev_id = vdev_id; |
| 1614 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 1615 | cmd->param = |
| 1616 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 1617 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1618 | 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] | 1619 | cmd->param); |
| 1620 | |
| 1621 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1622 | WMI_STA_SMPS_PARAM_CMDID); |
| 1623 | if (ret < 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1624 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1625 | wmi_buf_free(buf); |
| 1626 | } |
| 1627 | |
| 1628 | return ret; |
| 1629 | } |
| 1630 | |
| 1631 | /** |
| 1632 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 1633 | * @wmi_handle: wmi handle |
| 1634 | * @noa: p2p power save parameters |
| 1635 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1636 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1637 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1638 | 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] | 1639 | struct p2p_ps_params *noa) |
| 1640 | { |
| 1641 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 1642 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 1643 | wmi_buf_t buf; |
| 1644 | uint8_t *buf_ptr; |
| 1645 | uint16_t len; |
| 1646 | int32_t status; |
| 1647 | uint32_t duration; |
| 1648 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1649 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1650 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 1651 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1652 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1653 | WMI_LOGE("Failed to allocate memory"); |
| 1654 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1655 | goto end; |
| 1656 | } |
| 1657 | |
| 1658 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1659 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 1660 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1661 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 1662 | WMITLV_GET_STRUCT_TLVLEN |
| 1663 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 1664 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 1665 | cmd->vdev_id = noa->session_id; |
| 1666 | cmd->enable = (duration) ? true : false; |
| 1667 | cmd->num_noa = 1; |
| 1668 | |
| 1669 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 1670 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 1671 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 1672 | sizeof |
| 1673 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 1674 | + WMI_TLV_HDR_SIZE); |
| 1675 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 1676 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 1677 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 1678 | noa_discriptor->type_count = noa->count; |
| 1679 | noa_discriptor->duration = duration; |
| 1680 | noa_discriptor->interval = noa->interval; |
| 1681 | noa_discriptor->start_time = 0; |
| 1682 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1683 | 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] | 1684 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 1685 | noa->interval); |
| 1686 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1687 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
| 1688 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1689 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1690 | wmi_buf_free(buf); |
| 1691 | } |
| 1692 | |
| 1693 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1694 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1695 | return status; |
| 1696 | } |
| 1697 | |
| 1698 | |
| 1699 | /** |
| 1700 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 1701 | * @wmi_handle: wmi handle |
| 1702 | * @noa: p2p opp power save parameters |
| 1703 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1704 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1705 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1706 | 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] | 1707 | struct p2p_ps_params *oppps) |
| 1708 | { |
| 1709 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 1710 | wmi_buf_t buf; |
| 1711 | int32_t status; |
| 1712 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1713 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1714 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1715 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1716 | WMI_LOGE("Failed to allocate memory"); |
| 1717 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1718 | goto end; |
| 1719 | } |
| 1720 | |
| 1721 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 1722 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1723 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 1724 | WMITLV_GET_STRUCT_TLVLEN |
| 1725 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 1726 | cmd->vdev_id = oppps->session_id; |
| 1727 | if (oppps->ctwindow) |
| 1728 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 1729 | |
| 1730 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1731 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1732 | cmd->vdev_id, oppps->ctwindow); |
| 1733 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 1734 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
| 1735 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1736 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1737 | wmi_buf_free(buf); |
| 1738 | } |
| 1739 | |
| 1740 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1741 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1742 | return status; |
| 1743 | } |
| 1744 | |
| 1745 | /** |
| 1746 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 1747 | * @wmi_handle: wmi handle |
| 1748 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1749 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1750 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1751 | QDF_STATUS send_get_temperature_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1752 | { |
| 1753 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 1754 | wmi_buf_t wmi_buf; |
| 1755 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 1756 | uint8_t *buf_ptr; |
| 1757 | |
| 1758 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1759 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 1760 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1761 | } |
| 1762 | |
| 1763 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 1764 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1765 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 1766 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1767 | } |
| 1768 | |
| 1769 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1770 | |
| 1771 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 1772 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1773 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 1774 | WMITLV_GET_STRUCT_TLVLEN |
| 1775 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 1776 | |
| 1777 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 1778 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1779 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1780 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1781 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1782 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1783 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1784 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1785 | } |
| 1786 | |
| 1787 | /** |
| 1788 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 1789 | * @wmi_handle: wmi handle |
| 1790 | * @vdevid: vdev id |
| 1791 | * @peer_addr: peer mac address |
| 1792 | * @auto_triggerparam: auto trigger parameters |
| 1793 | * @num_ac: number of access category |
| 1794 | * |
| 1795 | * This function sets the trigger |
| 1796 | * uapsd params such as service interval, delay interval |
| 1797 | * and suspend interval which will be used by the firmware |
| 1798 | * to send trigger frames periodically when there is no |
| 1799 | * traffic on the transmit side. |
| 1800 | * |
| 1801 | * Return: 0 for success or error code. |
| 1802 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1803 | 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] | 1804 | struct sta_uapsd_trig_params *param) |
| 1805 | { |
| 1806 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
| 1807 | int32_t ret; |
| 1808 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 1809 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 1810 | uint32_t i; |
| 1811 | wmi_buf_t buf; |
| 1812 | uint8_t *buf_ptr; |
| 1813 | |
| 1814 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 1815 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1816 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1817 | return -ENOMEM; |
| 1818 | } |
| 1819 | |
| 1820 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1821 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 1822 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1823 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 1824 | WMITLV_GET_STRUCT_TLVLEN |
| 1825 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 1826 | cmd->vdev_id = param->vdevid; |
| 1827 | cmd->num_ac = param->num_ac; |
| 1828 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 1829 | |
| 1830 | /* TLV indicating array of structures to follow */ |
| 1831 | buf_ptr += sizeof(*cmd); |
| 1832 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 1833 | |
| 1834 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1835 | qdf_mem_copy(buf_ptr, param->auto_triggerparam, param_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1836 | |
| 1837 | /* |
| 1838 | * Update tag and length for uapsd auto trigger params (this will take |
| 1839 | * care of updating tag and length if it is not pre-filled by caller). |
| 1840 | */ |
| 1841 | for (i = 0; i < param->num_ac; i++) { |
| 1842 | WMITLV_SET_HDR((buf_ptr + |
| 1843 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 1844 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 1845 | WMITLV_GET_STRUCT_TLVLEN |
| 1846 | (wmi_sta_uapsd_auto_trig_param)); |
| 1847 | } |
| 1848 | |
| 1849 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 1850 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
| 1851 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1852 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1853 | wmi_buf_free(buf); |
| 1854 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 1855 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 1856 | return ret; |
| 1857 | } |
| 1858 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1859 | /** |
| 1860 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 1861 | * @wmi_handle: pointer to the wmi handle |
| 1862 | * @utc: pointer to the UTC time struct |
| 1863 | * |
| 1864 | * Return: 0 on succes |
| 1865 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1866 | 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] | 1867 | struct ocb_utc_param *utc) |
| 1868 | { |
| 1869 | int32_t ret; |
| 1870 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 1871 | uint8_t *buf_ptr; |
| 1872 | uint32_t len, i; |
| 1873 | wmi_buf_t buf; |
| 1874 | |
| 1875 | len = sizeof(*cmd); |
| 1876 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1877 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1878 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1879 | return -ENOMEM; |
| 1880 | } |
| 1881 | |
| 1882 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 1883 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 1884 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1885 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 1886 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 1887 | cmd->vdev_id = utc->vdev_id; |
| 1888 | |
| 1889 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 1890 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 1891 | |
| 1892 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 1893 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 1894 | |
| 1895 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1896 | WMI_OCB_SET_UTC_TIME_CMDID); |
| 1897 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1898 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1899 | wmi_buf_free(buf); |
| 1900 | return -EIO; |
| 1901 | } |
| 1902 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1903 | return QDF_STATUS_SUCCESS; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1904 | } |
| 1905 | |
| 1906 | /** |
| 1907 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 1908 | * frames on a channel |
| 1909 | * @wmi_handle: pointer to the wmi handle |
| 1910 | * @timing_advert: pointer to the timing advertisement struct |
| 1911 | * |
| 1912 | * Return: 0 on succes |
| 1913 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1914 | 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] | 1915 | struct ocb_timing_advert_param *timing_advert) |
| 1916 | { |
| 1917 | int32_t ret; |
| 1918 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 1919 | uint8_t *buf_ptr; |
| 1920 | uint32_t len, len_template; |
| 1921 | wmi_buf_t buf; |
| 1922 | |
| 1923 | len = sizeof(*cmd) + |
| 1924 | WMI_TLV_HDR_SIZE; |
| 1925 | |
| 1926 | len_template = timing_advert->template_length; |
| 1927 | /* Add padding to the template if needed */ |
| 1928 | if (len_template % 4 != 0) |
| 1929 | len_template += 4 - (len_template % 4); |
| 1930 | len += len_template; |
| 1931 | |
| 1932 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1933 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1934 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1935 | return -ENOMEM; |
| 1936 | } |
| 1937 | |
| 1938 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 1939 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 1940 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1941 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 1942 | WMITLV_GET_STRUCT_TLVLEN( |
| 1943 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 1944 | cmd->vdev_id = timing_advert->vdev_id; |
| 1945 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 1946 | cmd->channel_freq = timing_advert->chan_freq; |
| 1947 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 1948 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 1949 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 1950 | buf_ptr += sizeof(*cmd); |
| 1951 | |
| 1952 | /* Add the timing advert template */ |
| 1953 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 1954 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1955 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1956 | (uint8_t *)timing_advert->template_value, |
| 1957 | timing_advert->template_length); |
| 1958 | |
| 1959 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1960 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
| 1961 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1962 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1963 | wmi_buf_free(buf); |
| 1964 | return -EIO; |
| 1965 | } |
| 1966 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1967 | return QDF_STATUS_SUCCESS; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1968 | } |
| 1969 | |
| 1970 | /** |
| 1971 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 1972 | * on a channel |
| 1973 | * @wmi_handle: pointer to the wmi handle |
| 1974 | * @timing_advert: pointer to the timing advertisement struct |
| 1975 | * |
| 1976 | * Return: 0 on succes |
| 1977 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1978 | 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] | 1979 | struct ocb_timing_advert_param *timing_advert) |
| 1980 | { |
| 1981 | int32_t ret; |
| 1982 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 1983 | uint8_t *buf_ptr; |
| 1984 | uint32_t len; |
| 1985 | wmi_buf_t buf; |
| 1986 | |
| 1987 | len = sizeof(*cmd); |
| 1988 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1989 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1990 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1991 | return -ENOMEM; |
| 1992 | } |
| 1993 | |
| 1994 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 1995 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 1996 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1997 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 1998 | WMITLV_GET_STRUCT_TLVLEN( |
| 1999 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 2000 | cmd->vdev_id = timing_advert->vdev_id; |
| 2001 | cmd->channel_freq = timing_advert->chan_freq; |
| 2002 | |
| 2003 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2004 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
| 2005 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2006 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2007 | wmi_buf_free(buf); |
| 2008 | return -EIO; |
| 2009 | } |
| 2010 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2011 | return QDF_STATUS_SUCCESS; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2012 | } |
| 2013 | |
| 2014 | /** |
| 2015 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 2016 | * @wmi_handle: pointer to the wmi handle |
| 2017 | * @request: pointer to the request |
| 2018 | * |
| 2019 | * Return: 0 on succes |
| 2020 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2021 | 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] | 2022 | uint8_t vdev_id) |
| 2023 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2024 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2025 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 2026 | uint8_t *buf_ptr; |
| 2027 | wmi_buf_t buf; |
| 2028 | int32_t len; |
| 2029 | |
| 2030 | len = sizeof(*cmd); |
| 2031 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2032 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2033 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2034 | return -ENOMEM; |
| 2035 | } |
| 2036 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2037 | |
| 2038 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2039 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2040 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2041 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 2042 | WMITLV_GET_STRUCT_TLVLEN( |
| 2043 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 2044 | cmd->vdev_id = vdev_id; |
| 2045 | |
| 2046 | /* Send the WMI command */ |
| 2047 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2048 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 2049 | /* If there is an error, set the completion event */ |
| 2050 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2051 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2052 | wmi_buf_free(buf); |
| 2053 | return -EIO; |
| 2054 | } |
| 2055 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2056 | return QDF_STATUS_SUCCESS; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2057 | } |
| 2058 | |
| 2059 | /** |
| 2060 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 2061 | * @wmi_handle: pointer to the wmi handle |
| 2062 | * @get_stats_param: pointer to the dcc stats |
| 2063 | * |
| 2064 | * Return: 0 on succes |
| 2065 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2066 | 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] | 2067 | struct dcc_get_stats_param *get_stats_param) |
| 2068 | { |
| 2069 | int32_t ret; |
| 2070 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 2071 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 2072 | wmi_buf_t buf; |
| 2073 | uint8_t *buf_ptr; |
| 2074 | uint32_t len; |
| 2075 | uint32_t i; |
| 2076 | |
| 2077 | /* Validate the input */ |
| 2078 | if (get_stats_param->request_array_len != |
| 2079 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2080 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2081 | return -EINVAL; |
| 2082 | } |
| 2083 | |
| 2084 | /* Allocate memory for the WMI command */ |
| 2085 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 2086 | get_stats_param->request_array_len; |
| 2087 | |
| 2088 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2089 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2090 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2091 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2092 | } |
| 2093 | |
| 2094 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2095 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2096 | |
| 2097 | /* Populate the WMI command */ |
| 2098 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 2099 | buf_ptr += sizeof(*cmd); |
| 2100 | |
| 2101 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2102 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 2103 | WMITLV_GET_STRUCT_TLVLEN( |
| 2104 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 2105 | cmd->vdev_id = get_stats_param->vdev_id; |
| 2106 | cmd->num_channels = get_stats_param->channel_count; |
| 2107 | |
| 2108 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2109 | get_stats_param->request_array_len); |
| 2110 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2111 | |
| 2112 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2113 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2114 | get_stats_param->request_array_len); |
| 2115 | for (i = 0; i < cmd->num_channels; i++) |
| 2116 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 2117 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 2118 | WMITLV_GET_STRUCT_TLVLEN( |
| 2119 | wmi_dcc_channel_stats_request)); |
| 2120 | |
| 2121 | /* Send the WMI command */ |
| 2122 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2123 | WMI_DCC_GET_STATS_CMDID); |
| 2124 | |
| 2125 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2126 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2127 | wmi_buf_free(buf); |
| 2128 | return -EIO; |
| 2129 | } |
| 2130 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2131 | return QDF_STATUS_SUCCESS; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2132 | } |
| 2133 | |
| 2134 | /** |
| 2135 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 2136 | * @wmi_handle: pointer to the wmi handle |
| 2137 | * @vdev_id: vdev id |
| 2138 | * @dcc_stats_bitmap: dcc status bitmap |
| 2139 | * |
| 2140 | * Return: 0 on succes |
| 2141 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2142 | 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] | 2143 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 2144 | { |
| 2145 | int32_t ret; |
| 2146 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 2147 | wmi_buf_t buf; |
| 2148 | uint8_t *buf_ptr; |
| 2149 | uint32_t len; |
| 2150 | |
| 2151 | /* Allocate memory for the WMI command */ |
| 2152 | len = sizeof(*cmd); |
| 2153 | |
| 2154 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2155 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2156 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2157 | return -ENOMEM; |
| 2158 | } |
| 2159 | |
| 2160 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2161 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2162 | |
| 2163 | /* Populate the WMI command */ |
| 2164 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 2165 | |
| 2166 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2167 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 2168 | WMITLV_GET_STRUCT_TLVLEN( |
| 2169 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 2170 | cmd->vdev_id = vdev_id; |
| 2171 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 2172 | |
| 2173 | /* Send the WMI command */ |
| 2174 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2175 | WMI_DCC_CLEAR_STATS_CMDID); |
| 2176 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2177 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2178 | wmi_buf_free(buf); |
| 2179 | return -EIO; |
| 2180 | } |
| 2181 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2182 | return QDF_STATUS_SUCCESS; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2183 | } |
| 2184 | |
| 2185 | /** |
| 2186 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 2187 | * @wmi_handle: pointer to the wmi handle |
| 2188 | * @update_ndl_param: pointer to the request parameters |
| 2189 | * |
| 2190 | * Return: 0 on success |
| 2191 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2192 | 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] | 2193 | struct dcc_update_ndl_param *update_ndl_param) |
| 2194 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2195 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2196 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 2197 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 2198 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 2199 | uint32_t active_state_count; |
| 2200 | wmi_buf_t buf; |
| 2201 | uint8_t *buf_ptr; |
| 2202 | uint32_t len; |
| 2203 | uint32_t i; |
| 2204 | |
| 2205 | /* validate the input */ |
| 2206 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 2207 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2208 | WMI_LOGE(FL("Invalid parameter")); |
| 2209 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2210 | } |
| 2211 | active_state_count = 0; |
| 2212 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 2213 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 2214 | active_state_count += |
| 2215 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 2216 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 2217 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2218 | WMI_LOGE(FL("Invalid parameter")); |
| 2219 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2220 | } |
| 2221 | |
| 2222 | /* Allocate memory for the WMI command */ |
| 2223 | len = sizeof(*cmd) + |
| 2224 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 2225 | WMI_TLV_HDR_SIZE + |
| 2226 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 2227 | |
| 2228 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2229 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2230 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2231 | return -ENOMEM; |
| 2232 | } |
| 2233 | |
| 2234 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2235 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2236 | |
| 2237 | /* Populate the WMI command */ |
| 2238 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 2239 | buf_ptr += sizeof(*cmd); |
| 2240 | |
| 2241 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2242 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 2243 | WMITLV_GET_STRUCT_TLVLEN( |
| 2244 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 2245 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 2246 | cmd->num_channel = update_ndl_param->channel_count; |
| 2247 | |
| 2248 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2249 | update_ndl_param->dcc_ndl_chan_list_len); |
| 2250 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2251 | |
| 2252 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2253 | 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] | 2254 | update_ndl_param->dcc_ndl_chan_list_len); |
| 2255 | for (i = 0; i < cmd->num_channel; i++) |
| 2256 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 2257 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 2258 | WMITLV_GET_STRUCT_TLVLEN( |
| 2259 | wmi_dcc_ndl_chan)); |
| 2260 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 2261 | |
| 2262 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2263 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 2264 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2265 | |
| 2266 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2267 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2268 | update_ndl_param->dcc_ndl_active_state_list, |
| 2269 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 2270 | for (i = 0; i < active_state_count; i++) { |
| 2271 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 2272 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 2273 | WMITLV_GET_STRUCT_TLVLEN( |
| 2274 | wmi_dcc_ndl_active_state_config)); |
| 2275 | } |
| 2276 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 2277 | |
| 2278 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2279 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2280 | WMI_DCC_UPDATE_NDL_CMDID); |
| 2281 | /* If there is an error, set the completion event */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2282 | if (qdf_status) { |
| 2283 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2284 | wmi_buf_free(buf); |
| 2285 | return -EIO; |
| 2286 | } |
| 2287 | |
| 2288 | return 0; |
| 2289 | } |
| 2290 | |
| 2291 | /** |
| 2292 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 2293 | * @wmi_handle: pointer to the wmi handle |
| 2294 | * @config: the OCB configuration |
| 2295 | * |
| 2296 | * Return: 0 on success |
| 2297 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2298 | 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] | 2299 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 2300 | { |
| 2301 | int32_t ret; |
| 2302 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 2303 | wmi_channel *chan; |
| 2304 | wmi_ocb_channel *ocb_chan; |
| 2305 | wmi_qos_parameter *qos_param; |
| 2306 | wmi_dcc_ndl_chan *ndl_chan; |
| 2307 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 2308 | wmi_ocb_schedule_element *sched_elem; |
| 2309 | uint8_t *buf_ptr; |
| 2310 | wmi_buf_t buf; |
| 2311 | int32_t len; |
| 2312 | int32_t i, j, active_state_count; |
| 2313 | |
| 2314 | /* |
| 2315 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 2316 | * states. Validate dcc_ndl_active_state_list_len. |
| 2317 | */ |
| 2318 | active_state_count = 0; |
| 2319 | if (config->dcc_ndl_chan_list_len) { |
| 2320 | if (!config->dcc_ndl_chan_list || |
| 2321 | config->dcc_ndl_chan_list_len != |
| 2322 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2323 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2324 | config->dcc_ndl_chan_list_len); |
| 2325 | return -EINVAL; |
| 2326 | } |
| 2327 | |
| 2328 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 2329 | i < config->channel_count; ++i, ++ndl_chan) |
| 2330 | active_state_count += |
| 2331 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 2332 | |
| 2333 | if (active_state_count) { |
| 2334 | if (!config->dcc_ndl_active_state_list || |
| 2335 | config->dcc_ndl_active_state_list_len != |
| 2336 | active_state_count * |
| 2337 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2338 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2339 | return -EINVAL; |
| 2340 | } |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | len = sizeof(*cmd) + |
| 2345 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 2346 | sizeof(wmi_channel) + |
| 2347 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 2348 | sizeof(wmi_ocb_channel) + |
| 2349 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 2350 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 2351 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 2352 | WMI_TLV_HDR_SIZE + active_state_count * |
| 2353 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 2354 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 2355 | sizeof(wmi_ocb_schedule_element); |
| 2356 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2357 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2358 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2359 | return -ENOMEM; |
| 2360 | } |
| 2361 | |
| 2362 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 2363 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 2364 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2365 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 2366 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 2367 | cmd->vdev_id = config->session_id; |
| 2368 | cmd->channel_count = config->channel_count; |
| 2369 | cmd->schedule_size = config->schedule_size; |
| 2370 | cmd->flags = config->flags; |
| 2371 | buf_ptr += sizeof(*cmd); |
| 2372 | |
| 2373 | /* Add the wmi_channel info */ |
| 2374 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2375 | config->channel_count*sizeof(wmi_channel)); |
| 2376 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2377 | for (i = 0; i < config->channel_count; i++) { |
| 2378 | chan = (wmi_channel *)buf_ptr; |
| 2379 | WMITLV_SET_HDR(&chan->tlv_header, |
| 2380 | WMITLV_TAG_STRUC_wmi_channel, |
| 2381 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2382 | chan->mhz = config->channels[i].chan_freq; |
| 2383 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 2384 | chan->band_center_freq2 = 0; |
| 2385 | chan->info = 0; |
| 2386 | |
| 2387 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 2388 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 2389 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 2390 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 2391 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 2392 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 2393 | config->channels[i].antenna_max); |
| 2394 | |
| 2395 | if (config->channels[i].bandwidth < 10) |
| 2396 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 2397 | else if (config->channels[i].bandwidth < 20) |
| 2398 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 2399 | buf_ptr += sizeof(*chan); |
| 2400 | } |
| 2401 | |
| 2402 | /* Add the wmi_ocb_channel info */ |
| 2403 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2404 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 2405 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2406 | for (i = 0; i < config->channel_count; i++) { |
| 2407 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 2408 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 2409 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 2410 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 2411 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 2412 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 2413 | config->channels[i].mac_address.bytes, |
| 2414 | &ocb_chan->mac_address); |
| 2415 | buf_ptr += sizeof(*ocb_chan); |
| 2416 | } |
| 2417 | |
| 2418 | /* Add the wmi_qos_parameter info */ |
| 2419 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2420 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 2421 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2422 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 2423 | for (i = 0; i < config->channel_count; i++) { |
| 2424 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 2425 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 2426 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 2427 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 2428 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 2429 | qos_param->aifsn = |
| 2430 | config->channels[i].qos_params[j].aifsn; |
| 2431 | qos_param->cwmin = |
| 2432 | config->channels[i].qos_params[j].cwmin; |
| 2433 | qos_param->cwmax = |
| 2434 | config->channels[i].qos_params[j].cwmax; |
| 2435 | buf_ptr += sizeof(*qos_param); |
| 2436 | } |
| 2437 | } |
| 2438 | |
| 2439 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 2440 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2441 | config->dcc_ndl_chan_list_len); |
| 2442 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2443 | if (config->dcc_ndl_chan_list_len) { |
| 2444 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2445 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2446 | config->dcc_ndl_chan_list_len); |
| 2447 | for (i = 0; i < config->channel_count; i++) |
| 2448 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 2449 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 2450 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 2451 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 2452 | } |
| 2453 | |
| 2454 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 2455 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 2456 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 2457 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2458 | if (active_state_count) { |
| 2459 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2460 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2461 | config->dcc_ndl_active_state_list, |
| 2462 | active_state_count * sizeof(*ndl_active_config)); |
| 2463 | for (i = 0; i < active_state_count; ++i) |
| 2464 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 2465 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 2466 | WMITLV_GET_STRUCT_TLVLEN( |
| 2467 | wmi_dcc_ndl_active_state_config)); |
| 2468 | buf_ptr += active_state_count * |
| 2469 | sizeof(*ndl_active_config); |
| 2470 | } |
| 2471 | |
| 2472 | /* Add the wmi_ocb_schedule_element info */ |
| 2473 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2474 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 2475 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2476 | for (i = 0; i < config->schedule_size; i++) { |
| 2477 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 2478 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 2479 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 2480 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 2481 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 2482 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 2483 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 2484 | buf_ptr += sizeof(*sched_elem); |
| 2485 | } |
| 2486 | |
| 2487 | |
| 2488 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2489 | WMI_OCB_SET_CONFIG_CMDID); |
| 2490 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2491 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2492 | wmi_buf_free(buf); |
| 2493 | return -EIO; |
| 2494 | } |
| 2495 | |
| 2496 | return 0; |
| 2497 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2498 | |
| 2499 | /** |
| 2500 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 2501 | * @wmi_handle: wmi handle |
| 2502 | * @mcc_adaptive_scheduler: enable/disable |
| 2503 | * |
| 2504 | * This function enable/disable mcc adaptive scheduler in fw. |
| 2505 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2506 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2507 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2508 | QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2509 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler) |
| 2510 | { |
| 2511 | int ret = -1; |
| 2512 | wmi_buf_t buf = 0; |
| 2513 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 2514 | uint16_t len = |
| 2515 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 2516 | |
| 2517 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2518 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2519 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 2520 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2521 | } |
| 2522 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 2523 | wmi_buf_data(buf); |
| 2524 | |
| 2525 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2526 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 2527 | WMITLV_GET_STRUCT_TLVLEN |
| 2528 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 2529 | cmd->enable = mcc_adaptive_scheduler; |
| 2530 | |
| 2531 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2532 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
| 2533 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2534 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2535 | " adaptive scheduler command", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2536 | qdf_nbuf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2537 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2538 | return QDF_STATUS_SUCCESS; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2539 | } |
| 2540 | |
| 2541 | /** |
| 2542 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 2543 | * @wmi: wmi handle |
| 2544 | * @mcc_channel: mcc channel |
| 2545 | * @mcc_channel_time_latency: MCC channel time latency. |
| 2546 | * |
| 2547 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 2548 | * channel of it and channel number. The info is provided run time using |
| 2549 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 2550 | * |
| 2551 | * Return: CDF status |
| 2552 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2553 | 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] | 2554 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 2555 | { |
| 2556 | int ret = -1; |
| 2557 | wmi_buf_t buf = 0; |
| 2558 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 2559 | uint16_t len = 0; |
| 2560 | uint8_t *buf_ptr = NULL; |
| 2561 | wmi_resmgr_chan_latency chan_latency; |
| 2562 | /* Note: we only support MCC time latency for a single channel */ |
| 2563 | uint32_t num_channels = 1; |
| 2564 | uint32_t chan1_freq = mcc_channel_freq; |
| 2565 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 2566 | |
| 2567 | |
| 2568 | /* If 0ms latency is provided, then FW will set to a default. |
| 2569 | * Otherwise, latency must be at least 30ms. |
| 2570 | */ |
| 2571 | if ((latency_chan1 > 0) && |
| 2572 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2573 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2574 | "Minimum is 30ms (or 0 to use default value by " |
| 2575 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2576 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2577 | } |
| 2578 | |
| 2579 | /* Set WMI CMD for channel time latency here */ |
| 2580 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 2581 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 2582 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 2583 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2584 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2585 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 2586 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2587 | } |
| 2588 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2589 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 2590 | wmi_buf_data(buf); |
| 2591 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 2592 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 2593 | WMITLV_GET_STRUCT_TLVLEN |
| 2594 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 2595 | cmdTL->num_chans = num_channels; |
| 2596 | /* Update channel time latency information for home channel(s) */ |
| 2597 | buf_ptr += sizeof(*cmdTL); |
| 2598 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2599 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 2600 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2601 | chan_latency.chan_mhz = chan1_freq; |
| 2602 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2603 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2604 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2605 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
| 2606 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2607 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2608 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2609 | qdf_nbuf_free(buf); |
| 2610 | QDF_ASSERT(0); |
| 2611 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2612 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2613 | return QDF_STATUS_SUCCESS; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2614 | } |
| 2615 | |
| 2616 | /** |
| 2617 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 2618 | * @wmi: wmi handle |
| 2619 | * @adapter_1_chan_number: adapter 1 channel number |
| 2620 | * @adapter_1_quota: adapter 1 quota |
| 2621 | * @adapter_2_chan_number: adapter 2 channel number |
| 2622 | * |
| 2623 | * Return: CDF status |
| 2624 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2625 | 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] | 2626 | uint32_t adapter_1_chan_freq, |
| 2627 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 2628 | { |
| 2629 | int ret = -1; |
| 2630 | wmi_buf_t buf = 0; |
| 2631 | uint16_t len = 0; |
| 2632 | uint8_t *buf_ptr = NULL; |
| 2633 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 2634 | wmi_resmgr_chan_time_quota chan_quota; |
| 2635 | uint32_t quota_chan1 = adapter_1_quota; |
| 2636 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 2637 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 2638 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 2639 | uint32_t num_channels = 2; |
| 2640 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 2641 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 2642 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2643 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2644 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 2645 | chan1_freq, quota_chan1, chan2_freq, |
| 2646 | quota_chan2); |
| 2647 | |
| 2648 | /* |
| 2649 | * Perform sanity check on time quota values provided. |
| 2650 | */ |
| 2651 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 2652 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2653 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2654 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2655 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2656 | } |
| 2657 | /* Set WMI CMD for channel time quota here */ |
| 2658 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 2659 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 2660 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 2661 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2662 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2663 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 2664 | QDF_ASSERT(0); |
| 2665 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2666 | } |
| 2667 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2668 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 2669 | wmi_buf_data(buf); |
| 2670 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 2671 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 2672 | WMITLV_GET_STRUCT_TLVLEN |
| 2673 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 2674 | cmdTQ->num_chans = num_channels; |
| 2675 | |
| 2676 | /* Update channel time quota information for home channel(s) */ |
| 2677 | buf_ptr += sizeof(*cmdTQ); |
| 2678 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2679 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 2680 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2681 | chan_quota.chan_mhz = chan1_freq; |
| 2682 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2683 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2684 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 2685 | buf_ptr += sizeof(chan_quota); |
| 2686 | chan_quota.chan_mhz = chan2_freq; |
| 2687 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2688 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2689 | |
| 2690 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2691 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
| 2692 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2693 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
| 2694 | qdf_nbuf_free(buf); |
| 2695 | QDF_ASSERT(0); |
| 2696 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2697 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2698 | return QDF_STATUS_SUCCESS; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2699 | } |
| 2700 | |
| 2701 | /** |
| 2702 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 2703 | * @wmi_handle: Pointer to wmi handle |
| 2704 | * @thermal_info: Thermal command information |
| 2705 | * |
| 2706 | * This function sends the thermal management command |
| 2707 | * to the firmware |
| 2708 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2709 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2710 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2711 | 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] | 2712 | struct thermal_cmd_params *thermal_info) |
| 2713 | { |
| 2714 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 2715 | wmi_buf_t buf = NULL; |
| 2716 | int status = 0; |
| 2717 | uint32_t len = 0; |
| 2718 | |
| 2719 | len = sizeof(*cmd); |
| 2720 | |
| 2721 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2722 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2723 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 2724 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2725 | } |
| 2726 | |
| 2727 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 2728 | |
| 2729 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2730 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 2731 | WMITLV_GET_STRUCT_TLVLEN |
| 2732 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 2733 | |
| 2734 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 2735 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 2736 | cmd->enable = thermal_info->thermal_enable; |
| 2737 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2738 | 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] | 2739 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 2740 | |
| 2741 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2742 | WMI_THERMAL_MGMT_CMDID); |
| 2743 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2744 | qdf_nbuf_free(buf); |
| 2745 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
| 2746 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2747 | } |
| 2748 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2749 | return QDF_STATUS_SUCCESS; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2750 | } |
| 2751 | |
| 2752 | |
| 2753 | /** |
| 2754 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2755 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2756 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 2757 | * |
| 2758 | * This function sends down the LRO configuration parameters to |
| 2759 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 2760 | * seed values for the toeplitz hash generation |
| 2761 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2762 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2763 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2764 | QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2765 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 2766 | { |
| 2767 | wmi_lro_info_cmd_fixed_param *cmd; |
| 2768 | wmi_buf_t buf; |
| 2769 | int status; |
| 2770 | |
| 2771 | |
| 2772 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2773 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2774 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 2775 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2776 | } |
| 2777 | |
| 2778 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 2779 | |
| 2780 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2781 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 2782 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 2783 | |
| 2784 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 2785 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 2786 | wmi_lro_cmd->tcp_flag); |
| 2787 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 2788 | wmi_lro_cmd->tcp_flag_mask); |
| 2789 | cmd->toeplitz_hash_ipv4_0_3 = |
| 2790 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 2791 | cmd->toeplitz_hash_ipv4_4_7 = |
| 2792 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 2793 | cmd->toeplitz_hash_ipv4_8_11 = |
| 2794 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 2795 | cmd->toeplitz_hash_ipv4_12_15 = |
| 2796 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 2797 | cmd->toeplitz_hash_ipv4_16 = |
| 2798 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 2799 | |
| 2800 | cmd->toeplitz_hash_ipv6_0_3 = |
| 2801 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 2802 | cmd->toeplitz_hash_ipv6_4_7 = |
| 2803 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 2804 | cmd->toeplitz_hash_ipv6_8_11 = |
| 2805 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 2806 | cmd->toeplitz_hash_ipv6_12_15 = |
| 2807 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 2808 | cmd->toeplitz_hash_ipv6_16_19 = |
| 2809 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 2810 | cmd->toeplitz_hash_ipv6_20_23 = |
| 2811 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 2812 | cmd->toeplitz_hash_ipv6_24_27 = |
| 2813 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 2814 | cmd->toeplitz_hash_ipv6_28_31 = |
| 2815 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 2816 | cmd->toeplitz_hash_ipv6_32_35 = |
| 2817 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 2818 | cmd->toeplitz_hash_ipv6_36_39 = |
| 2819 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 2820 | cmd->toeplitz_hash_ipv6_40 = |
| 2821 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 2822 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2823 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2824 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 2825 | |
| 2826 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 2827 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
| 2828 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2829 | qdf_nbuf_free(buf); |
| 2830 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
| 2831 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2832 | } |
| 2833 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2834 | return QDF_STATUS_SUCCESS; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 2835 | } |
| 2836 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2837 | /** |
| 2838 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 2839 | * @wmi_handle: wmi handle |
| 2840 | * @param: bcn ll cmd parameter |
| 2841 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2842 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2843 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2844 | 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] | 2845 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 2846 | { |
| 2847 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 2848 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2849 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2850 | |
| 2851 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2852 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2853 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 2854 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2855 | } |
| 2856 | |
| 2857 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2858 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2859 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 2860 | WMITLV_GET_STRUCT_TLVLEN |
| 2861 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 2862 | cmd->vdev_id = param->vdev_id; |
| 2863 | cmd->data_len = param->data_len; |
| 2864 | cmd->frame_ctrl = param->frame_ctrl; |
| 2865 | cmd->frag_ptr = param->frag_ptr; |
| 2866 | cmd->dtim_flag = param->dtim_flag; |
| 2867 | |
| 2868 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 2869 | WMI_PDEV_SEND_BCN_CMDID); |
| 2870 | |
| 2871 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2872 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2873 | wmi_buf_free(wmi_buf); |
| 2874 | } |
| 2875 | |
| 2876 | return ret; |
| 2877 | } |
| 2878 | |
| 2879 | /** |
| 2880 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 2881 | * @wmi_handle: wmi handle |
| 2882 | * @vdev_id: vdev id |
| 2883 | * @max_retries: max retries |
| 2884 | * @retry_interval: retry interval |
| 2885 | * This function sets sta query related parameters in fw. |
| 2886 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2887 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2888 | */ |
| 2889 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2890 | 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] | 2891 | uint8_t vdev_id, uint32_t max_retries, |
| 2892 | uint32_t retry_interval) |
| 2893 | { |
| 2894 | wmi_buf_t buf; |
| 2895 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 2896 | int len; |
| 2897 | |
| 2898 | len = sizeof(*cmd); |
| 2899 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2900 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2901 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 2902 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2903 | } |
| 2904 | |
| 2905 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 2906 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2907 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 2908 | WMITLV_GET_STRUCT_TLVLEN |
| 2909 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 2910 | |
| 2911 | |
| 2912 | cmd->vdev_id = vdev_id; |
| 2913 | cmd->sa_query_max_retry_count = max_retries; |
| 2914 | cmd->sa_query_retry_interval = retry_interval; |
| 2915 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2916 | 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] | 2917 | vdev_id, retry_interval, max_retries); |
| 2918 | |
| 2919 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2920 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2921 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
| 2922 | qdf_nbuf_free(buf); |
| 2923 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2924 | } |
| 2925 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2926 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2927 | return 0; |
| 2928 | } |
| 2929 | |
| 2930 | /** |
| 2931 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 2932 | * @wmi_handle: wmi handle |
| 2933 | * @params: sta keep alive parameter |
| 2934 | * |
| 2935 | * This function sets keep alive related parameters in fw. |
| 2936 | * |
| 2937 | * Return: CDF status |
| 2938 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2939 | 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] | 2940 | struct sta_params *params) |
| 2941 | { |
| 2942 | wmi_buf_t buf; |
| 2943 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 2944 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 2945 | uint8_t *buf_ptr; |
| 2946 | int len; |
| 2947 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2948 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2949 | |
| 2950 | if (params->timeperiod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2951 | WMI_LOGE("Invalid period %d Max limit %d", params->timeperiod, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2952 | WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2953 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2954 | } |
| 2955 | |
| 2956 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 2957 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2958 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2959 | WMI_LOGE("wmi_buf_alloc failed"); |
| 2960 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2961 | } |
| 2962 | |
| 2963 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 2964 | buf_ptr = (uint8_t *) cmd; |
| 2965 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2966 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 2967 | WMITLV_GET_STRUCT_TLVLEN |
| 2968 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 2969 | cmd->interval = params->timeperiod; |
| 2970 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 2971 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2972 | 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] | 2973 | params->timeperiod, params->method); |
| 2974 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 2975 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 2976 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 2977 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 2978 | |
| 2979 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 2980 | if ((NULL == params->hostv4addr) || |
| 2981 | (NULL == params->destv4addr) || |
| 2982 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2983 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2984 | "destv4addr:%p destmac:%p ", __func__, |
| 2985 | params->hostv4addr, params->destv4addr, params->destmac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2986 | qdf_nbuf_free(buf); |
| 2987 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2988 | } |
| 2989 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2990 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2991 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2992 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2993 | WMI_IPV4_ADDR_LEN); |
| 2994 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 2995 | } else { |
| 2996 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 2997 | } |
| 2998 | |
| 2999 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3000 | WMI_STA_KEEPALIVE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3001 | WMI_LOGE("Failed to set KeepAlive"); |
| 3002 | qdf_nbuf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3003 | } |
| 3004 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3005 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3006 | return 0; |
| 3007 | } |
| 3008 | |
| 3009 | /** |
| 3010 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 3011 | * @wmi_handle: wmi handle |
| 3012 | * @if_id: vdev id |
| 3013 | * @gtx_info: GTX config params |
| 3014 | * |
| 3015 | * This function set GTX related params in firmware. |
| 3016 | * |
| 3017 | * Return: 0 for success or error code |
| 3018 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3019 | 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] | 3020 | struct wmi_gtx_config *gtx_info) |
| 3021 | { |
| 3022 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 3023 | wmi_buf_t buf; |
| 3024 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
| 3025 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3026 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3027 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3028 | return -ENOMEM; |
| 3029 | } |
| 3030 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 3031 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3032 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 3033 | WMITLV_GET_STRUCT_TLVLEN |
| 3034 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 3035 | cmd->vdev_id = if_id; |
| 3036 | |
| 3037 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 3038 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 3039 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 3040 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 3041 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 3042 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 3043 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 3044 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 3045 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3046 | 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] | 3047 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 3048 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 3049 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 3050 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 3051 | |
| 3052 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3053 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
| 3054 | } |
| 3055 | |
| 3056 | /** |
| 3057 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 3058 | * @wmi_handle: wmi handle |
| 3059 | * @edca_params: edca parameters |
| 3060 | * |
| 3061 | * This function updates EDCA parameters to the target |
| 3062 | * |
| 3063 | * Return: CDF Status |
| 3064 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3065 | 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] | 3066 | uint8_t vdev_id, |
| 3067 | wmi_wmm_vparams gwmm_param[WMI_MAX_NUM_AC]) |
| 3068 | { |
| 3069 | uint8_t *buf_ptr; |
| 3070 | wmi_buf_t buf; |
| 3071 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
| 3072 | wmi_wmm_vparams *wmm_param, *twmm_param; |
| 3073 | int len = sizeof(*cmd); |
| 3074 | int ac; |
| 3075 | |
| 3076 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3077 | |
| 3078 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3079 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3080 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3081 | } |
| 3082 | |
| 3083 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3084 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 3085 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3086 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3087 | WMITLV_GET_STRUCT_TLVLEN |
| 3088 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 3089 | cmd->vdev_id = vdev_id; |
| 3090 | |
| 3091 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 3092 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
| 3093 | twmm_param = (wmi_wmm_vparams *) (&gwmm_param[ac]); |
| 3094 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 3095 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 3096 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 3097 | wmm_param->cwmin = twmm_param->cwmin; |
| 3098 | wmm_param->cwmax = twmm_param->cwmax; |
| 3099 | wmm_param->aifs = twmm_param->aifs; |
| 3100 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 3101 | wmm_param->acm = twmm_param->acm; |
| 3102 | wmm_param->no_ack = twmm_param->no_ack; |
| 3103 | } |
| 3104 | |
| 3105 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3106 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 3107 | goto fail; |
| 3108 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3109 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3110 | |
| 3111 | fail: |
| 3112 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3113 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 3114 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3115 | } |
| 3116 | |
| 3117 | /** |
| 3118 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 3119 | * @wmi_handle: wmi handle |
| 3120 | * @vdev_id: vdev id |
| 3121 | * @probe_rsp_info: probe response info |
| 3122 | * |
| 3123 | * Return: 0 for success or error code |
| 3124 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3125 | 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] | 3126 | uint8_t vdev_id, |
| 3127 | struct wmi_probe_resp_params *probe_rsp_info, |
| 3128 | uint8_t *frm) |
| 3129 | { |
| 3130 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 3131 | wmi_bcn_prb_info *bcn_prb_info; |
| 3132 | wmi_buf_t wmi_buf; |
| 3133 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 3134 | uint8_t *buf_ptr; |
| 3135 | int ret; |
| 3136 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3137 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3138 | |
| 3139 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 3140 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 3141 | |
| 3142 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 3143 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 3144 | tmpl_len_aligned; |
| 3145 | |
| 3146 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3147 | 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] | 3148 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
| 3149 | return -EINVAL; |
| 3150 | } |
| 3151 | |
| 3152 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 3153 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3154 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3155 | return -ENOMEM; |
| 3156 | } |
| 3157 | |
| 3158 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3159 | |
| 3160 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 3161 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3162 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 3163 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 3164 | cmd->vdev_id = vdev_id; |
| 3165 | cmd->buf_len = tmpl_len; |
| 3166 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 3167 | |
| 3168 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 3169 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 3170 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 3171 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 3172 | bcn_prb_info->caps = 0; |
| 3173 | bcn_prb_info->erp = 0; |
| 3174 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 3175 | |
| 3176 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 3177 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3178 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3179 | |
| 3180 | ret = wmi_unified_cmd_send(wmi_handle, |
| 3181 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
| 3182 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3183 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3184 | wmi_buf_free(wmi_buf); |
| 3185 | } |
| 3186 | |
| 3187 | return ret; |
| 3188 | } |
| 3189 | |
| 3190 | /** |
| 3191 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 3192 | * @wmi_handle: wmi handle |
| 3193 | * @vdev_id: vdev id |
| 3194 | * @p2p_ie: p2p IE |
| 3195 | * |
| 3196 | * Return: 0 for success or error code |
| 3197 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3198 | 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] | 3199 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 3200 | { |
| 3201 | int ret; |
| 3202 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 3203 | wmi_buf_t wmi_buf; |
| 3204 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 3205 | uint8_t *buf_ptr; |
| 3206 | |
| 3207 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 3208 | |
| 3209 | /* More than one P2P IE may be included in a single frame. |
| 3210 | If multiple P2P IEs are present, the complete P2P attribute |
| 3211 | data consists of the concatenation of the P2P Attribute |
| 3212 | fields of the P2P IEs. The P2P Attributes field of each |
| 3213 | P2P IE may be any length up to the maximum (251 octets). |
| 3214 | In this case host sends one P2P IE to firmware so the length |
| 3215 | should not exceed more than 251 bytes |
| 3216 | */ |
| 3217 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3218 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3219 | return -EINVAL; |
| 3220 | } |
| 3221 | |
| 3222 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 3223 | |
| 3224 | wmi_buf_len = |
| 3225 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 3226 | WMI_TLV_HDR_SIZE; |
| 3227 | |
| 3228 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 3229 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3230 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3231 | return -ENOMEM; |
| 3232 | } |
| 3233 | |
| 3234 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3235 | |
| 3236 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 3237 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3238 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 3239 | WMITLV_GET_STRUCT_TLVLEN |
| 3240 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 3241 | cmd->vdev_id = vdev_id; |
| 3242 | cmd->ie_buf_len = ie_len; |
| 3243 | |
| 3244 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 3245 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 3246 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3247 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3248 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3249 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3250 | |
| 3251 | ret = wmi_unified_cmd_send(wmi_handle, |
| 3252 | wmi_buf, wmi_buf_len, |
| 3253 | WMI_P2P_GO_SET_BEACON_IE); |
| 3254 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3255 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3256 | wmi_buf_free(wmi_buf); |
| 3257 | } |
| 3258 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3259 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3260 | return ret; |
| 3261 | } |
| 3262 | |
| 3263 | /** |
| 3264 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 3265 | * @wmi_handle: wmi handle |
| 3266 | * @req: gateway parameter update request structure |
| 3267 | * |
| 3268 | * This function reads the incoming @req and fill in the destination |
| 3269 | * WMI structure and sends down the gateway configs down to the firmware |
| 3270 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3271 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3272 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3273 | 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] | 3274 | struct gateway_update_req_param *req) |
| 3275 | { |
| 3276 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 3277 | wmi_buf_t buf; |
| 3278 | int ret; |
| 3279 | int len = sizeof(*cmd); |
| 3280 | |
| 3281 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3282 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3283 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 3284 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3285 | } |
| 3286 | |
| 3287 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 3288 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3289 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 3290 | WMITLV_GET_STRUCT_TLVLEN( |
| 3291 | wmi_roam_subnet_change_config_fixed_param)); |
| 3292 | |
| 3293 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3294 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 3295 | QDF_IPV4_ADDR_SIZE); |
| 3296 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 3297 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3298 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 3299 | &cmd->inet_gw_mac_addr); |
| 3300 | cmd->max_retries = req->max_retries; |
| 3301 | cmd->timeout = req->timeout; |
| 3302 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 3303 | cmd->flag = 0; |
| 3304 | if (req->ipv4_addr_type) |
| 3305 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 3306 | |
| 3307 | if (req->ipv6_addr_type) |
| 3308 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 3309 | |
| 3310 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3311 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
| 3312 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3313 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3314 | ret); |
| 3315 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3316 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3317 | } |
| 3318 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3319 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3320 | } |
| 3321 | |
| 3322 | /** |
| 3323 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 3324 | * @wmi_handle: wmi handle |
| 3325 | * @req: rssi monitoring request structure |
| 3326 | * |
| 3327 | * This function reads the incoming @req and fill in the destination |
| 3328 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 3329 | * |
| 3330 | * Return: 0 on success; error number otherwise |
| 3331 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3332 | 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] | 3333 | struct rssi_monitor_param *req) |
| 3334 | { |
| 3335 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 3336 | wmi_buf_t buf; |
| 3337 | int ret, len = sizeof(*cmd); |
| 3338 | |
| 3339 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3340 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3341 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 3342 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3343 | } |
| 3344 | |
| 3345 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 3346 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3347 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 3348 | WMITLV_GET_STRUCT_TLVLEN( |
| 3349 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 3350 | |
| 3351 | cmd->vdev_id = req->session_id; |
| 3352 | cmd->request_id = req->request_id; |
| 3353 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 3354 | cmd->hi_rssi_reenable_histeresis = 0; |
| 3355 | cmd->min_report_interval = 0; |
| 3356 | cmd->max_num_report = 1; |
| 3357 | if (req->control) { |
| 3358 | /* enable one threshold for each min/max */ |
| 3359 | cmd->enabled_bitmap = 0x09; |
| 3360 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 3361 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 3362 | } else { |
| 3363 | cmd->enabled_bitmap = 0; |
| 3364 | cmd->low_rssi_breach_threshold[0] = 0; |
| 3365 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 3366 | } |
| 3367 | |
| 3368 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3369 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
| 3370 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3371 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3372 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3373 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3374 | } |
| 3375 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3376 | WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
| 3377 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3378 | } |
| 3379 | |
| 3380 | /** |
| 3381 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 3382 | * @wmi_handle: wmi handle |
| 3383 | * @psetoui: OUI parameters |
| 3384 | * |
| 3385 | * set scan probe OUI parameters in firmware |
| 3386 | * |
| 3387 | * Return: CDF status |
| 3388 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3389 | 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] | 3390 | struct scan_mac_oui *psetoui) |
| 3391 | { |
| 3392 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 3393 | wmi_buf_t wmi_buf; |
| 3394 | uint32_t len; |
| 3395 | uint8_t *buf_ptr; |
| 3396 | uint32_t *oui_buf; |
| 3397 | |
| 3398 | len = sizeof(*cmd); |
| 3399 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 3400 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3401 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 3402 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3403 | } |
| 3404 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3405 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 3406 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3407 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 3408 | WMITLV_GET_STRUCT_TLVLEN |
| 3409 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 3410 | |
| 3411 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3412 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3413 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 3414 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3415 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3416 | cmd->prob_req_oui); |
| 3417 | |
| 3418 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 3419 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3420 | WMI_LOGE("%s: failed to send command", __func__); |
| 3421 | qdf_nbuf_free(wmi_buf); |
| 3422 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3423 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3424 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3425 | } |
| 3426 | |
| 3427 | /** |
| 3428 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 3429 | * @wmi_handle: wmi handle |
| 3430 | * @req: passpoint network request structure |
| 3431 | * |
| 3432 | * This function sends down WMI command with network id set to wildcard id. |
| 3433 | * firmware shall clear all the config entries |
| 3434 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3435 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3436 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3437 | 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] | 3438 | struct wifi_passpoint_req_param *req) |
| 3439 | { |
| 3440 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 3441 | wmi_buf_t buf; |
| 3442 | uint32_t len; |
| 3443 | int ret; |
| 3444 | |
| 3445 | len = sizeof(*cmd); |
| 3446 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3447 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3448 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 3449 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3450 | } |
| 3451 | |
| 3452 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 3453 | |
| 3454 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3455 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 3456 | WMITLV_GET_STRUCT_TLVLEN( |
| 3457 | wmi_passpoint_config_cmd_fixed_param)); |
| 3458 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 3459 | |
| 3460 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3461 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 3462 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3463 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3464 | __func__); |
| 3465 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3466 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3467 | } |
| 3468 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3469 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3470 | } |
| 3471 | |
| 3472 | /** |
| 3473 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 3474 | * @wmi_handle: wmi handle |
| 3475 | * @req: passpoint network request structure |
| 3476 | * |
| 3477 | * This function reads the incoming @req and fill in the destination |
| 3478 | * WMI structure and send down the passpoint configs down to the firmware |
| 3479 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3480 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3481 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3482 | 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] | 3483 | struct wifi_passpoint_req_param *req) |
| 3484 | { |
| 3485 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 3486 | u_int8_t i, j, *bytes; |
| 3487 | wmi_buf_t buf; |
| 3488 | uint32_t len; |
| 3489 | int ret; |
| 3490 | |
| 3491 | len = sizeof(*cmd); |
| 3492 | for (i = 0; i < req->num_networks; i++) { |
| 3493 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3494 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3495 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 3496 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3497 | } |
| 3498 | |
| 3499 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 3500 | wmi_buf_data(buf); |
| 3501 | |
| 3502 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3503 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 3504 | WMITLV_GET_STRUCT_TLVLEN( |
| 3505 | wmi_passpoint_config_cmd_fixed_param)); |
| 3506 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3507 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 3508 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3509 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3510 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3511 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 3512 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3513 | 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] | 3514 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 3515 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 3516 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3517 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3518 | &req->networks[i].roaming_consortium_ids[j], |
| 3519 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 3520 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3521 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3522 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3523 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3524 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 3525 | |
| 3526 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3527 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 3528 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3529 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3530 | __func__); |
| 3531 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3532 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3533 | } |
| 3534 | } |
| 3535 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3536 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 3537 | } |
| 3538 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame^] | 3539 | /** |
| 3540 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 3541 | * @wmi_handle: wmi handle |
| 3542 | * @scan_cmd_fp: start scan command ptr |
| 3543 | * @roam_req: roam request param |
| 3544 | * |
| 3545 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 3546 | * of WMI_ROAM_SCAN_MODE. |
| 3547 | * |
| 3548 | * Return: QDF status |
| 3549 | */ |
| 3550 | QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 3551 | wmi_start_scan_cmd_fixed_param * |
| 3552 | scan_cmd_fp, |
| 3553 | struct roam_offload_scan_params *roam_req) |
| 3554 | { |
| 3555 | wmi_buf_t buf = NULL; |
| 3556 | int status = 0; |
| 3557 | int len; |
| 3558 | uint8_t *buf_ptr; |
| 3559 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
| 3560 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3561 | int auth_mode = roam_req->auth_mode; |
| 3562 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 3563 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 3564 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 3565 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
| 3566 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 3567 | /* Need to create a buf with roam_scan command at |
| 3568 | * front and piggyback with scan command */ |
| 3569 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 3570 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3571 | (2 * WMI_TLV_HDR_SIZE) + |
| 3572 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 3573 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 3574 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3575 | if (roam_req->is_roam_req_valid && |
| 3576 | roam_req->roam_offload_enabled) { |
| 3577 | len += sizeof(wmi_roam_offload_tlv_param); |
| 3578 | len += WMI_TLV_HDR_SIZE; |
| 3579 | if ((auth_mode != WMI_AUTH_NONE) && |
| 3580 | ((auth_mode != WMI_AUTH_OPEN) || |
| 3581 | (auth_mode == WMI_AUTH_OPEN && |
| 3582 | roam_req->mdid.mdie_present) || |
| 3583 | roam_req->is_ese_assoc)) { |
| 3584 | len += WMI_TLV_HDR_SIZE; |
| 3585 | if (roam_req->is_ese_assoc) |
| 3586 | len += |
| 3587 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 3588 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 3589 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 3590 | (auth_mode == WMI_AUTH_OPEN && |
| 3591 | roam_req->mdid.mdie_present)) |
| 3592 | len += |
| 3593 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 3594 | else |
| 3595 | len += |
| 3596 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 3597 | } else { |
| 3598 | len += WMI_TLV_HDR_SIZE; |
| 3599 | } |
| 3600 | } else { |
| 3601 | if (roam_req->is_roam_req_valid) |
| 3602 | WMA_LOGD("%s : roam offload = %d", |
| 3603 | __func__, roam_req->roam_offload_enabled); |
| 3604 | else |
| 3605 | WMA_LOGD("%s : roam_req is NULL", __func__); |
| 3606 | len += (2 * WMI_TLV_HDR_SIZE); |
| 3607 | } |
| 3608 | if (roam_req->is_roam_req_valid && |
| 3609 | roam_req->roam_offload_enabled) { |
| 3610 | roam_req->mode = roam_req->mode | |
| 3611 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 3612 | } |
| 3613 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 3614 | |
| 3615 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3616 | if (!buf) { |
| 3617 | WMA_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3618 | return QDF_STATUS_E_NOMEM; |
| 3619 | } |
| 3620 | |
| 3621 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3622 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 3623 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 3624 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 3625 | WMITLV_GET_STRUCT_TLVLEN |
| 3626 | (wmi_roam_scan_mode_fixed_param)); |
| 3627 | |
| 3628 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 3629 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
| 3630 | /* Fill in scan parameters suitable for roaming scan */ |
| 3631 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
| 3632 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 3633 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 3634 | /* Ensure there is no additional IEs */ |
| 3635 | scan_cmd_fp->ie_len = 0; |
| 3636 | WMITLV_SET_HDR(buf_ptr, |
| 3637 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 3638 | WMITLV_GET_STRUCT_TLVLEN |
| 3639 | (wmi_start_scan_cmd_fixed_param)); |
| 3640 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3641 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 3642 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 3643 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3644 | sizeof(wmi_roam_offload_tlv_param)); |
| 3645 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3646 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 3647 | WMITLV_SET_HDR(buf_ptr, |
| 3648 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 3649 | WMITLV_GET_STRUCT_TLVLEN |
| 3650 | (wmi_roam_offload_tlv_param)); |
| 3651 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 3652 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 3653 | roam_offload_params->select_5g_margin = |
| 3654 | roam_req->select_5ghz_margin; |
| 3655 | roam_offload_params->reassoc_failure_timeout = |
| 3656 | roam_req->reassoc_failure_timeout; |
| 3657 | |
| 3658 | /* Fill the capabilities */ |
| 3659 | roam_offload_params->capability = |
| 3660 | roam_req->roam_offload_params.capability; |
| 3661 | roam_offload_params->ht_caps_info = |
| 3662 | roam_req->roam_offload_params.ht_caps_info; |
| 3663 | roam_offload_params->ampdu_param = |
| 3664 | roam_req->roam_offload_params.ampdu_param; |
| 3665 | roam_offload_params->ht_ext_cap = |
| 3666 | roam_req->roam_offload_params.ht_ext_cap; |
| 3667 | roam_offload_params->ht_txbf = |
| 3668 | roam_req->roam_offload_params.ht_txbf; |
| 3669 | roam_offload_params->asel_cap = |
| 3670 | roam_req->roam_offload_params.asel_cap; |
| 3671 | roam_offload_params->qos_caps = |
| 3672 | roam_req->roam_offload_params.qos_caps; |
| 3673 | roam_offload_params->wmm_caps = |
| 3674 | roam_req->roam_offload_params.wmm_caps; |
| 3675 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 3676 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 3677 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 3678 | |
| 3679 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 3680 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 3681 | * they are filled in the same order.Depending on the |
| 3682 | * authentication type, the other mode TLV's are nullified |
| 3683 | * and only headers are filled.*/ |
| 3684 | if ((auth_mode != WMI_AUTH_NONE) && |
| 3685 | ((auth_mode != WMI_AUTH_OPEN) || |
| 3686 | (auth_mode == WMI_AUTH_OPEN |
| 3687 | && roam_req->mdid.mdie_present) || |
| 3688 | roam_req->is_ese_assoc)) { |
| 3689 | if (roam_req->is_ese_assoc) { |
| 3690 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3691 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3692 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3693 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3694 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3695 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3696 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3697 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 3698 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3699 | roam_offload_ese = |
| 3700 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 3701 | qdf_mem_copy(roam_offload_ese->krk, |
| 3702 | roam_req->krk, |
| 3703 | sizeof(roam_req->krk)); |
| 3704 | qdf_mem_copy(roam_offload_ese->btk, |
| 3705 | roam_req->btk, |
| 3706 | sizeof(roam_req->btk)); |
| 3707 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 3708 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 3709 | WMITLV_GET_STRUCT_TLVLEN |
| 3710 | (wmi_roam_ese_offload_tlv_param)); |
| 3711 | buf_ptr += |
| 3712 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 3713 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 3714 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 3715 | || (auth_mode == WMI_AUTH_OPEN |
| 3716 | && roam_req->mdid.mdie_present)) { |
| 3717 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3718 | 0); |
| 3719 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3720 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3721 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 3722 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3723 | roam_offload_11r = |
| 3724 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 3725 | roam_offload_11r->r0kh_id_len = |
| 3726 | roam_req->rokh_id_length; |
| 3727 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 3728 | roam_req->rokh_id, |
| 3729 | roam_offload_11r->r0kh_id_len); |
| 3730 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 3731 | roam_req->psk_pmk, |
| 3732 | sizeof(roam_req->psk_pmk)); |
| 3733 | roam_offload_11r->psk_msk_len = |
| 3734 | roam_req->pmk_len; |
| 3735 | roam_offload_11r->mdie_present = |
| 3736 | roam_req->mdid.mdie_present; |
| 3737 | roam_offload_11r->mdid = |
| 3738 | roam_req->mdid.mobility_domain; |
| 3739 | if (auth_mode == WMI_AUTH_OPEN) { |
| 3740 | /* If FT-Open ensure pmk length |
| 3741 | and r0khid len are zero */ |
| 3742 | roam_offload_11r->r0kh_id_len = 0; |
| 3743 | roam_offload_11r->psk_msk_len = 0; |
| 3744 | } |
| 3745 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 3746 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 3747 | WMITLV_GET_STRUCT_TLVLEN |
| 3748 | (wmi_roam_11r_offload_tlv_param)); |
| 3749 | buf_ptr += |
| 3750 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 3751 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3752 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3753 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3754 | } else { |
| 3755 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3756 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 3757 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3758 | roam_offload_11i = |
| 3759 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
| 3760 | if (roam_req->roam_key_mgmt_offload_enabled) { |
| 3761 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 3762 | (roam_offload_11i->flags); |
| 3763 | WMA_LOGE("LFR3:OKC Enabled"); |
| 3764 | } else { |
| 3765 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 3766 | (roam_offload_11i->flags); |
| 3767 | WMA_LOGE("LFR3:OKC Disabled"); |
| 3768 | } |
| 3769 | |
| 3770 | qdf_mem_copy(roam_offload_11i->pmk, |
| 3771 | roam_req->psk_pmk, |
| 3772 | sizeof(roam_req->psk_pmk)); |
| 3773 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 3774 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 3775 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 3776 | WMITLV_GET_STRUCT_TLVLEN |
| 3777 | (wmi_roam_11i_offload_tlv_param)); |
| 3778 | buf_ptr += |
| 3779 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 3780 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3781 | 0); |
| 3782 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3783 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3784 | 0); |
| 3785 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3786 | } |
| 3787 | } else { |
| 3788 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3789 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3790 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3791 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3792 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3793 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3794 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3795 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3796 | } |
| 3797 | } else { |
| 3798 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3799 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3800 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3801 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3802 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3803 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3804 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3805 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3806 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3807 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3808 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 3809 | } |
| 3810 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 3811 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 3812 | len, WMI_ROAM_SCAN_MODE); |
| 3813 | if (status != EOK) { |
| 3814 | WMA_LOGE( |
| 3815 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 3816 | status); |
| 3817 | wmi_buf_free(buf); |
| 3818 | return QDF_STATUS_E_FAILURE; |
| 3819 | } |
| 3820 | |
| 3821 | return QDF_STATUS_SUCCESS; |
| 3822 | } |
| 3823 | |
| 3824 | |
| 3825 | /** |
| 3826 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 3827 | * rssi threashold |
| 3828 | * @wmi_handle: wmi handle |
| 3829 | * @roam_req: Roaming request buffer |
| 3830 | * |
| 3831 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 3832 | * |
| 3833 | * Return: QDF status |
| 3834 | */ |
| 3835 | QDF_STATUS send_roam_scan_offload_rssi_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
| 3836 | struct roam_offload_scan_rssi_params *roam_req) |
| 3837 | { |
| 3838 | wmi_buf_t buf = NULL; |
| 3839 | int status = 0; |
| 3840 | int len; |
| 3841 | uint8_t *buf_ptr; |
| 3842 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 3843 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 3844 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
| 3845 | |
| 3846 | |
| 3847 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 3848 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 3849 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 3850 | len += WMI_TLV_HDR_SIZE; |
| 3851 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 3852 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3853 | if (!buf) { |
| 3854 | WMA_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3855 | return QDF_STATUS_E_NOMEM; |
| 3856 | } |
| 3857 | |
| 3858 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3859 | rssi_threshold_fp = |
| 3860 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 3861 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 3862 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 3863 | WMITLV_GET_STRUCT_TLVLEN |
| 3864 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 3865 | /* fill in threshold values */ |
| 3866 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 3867 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 3868 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 3869 | rssi_threshold_fp->hirssi_scan_max_count = |
| 3870 | roam_req->hi_rssi_scan_max_count; |
| 3871 | rssi_threshold_fp->hirssi_scan_delta = |
| 3872 | roam_req->hi_rssi_scan_rssi_delta; |
| 3873 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
| 3874 | |
| 3875 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 3876 | WMITLV_SET_HDR(buf_ptr, |
| 3877 | WMITLV_TAG_ARRAY_STRUC, |
| 3878 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 3879 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3880 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 3881 | |
| 3882 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 3883 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 3884 | ext_thresholds->boost_threshold_5g = |
| 3885 | roam_req->boost_threshold_5g; |
| 3886 | |
| 3887 | ext_thresholds->boost_algorithm_5g = |
| 3888 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 3889 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 3890 | ext_thresholds->penalty_algorithm_5g = |
| 3891 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 3892 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 3893 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 3894 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 3895 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 3896 | |
| 3897 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 3898 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 3899 | WMITLV_GET_STRUCT_TLVLEN |
| 3900 | (wmi_roam_scan_extended_threshold_param)); |
| 3901 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 3902 | WMITLV_SET_HDR(buf_ptr, |
| 3903 | WMITLV_TAG_ARRAY_STRUC, |
| 3904 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 3905 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3906 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 3907 | early_stop_thresholds->roam_earlystop_thres_min = |
| 3908 | roam_req->roam_earlystop_thres_min; |
| 3909 | early_stop_thresholds->roam_earlystop_thres_max = |
| 3910 | roam_req->roam_earlystop_thres_max; |
| 3911 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 3912 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 3913 | WMITLV_GET_STRUCT_TLVLEN |
| 3914 | (wmi_roam_earlystop_rssi_thres_param)); |
| 3915 | |
| 3916 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 3917 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
| 3918 | if (status != EOK) { |
| 3919 | WMA_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
| 3920 | status); |
| 3921 | wmi_buf_free(buf); |
| 3922 | return QDF_STATUS_E_FAILURE; |
| 3923 | } |
| 3924 | |
| 3925 | return QDF_STATUS_SUCCESS; |
| 3926 | } |
| 3927 | |
| 3928 | /** |
| 3929 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 3930 | * @wmi_handle: wmi handle |
| 3931 | * @roam_req: Request which contains the filters |
| 3932 | * |
| 3933 | * There are filters such as whitelist, blacklist and preferred |
| 3934 | * list that need to be applied to the scan results to form the |
| 3935 | * probable candidates for roaming. |
| 3936 | * |
| 3937 | * Return: Return success upon succesfully passing the |
| 3938 | * parameters to the firmware, otherwise failure. |
| 3939 | */ |
| 3940 | QDF_STATUS send_roam_scan_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 3941 | struct roam_scan_filter_params *roam_req) |
| 3942 | { |
| 3943 | wmi_buf_t buf = NULL; |
| 3944 | int status = 0, i; |
| 3945 | uint32_t len; |
| 3946 | uint8_t *buf_ptr; |
| 3947 | wmi_roam_filter_fixed_param *roam_filter; |
| 3948 | uint8_t *bssid_src_ptr = NULL; |
| 3949 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 3950 | wmi_ssid *ssid_ptr = NULL; |
| 3951 | uint32_t *bssid_preferred_factor_ptr = NULL; |
| 3952 | |
| 3953 | len = sizeof(wmi_roam_filter_fixed_param); |
| 3954 | len += WMI_TLV_HDR_SIZE; |
| 3955 | len += roam_req->len; |
| 3956 | |
| 3957 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3958 | if (!buf) { |
| 3959 | WMA_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3960 | return QDF_STATUS_E_NOMEM; |
| 3961 | } |
| 3962 | |
| 3963 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 3964 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 3965 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 3966 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 3967 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 3968 | /* fill in fixed values */ |
| 3969 | roam_filter->vdev_id = roam_req->session_id; |
| 3970 | roam_filter->flags = 0; |
| 3971 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 3972 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 3973 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 3974 | roam_filter->num_bssid_preferred_list = |
| 3975 | roam_req->num_bssid_preferred_list; |
| 3976 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 3977 | |
| 3978 | WMITLV_SET_HDR((buf_ptr), |
| 3979 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 3980 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 3981 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 3982 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 3983 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 3984 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 3985 | bssid_src_ptr += ATH_MAC_LEN; |
| 3986 | bssid_dst_ptr++; |
| 3987 | } |
| 3988 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 3989 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 3990 | WMITLV_SET_HDR((buf_ptr), |
| 3991 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 3992 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 3993 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 3994 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 3995 | qdf_mem_copy(&ssid_ptr->ssid, |
| 3996 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 3997 | roam_req->ssid_allowed_list[i].length); |
| 3998 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 3999 | ssid_ptr++; |
| 4000 | } |
| 4001 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 4002 | sizeof(wmi_ssid)); |
| 4003 | WMITLV_SET_HDR((buf_ptr), |
| 4004 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 4005 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 4006 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 4007 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 4008 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 4009 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 4010 | (wmi_mac_addr *)bssid_dst_ptr); |
| 4011 | bssid_src_ptr += ATH_MAC_LEN; |
| 4012 | bssid_dst_ptr++; |
| 4013 | } |
| 4014 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 4015 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 4016 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 4017 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 4018 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 4019 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 4020 | *bssid_preferred_factor_ptr = |
| 4021 | roam_req->bssid_favored_factor[i]; |
| 4022 | bssid_preferred_factor_ptr++; |
| 4023 | } |
| 4024 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 4025 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 4026 | |
| 4027 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4028 | len, WMI_ROAM_FILTER_CMDID); |
| 4029 | if (status != EOK) { |
| 4030 | WMA_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
| 4031 | status); |
| 4032 | wmi_buf_free(buf); |
| 4033 | return QDF_STATUS_E_FAILURE; |
| 4034 | } |
| 4035 | return QDF_STATUS_SUCCESS; |
| 4036 | } |
| 4037 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4038 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 4039 | * @wmi_handle: wmi handle |
| 4040 | * @req: epno config params request structure |
| 4041 | * |
| 4042 | * This function reads the incoming epno config request structure |
| 4043 | * and constructs the WMI message to the firmware. |
| 4044 | * |
| 4045 | * Returns: 0 on success, error number otherwise |
| 4046 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4047 | 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] | 4048 | struct wifi_enhanched_pno_params *req) |
| 4049 | { |
| 4050 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 4051 | nlo_configured_parameters *nlo_list; |
| 4052 | u_int8_t i, *buf_ptr; |
| 4053 | wmi_buf_t buf; |
| 4054 | uint32_t len; |
| 4055 | int ret; |
| 4056 | |
| 4057 | /* TLV place holder for array of structures |
| 4058 | * nlo_configured_parameters(nlo_list) */ |
| 4059 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4060 | len += sizeof(nlo_configured_parameters) * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4061 | QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4062 | len += WMI_TLV_HDR_SIZE; /* TLV for channel_list */ |
| 4063 | len += WMI_TLV_HDR_SIZE; /* TLV for channel prediction cfg*/ |
| 4064 | |
| 4065 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4066 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4067 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4068 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4069 | } |
| 4070 | |
| 4071 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 4072 | |
| 4073 | buf_ptr = (u_int8_t *) cmd; |
| 4074 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4075 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 4076 | WMITLV_GET_STRUCT_TLVLEN( |
| 4077 | wmi_nlo_config_cmd_fixed_param)); |
| 4078 | cmd->vdev_id = req->session_id; |
| 4079 | cmd->flags = WMI_NLO_CONFIG_ENLO; |
| 4080 | |
| 4081 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 4082 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4083 | cmd->no_of_ssids = QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS); |
| 4084 | WMI_LOGD("SSID count: %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4085 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4086 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 4087 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4088 | |
| 4089 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 4090 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 4091 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 4092 | WMITLV_TAG_ARRAY_BYTE, |
| 4093 | WMITLV_GET_STRUCT_TLVLEN(nlo_configured_parameters)); |
| 4094 | /* Copy ssid and it's length */ |
| 4095 | nlo_list[i].ssid.valid = true; |
| 4096 | nlo_list[i].ssid.ssid.ssid_len = req->networks[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4097 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4098 | req->networks[i].ssid.mac_ssid, |
| 4099 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4100 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4101 | nlo_list[i].ssid.ssid.ssid_len, |
| 4102 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 4103 | nlo_list[i].ssid.ssid.ssid_len); |
| 4104 | |
| 4105 | /* Copy rssi threshold */ |
| 4106 | nlo_list[i].rssi_cond.valid = true; |
| 4107 | nlo_list[i].rssi_cond.rssi = |
| 4108 | req->networks[i].rssi_threshold; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4109 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4110 | nlo_list[i].rssi_cond.rssi); |
| 4111 | |
| 4112 | /* Copy pno flags */ |
| 4113 | nlo_list[i].bcast_nw_type.valid = true; |
| 4114 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 4115 | req->networks[i].flags; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4116 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4117 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 4118 | |
| 4119 | /* Copy auth bit field */ |
| 4120 | nlo_list[i].auth_type.valid = true; |
| 4121 | nlo_list[i].auth_type.auth_type = |
| 4122 | req->networks[i].auth_bit_field; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4123 | WMI_LOGD("Auth bit field (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4124 | nlo_list[i].auth_type.auth_type); |
| 4125 | } |
| 4126 | |
| 4127 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 4128 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 4129 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4130 | |
| 4131 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 4132 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4133 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4134 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 4135 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4136 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4137 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4138 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4139 | } |
| 4140 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4141 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4142 | req->session_id); |
| 4143 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4144 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4145 | } |
| 4146 | |
| 4147 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 4148 | * @wmi_handle: wmi handle |
| 4149 | * @ipa_offload: ipa offload control parameter |
| 4150 | * |
| 4151 | * Returns: 0 on success, error number otherwise |
| 4152 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4153 | 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] | 4154 | struct ipa_offload_control_params *ipa_offload) |
| 4155 | { |
| 4156 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 4157 | wmi_buf_t wmi_buf; |
| 4158 | uint32_t len; |
| 4159 | u_int8_t *buf_ptr; |
| 4160 | |
| 4161 | len = sizeof(*cmd); |
| 4162 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4163 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4164 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 4165 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4166 | } |
| 4167 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4168 | WMI_LOGE("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4169 | ipa_offload->offload_type, ipa_offload->enable); |
| 4170 | |
| 4171 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 4172 | |
| 4173 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 4174 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4175 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 4176 | WMITLV_GET_STRUCT_TLVLEN( |
| 4177 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 4178 | |
| 4179 | cmd->offload_type = ipa_offload->offload_type; |
| 4180 | cmd->vdev_id = ipa_offload->vdev_id; |
| 4181 | cmd->enable = ipa_offload->enable; |
| 4182 | |
| 4183 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4184 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4185 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4186 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4187 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4188 | } |
| 4189 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4190 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4191 | } |
| 4192 | |
| 4193 | /** |
| 4194 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 4195 | * @wmi_handle: wmi handle |
| 4196 | * @pgetcapab: get capabilities params |
| 4197 | * |
| 4198 | * This function send request to fw to get extscan capabilities. |
| 4199 | * |
| 4200 | * Return: CDF status |
| 4201 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4202 | 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] | 4203 | struct extscan_capabilities_params *pgetcapab) |
| 4204 | { |
| 4205 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 4206 | wmi_buf_t wmi_buf; |
| 4207 | uint32_t len; |
| 4208 | uint8_t *buf_ptr; |
| 4209 | |
| 4210 | len = sizeof(*cmd); |
| 4211 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4212 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4213 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4214 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4215 | } |
| 4216 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4217 | |
| 4218 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 4219 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4220 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 4221 | WMITLV_GET_STRUCT_TLVLEN |
| 4222 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 4223 | |
| 4224 | cmd->request_id = pgetcapab->request_id; |
| 4225 | |
| 4226 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4227 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4228 | WMI_LOGE("%s: failed to command", __func__); |
| 4229 | qdf_nbuf_free(wmi_buf); |
| 4230 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4231 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4232 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4233 | } |
| 4234 | |
| 4235 | /** |
| 4236 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 4237 | * @wmi_handle: wmi handle |
| 4238 | * @pcached_results: cached results parameters |
| 4239 | * |
| 4240 | * This function send request to fw to get cached results. |
| 4241 | * |
| 4242 | * Return: CDF status |
| 4243 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4244 | 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] | 4245 | struct extscan_cached_result_params *pcached_results) |
| 4246 | { |
| 4247 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 4248 | wmi_buf_t wmi_buf; |
| 4249 | uint32_t len; |
| 4250 | uint8_t *buf_ptr; |
| 4251 | |
| 4252 | len = sizeof(*cmd); |
| 4253 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4254 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4255 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4256 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4257 | } |
| 4258 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4259 | |
| 4260 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 4261 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4262 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 4263 | WMITLV_GET_STRUCT_TLVLEN |
| 4264 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 4265 | |
| 4266 | cmd->request_id = pcached_results->request_id; |
| 4267 | cmd->vdev_id = pcached_results->session_id; |
| 4268 | cmd->control_flags = pcached_results->flush; |
| 4269 | |
| 4270 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4271 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4272 | WMI_LOGE("%s: failed to command", __func__); |
| 4273 | qdf_nbuf_free(wmi_buf); |
| 4274 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4275 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4276 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4277 | } |
| 4278 | |
| 4279 | /** |
| 4280 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 4281 | * @wmi_handle: wmi handle |
| 4282 | * @reset_req: Reset change request params |
| 4283 | * |
| 4284 | * This function sends stop change monitor request to fw. |
| 4285 | * |
| 4286 | * Return: CDF status |
| 4287 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4288 | 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] | 4289 | struct extscan_capabilities_reset_params *reset_req) |
| 4290 | { |
| 4291 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 4292 | wmi_buf_t wmi_buf; |
| 4293 | uint32_t len; |
| 4294 | uint8_t *buf_ptr; |
| 4295 | int change_list = 0; |
| 4296 | |
| 4297 | len = sizeof(*cmd); |
| 4298 | |
| 4299 | /* reset significant change tlv is set to 0 */ |
| 4300 | len += WMI_TLV_HDR_SIZE; |
| 4301 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 4302 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4303 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4304 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4305 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4306 | } |
| 4307 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4308 | |
| 4309 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 4310 | buf_ptr; |
| 4311 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4312 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 4313 | WMITLV_GET_STRUCT_TLVLEN |
| 4314 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 4315 | |
| 4316 | cmd->request_id = reset_req->request_id; |
| 4317 | cmd->vdev_id = reset_req->session_id; |
| 4318 | cmd->mode = 0; |
| 4319 | |
| 4320 | buf_ptr += sizeof(*cmd); |
| 4321 | WMITLV_SET_HDR(buf_ptr, |
| 4322 | WMITLV_TAG_ARRAY_STRUC, |
| 4323 | change_list * |
| 4324 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 4325 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 4326 | sizeof |
| 4327 | (wmi_extscan_wlan_change_bssid_param)); |
| 4328 | |
| 4329 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4330 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4331 | WMI_LOGE("%s: failed to command", __func__); |
| 4332 | qdf_nbuf_free(wmi_buf); |
| 4333 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4334 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4335 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4336 | } |
| 4337 | |
| 4338 | /** |
| 4339 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 4340 | * @wmi_handle: wmi handle |
| 4341 | * @psigchange: change monitor request params |
| 4342 | * @buf: wmi buffer |
| 4343 | * @buf_len: buffer length |
| 4344 | * |
| 4345 | * This function fills elements of change monitor request buffer. |
| 4346 | * |
| 4347 | * Return: CDF status |
| 4348 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4349 | 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] | 4350 | struct extscan_set_sig_changereq_params |
| 4351 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 4352 | { |
| 4353 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 4354 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 4355 | uint8_t *buf_ptr; |
| 4356 | int j; |
| 4357 | int len = sizeof(*cmd); |
| 4358 | int numap = psigchange->num_ap; |
| 4359 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 4360 | |
| 4361 | if (!numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4362 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 4363 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4364 | } |
| 4365 | len += WMI_TLV_HDR_SIZE; |
| 4366 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 4367 | |
| 4368 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 4369 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4370 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4371 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4372 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4373 | } |
| 4374 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 4375 | cmd = |
| 4376 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 4377 | buf_ptr; |
| 4378 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4379 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 4380 | WMITLV_GET_STRUCT_TLVLEN |
| 4381 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 4382 | |
| 4383 | cmd->request_id = psigchange->request_id; |
| 4384 | cmd->vdev_id = psigchange->session_id; |
| 4385 | cmd->total_entries = numap; |
| 4386 | cmd->mode = 1; |
| 4387 | cmd->num_entries_in_page = numap; |
| 4388 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 4389 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 4390 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 4391 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 4392 | |
| 4393 | buf_ptr += sizeof(*cmd); |
| 4394 | WMITLV_SET_HDR(buf_ptr, |
| 4395 | WMITLV_TAG_ARRAY_STRUC, |
| 4396 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 4397 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 4398 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4399 | |
| 4400 | for (j = 0; j < numap; j++) { |
| 4401 | WMITLV_SET_HDR(dest_chglist, |
| 4402 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 4403 | WMITLV_GET_STRUCT_TLVLEN |
| 4404 | (wmi_extscan_wlan_change_bssid_param)); |
| 4405 | |
| 4406 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 4407 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 4408 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 4409 | &dest_chglist->bssid); |
| 4410 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4411 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4412 | dest_chglist->lower_rssi_limit); |
| 4413 | dest_chglist++; |
| 4414 | src_ap++; |
| 4415 | } |
| 4416 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 4417 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 4418 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4419 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4420 | } |
| 4421 | |
| 4422 | /** |
| 4423 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 4424 | * @wmi_handle: wmi handle |
| 4425 | * @psigchange: change monitor request params |
| 4426 | * |
| 4427 | * This function sends start change monitor request to fw. |
| 4428 | * |
| 4429 | * Return: CDF status |
| 4430 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4431 | 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] | 4432 | struct extscan_set_sig_changereq_params * |
| 4433 | psigchange) |
| 4434 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4435 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4436 | wmi_buf_t buf; |
| 4437 | int len; |
| 4438 | |
| 4439 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4440 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4441 | psigchange, &buf, |
| 4442 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4443 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 4444 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4445 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4446 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4447 | } |
| 4448 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4449 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 4450 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4451 | } |
| 4452 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4453 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4454 | WMI_LOGE("%s: failed to send command", __func__); |
| 4455 | qdf_nbuf_free(buf); |
| 4456 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4457 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4458 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4459 | } |
| 4460 | |
| 4461 | /** |
| 4462 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 4463 | * @wmi_handle: wmi handle |
| 4464 | * @photlist_reset: hotlist reset params |
| 4465 | * |
| 4466 | * This function configures hotlist monitor to stop in fw. |
| 4467 | * |
| 4468 | * Return: CDF status |
| 4469 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4470 | 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] | 4471 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 4472 | { |
| 4473 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 4474 | wmi_buf_t wmi_buf; |
| 4475 | uint32_t len; |
| 4476 | uint8_t *buf_ptr; |
| 4477 | int hotlist_entries = 0; |
| 4478 | |
| 4479 | len = sizeof(*cmd); |
| 4480 | |
| 4481 | /* reset bssid hotlist with tlv set to 0 */ |
| 4482 | len += WMI_TLV_HDR_SIZE; |
| 4483 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 4484 | |
| 4485 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4486 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4487 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4488 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4489 | } |
| 4490 | |
| 4491 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4492 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 4493 | buf_ptr; |
| 4494 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4495 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 4496 | WMITLV_GET_STRUCT_TLVLEN |
| 4497 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 4498 | |
| 4499 | cmd->request_id = photlist_reset->request_id; |
| 4500 | cmd->vdev_id = photlist_reset->session_id; |
| 4501 | cmd->mode = 0; |
| 4502 | |
| 4503 | buf_ptr += sizeof(*cmd); |
| 4504 | WMITLV_SET_HDR(buf_ptr, |
| 4505 | WMITLV_TAG_ARRAY_STRUC, |
| 4506 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 4507 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 4508 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 4509 | |
| 4510 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4511 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4512 | WMI_LOGE("%s: failed to command", __func__); |
| 4513 | qdf_nbuf_free(wmi_buf); |
| 4514 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4515 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4516 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4517 | } |
| 4518 | |
| 4519 | /** |
| 4520 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 4521 | * @wmi_handle: wmi handle |
| 4522 | * @pstopcmd: stop scan command request params |
| 4523 | * |
| 4524 | * This function sends stop extscan request to fw. |
| 4525 | * |
| 4526 | * Return: CDF Status. |
| 4527 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4528 | QDF_STATUS send_stop_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4529 | struct extscan_stop_req_params *pstopcmd) |
| 4530 | { |
| 4531 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 4532 | wmi_buf_t wmi_buf; |
| 4533 | uint32_t len; |
| 4534 | uint8_t *buf_ptr; |
| 4535 | |
| 4536 | len = sizeof(*cmd); |
| 4537 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4538 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4539 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4540 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4541 | } |
| 4542 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4543 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 4544 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4545 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 4546 | WMITLV_GET_STRUCT_TLVLEN |
| 4547 | (wmi_extscan_stop_cmd_fixed_param)); |
| 4548 | |
| 4549 | cmd->request_id = pstopcmd->request_id; |
| 4550 | cmd->vdev_id = pstopcmd->session_id; |
| 4551 | |
| 4552 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4553 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4554 | WMI_LOGE("%s: failed to command", __func__); |
| 4555 | qdf_nbuf_free(wmi_buf); |
| 4556 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4557 | } |
| 4558 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4559 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4560 | } |
| 4561 | |
| 4562 | /** |
| 4563 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 4564 | * @wmi_handle: wmi handle |
| 4565 | * @pstart: scan command request params |
| 4566 | * @buf: event buffer |
| 4567 | * @buf_len: length of buffer |
| 4568 | * |
| 4569 | * This function fills individual elements of extscan request and |
| 4570 | * TLV for buckets, channel list. |
| 4571 | * |
| 4572 | * Return: CDF Status. |
| 4573 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4574 | 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] | 4575 | struct wifi_scan_cmd_req_params *pstart, |
| 4576 | wmi_buf_t *buf, int *buf_len) |
| 4577 | { |
| 4578 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 4579 | wmi_extscan_bucket *dest_blist; |
| 4580 | wmi_extscan_bucket_channel *dest_clist; |
| 4581 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 4582 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 4583 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 4584 | |
| 4585 | uint8_t *buf_ptr; |
| 4586 | int i, k, count = 0; |
| 4587 | int len = sizeof(*cmd); |
| 4588 | int nbuckets = pstart->numBuckets; |
| 4589 | int nchannels = 0; |
| 4590 | |
| 4591 | /* These TLV's are are NULL by default */ |
| 4592 | uint32_t ie_len_with_pad = 0; |
| 4593 | int num_ssid = 0; |
| 4594 | int num_bssid = 0; |
| 4595 | int ie_len = 0; |
| 4596 | |
| 4597 | uint32_t base_period = pstart->basePeriod; |
| 4598 | |
| 4599 | /* TLV placeholder for ssid_list (NULL) */ |
| 4600 | len += WMI_TLV_HDR_SIZE; |
| 4601 | len += num_ssid * sizeof(wmi_ssid); |
| 4602 | |
| 4603 | /* TLV placeholder for bssid_list (NULL) */ |
| 4604 | len += WMI_TLV_HDR_SIZE; |
| 4605 | len += num_bssid * sizeof(wmi_mac_addr); |
| 4606 | |
| 4607 | /* TLV placeholder for ie_data (NULL) */ |
| 4608 | len += WMI_TLV_HDR_SIZE; |
| 4609 | len += ie_len * sizeof(uint32_t); |
| 4610 | |
| 4611 | /* TLV placeholder for bucket */ |
| 4612 | len += WMI_TLV_HDR_SIZE; |
| 4613 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 4614 | |
| 4615 | /* TLV channel placeholder */ |
| 4616 | len += WMI_TLV_HDR_SIZE; |
| 4617 | for (i = 0; i < nbuckets; i++) { |
| 4618 | nchannels += src_bucket->numChannels; |
| 4619 | src_bucket++; |
| 4620 | } |
| 4621 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4622 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4623 | __func__, nbuckets, nchannels); |
| 4624 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 4625 | /* Allocate the memory */ |
| 4626 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 4627 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4628 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4629 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4630 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4631 | } |
| 4632 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 4633 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 4634 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4635 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 4636 | WMITLV_GET_STRUCT_TLVLEN |
| 4637 | (wmi_extscan_start_cmd_fixed_param)); |
| 4638 | |
| 4639 | cmd->request_id = pstart->requestId; |
| 4640 | cmd->vdev_id = pstart->sessionId; |
| 4641 | cmd->base_period = pstart->basePeriod; |
| 4642 | cmd->num_buckets = nbuckets; |
| 4643 | cmd->configuration_flags = 0; |
| 4644 | if (pstart->configuration_flags & EXTSCAN_LP_EXTENDED_BATCHING) |
| 4645 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4646 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4647 | cmd->configuration_flags); |
| 4648 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4649 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 4650 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4651 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 4652 | |
| 4653 | /* The max dwell time is retrieved from the first channel |
| 4654 | * of the first bucket and kept common for all channels. |
| 4655 | */ |
| 4656 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 4657 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 4658 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 4659 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 4660 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 4661 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 4662 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 4663 | |
| 4664 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4665 | WMI_SCAN_NPROBES_DEFAULT; |
| 4666 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4667 | cmd->probe_delay = 0; |
| 4668 | cmd->probe_spacing_time = 0; |
| 4669 | cmd->idle_time = 0; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4670 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4671 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 4672 | WMI_SCAN_ADD_CCK_RATES | |
| 4673 | WMI_SCAN_ADD_OFDM_RATES | |
| 4674 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 4675 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
| 4676 | cmd->scan_priority = WMI_SCAN_PRIORITY_HIGH; |
| 4677 | cmd->num_ssids = 0; |
| 4678 | cmd->num_bssid = 0; |
| 4679 | cmd->ie_len = 0; |
| 4680 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 4681 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 4682 | |
| 4683 | buf_ptr += sizeof(*cmd); |
| 4684 | WMITLV_SET_HDR(buf_ptr, |
| 4685 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 4686 | num_ssid * sizeof(wmi_ssid)); |
| 4687 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 4688 | |
| 4689 | WMITLV_SET_HDR(buf_ptr, |
| 4690 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 4691 | num_bssid * sizeof(wmi_mac_addr)); |
| 4692 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 4693 | |
| 4694 | ie_len_with_pad = 0; |
| 4695 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4696 | ie_len_with_pad); |
| 4697 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 4698 | |
| 4699 | WMITLV_SET_HDR(buf_ptr, |
| 4700 | WMITLV_TAG_ARRAY_STRUC, |
| 4701 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 4702 | dest_blist = (wmi_extscan_bucket *) |
| 4703 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4704 | src_bucket = pstart->buckets; |
| 4705 | |
| 4706 | /* Retrieve scanning information from each bucket and |
| 4707 | * channels and send it to the target |
| 4708 | */ |
| 4709 | for (i = 0; i < nbuckets; i++) { |
| 4710 | WMITLV_SET_HDR(dest_blist, |
| 4711 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 4712 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 4713 | |
| 4714 | dest_blist->bucket_id = src_bucket->bucket; |
| 4715 | dest_blist->base_period_multiplier = |
| 4716 | src_bucket->period / base_period; |
| 4717 | dest_blist->min_period = src_bucket->period; |
| 4718 | dest_blist->max_period = src_bucket->max_period; |
| 4719 | dest_blist->exp_backoff = src_bucket->exponent; |
| 4720 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 4721 | dest_blist->channel_band = src_bucket->band; |
| 4722 | dest_blist->num_channels = src_bucket->numChannels; |
| 4723 | dest_blist->notify_extscan_events = 0; |
| 4724 | |
| 4725 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 4726 | dest_blist->notify_extscan_events = |
| 4727 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT; |
| 4728 | |
| 4729 | if (src_bucket->reportEvents & |
| 4730 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 4731 | dest_blist->forwarding_flags = |
| 4732 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 4733 | dest_blist->notify_extscan_events |= |
| 4734 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 4735 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 4736 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 4737 | } else { |
| 4738 | dest_blist->forwarding_flags = |
| 4739 | WMI_EXTSCAN_NO_FORWARDING; |
| 4740 | } |
| 4741 | |
| 4742 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 4743 | dest_blist->configuration_flags = 0; |
| 4744 | else |
| 4745 | dest_blist->configuration_flags = |
| 4746 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 4747 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4748 | 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] | 4749 | __func__, dest_blist->notify_extscan_events, |
| 4750 | dest_blist->configuration_flags, |
| 4751 | dest_blist->forwarding_flags); |
| 4752 | |
| 4753 | dest_blist->min_dwell_time_active = |
| 4754 | src_bucket->min_dwell_time_active; |
| 4755 | dest_blist->max_dwell_time_active = |
| 4756 | src_bucket->max_dwell_time_active; |
| 4757 | dest_blist->min_dwell_time_passive = |
| 4758 | src_bucket->min_dwell_time_passive; |
| 4759 | dest_blist->max_dwell_time_passive = |
| 4760 | src_bucket->max_dwell_time_passive; |
| 4761 | src_channel = src_bucket->channels; |
| 4762 | |
| 4763 | /* save the channel info to later populate |
| 4764 | * the channel TLV |
| 4765 | */ |
| 4766 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 4767 | save_channel[count++].channel = src_channel->channel; |
| 4768 | src_channel++; |
| 4769 | } |
| 4770 | dest_blist++; |
| 4771 | src_bucket++; |
| 4772 | } |
| 4773 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 4774 | WMITLV_SET_HDR(buf_ptr, |
| 4775 | WMITLV_TAG_ARRAY_STRUC, |
| 4776 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 4777 | dest_clist = (wmi_extscan_bucket_channel *) |
| 4778 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4779 | |
| 4780 | /* Active or passive scan is based on the bucket dwell time |
| 4781 | * and channel specific active,passive scans are not |
| 4782 | * supported yet |
| 4783 | */ |
| 4784 | for (i = 0; i < nchannels; i++) { |
| 4785 | WMITLV_SET_HDR(dest_clist, |
| 4786 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 4787 | WMITLV_GET_STRUCT_TLVLEN |
| 4788 | (wmi_extscan_bucket_channel)); |
| 4789 | dest_clist->channel = save_channel[i].channel; |
| 4790 | dest_clist++; |
| 4791 | } |
| 4792 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 4793 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 4794 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4795 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4796 | } |
| 4797 | |
| 4798 | /** |
| 4799 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 4800 | * @wmi_handle: wmi handle |
| 4801 | * @pstart: scan command request params |
| 4802 | * |
| 4803 | * This function sends start extscan request to fw. |
| 4804 | * |
| 4805 | * Return: CDF Status. |
| 4806 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4807 | QDF_STATUS send_start_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4808 | struct wifi_scan_cmd_req_params *pstart) |
| 4809 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4810 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4811 | wmi_buf_t buf; |
| 4812 | int len; |
| 4813 | |
| 4814 | /* Fill individual elements of extscan request and |
| 4815 | * TLV for buckets, channel list. |
| 4816 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4817 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4818 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4819 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 4820 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 4821 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4822 | } |
| 4823 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4824 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4825 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4826 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4827 | } |
| 4828 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 4829 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4830 | WMI_LOGE("%s: failed to send command", __func__); |
| 4831 | qdf_nbuf_free(buf); |
| 4832 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4833 | } |
| 4834 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4835 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4836 | } |
| 4837 | |
| 4838 | /** |
| 4839 | * send_plm_stop_cmd_tlv() - plm stop request |
| 4840 | * @wmi_handle: wmi handle |
| 4841 | * @plm: plm request parameters |
| 4842 | * |
| 4843 | * This function request FW to stop PLM. |
| 4844 | * |
| 4845 | * Return: CDF status |
| 4846 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4847 | QDF_STATUS send_plm_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4848 | const struct plm_req_params *plm) |
| 4849 | { |
| 4850 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 4851 | int32_t len; |
| 4852 | wmi_buf_t buf; |
| 4853 | uint8_t *buf_ptr; |
| 4854 | int ret; |
| 4855 | |
| 4856 | len = sizeof(*cmd); |
| 4857 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4858 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4859 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4860 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4861 | } |
| 4862 | |
| 4863 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 4864 | |
| 4865 | buf_ptr = (uint8_t *) cmd; |
| 4866 | |
| 4867 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4868 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 4869 | WMITLV_GET_STRUCT_TLVLEN |
| 4870 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 4871 | |
| 4872 | cmd->vdev_id = plm->session_id; |
| 4873 | |
| 4874 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4875 | 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] | 4876 | |
| 4877 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4878 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 4879 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4880 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4881 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4882 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4883 | } |
| 4884 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4885 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4886 | } |
| 4887 | |
| 4888 | /** |
| 4889 | * send_plm_start_cmd_tlv() - plm start request |
| 4890 | * @wmi_handle: wmi handle |
| 4891 | * @plm: plm request parameters |
| 4892 | * |
| 4893 | * This function request FW to start PLM. |
| 4894 | * |
| 4895 | * Return: CDF status |
| 4896 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4897 | QDF_STATUS send_plm_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4898 | const struct plm_req_params *plm, |
| 4899 | uint32_t *gchannel_list) |
| 4900 | { |
| 4901 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 4902 | uint32_t *channel_list; |
| 4903 | int32_t len; |
| 4904 | wmi_buf_t buf; |
| 4905 | uint8_t *buf_ptr; |
| 4906 | uint8_t count; |
| 4907 | int ret; |
| 4908 | |
| 4909 | /* TLV place holder for channel_list */ |
| 4910 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4911 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 4912 | |
| 4913 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4914 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4915 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 4916 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4917 | } |
| 4918 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 4919 | |
| 4920 | buf_ptr = (uint8_t *) cmd; |
| 4921 | |
| 4922 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4923 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 4924 | WMITLV_GET_STRUCT_TLVLEN |
| 4925 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 4926 | |
| 4927 | cmd->vdev_id = plm->session_id; |
| 4928 | |
| 4929 | cmd->meas_token = plm->meas_token; |
| 4930 | cmd->dialog_token = plm->diag_token; |
| 4931 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4932 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4933 | cmd->off_duration = plm->meas_duration; |
| 4934 | cmd->burst_cycle = plm->burst_len; |
| 4935 | cmd->tx_power = plm->desired_tx_pwr; |
| 4936 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 4937 | cmd->num_chans = plm->plm_num_ch; |
| 4938 | |
| 4939 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 4940 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4941 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 4942 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 4943 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 4944 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 4945 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 4946 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 4947 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 4948 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4949 | |
| 4950 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 4951 | (cmd->num_chans * sizeof(uint32_t))); |
| 4952 | |
| 4953 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4954 | if (cmd->num_chans) { |
| 4955 | channel_list = (uint32_t *) buf_ptr; |
| 4956 | for (count = 0; count < cmd->num_chans; count++) { |
| 4957 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4958 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4959 | channel_list[count] = |
| 4960 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4961 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4962 | } |
| 4963 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 4964 | } |
| 4965 | |
| 4966 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4967 | WMI_VDEV_PLMREQ_START_CMDID); |
| 4968 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4969 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4970 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4971 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4972 | } |
| 4973 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4974 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4975 | } |
| 4976 | |
| 4977 | /** |
| 4978 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 4979 | * @wmi_handle: wmi handle |
| 4980 | * @vdev_id: vdev id |
| 4981 | * |
| 4982 | * This function request FW to stop ongoing PNO operation. |
| 4983 | * |
| 4984 | * Return: CDF status |
| 4985 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4986 | 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] | 4987 | { |
| 4988 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 4989 | int32_t len = sizeof(*cmd); |
| 4990 | wmi_buf_t buf; |
| 4991 | uint8_t *buf_ptr; |
| 4992 | int ret; |
| 4993 | |
| 4994 | /* |
| 4995 | * TLV place holder for array of structures nlo_configured_parameters |
| 4996 | * TLV place holder for array of uint32_t channel_list |
| 4997 | * TLV place holder for chnl prediction cfg |
| 4998 | */ |
| 4999 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 5000 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5001 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5002 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5003 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5004 | } |
| 5005 | |
| 5006 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5007 | buf_ptr = (uint8_t *) cmd; |
| 5008 | |
| 5009 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5010 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5011 | WMITLV_GET_STRUCT_TLVLEN |
| 5012 | (wmi_nlo_config_cmd_fixed_param)); |
| 5013 | |
| 5014 | cmd->vdev_id = vdev_id; |
| 5015 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 5016 | buf_ptr += sizeof(*cmd); |
| 5017 | |
| 5018 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5019 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5020 | |
| 5021 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 5022 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5023 | |
| 5024 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5025 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5026 | |
| 5027 | |
| 5028 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5029 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 5030 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5031 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5032 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5033 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5034 | } |
| 5035 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5036 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5037 | } |
| 5038 | |
| 5039 | /** |
| 5040 | * send_pno_start_cmd_tlv() - PNO start request |
| 5041 | * @wmi_handle: wmi handle |
| 5042 | * @pno: PNO request |
| 5043 | * |
| 5044 | * This function request FW to start PNO request. |
| 5045 | * Request: CDF status |
| 5046 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5047 | QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5048 | struct pno_scan_req_params *pno, |
| 5049 | uint32_t *gchannel_freq_list) |
| 5050 | { |
| 5051 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 5052 | nlo_configured_parameters *nlo_list; |
| 5053 | uint32_t *channel_list; |
| 5054 | int32_t len; |
| 5055 | wmi_buf_t buf; |
| 5056 | uint8_t *buf_ptr; |
| 5057 | uint8_t i; |
| 5058 | int ret; |
| 5059 | |
| 5060 | /* |
| 5061 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 5062 | * TLV place holder for array of uint32_t channel_list |
| 5063 | * TLV place holder for chnnl prediction cfg |
| 5064 | */ |
| 5065 | len = sizeof(*cmd) + |
| 5066 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 5067 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5068 | len += sizeof(uint32_t) * QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5069 | WMI_NLO_MAX_CHAN); |
| 5070 | len += sizeof(nlo_configured_parameters) * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5071 | QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5072 | len += sizeof(nlo_channel_prediction_cfg); |
| 5073 | |
| 5074 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5075 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5076 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5077 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5078 | } |
| 5079 | |
| 5080 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5081 | |
| 5082 | buf_ptr = (uint8_t *) cmd; |
| 5083 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5084 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5085 | WMITLV_GET_STRUCT_TLVLEN |
| 5086 | (wmi_nlo_config_cmd_fixed_param)); |
| 5087 | cmd->vdev_id = pno->sessionId; |
| 5088 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 5089 | |
| 5090 | /* Current FW does not support min-max range for dwell time */ |
| 5091 | cmd->active_dwell_time = pno->active_max_time; |
| 5092 | cmd->passive_dwell_time = pno->passive_max_time; |
| 5093 | |
| 5094 | /* Copy scan interval */ |
| 5095 | cmd->fast_scan_period = pno->fast_scan_period; |
| 5096 | cmd->slow_scan_period = pno->slow_scan_period; |
| 5097 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5098 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5099 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5100 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5101 | |
| 5102 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 5103 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5104 | cmd->no_of_ssids = QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
| 5105 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5106 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5107 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 5108 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5109 | |
| 5110 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 5111 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 5112 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 5113 | WMITLV_TAG_ARRAY_BYTE, |
| 5114 | WMITLV_GET_STRUCT_TLVLEN |
| 5115 | (nlo_configured_parameters)); |
| 5116 | /* Copy ssid and it's length */ |
| 5117 | nlo_list[i].ssid.valid = true; |
| 5118 | nlo_list[i].ssid.ssid.ssid_len = pno->aNetworks[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5119 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5120 | pno->aNetworks[i].ssid.mac_ssid, |
| 5121 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5122 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5123 | nlo_list[i].ssid.ssid.ssid_len, |
| 5124 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 5125 | nlo_list[i].ssid.ssid.ssid_len); |
| 5126 | |
| 5127 | /* Copy rssi threshold */ |
| 5128 | if (pno->aNetworks[i].rssiThreshold && |
| 5129 | pno->aNetworks[i].rssiThreshold > WMI_RSSI_THOLD_DEFAULT) { |
| 5130 | nlo_list[i].rssi_cond.valid = true; |
| 5131 | nlo_list[i].rssi_cond.rssi = |
| 5132 | pno->aNetworks[i].rssiThreshold; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5133 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5134 | nlo_list[i].rssi_cond.rssi); |
| 5135 | } |
| 5136 | nlo_list[i].bcast_nw_type.valid = true; |
| 5137 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 5138 | pno->aNetworks[i].bcastNetwType; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5139 | WMI_LOGI("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5140 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 5141 | } |
| 5142 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 5143 | |
| 5144 | /* Copy channel info */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5145 | cmd->num_of_channels = QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5146 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5147 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5148 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 5149 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 5150 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5151 | |
| 5152 | channel_list = (uint32_t *) buf_ptr; |
| 5153 | for (i = 0; i < cmd->num_of_channels; i++) { |
| 5154 | channel_list[i] = pno->aNetworks[0].aChannels[i]; |
| 5155 | |
| 5156 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
| 5157 | channel_list[i] = gchannel_freq_list[i]; |
| 5158 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5159 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5160 | } |
| 5161 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 5162 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5163 | sizeof(nlo_channel_prediction_cfg)); |
| 5164 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5165 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5166 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 5167 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 5168 | */ |
| 5169 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5170 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 5171 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5172 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5173 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5174 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5175 | } |
| 5176 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5177 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5178 | } |
| 5179 | |
| 5180 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 5181 | * @wmi_handle: wmi handle |
| 5182 | * @msg: message |
| 5183 | * @is_add_ts: is addts required |
| 5184 | * |
| 5185 | * This function sets ric request element for 11r roaming. |
| 5186 | * |
| 5187 | * Return: CDF status |
| 5188 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5189 | 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] | 5190 | void *msg, uint8_t is_add_ts) |
| 5191 | { |
| 5192 | wmi_ric_request_fixed_param *cmd; |
| 5193 | wmi_ric_tspec *tspec_param; |
| 5194 | wmi_buf_t buf; |
| 5195 | uint8_t *buf_ptr; |
| 5196 | struct mac_tspec_ie *ptspecIE; |
| 5197 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 5198 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 5199 | |
| 5200 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5201 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5202 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5203 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5204 | } |
| 5205 | |
| 5206 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5207 | |
| 5208 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 5209 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5210 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 5211 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 5212 | if (is_add_ts) |
| 5213 | cmd->vdev_id = ((struct add_ts_param *) msg)->sessionId; |
| 5214 | else |
| 5215 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 5216 | cmd->num_ric_request = 1; |
| 5217 | cmd->is_add_ric = is_add_ts; |
| 5218 | |
| 5219 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 5220 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 5221 | |
| 5222 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5223 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 5224 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 5225 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 5226 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 5227 | |
| 5228 | if (is_add_ts) |
| 5229 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
| 5230 | else |
| 5231 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
| 5232 | |
| 5233 | /* Fill the tsinfo in the format expected by firmware */ |
| 5234 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5235 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5236 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
| 5237 | #else |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5238 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5239 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
| 5240 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 5241 | |
| 5242 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 5243 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 5244 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 5245 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 5246 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 5247 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 5248 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 5249 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 5250 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 5251 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 5252 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 5253 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 5254 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 5255 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 5256 | tspec_param->medium_time = 0; |
| 5257 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5258 | 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] | 5259 | |
| 5260 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5261 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5262 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5263 | __func__); |
| 5264 | if (is_add_ts) |
| 5265 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5266 | QDF_STATUS_E_FAILURE; |
| 5267 | qdf_nbuf_free(buf); |
| 5268 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5269 | } |
| 5270 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5271 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5272 | } |
| 5273 | |
| 5274 | /** |
| 5275 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 5276 | * @wmi_handle: wmi handle |
| 5277 | * @clear_req: ll stats clear request command params |
| 5278 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5279 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5280 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5281 | 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] | 5282 | const struct ll_stats_clear_params *clear_req, |
| 5283 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 5284 | { |
| 5285 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 5286 | int32_t len; |
| 5287 | wmi_buf_t buf; |
| 5288 | uint8_t *buf_ptr; |
| 5289 | int ret; |
| 5290 | |
| 5291 | len = sizeof(*cmd); |
| 5292 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5293 | |
| 5294 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5295 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5296 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5297 | } |
| 5298 | |
| 5299 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5300 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5301 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 5302 | |
| 5303 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5304 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 5305 | WMITLV_GET_STRUCT_TLVLEN |
| 5306 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 5307 | |
| 5308 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 5309 | cmd->vdev_id = clear_req->sta_id; |
| 5310 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 5311 | |
| 5312 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 5313 | &cmd->peer_macaddr); |
| 5314 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5315 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 5316 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 5317 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 5318 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 5319 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5320 | cmd->peer_macaddr); */ |
| 5321 | |
| 5322 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5323 | WMI_CLEAR_LINK_STATS_CMDID); |
| 5324 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5325 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5326 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5327 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5328 | } |
| 5329 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5330 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 5331 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5332 | } |
| 5333 | |
| 5334 | /** |
| 5335 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 5336 | * @wmi_handle: wmi handle |
| 5337 | * @setReq: ll stats set request command params |
| 5338 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5339 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5340 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5341 | 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] | 5342 | const struct ll_stats_set_params *set_req) |
| 5343 | { |
| 5344 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 5345 | int32_t len; |
| 5346 | wmi_buf_t buf; |
| 5347 | uint8_t *buf_ptr; |
| 5348 | int ret; |
| 5349 | |
| 5350 | len = sizeof(*cmd); |
| 5351 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5352 | |
| 5353 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5354 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5355 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5356 | } |
| 5357 | |
| 5358 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5359 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5360 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 5361 | |
| 5362 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5363 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 5364 | WMITLV_GET_STRUCT_TLVLEN |
| 5365 | (wmi_start_link_stats_cmd_fixed_param)); |
| 5366 | |
| 5367 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 5368 | cmd->aggressive_statistics_gathering = |
| 5369 | set_req->aggressive_statistics_gathering; |
| 5370 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5371 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 5372 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 5373 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5374 | |
| 5375 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5376 | WMI_START_LINK_STATS_CMDID); |
| 5377 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5378 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5379 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5380 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5381 | } |
| 5382 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5383 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5384 | } |
| 5385 | |
| 5386 | /** |
| 5387 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 5388 | * @wmi_handle:wmi handle |
| 5389 | * @get_req:ll stats get request command params |
| 5390 | * @addr: mac address |
| 5391 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5392 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5393 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5394 | 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] | 5395 | const struct ll_stats_get_params *get_req, |
| 5396 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 5397 | { |
| 5398 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 5399 | int32_t len; |
| 5400 | wmi_buf_t buf; |
| 5401 | uint8_t *buf_ptr; |
| 5402 | int ret; |
| 5403 | |
| 5404 | len = sizeof(*cmd); |
| 5405 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5406 | |
| 5407 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5408 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5409 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 5410 | |
| 5411 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5412 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 5413 | WMITLV_GET_STRUCT_TLVLEN |
| 5414 | (wmi_request_link_stats_cmd_fixed_param)); |
| 5415 | |
| 5416 | cmd->request_id = get_req->req_id; |
| 5417 | cmd->stats_type = get_req->param_id_mask; |
| 5418 | cmd->vdev_id = get_req->sta_id; |
| 5419 | |
| 5420 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 5421 | &cmd->peer_macaddr); |
| 5422 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5423 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
| 5424 | WMI_LOGD("Request ID : %d", cmd->request_id); |
| 5425 | WMI_LOGD("Stats Type : %d", cmd->stats_type); |
| 5426 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 5427 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5428 | |
| 5429 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5430 | WMI_REQUEST_LINK_STATS_CMDID); |
| 5431 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5432 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5433 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5434 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5435 | } |
| 5436 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5437 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5438 | } |
| 5439 | |
| 5440 | /** |
| 5441 | * send_get_stats_cmd_tlv() - get stats request |
| 5442 | * @wmi_handle: wmi handle |
| 5443 | * @get_stats_param: stats params |
| 5444 | * @addr: mac address |
| 5445 | * |
| 5446 | * Return: CDF status |
| 5447 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5448 | QDF_STATUS send_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5449 | struct pe_stats_req *get_stats_param, |
| 5450 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 5451 | { |
| 5452 | wmi_buf_t buf; |
| 5453 | wmi_request_stats_cmd_fixed_param *cmd; |
| 5454 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 5455 | |
| 5456 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5457 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5458 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 5459 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5460 | } |
| 5461 | |
| 5462 | |
| 5463 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 5464 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5465 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 5466 | WMITLV_GET_STRUCT_TLVLEN |
| 5467 | (wmi_request_stats_cmd_fixed_param)); |
| 5468 | cmd->stats_id = |
| 5469 | WMI_REQUEST_PEER_STAT | WMI_REQUEST_PDEV_STAT | |
| 5470 | WMI_REQUEST_VDEV_STAT; |
| 5471 | cmd->vdev_id = get_stats_param->session_id; |
| 5472 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5473 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5474 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5475 | WMI_REQUEST_STATS_CMDID)) { |
| 5476 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5477 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5478 | __func__); |
| 5479 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5480 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5481 | } |
| 5482 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5483 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5484 | |
| 5485 | } |
| 5486 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5487 | /** |
| 5488 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 5489 | * @wmi_handle: wmi handle |
| 5490 | * @rssi_req: get RSSI request |
| 5491 | * |
| 5492 | * Return: CDF status |
| 5493 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5494 | QDF_STATUS send_snr_request_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5495 | { |
| 5496 | wmi_buf_t buf; |
| 5497 | wmi_request_stats_cmd_fixed_param *cmd; |
| 5498 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 5499 | |
| 5500 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5501 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5502 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5503 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5504 | } |
| 5505 | |
| 5506 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 5507 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5508 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 5509 | WMITLV_GET_STRUCT_TLVLEN |
| 5510 | (wmi_request_stats_cmd_fixed_param)); |
| 5511 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 5512 | if (wmi_unified_cmd_send |
| 5513 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5514 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5515 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5516 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5517 | } |
| 5518 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5519 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5520 | } |
| 5521 | |
| 5522 | /** |
| 5523 | * send_snr_cmd_tlv() - get RSSI from fw |
| 5524 | * @wmi_handle: wmi handle |
| 5525 | * @vdev_id: vdev id |
| 5526 | * |
| 5527 | * Return: CDF status |
| 5528 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5529 | 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] | 5530 | { |
| 5531 | wmi_buf_t buf; |
| 5532 | wmi_request_stats_cmd_fixed_param *cmd; |
| 5533 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 5534 | |
| 5535 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5536 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5537 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5538 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5539 | } |
| 5540 | |
| 5541 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 5542 | cmd->vdev_id = vdev_id; |
| 5543 | |
| 5544 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5545 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 5546 | WMITLV_GET_STRUCT_TLVLEN |
| 5547 | (wmi_request_stats_cmd_fixed_param)); |
| 5548 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 5549 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5550 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5551 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5552 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5553 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5554 | } |
| 5555 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5556 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5557 | } |
| 5558 | |
| 5559 | /** |
| 5560 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 5561 | * @wmi_handle: wmi handle |
| 5562 | * @link_status: get link params |
| 5563 | * |
| 5564 | * Return: CDF status |
| 5565 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5566 | 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] | 5567 | struct link_status_params *link_status) |
| 5568 | { |
| 5569 | wmi_buf_t buf; |
| 5570 | wmi_request_stats_cmd_fixed_param *cmd; |
| 5571 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 5572 | |
| 5573 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5574 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5575 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5576 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5577 | } |
| 5578 | |
| 5579 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 5580 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5581 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 5582 | WMITLV_GET_STRUCT_TLVLEN |
| 5583 | (wmi_request_stats_cmd_fixed_param)); |
| 5584 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 5585 | cmd->vdev_id = link_status->session_id; |
| 5586 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5587 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5588 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5589 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5590 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5591 | } |
| 5592 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5593 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5594 | } |
| 5595 | |
| 5596 | #ifdef FEATURE_WLAN_LPHB |
| 5597 | |
| 5598 | /** |
| 5599 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 5600 | * @wmi_handle: wmi handle |
| 5601 | * @lphb_conf_req: configuration info |
| 5602 | * |
| 5603 | * Return: CDF status |
| 5604 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5605 | 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] | 5606 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 5607 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5608 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5609 | int status = 0; |
| 5610 | wmi_buf_t buf = NULL; |
| 5611 | uint8_t *buf_ptr; |
| 5612 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 5613 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 5614 | |
| 5615 | |
| 5616 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5617 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5618 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5619 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5620 | } |
| 5621 | |
| 5622 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5623 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 5624 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 5625 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 5626 | WMITLV_GET_STRUCT_TLVLEN |
| 5627 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 5628 | |
| 5629 | /* fill in values */ |
| 5630 | hb_enable_fp->vdev_id = params->session; |
| 5631 | hb_enable_fp->enable = params->enable; |
| 5632 | hb_enable_fp->item = params->item; |
| 5633 | hb_enable_fp->session = params->session; |
| 5634 | |
| 5635 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5636 | len, WMI_HB_SET_ENABLE_CMDID); |
| 5637 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5638 | 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] | 5639 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5640 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5641 | goto error; |
| 5642 | } |
| 5643 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5644 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5645 | error: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5646 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5647 | } |
| 5648 | |
| 5649 | /** |
| 5650 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 5651 | * @wmi_handle: wmi handle |
| 5652 | * @lphb_conf_req: lphb config request |
| 5653 | * |
| 5654 | * Return: CDF status |
| 5655 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5656 | 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] | 5657 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 5658 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5659 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5660 | int status = 0; |
| 5661 | wmi_buf_t buf = NULL; |
| 5662 | uint8_t *buf_ptr; |
| 5663 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 5664 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 5665 | |
| 5666 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5667 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5668 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5669 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5670 | } |
| 5671 | |
| 5672 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5673 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 5674 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 5675 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 5676 | WMITLV_GET_STRUCT_TLVLEN |
| 5677 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 5678 | |
| 5679 | /* fill in values */ |
| 5680 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 5681 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 5682 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 5683 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 5684 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 5685 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 5686 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 5687 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 5688 | hb_tcp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5689 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5690 | &lphb_conf_req->gateway_mac, |
| 5691 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 5692 | |
| 5693 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5694 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
| 5695 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5696 | 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] | 5697 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5698 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5699 | goto error; |
| 5700 | } |
| 5701 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5702 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5703 | error: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5704 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5705 | } |
| 5706 | |
| 5707 | /** |
| 5708 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 5709 | * @wmi_handle: wmi handle |
| 5710 | * @lphb_conf_req: lphb config request |
| 5711 | * |
| 5712 | * Return: CDF status |
| 5713 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5714 | 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] | 5715 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 5716 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5717 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5718 | int status = 0; |
| 5719 | wmi_buf_t buf = NULL; |
| 5720 | uint8_t *buf_ptr; |
| 5721 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 5722 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 5723 | |
| 5724 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5725 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5726 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5727 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5728 | } |
| 5729 | |
| 5730 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5731 | hb_tcp_filter_fp = |
| 5732 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 5733 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 5734 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 5735 | WMITLV_GET_STRUCT_TLVLEN |
| 5736 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 5737 | |
| 5738 | /* fill in values */ |
| 5739 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 5740 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 5741 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 5742 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 5743 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 5744 | (void *)&g_hb_tcp_filter_fp->filter, |
| 5745 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 5746 | |
| 5747 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5748 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 5749 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5750 | 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] | 5751 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5752 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5753 | goto error; |
| 5754 | } |
| 5755 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5756 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5757 | error: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5758 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5759 | } |
| 5760 | |
| 5761 | /** |
| 5762 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 5763 | * @wmi_handle: wmi handle |
| 5764 | * @lphb_conf_req: lphb config request |
| 5765 | * |
| 5766 | * Return: CDF status |
| 5767 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5768 | 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] | 5769 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 5770 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5771 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5772 | int status = 0; |
| 5773 | wmi_buf_t buf = NULL; |
| 5774 | uint8_t *buf_ptr; |
| 5775 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 5776 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 5777 | |
| 5778 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5779 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5780 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5781 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5782 | } |
| 5783 | |
| 5784 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5785 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 5786 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 5787 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 5788 | WMITLV_GET_STRUCT_TLVLEN |
| 5789 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 5790 | |
| 5791 | /* fill in values */ |
| 5792 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 5793 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 5794 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 5795 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 5796 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 5797 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 5798 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 5799 | hb_udp_params_fp->session = lphb_conf_req->session; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5800 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5801 | &lphb_conf_req->gateway_mac, |
| 5802 | sizeof(lphb_conf_req->gateway_mac)); |
| 5803 | |
| 5804 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5805 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
| 5806 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5807 | 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] | 5808 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5809 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5810 | goto error; |
| 5811 | } |
| 5812 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5813 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5814 | error: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5815 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5816 | } |
| 5817 | |
| 5818 | /** |
| 5819 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 5820 | * @wmi_handle: wmi handle |
| 5821 | * @lphb_conf_req: lphb config request |
| 5822 | * |
| 5823 | * Return: CDF status |
| 5824 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5825 | 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] | 5826 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 5827 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5828 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5829 | int status = 0; |
| 5830 | wmi_buf_t buf = NULL; |
| 5831 | uint8_t *buf_ptr; |
| 5832 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 5833 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 5834 | |
| 5835 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5836 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5837 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5838 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5839 | } |
| 5840 | |
| 5841 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5842 | hb_udp_filter_fp = |
| 5843 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 5844 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 5845 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 5846 | WMITLV_GET_STRUCT_TLVLEN |
| 5847 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 5848 | |
| 5849 | /* fill in values */ |
| 5850 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 5851 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 5852 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 5853 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 5854 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 5855 | (void *)&lphb_conf_req->filter, |
| 5856 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 5857 | |
| 5858 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5859 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 5860 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5861 | 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] | 5862 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5863 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5864 | goto error; |
| 5865 | } |
| 5866 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5867 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5868 | error: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5869 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5870 | } |
| 5871 | #endif /* FEATURE_WLAN_LPHB */ |
| 5872 | |
| 5873 | /** |
| 5874 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 5875 | * @wmi_handle: wmi handle |
| 5876 | * @ta_dhcp_ind: DHCP indication parameter |
| 5877 | * |
| 5878 | * Return: CDF Status |
| 5879 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5880 | 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] | 5881 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 5882 | { |
| 5883 | int status = 0; |
| 5884 | wmi_buf_t buf = NULL; |
| 5885 | uint8_t *buf_ptr; |
| 5886 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 5887 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 5888 | |
| 5889 | |
| 5890 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5891 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5892 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5893 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5894 | } |
| 5895 | |
| 5896 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5897 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 5898 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 5899 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 5900 | WMITLV_GET_STRUCT_TLVLEN |
| 5901 | (wmi_peer_set_param_cmd_fixed_param)); |
| 5902 | |
| 5903 | /* fill in values */ |
| 5904 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 5905 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 5906 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5907 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5908 | &ta_dhcp_ind->peer_macaddr, |
| 5909 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 5910 | |
| 5911 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5912 | len, WMI_PEER_SET_PARAM_CMDID); |
| 5913 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5914 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5915 | " returned Error %d", __func__, status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5916 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5917 | } |
| 5918 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5919 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5920 | } |
| 5921 | |
| 5922 | /** |
| 5923 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 5924 | * @wmi_handle: wmi handle |
| 5925 | * @pLinkSpeed: link speed info |
| 5926 | * |
| 5927 | * Return: CDF status |
| 5928 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5929 | 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] | 5930 | wmi_mac_addr peer_macaddr) |
| 5931 | { |
| 5932 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 5933 | wmi_buf_t wmi_buf; |
| 5934 | uint32_t len; |
| 5935 | uint8_t *buf_ptr; |
| 5936 | |
| 5937 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 5938 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5939 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5940 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5941 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5942 | } |
| 5943 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5944 | |
| 5945 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 5946 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5947 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 5948 | WMITLV_GET_STRUCT_TLVLEN |
| 5949 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 5950 | |
| 5951 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5952 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5953 | &peer_macaddr, |
| 5954 | sizeof(peer_macaddr)); |
| 5955 | |
| 5956 | |
| 5957 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5958 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5959 | WMI_LOGE("%s: failed to send link speed command", __func__); |
| 5960 | qdf_nbuf_free(wmi_buf); |
| 5961 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5962 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5963 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5964 | } |
| 5965 | |
| 5966 | /** |
| 5967 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 5968 | * @wmi_handle: wmi handler |
| 5969 | * @egap_params: pointer to egap_params |
| 5970 | * |
| 5971 | * Return: 0 for success, otherwise appropriate error code |
| 5972 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5973 | 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] | 5974 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 5975 | { |
| 5976 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 5977 | wmi_buf_t buf; |
| 5978 | int32_t err; |
| 5979 | |
| 5980 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 5981 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5982 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 5983 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5984 | } |
| 5985 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 5986 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5987 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 5988 | WMITLV_GET_STRUCT_TLVLEN( |
| 5989 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 5990 | |
| 5991 | cmd->enable = egap_params->enable; |
| 5992 | cmd->inactivity_time = egap_params->inactivity_time; |
| 5993 | cmd->wait_time = egap_params->wait_time; |
| 5994 | cmd->flags = egap_params->flags; |
| 5995 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 5996 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 5997 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5998 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 5999 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6000 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6001 | } |
| 6002 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6003 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6004 | } |
| 6005 | |
| 6006 | /** |
| 6007 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 6008 | * @wmi_handl: wmi handle |
| 6009 | * @cmd: Profiling command index |
| 6010 | * @value1: parameter1 value |
| 6011 | * @value2: parameter2 value |
| 6012 | * |
| 6013 | * Return: 0 for success else error code |
| 6014 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6015 | QDF_STATUS send_fw_profiling_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6016 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 6017 | { |
| 6018 | wmi_buf_t buf; |
| 6019 | int32_t len = 0; |
| 6020 | int ret; |
| 6021 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 6022 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 6023 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 6024 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 6025 | |
| 6026 | switch (cmd) { |
| 6027 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 6028 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 6029 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6030 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6031 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6032 | return -ENOMEM; |
| 6033 | } |
| 6034 | prof_trig_cmd = |
| 6035 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 6036 | wmi_buf_data(buf); |
| 6037 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 6038 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 6039 | WMITLV_GET_STRUCT_TLVLEN |
| 6040 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 6041 | prof_trig_cmd->enable = value1; |
| 6042 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6043 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 6044 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6045 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6046 | value1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6047 | qdf_nbuf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6048 | return ret; |
| 6049 | } |
| 6050 | break; |
| 6051 | |
| 6052 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 6053 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 6054 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6055 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6056 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6057 | return -ENOMEM; |
| 6058 | } |
| 6059 | profile_getdata_cmd = |
| 6060 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 6061 | wmi_buf_data(buf); |
| 6062 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 6063 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 6064 | WMITLV_GET_STRUCT_TLVLEN |
| 6065 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 6066 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6067 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 6068 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6069 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6070 | value1, value2); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6071 | qdf_nbuf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6072 | return ret; |
| 6073 | } |
| 6074 | break; |
| 6075 | |
| 6076 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 6077 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 6078 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6079 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6080 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6081 | return -ENOMEM; |
| 6082 | } |
| 6083 | hist_intvl_cmd = |
| 6084 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 6085 | wmi_buf_data(buf); |
| 6086 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 6087 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 6088 | WMITLV_GET_STRUCT_TLVLEN |
| 6089 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 6090 | hist_intvl_cmd->profile_id = value1; |
| 6091 | hist_intvl_cmd->value = value2; |
| 6092 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6093 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 6094 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6095 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6096 | value1, value2); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6097 | qdf_nbuf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6098 | return ret; |
| 6099 | } |
| 6100 | break; |
| 6101 | |
| 6102 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 6103 | len = |
| 6104 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 6105 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6106 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6107 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6108 | return -ENOMEM; |
| 6109 | } |
| 6110 | profile_enable_cmd = |
| 6111 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 6112 | wmi_buf_data(buf); |
| 6113 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 6114 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 6115 | WMITLV_GET_STRUCT_TLVLEN |
| 6116 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 6117 | profile_enable_cmd->profile_id = value1; |
| 6118 | profile_enable_cmd->enable = value2; |
| 6119 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6120 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 6121 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6122 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6123 | value1, value2); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6124 | qdf_nbuf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6125 | return ret; |
| 6126 | } |
| 6127 | break; |
| 6128 | |
| 6129 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6130 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6131 | break; |
| 6132 | } |
| 6133 | |
| 6134 | return 0; |
| 6135 | } |
| 6136 | |
| 6137 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 6138 | /** |
| 6139 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 6140 | * @wmi_handle: wmi handle |
| 6141 | * @vdev_id: vdev id |
| 6142 | * |
| 6143 | * Return: CDF status |
| 6144 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6145 | 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] | 6146 | uint8_t vdev_id, uint8_t default_pattern, |
| 6147 | uint16_t rate_limit_interval) |
| 6148 | { |
| 6149 | |
| 6150 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 6151 | wmi_buf_t buf; |
| 6152 | uint8_t *buf_ptr; |
| 6153 | int32_t len; |
| 6154 | int ret; |
| 6155 | |
| 6156 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 6157 | WMI_TLV_HDR_SIZE + |
| 6158 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 6159 | WMI_TLV_HDR_SIZE + |
| 6160 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 6161 | WMI_TLV_HDR_SIZE + |
| 6162 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 6163 | WMI_TLV_HDR_SIZE + |
| 6164 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 6165 | WMI_TLV_HDR_SIZE + |
| 6166 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 6167 | |
| 6168 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6169 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6170 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6171 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6172 | } |
| 6173 | |
| 6174 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 6175 | buf_ptr = (uint8_t *) cmd; |
| 6176 | |
| 6177 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6178 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 6179 | WMITLV_GET_STRUCT_TLVLEN |
| 6180 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 6181 | cmd->vdev_id = vdev_id; |
| 6182 | cmd->pattern_id = default_pattern, |
| 6183 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 6184 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 6185 | |
| 6186 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 6187 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6188 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6189 | |
| 6190 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 6191 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6192 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6193 | |
| 6194 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 6195 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6196 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6197 | |
| 6198 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 6199 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6200 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6201 | |
| 6202 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 6203 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6204 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6205 | |
| 6206 | /* Fill TLV for ra_ratelimit_interval. */ |
| 6207 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 6208 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6209 | |
| 6210 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 6211 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6212 | 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] | 6213 | rate_limit_interval, vdev_id); |
| 6214 | |
| 6215 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6216 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 6217 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6218 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +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 | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6221 | } |
| 6222 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6223 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6224 | |
| 6225 | } |
| 6226 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 6227 | |
| 6228 | /** |
| 6229 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 6230 | * @wmi_handle: wmi handle |
| 6231 | * @vdev_id: vdev id |
| 6232 | * |
| 6233 | * Return: 0 for success or error code |
| 6234 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6235 | 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] | 6236 | { |
| 6237 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 6238 | wmi_buf_t buf; |
| 6239 | int32_t len = sizeof(*cmd); |
| 6240 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6241 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6242 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6243 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6244 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6245 | return -ENOMEM; |
| 6246 | } |
| 6247 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 6248 | wmi_buf_data(buf); |
| 6249 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6250 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 6251 | WMITLV_GET_STRUCT_TLVLEN |
| 6252 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 6253 | cmd->vdev_id = vdev_id; |
| 6254 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 6255 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6256 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6257 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6258 | __func__); |
| 6259 | wmi_buf_free(buf); |
| 6260 | return -EIO; |
| 6261 | } |
| 6262 | |
| 6263 | return 0; |
| 6264 | } |
| 6265 | |
| 6266 | /** |
| 6267 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 6268 | * @wmi_handle: wmi handle |
| 6269 | * @vdev_id: vdev id |
| 6270 | * |
| 6271 | * Return: 0 for success or error code |
| 6272 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6273 | 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] | 6274 | uint8_t vdev_id) |
| 6275 | { |
| 6276 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 6277 | wmi_buf_t buf; |
| 6278 | int32_t len = sizeof(*cmd); |
| 6279 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6280 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6281 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6282 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6283 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6284 | return -ENOMEM; |
| 6285 | } |
| 6286 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 6287 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6288 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 6289 | WMITLV_GET_STRUCT_TLVLEN |
| 6290 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 6291 | cmd->vdev_id = vdev_id; |
| 6292 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 6293 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6294 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6295 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6296 | __func__); |
| 6297 | wmi_buf_free(buf); |
| 6298 | return -EIO; |
| 6299 | } |
| 6300 | |
| 6301 | return 0; |
| 6302 | } |
| 6303 | |
| 6304 | /** |
| 6305 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 6306 | * @wmi_handle: wmi handle |
| 6307 | * @startOemDataReq: start request params |
| 6308 | * |
| 6309 | * Return: CDF status |
| 6310 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6311 | QDF_STATUS send_start_oem_data_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6312 | uint8_t data_len, |
| 6313 | uint8_t *data) |
| 6314 | { |
| 6315 | wmi_buf_t buf; |
| 6316 | uint8_t *cmd; |
| 6317 | int ret = 0; |
| 6318 | |
| 6319 | buf = wmi_buf_alloc(wmi_handle, |
| 6320 | (data_len + WMI_TLV_HDR_SIZE)); |
| 6321 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6322 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 6323 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6324 | } |
| 6325 | |
| 6326 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 6327 | |
| 6328 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 6329 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6330 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6331 | data_len); |
| 6332 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6333 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6334 | data_len); |
| 6335 | |
| 6336 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 6337 | (data_len + |
| 6338 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 6339 | |
| 6340 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6341 | WMI_LOGE(FL(":wmi cmd send failed")); |
| 6342 | qdf_nbuf_free(buf); |
| 6343 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6344 | } |
| 6345 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6346 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6347 | } |
| 6348 | |
| 6349 | /** |
| 6350 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 6351 | * @wmi_handle: wmi handle |
| 6352 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 6353 | * |
| 6354 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 6355 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 6356 | * to firmware based on phyerr filtering |
| 6357 | * offload status. |
| 6358 | * |
| 6359 | * Return: 1 success, 0 failure |
| 6360 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6361 | QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6362 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 6363 | bool dfs_phyerr_filter_offload) |
| 6364 | { |
| 6365 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 6366 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 6367 | wmi_buf_t buf; |
| 6368 | uint16_t len; |
| 6369 | int ret; |
| 6370 | |
| 6371 | |
| 6372 | if (dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6373 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6374 | __func__); |
| 6375 | len = sizeof(*disable_phyerr_offload_cmd); |
| 6376 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6377 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6378 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6379 | return 0; |
| 6380 | } |
| 6381 | disable_phyerr_offload_cmd = |
| 6382 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 6383 | wmi_buf_data(buf); |
| 6384 | |
| 6385 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 6386 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 6387 | WMITLV_GET_STRUCT_TLVLEN |
| 6388 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 6389 | |
| 6390 | /* |
| 6391 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 6392 | * to the firmware to disable the phyerror |
| 6393 | * filtering offload. |
| 6394 | */ |
| 6395 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6396 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
| 6397 | if (ret < 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6398 | 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] | 6399 | __func__, ret); |
| 6400 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6401 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6402 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6403 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6404 | __func__); |
| 6405 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6406 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6407 | __func__); |
| 6408 | |
| 6409 | len = sizeof(*enable_phyerr_offload_cmd); |
| 6410 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6411 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6412 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 6413 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6414 | } |
| 6415 | |
| 6416 | enable_phyerr_offload_cmd = |
| 6417 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 6418 | wmi_buf_data(buf); |
| 6419 | |
| 6420 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 6421 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 6422 | WMITLV_GET_STRUCT_TLVLEN |
| 6423 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 6424 | |
| 6425 | /* |
| 6426 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 6427 | * to the firmware to enable the phyerror |
| 6428 | * filtering offload. |
| 6429 | */ |
| 6430 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6431 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 6432 | |
| 6433 | if (ret < 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6434 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6435 | __func__, ret); |
| 6436 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6437 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6438 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6439 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6440 | __func__); |
| 6441 | } |
| 6442 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6443 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6444 | } |
| 6445 | |
| 6446 | #if !defined(REMOVE_PKT_LOG) |
| 6447 | /** |
| 6448 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 6449 | * @wmi_handle: wmi handle |
| 6450 | * @pktlog_event: pktlog event |
| 6451 | * @cmd_id: pktlog cmd id |
| 6452 | * |
| 6453 | * Return: CDF status |
| 6454 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6455 | 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] | 6456 | WMI_PKTLOG_EVENT pktlog_event, |
| 6457 | WMI_CMD_ID cmd_id) |
| 6458 | { |
| 6459 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 6460 | WMI_CMD_ID CMD_ID; |
| 6461 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 6462 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 6463 | int len = 0; |
| 6464 | wmi_buf_t buf; |
| 6465 | |
| 6466 | PKTLOG_EVENT = pktlog_event; |
| 6467 | CMD_ID = cmd_id; |
| 6468 | |
| 6469 | switch (CMD_ID) { |
| 6470 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 6471 | len = sizeof(*cmd); |
| 6472 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6473 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6474 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 6475 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6476 | } |
| 6477 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 6478 | wmi_buf_data(buf); |
| 6479 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6480 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 6481 | WMITLV_GET_STRUCT_TLVLEN |
| 6482 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 6483 | cmd->evlist = PKTLOG_EVENT; |
| 6484 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6485 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6486 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6487 | goto wmi_send_failed; |
| 6488 | } |
| 6489 | break; |
| 6490 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 6491 | len = sizeof(*disable_cmd); |
| 6492 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6493 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6494 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 6495 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6496 | } |
| 6497 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 6498 | wmi_buf_data(buf); |
| 6499 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 6500 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 6501 | WMITLV_GET_STRUCT_TLVLEN |
| 6502 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Govind Singh | 8b1466e | 2016-03-16 16:27:50 +0530 | [diff] [blame] | 6503 | disable_cmd->pdev_id = 0; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6504 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6505 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6506 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6507 | goto wmi_send_failed; |
| 6508 | } |
| 6509 | break; |
| 6510 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6511 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6512 | break; |
| 6513 | } |
| 6514 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6515 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6516 | |
| 6517 | wmi_send_failed: |
| 6518 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6519 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6520 | } |
| 6521 | #endif /* REMOVE_PKT_LOG */ |
| 6522 | |
| 6523 | /** |
| 6524 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 6525 | * @wmi_handle: wmi handle |
| 6526 | * @vdev_id: vdev id |
| 6527 | * @bitmap: Event bitmap |
| 6528 | * @enable: enable/disable |
| 6529 | * |
| 6530 | * Return: CDF status |
| 6531 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6532 | 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] | 6533 | uint32_t vdev_id, |
| 6534 | uint32_t bitmap, |
| 6535 | bool enable) |
| 6536 | { |
| 6537 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 6538 | uint16_t len; |
| 6539 | wmi_buf_t buf; |
| 6540 | int ret; |
| 6541 | |
| 6542 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 6543 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6544 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6545 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6546 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6547 | } |
| 6548 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 6549 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6550 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 6551 | WMITLV_GET_STRUCT_TLVLEN |
| 6552 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 6553 | cmd->vdev_id = vdev_id; |
| 6554 | cmd->is_add = enable; |
| 6555 | cmd->event_bitmap = bitmap; |
| 6556 | |
| 6557 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6558 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 6559 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6560 | WMI_LOGE("Failed to config wow wakeup event"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6561 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6562 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6563 | } |
| 6564 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6565 | WMI_LOGD("Wakeup pattern 0x%x %s in fw", bitmap, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6566 | enable ? "enabled" : "disabled"); |
| 6567 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6568 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6569 | } |
| 6570 | |
| 6571 | /** |
| 6572 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 6573 | * @wmi_handle: wmi handle |
| 6574 | * @vdev_id: vdev id |
| 6575 | * @ptrn_id: pattern id |
| 6576 | * @ptrn: pattern |
| 6577 | * @ptrn_len: pattern length |
| 6578 | * @ptrn_offset: pattern offset |
| 6579 | * @mask: mask |
| 6580 | * @mask_len: mask length |
| 6581 | * @user: true for user configured pattern and false for default pattern |
| 6582 | * @default_patterns: default patterns |
| 6583 | * |
| 6584 | * Return: CDF status |
| 6585 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6586 | 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] | 6587 | uint8_t vdev_id, uint8_t ptrn_id, |
| 6588 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 6589 | uint8_t ptrn_offset, const uint8_t *mask, |
| 6590 | uint8_t mask_len, bool user, |
| 6591 | uint8_t default_patterns) |
| 6592 | { |
| 6593 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 6594 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 6595 | wmi_buf_t buf; |
| 6596 | uint8_t *buf_ptr; |
| 6597 | int32_t len; |
| 6598 | int ret; |
| 6599 | |
| 6600 | |
| 6601 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 6602 | WMI_TLV_HDR_SIZE + |
| 6603 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 6604 | WMI_TLV_HDR_SIZE + |
| 6605 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 6606 | WMI_TLV_HDR_SIZE + |
| 6607 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 6608 | WMI_TLV_HDR_SIZE + |
| 6609 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 6610 | WMI_TLV_HDR_SIZE + |
| 6611 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 6612 | |
| 6613 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6614 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6615 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6616 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6617 | } |
| 6618 | |
| 6619 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 6620 | buf_ptr = (uint8_t *) cmd; |
| 6621 | |
| 6622 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6623 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 6624 | WMITLV_GET_STRUCT_TLVLEN |
| 6625 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 6626 | cmd->vdev_id = vdev_id; |
| 6627 | cmd->pattern_id = ptrn_id; |
| 6628 | |
| 6629 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 6630 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 6631 | |
| 6632 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6633 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 6634 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6635 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 6636 | |
| 6637 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 6638 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 6639 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 6640 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6641 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 6642 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6643 | |
| 6644 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 6645 | bitmap_pattern->pattern_len = ptrn_len; |
| 6646 | |
| 6647 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 6648 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 6649 | |
| 6650 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 6651 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 6652 | |
| 6653 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 6654 | bitmap_pattern->pattern_id = ptrn_id; |
| 6655 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6656 | 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] | 6657 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 6658 | bitmap_pattern->pattern_offset, user); |
| 6659 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6660 | WMI_LOGI("Pattern : "); |
| 6661 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6662 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 6663 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6664 | WMI_LOGI("Mask : "); |
| 6665 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6666 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
| 6667 | |
| 6668 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 6669 | |
| 6670 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 6671 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6672 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6673 | |
| 6674 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 6675 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6676 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6677 | |
| 6678 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 6679 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6680 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6681 | |
| 6682 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 6683 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6684 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6685 | |
| 6686 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 6687 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 6688 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6689 | *(A_UINT32 *) buf_ptr = 0; |
| 6690 | |
| 6691 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6692 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 6693 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6694 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6695 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6696 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6697 | } |
| 6698 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6699 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6700 | } |
| 6701 | |
| 6702 | /** |
| 6703 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 6704 | * @wmi_handle: wmi handle |
| 6705 | * @ptrn_id: pattern id |
| 6706 | * @vdev_id: vdev id |
| 6707 | * |
| 6708 | * Return: CDF status |
| 6709 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6710 | 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] | 6711 | uint8_t vdev_id) |
| 6712 | { |
| 6713 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 6714 | wmi_buf_t buf; |
| 6715 | int32_t len; |
| 6716 | int ret; |
| 6717 | |
| 6718 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 6719 | |
| 6720 | |
| 6721 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6722 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6723 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6724 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6725 | } |
| 6726 | |
| 6727 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 6728 | |
| 6729 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6730 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 6731 | WMITLV_GET_STRUCT_TLVLEN( |
| 6732 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 6733 | cmd->vdev_id = vdev_id; |
| 6734 | cmd->pattern_id = ptrn_id; |
| 6735 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 6736 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6737 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6738 | cmd->pattern_id, vdev_id); |
| 6739 | |
| 6740 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6741 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 6742 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6743 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6744 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6745 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6746 | } |
| 6747 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6748 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6749 | } |
| 6750 | |
| 6751 | /** |
| 6752 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 6753 | * @wmi_handle: wmi handle |
| 6754 | * |
| 6755 | * Sends host wakeup indication to FW. On receiving this indication, |
| 6756 | * FW will come out of WOW. |
| 6757 | * |
| 6758 | * Return: CDF status |
| 6759 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6760 | 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] | 6761 | { |
| 6762 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 6763 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6764 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6765 | int32_t len; |
| 6766 | int ret; |
| 6767 | |
| 6768 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 6769 | |
| 6770 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6771 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6772 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6773 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6774 | } |
| 6775 | |
| 6776 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 6777 | wmi_buf_data(buf); |
| 6778 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6779 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 6780 | WMITLV_GET_STRUCT_TLVLEN |
| 6781 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 6782 | |
| 6783 | |
| 6784 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6785 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 6786 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6787 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6788 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6789 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6790 | } |
| 6791 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6792 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6793 | } |
| 6794 | |
| 6795 | /** |
| 6796 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 6797 | * @wmi_handle: wmi handle |
| 6798 | * @msg: delts params |
| 6799 | * |
| 6800 | * Return: CDF status |
| 6801 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6802 | 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] | 6803 | uint8_t ac) |
| 6804 | { |
| 6805 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 6806 | wmi_buf_t buf; |
| 6807 | int32_t len = sizeof(*cmd); |
| 6808 | |
| 6809 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6810 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6811 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6812 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6813 | } |
| 6814 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 6815 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6816 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 6817 | WMITLV_GET_STRUCT_TLVLEN |
| 6818 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 6819 | cmd->vdev_id = vdev_id; |
| 6820 | cmd->ac = ac; |
| 6821 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6822 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6823 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 6824 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6825 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6826 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
| 6827 | qdf_nbuf_free(buf); |
| 6828 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6829 | } |
| 6830 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6831 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6832 | } |
| 6833 | |
| 6834 | /** |
| 6835 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 6836 | * @wmi_handle: handle to wmi |
| 6837 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 6838 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6839 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6840 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 6841 | * active flow. |
| 6842 | * |
| 6843 | * Return: CDF status |
| 6844 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6845 | QDF_STATUS send_aggr_qos_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6846 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 6847 | { |
| 6848 | int i = 0; |
| 6849 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 6850 | wmi_buf_t buf; |
| 6851 | int32_t len = sizeof(*cmd); |
| 6852 | |
| 6853 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 6854 | /* if flow in this AC is active */ |
| 6855 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 6856 | /* |
| 6857 | * as per implementation of wma_add_ts_req() we |
| 6858 | * are not waiting any response from firmware so |
| 6859 | * apart from sending ADDTS to firmware just send |
| 6860 | * success to upper layers |
| 6861 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6862 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6863 | |
| 6864 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6865 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6866 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6867 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6868 | } |
| 6869 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 6870 | wmi_buf_data(buf); |
| 6871 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6872 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 6873 | WMITLV_GET_STRUCT_TLVLEN |
| 6874 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 6875 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 6876 | cmd->ac = |
| 6877 | TID_TO_WME_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
| 6878 | traffic.userPrio); |
| 6879 | cmd->medium_time_us = |
| 6880 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 6881 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6882 | 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] | 6883 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 6884 | cmd->medium_time_us, cmd->downgrade_type); |
| 6885 | if (wmi_unified_cmd_send |
| 6886 | (wmi_handle, buf, len, |
| 6887 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6888 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6889 | __func__); |
| 6890 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6891 | QDF_STATUS_E_FAILURE; |
| 6892 | qdf_nbuf_free(buf); |
| 6893 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6894 | } |
| 6895 | } |
| 6896 | } |
| 6897 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6898 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6899 | } |
| 6900 | |
| 6901 | /** |
| 6902 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 6903 | * @wmi_handle: wmi handle |
| 6904 | * @msg: ADDTS params |
| 6905 | * |
| 6906 | * Return: CDF status |
| 6907 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6908 | QDF_STATUS send_add_ts_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6909 | struct add_ts_param *msg) |
| 6910 | { |
| 6911 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 6912 | wmi_buf_t buf; |
| 6913 | int32_t len = sizeof(*cmd); |
| 6914 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6915 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6916 | |
| 6917 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6918 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6919 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6920 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6921 | } |
| 6922 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 6923 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6924 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 6925 | WMITLV_GET_STRUCT_TLVLEN |
| 6926 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 6927 | cmd->vdev_id = msg->sme_session_id; |
| 6928 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 6929 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 6930 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6931 | 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] | 6932 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 6933 | cmd->downgrade_type, __func__, __LINE__); |
| 6934 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6935 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6936 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 6937 | msg->status = QDF_STATUS_E_FAILURE; |
| 6938 | qdf_nbuf_free(buf); |
| 6939 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6940 | } |
| 6941 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6942 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6943 | } |
| 6944 | |
| 6945 | /** |
| 6946 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter in target |
| 6947 | * @wmi_handle: wmi handle |
| 6948 | * @vdev_id: vdev id |
| 6949 | * @enable: Flag to enable/disable packet filter |
| 6950 | * |
| 6951 | * Return: 0 for success or error code |
| 6952 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6953 | 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] | 6954 | uint8_t vdev_id, bool enable) |
| 6955 | { |
| 6956 | int32_t len; |
| 6957 | int ret = 0; |
| 6958 | wmi_buf_t buf; |
| 6959 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 6960 | |
| 6961 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 6962 | |
| 6963 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6964 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6965 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6966 | return -ENOMEM; |
| 6967 | } |
| 6968 | |
| 6969 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 6970 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6971 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 6972 | WMITLV_GET_STRUCT_TLVLEN( |
| 6973 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 6974 | |
| 6975 | cmd->vdev_id = vdev_id; |
| 6976 | if (enable) |
| 6977 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 6978 | else |
| 6979 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 6980 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6981 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6982 | __func__, cmd->enable, vdev_id); |
| 6983 | |
| 6984 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6985 | WMI_PACKET_FILTER_ENABLE_CMDID); |
| 6986 | if (ret) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6987 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 6988 | |
| 6989 | return ret; |
| 6990 | } |
| 6991 | |
| 6992 | /** |
| 6993 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 6994 | * @wmi_handle: wmi handle |
| 6995 | * @vdev_id: vdev id |
| 6996 | * @rcv_filter_param: Packet filter parameters |
| 6997 | * @filter_id: Filter id |
| 6998 | * @enable: Flag to add/delete packet filter configuration |
| 6999 | * |
| 7000 | * Return: 0 for success or error code |
| 7001 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7002 | 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] | 7003 | uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param, |
| 7004 | uint8_t filter_id, bool enable) |
| 7005 | { |
| 7006 | int len, i; |
| 7007 | int err = 0; |
| 7008 | wmi_buf_t buf; |
| 7009 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 7010 | |
| 7011 | |
| 7012 | /* allocate the memory */ |
| 7013 | len = sizeof(*cmd); |
| 7014 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7015 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7016 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7017 | return -ENOMEM; |
| 7018 | } |
| 7019 | |
| 7020 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 7021 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7022 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 7023 | WMITLV_GET_STRUCT_TLVLEN |
| 7024 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 7025 | |
| 7026 | cmd->vdev_id = vdev_id; |
| 7027 | cmd->filter_id = filter_id; |
| 7028 | if (enable) |
| 7029 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 7030 | else |
| 7031 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 7032 | |
| 7033 | if (enable) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7034 | cmd->num_params = QDF_MIN( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7035 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 7036 | rcv_filter_param->numFieldParams); |
| 7037 | cmd->filter_type = rcv_filter_param->filterType; |
| 7038 | cmd->coalesce_time = rcv_filter_param->coalesceTime; |
| 7039 | |
| 7040 | for (i = 0; i < cmd->num_params; i++) { |
| 7041 | cmd->paramsData[i].proto_type = |
| 7042 | rcv_filter_param->paramsData[i].protocolLayer; |
| 7043 | cmd->paramsData[i].cmp_type = |
| 7044 | rcv_filter_param->paramsData[i].cmpFlag; |
| 7045 | cmd->paramsData[i].data_length = |
| 7046 | rcv_filter_param->paramsData[i].dataLength; |
| 7047 | cmd->paramsData[i].data_offset = |
| 7048 | rcv_filter_param->paramsData[i].dataOffset; |
| 7049 | memcpy(&cmd->paramsData[i].compareData, |
| 7050 | rcv_filter_param->paramsData[i].compareData, |
| 7051 | sizeof(cmd->paramsData[i].compareData)); |
| 7052 | memcpy(&cmd->paramsData[i].dataMask, |
| 7053 | rcv_filter_param->paramsData[i].dataMask, |
| 7054 | sizeof(cmd->paramsData[i].dataMask)); |
| 7055 | } |
| 7056 | } |
| 7057 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7058 | 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] | 7059 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 7060 | /* send the command along with data */ |
| 7061 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7062 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 7063 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7064 | WMI_LOGE("Failed to send pkt_filter cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7065 | wmi_buf_free(buf); |
| 7066 | return -EIO; |
| 7067 | } |
| 7068 | |
| 7069 | |
| 7070 | return 0; |
| 7071 | } |
| 7072 | |
| 7073 | /** |
| 7074 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 7075 | * @wmi_handle: wmi handle |
| 7076 | * @vdev_id: vdev id |
| 7077 | * @multicastAddr: mcast address |
| 7078 | * @clearList: clear list flag |
| 7079 | * |
| 7080 | * Return: 0 for success or error code |
| 7081 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7082 | 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] | 7083 | uint8_t vdev_id, |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7084 | struct qdf_mac_addr multicast_addr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7085 | bool clearList) |
| 7086 | { |
| 7087 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 7088 | wmi_buf_t buf; |
| 7089 | int err; |
| 7090 | |
| 7091 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7092 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7093 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7094 | return -ENOMEM; |
| 7095 | } |
| 7096 | |
| 7097 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7098 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7099 | |
| 7100 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7101 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 7102 | WMITLV_GET_STRUCT_TLVLEN |
| 7103 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 7104 | cmd->action = |
| 7105 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 7106 | cmd->vdev_id = vdev_id; |
| 7107 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
| 7108 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7109 | sizeof(*cmd), |
| 7110 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 7111 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7112 | WMI_LOGE("Failed to send set_param cmd"); |
| 7113 | qdf_mem_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7114 | return -EIO; |
| 7115 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7116 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7117 | cmd->action, vdev_id, clearList); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7118 | WMI_LOGD("MCBC MAC Addr: "MAC_ADDRESS_STR, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7119 | MAC_ADDR_ARRAY(multicast_addr.bytes)); |
| 7120 | |
| 7121 | return 0; |
| 7122 | } |
| 7123 | |
| 7124 | /** |
| 7125 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 7126 | * @wmi_handle: wmi handle |
| 7127 | * @vdev_id: vdev id |
| 7128 | * @params: GTK offload parameters |
| 7129 | * |
| 7130 | * Return: CDF status |
| 7131 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7132 | 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] | 7133 | struct gtk_offload_params *params, |
| 7134 | bool enable_offload, |
| 7135 | uint32_t gtk_offload_opcode) |
| 7136 | { |
| 7137 | int len; |
| 7138 | wmi_buf_t buf; |
| 7139 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7140 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7141 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7142 | WMI_LOGD("%s Enter", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7143 | |
| 7144 | len = sizeof(*cmd); |
| 7145 | |
| 7146 | /* alloc wmi buffer */ |
| 7147 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7148 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7149 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 7150 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7151 | goto out; |
| 7152 | } |
| 7153 | |
| 7154 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 7155 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7156 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 7157 | WMITLV_GET_STRUCT_TLVLEN |
| 7158 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 7159 | |
| 7160 | cmd->vdev_id = vdev_id; |
| 7161 | |
| 7162 | /* Request target to enable GTK offload */ |
| 7163 | if (enable_offload) { |
| 7164 | cmd->flags = gtk_offload_opcode; |
| 7165 | |
| 7166 | /* Copy the keys and replay counter */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7167 | qdf_mem_copy(cmd->KCK, params->aKCK, WMI_GTK_OFFLOAD_KCK_BYTES); |
| 7168 | qdf_mem_copy(cmd->KEK, params->aKEK, WMI_GTK_OFFLOAD_KEK_BYTES); |
| 7169 | qdf_mem_copy(cmd->replay_counter, ¶ms->ullKeyReplayCounter, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7170 | GTK_REPLAY_COUNTER_BYTES); |
| 7171 | } else { |
| 7172 | cmd->flags = gtk_offload_opcode; |
| 7173 | } |
| 7174 | |
| 7175 | /* send the wmi command */ |
| 7176 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7177 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7178 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7179 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7180 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7181 | } |
| 7182 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7183 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7184 | out: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7185 | WMI_LOGD("%s Exit", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7186 | return status; |
| 7187 | } |
| 7188 | |
| 7189 | /** |
| 7190 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 7191 | * @wmi_handle: wmi handle |
| 7192 | * @params: GTK offload params |
| 7193 | * |
| 7194 | * Return: CDF status |
| 7195 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7196 | 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] | 7197 | uint8_t vdev_id, |
| 7198 | uint64_t offload_req_opcode) |
| 7199 | { |
| 7200 | int len; |
| 7201 | wmi_buf_t buf; |
| 7202 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7203 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7204 | |
| 7205 | len = sizeof(*cmd); |
| 7206 | |
| 7207 | /* alloc wmi buffer */ |
| 7208 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7209 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7210 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 7211 | status = QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7212 | goto out; |
| 7213 | } |
| 7214 | |
| 7215 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 7216 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7217 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 7218 | WMITLV_GET_STRUCT_TLVLEN |
| 7219 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 7220 | |
| 7221 | /* Request for GTK offload status */ |
| 7222 | cmd->flags = offload_req_opcode; |
| 7223 | cmd->vdev_id = vdev_id; |
| 7224 | |
| 7225 | /* send the wmi command */ |
| 7226 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7227 | WMI_GTK_OFFLOAD_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7228 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7229 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7230 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7231 | } |
| 7232 | |
| 7233 | out: |
| 7234 | return status; |
| 7235 | } |
| 7236 | |
| 7237 | /** |
| 7238 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 7239 | * @wmi_handle: wmi handle |
| 7240 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 7241 | * |
| 7242 | * Retrun: CDF status |
| 7243 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7244 | 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] | 7245 | struct periodic_tx_pattern * |
| 7246 | pAddPeriodicTxPtrnParams, |
| 7247 | uint8_t vdev_id) |
| 7248 | { |
| 7249 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 7250 | wmi_buf_t wmi_buf; |
| 7251 | uint32_t len; |
| 7252 | uint8_t *buf_ptr; |
| 7253 | uint32_t ptrn_len, ptrn_len_aligned; |
| 7254 | int j; |
| 7255 | |
| 7256 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 7257 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 7258 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 7259 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 7260 | |
| 7261 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7262 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7263 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7264 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7265 | } |
| 7266 | |
| 7267 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7268 | |
| 7269 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 7270 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7271 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 7272 | WMITLV_GET_STRUCT_TLVLEN |
| 7273 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 7274 | |
| 7275 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 7276 | cmd->vdev_id = vdev_id; |
| 7277 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 7278 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 7279 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 7280 | |
| 7281 | /* Pattern info */ |
| 7282 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 7283 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 7284 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7285 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7286 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7287 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7288 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7289 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7290 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 7291 | |
| 7292 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7293 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7294 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7295 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7296 | qdf_nbuf_free(wmi_buf); |
| 7297 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7298 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7299 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7300 | } |
| 7301 | |
| 7302 | /** |
| 7303 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 7304 | * @wmi_handle: wmi handle |
| 7305 | * @vdev_id: vdev id |
| 7306 | * @pattern_id: pattern id |
| 7307 | * |
| 7308 | * Retrun: CDF status |
| 7309 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7310 | 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] | 7311 | uint8_t vdev_id, |
| 7312 | uint8_t pattern_id) |
| 7313 | { |
| 7314 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 7315 | wmi_buf_t wmi_buf; |
| 7316 | uint32_t len = |
| 7317 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 7318 | |
| 7319 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7320 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7321 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7322 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7323 | } |
| 7324 | |
| 7325 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 7326 | wmi_buf_data(wmi_buf); |
| 7327 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7328 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 7329 | WMITLV_GET_STRUCT_TLVLEN |
| 7330 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 7331 | |
| 7332 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 7333 | cmd->vdev_id = vdev_id; |
| 7334 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7335 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7336 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 7337 | |
| 7338 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7339 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7340 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
| 7341 | qdf_nbuf_free(wmi_buf); |
| 7342 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7343 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7344 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7345 | } |
| 7346 | |
| 7347 | /** |
| 7348 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 7349 | * @wmi_handle: wmi handle |
| 7350 | * @preq: stats ext params |
| 7351 | * |
| 7352 | * Return: CDF status |
| 7353 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7354 | 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] | 7355 | struct stats_ext_params *preq) |
| 7356 | { |
| 7357 | int32_t ret; |
| 7358 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 7359 | wmi_buf_t buf; |
| 7360 | uint16_t len; |
| 7361 | uint8_t *buf_ptr; |
| 7362 | |
| 7363 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 7364 | |
| 7365 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7366 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7367 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7368 | return -ENOMEM; |
| 7369 | } |
| 7370 | |
| 7371 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7372 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 7373 | |
| 7374 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7375 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 7376 | WMITLV_GET_STRUCT_TLVLEN |
| 7377 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 7378 | cmd->vdev_id = preq->vdev_id; |
| 7379 | cmd->data_len = preq->request_data_len; |
| 7380 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7381 | 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] | 7382 | __func__, preq->request_data_len, preq->vdev_id); |
| 7383 | |
| 7384 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 7385 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 7386 | |
| 7387 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7388 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7389 | |
| 7390 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7391 | WMI_REQUEST_STATS_EXT_CMDID); |
| 7392 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7393 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7394 | ret); |
| 7395 | wmi_buf_free(buf); |
| 7396 | } |
| 7397 | |
| 7398 | return ret; |
| 7399 | } |
| 7400 | |
| 7401 | /** |
| 7402 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 7403 | * @wmi_handle: wmi handle |
| 7404 | * @params: ext wow params |
| 7405 | * |
| 7406 | * Return:0 for success or error code |
| 7407 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7408 | 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] | 7409 | struct ext_wow_params *params) |
| 7410 | { |
| 7411 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 7412 | wmi_buf_t buf; |
| 7413 | int32_t len; |
| 7414 | int ret; |
| 7415 | |
| 7416 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 7417 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7418 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7419 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7420 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7421 | } |
| 7422 | |
| 7423 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 7424 | |
| 7425 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7426 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 7427 | WMITLV_GET_STRUCT_TLVLEN |
| 7428 | (wmi_extwow_enable_cmd_fixed_param)); |
| 7429 | |
| 7430 | cmd->vdev_id = params->vdev_id; |
| 7431 | cmd->type = params->type; |
| 7432 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 7433 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7434 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7435 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 7436 | |
| 7437 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7438 | WMI_EXTWOW_ENABLE_CMDID); |
| 7439 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7440 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7441 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7442 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7443 | } |
| 7444 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7445 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7446 | |
| 7447 | } |
| 7448 | |
| 7449 | /** |
| 7450 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 7451 | * @wmi_handle: wmi handle |
| 7452 | * @app_type1_params: app type1 params |
| 7453 | * |
| 7454 | * Return: CDF status |
| 7455 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7456 | 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] | 7457 | struct app_type1_params *app_type1_params) |
| 7458 | { |
| 7459 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 7460 | wmi_buf_t buf; |
| 7461 | int32_t len; |
| 7462 | int ret; |
| 7463 | |
| 7464 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 7465 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7466 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7467 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7468 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7469 | } |
| 7470 | |
| 7471 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 7472 | wmi_buf_data(buf); |
| 7473 | |
| 7474 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7475 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 7476 | WMITLV_GET_STRUCT_TLVLEN |
| 7477 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 7478 | |
| 7479 | cmd->vdev_id = app_type1_params->vdev_id; |
| 7480 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 7481 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7482 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7483 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7484 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7485 | cmd->passwd_len = app_type1_params->pass_length; |
| 7486 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7487 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7488 | "identification_id %.8s id_length %u " |
| 7489 | "password %.16s pass_length %u", |
| 7490 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 7491 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 7492 | |
| 7493 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7494 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 7495 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7496 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7497 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7498 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7499 | } |
| 7500 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7501 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7502 | } |
| 7503 | |
| 7504 | /** |
| 7505 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 7506 | * @wmi_handle: wmi handle |
| 7507 | * @appType2Params: app type2 params |
| 7508 | * |
| 7509 | * Return: CDF status |
| 7510 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7511 | 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] | 7512 | struct app_type2_params *appType2Params) |
| 7513 | { |
| 7514 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 7515 | wmi_buf_t buf; |
| 7516 | int32_t len; |
| 7517 | int ret; |
| 7518 | |
| 7519 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 7520 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7521 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7522 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7523 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7524 | } |
| 7525 | |
| 7526 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 7527 | wmi_buf_data(buf); |
| 7528 | |
| 7529 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7530 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 7531 | WMITLV_GET_STRUCT_TLVLEN |
| 7532 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 7533 | |
| 7534 | cmd->vdev_id = appType2Params->vdev_id; |
| 7535 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7536 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7537 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 7538 | |
| 7539 | cmd->ip_id = appType2Params->ip_id; |
| 7540 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 7541 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 7542 | |
| 7543 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 7544 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 7545 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 7546 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 7547 | |
| 7548 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 7549 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 7550 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 7551 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 7552 | |
| 7553 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 7554 | &cmd->gateway_mac); |
| 7555 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 7556 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 7557 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7558 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7559 | "rc4_key %.16s rc4_key_len %u " |
| 7560 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 7561 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 7562 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 7563 | "keepalive_max %u keepalive_inc %u " |
| 7564 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 7565 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 7566 | cmd->rc4_key, cmd->rc4_key_len, |
| 7567 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 7568 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 7569 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 7570 | cmd->keepalive_max, cmd->keepalive_inc, |
| 7571 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 7572 | |
| 7573 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7574 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 7575 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7576 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7577 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7578 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7579 | } |
| 7580 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7581 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7582 | |
| 7583 | } |
| 7584 | |
| 7585 | /** |
| 7586 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 7587 | * @wmi_handle: wmi handle |
| 7588 | * @timer_val: auto shutdown timer value |
| 7589 | * |
| 7590 | * Return: CDF status |
| 7591 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7592 | 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] | 7593 | uint32_t timer_val) |
| 7594 | { |
| 7595 | int status = 0; |
| 7596 | wmi_buf_t buf = NULL; |
| 7597 | uint8_t *buf_ptr; |
| 7598 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 7599 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 7600 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7601 | 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] | 7602 | __func__, timer_val); |
| 7603 | |
| 7604 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7605 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7606 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7607 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7608 | } |
| 7609 | |
| 7610 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7611 | wmi_auto_sh_cmd = |
| 7612 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 7613 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 7614 | |
| 7615 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 7616 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 7617 | WMITLV_GET_STRUCT_TLVLEN |
| 7618 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 7619 | |
| 7620 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7621 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
| 7622 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7623 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7624 | __func__, status); |
| 7625 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7626 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7627 | } |
| 7628 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7629 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7630 | } |
| 7631 | |
| 7632 | /** |
| 7633 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 7634 | * @wmi_handle: wmi handle |
| 7635 | * @nan_req: request data which will be non-null |
| 7636 | * |
| 7637 | * Return: CDF status |
| 7638 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7639 | QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7640 | struct nan_req_params *nan_req) |
| 7641 | { |
| 7642 | int ret; |
| 7643 | wmi_nan_cmd_param *cmd; |
| 7644 | wmi_buf_t buf; |
| 7645 | uint16_t len = sizeof(*cmd); |
| 7646 | uint16_t nan_data_len, nan_data_len_aligned; |
| 7647 | uint8_t *buf_ptr; |
| 7648 | |
| 7649 | /* |
| 7650 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 7651 | * +------------+----------+-----------------------+--------------+ |
| 7652 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 7653 | * +------------+----------+-----------------------+--------------+ |
| 7654 | */ |
| 7655 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7656 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 7657 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7658 | } |
| 7659 | nan_data_len = nan_req->request_data_len; |
| 7660 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 7661 | sizeof(uint32_t)); |
| 7662 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 7663 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7664 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7665 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7666 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7667 | } |
| 7668 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7669 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 7670 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7671 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 7672 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 7673 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7674 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7675 | __func__, nan_req->request_data_len); |
| 7676 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 7677 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 7678 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7679 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7680 | |
| 7681 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7682 | WMI_NAN_CMDID); |
| 7683 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7684 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7685 | __func__, ret); |
| 7686 | wmi_buf_free(buf); |
| 7687 | } |
| 7688 | |
| 7689 | return ret; |
| 7690 | } |
| 7691 | |
| 7692 | /** |
| 7693 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 7694 | * @wmi_handle: wmi handle |
| 7695 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 7696 | * |
| 7697 | * Return: 0 for success or error code |
| 7698 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7699 | 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] | 7700 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 7701 | { |
| 7702 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 7703 | wmi_buf_t buf; |
| 7704 | int err; |
| 7705 | |
| 7706 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7707 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7708 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7709 | "set_dhcp_server_offload cmd"); |
| 7710 | return -ENOMEM; |
| 7711 | } |
| 7712 | |
| 7713 | 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] | 7714 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7715 | |
| 7716 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7717 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 7718 | WMITLV_GET_STRUCT_TLVLEN |
| 7719 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 7720 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 7721 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 7722 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 7723 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 7724 | cmd->start_lsb = 0; |
| 7725 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7726 | sizeof(*cmd), |
| 7727 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
| 7728 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7729 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7730 | wmi_buf_free(buf); |
| 7731 | return -EIO; |
| 7732 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7733 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7734 | pDhcpSrvOffloadInfo->vdev_id); |
| 7735 | return 0; |
| 7736 | } |
| 7737 | |
| 7738 | /** |
| 7739 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 7740 | * @wmi_handle: wmi handle |
| 7741 | * @flashing: flashing request |
| 7742 | * |
| 7743 | * Return: CDF status |
| 7744 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7745 | 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] | 7746 | struct flashing_req_params *flashing) |
| 7747 | { |
| 7748 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
| 7749 | int status = 0; |
| 7750 | wmi_buf_t buf; |
| 7751 | uint8_t *buf_ptr; |
| 7752 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 7753 | |
| 7754 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7755 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7756 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7757 | return -ENOMEM; |
| 7758 | } |
| 7759 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7760 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 7761 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7762 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 7763 | WMITLV_GET_STRUCT_TLVLEN |
| 7764 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 7765 | cmd->pattern_id = flashing->pattern_id; |
| 7766 | cmd->led_x0 = flashing->led_x0; |
| 7767 | cmd->led_x1 = flashing->led_x1; |
| 7768 | |
| 7769 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7770 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
| 7771 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7772 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7773 | " returned Error %d", __func__, status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7774 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7775 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7776 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7777 | } |
| 7778 | |
| 7779 | /** |
| 7780 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 7781 | * @wmi_handle: wmi handle |
| 7782 | * @ch_avoid_update_req: channel avoid update params |
| 7783 | * |
| 7784 | * Return: CDF status |
| 7785 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7786 | 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] | 7787 | { |
| 7788 | int status = 0; |
| 7789 | wmi_buf_t buf = NULL; |
| 7790 | uint8_t *buf_ptr; |
| 7791 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 7792 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 7793 | |
| 7794 | |
| 7795 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7796 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7797 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7798 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7799 | } |
| 7800 | |
| 7801 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7802 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 7803 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 7804 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 7805 | WMITLV_GET_STRUCT_TLVLEN |
| 7806 | (wmi_chan_avoid_update_cmd_param)); |
| 7807 | |
| 7808 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7809 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
| 7810 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7811 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7812 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 7813 | " returned Error %d", status); |
| 7814 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7815 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7816 | } |
| 7817 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7818 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7819 | } |
| 7820 | |
| 7821 | /** |
| 7822 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 7823 | * @wmi_handle: wmi handle |
| 7824 | * @reg_dmn: reg domain |
| 7825 | * @regdmn2G: 2G reg domain |
| 7826 | * @regdmn5G: 5G reg domain |
| 7827 | * @ctl2G: 2G test limit |
| 7828 | * @ctl5G: 5G test limit |
| 7829 | * |
| 7830 | * Return: none |
| 7831 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7832 | 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] | 7833 | uint32_t reg_dmn, uint16_t regdmn2G, |
| 7834 | uint16_t regdmn5G, int8_t ctl2G, |
| 7835 | int8_t ctl5G) |
| 7836 | { |
| 7837 | wmi_buf_t buf; |
| 7838 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 7839 | int32_t len = sizeof(*cmd); |
| 7840 | |
| 7841 | |
| 7842 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7843 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7844 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 7845 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7846 | } |
| 7847 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 7848 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7849 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 7850 | WMITLV_GET_STRUCT_TLVLEN |
| 7851 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 7852 | cmd->reg_domain = reg_dmn; |
| 7853 | cmd->reg_domain_2G = regdmn2G; |
| 7854 | cmd->reg_domain_5G = regdmn5G; |
| 7855 | cmd->conformance_test_limit_2G = ctl2G; |
| 7856 | cmd->conformance_test_limit_5G = ctl5G; |
| 7857 | |
| 7858 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7859 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7860 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7861 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7862 | qdf_nbuf_free(buf); |
| 7863 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7864 | } |
| 7865 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7866 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7867 | } |
| 7868 | |
| 7869 | |
| 7870 | /** |
| 7871 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 7872 | * @wmi_handle: wmi handle |
| 7873 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 7874 | * |
| 7875 | * This function sets tdls off channel mode |
| 7876 | * |
| 7877 | * Return: 0 on success; Negative errno otherwise |
| 7878 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7879 | 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] | 7880 | struct tdls_channel_switch_params *chan_switch_params) |
| 7881 | { |
| 7882 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 7883 | wmi_buf_t wmi_buf; |
| 7884 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 7885 | |
| 7886 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7887 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7888 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 7889 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7890 | } |
| 7891 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 7892 | wmi_buf_data(wmi_buf); |
| 7893 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7894 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 7895 | WMITLV_GET_STRUCT_TLVLEN( |
| 7896 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 7897 | |
| 7898 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 7899 | &cmd->peer_macaddr); |
| 7900 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 7901 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 7902 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 7903 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 7904 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 7905 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 7906 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7907 | 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] | 7908 | cmd->peer_macaddr.mac_addr31to0, |
| 7909 | cmd->peer_macaddr.mac_addr47to32); |
| 7910 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7911 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7912 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 7913 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 7914 | ), |
| 7915 | cmd->vdev_id, |
| 7916 | cmd->offchan_mode, |
| 7917 | cmd->offchan_num, |
| 7918 | cmd->offchan_bw_bitmap, |
| 7919 | cmd->is_peer_responder, |
| 7920 | cmd->offchan_oper_class); |
| 7921 | |
| 7922 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7923 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7924 | WMI_LOGP(FL("failed to send tdls off chan command")); |
| 7925 | qdf_nbuf_free(wmi_buf); |
| 7926 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7927 | } |
| 7928 | |
| 7929 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7930 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7931 | } |
| 7932 | |
| 7933 | /** |
| 7934 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 7935 | * @wmi_handle: wmi handle |
| 7936 | * @pwmaTdlsparams: TDLS params |
| 7937 | * |
| 7938 | * Return: 0 for sucess or error code |
| 7939 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7940 | 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] | 7941 | void *tdls_param, uint8_t tdls_state) |
| 7942 | { |
| 7943 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 7944 | wmi_buf_t wmi_buf; |
| 7945 | |
| 7946 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 7947 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 7948 | |
| 7949 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7950 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7951 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 7952 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7953 | } |
| 7954 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 7955 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7956 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 7957 | WMITLV_GET_STRUCT_TLVLEN |
| 7958 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 7959 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 7960 | cmd->state = tdls_state; |
| 7961 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 7962 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 7963 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 7964 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 7965 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 7966 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 7967 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 7968 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 7969 | wmi_tdls->peer_traffic_response_timeout; |
| 7970 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 7971 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 7972 | cmd->tdls_puapsd_rx_frame_threshold = |
| 7973 | wmi_tdls->puapsd_rx_frame_threshold; |
| 7974 | cmd->teardown_notification_ms = |
| 7975 | wmi_tdls->teardown_notification_ms; |
| 7976 | cmd->tdls_peer_kickout_threshold = |
| 7977 | wmi_tdls->tdls_peer_kickout_threshold; |
| 7978 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7979 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7980 | "notification_interval_ms: %d, " |
| 7981 | "tx_discovery_threshold: %d, " |
| 7982 | "tx_teardown_threshold: %d, " |
| 7983 | "rssi_teardown_threshold: %d, " |
| 7984 | "rssi_delta: %d, " |
| 7985 | "tdls_options: 0x%x, " |
| 7986 | "tdls_peer_traffic_ind_window: %d, " |
| 7987 | "tdls_peer_traffic_response_timeout: %d, " |
| 7988 | "tdls_puapsd_mask: 0x%x, " |
| 7989 | "tdls_puapsd_inactivity_time: %d, " |
| 7990 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 7991 | "teardown_notification_ms: %d, " |
| 7992 | "tdls_peer_kickout_threshold: %d", |
| 7993 | __func__, tdls_state, cmd->state, |
| 7994 | cmd->notification_interval_ms, |
| 7995 | cmd->tx_discovery_threshold, |
| 7996 | cmd->tx_teardown_threshold, |
| 7997 | cmd->rssi_teardown_threshold, |
| 7998 | cmd->rssi_delta, |
| 7999 | cmd->tdls_options, |
| 8000 | cmd->tdls_peer_traffic_ind_window, |
| 8001 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 8002 | cmd->tdls_puapsd_mask, |
| 8003 | cmd->tdls_puapsd_inactivity_time_ms, |
| 8004 | cmd->tdls_puapsd_rx_frame_threshold, |
| 8005 | cmd->teardown_notification_ms, |
| 8006 | cmd->tdls_peer_kickout_threshold); |
| 8007 | |
| 8008 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8009 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8010 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
| 8011 | qdf_nbuf_free(wmi_buf); |
| 8012 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8013 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8014 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8015 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8016 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8017 | } |
| 8018 | |
| 8019 | /** |
| 8020 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 8021 | * @wmi_handle: wmi handle |
| 8022 | * @peerStateParams: TDLS peer state params |
| 8023 | * |
| 8024 | * Return: 0 for success or error code |
| 8025 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8026 | 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] | 8027 | struct tdls_peer_state_params *peerStateParams, |
| 8028 | uint32_t *ch_mhz) |
| 8029 | { |
| 8030 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 8031 | wmi_tdls_peer_capabilities *peer_cap; |
| 8032 | wmi_channel *chan_info; |
| 8033 | wmi_buf_t wmi_buf; |
| 8034 | uint8_t *buf_ptr; |
| 8035 | uint32_t i; |
| 8036 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 8037 | sizeof(wmi_tdls_peer_capabilities); |
| 8038 | |
| 8039 | |
| 8040 | len += WMI_TLV_HDR_SIZE + |
| 8041 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 8042 | |
| 8043 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8044 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8045 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8046 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8047 | } |
| 8048 | |
| 8049 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8050 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 8051 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8052 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 8053 | WMITLV_GET_STRUCT_TLVLEN |
| 8054 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 8055 | |
| 8056 | cmd->vdev_id = peerStateParams->vdevId; |
| 8057 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 8058 | &cmd->peer_macaddr); |
| 8059 | |
| 8060 | |
| 8061 | cmd->peer_state = peerStateParams->peerState; |
| 8062 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8063 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8064 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 8065 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 8066 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 8067 | cmd->peer_macaddr.mac_addr31to0, |
| 8068 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 8069 | |
| 8070 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 8071 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 8072 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 8073 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 8074 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 8075 | |
| 8076 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 8077 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 8078 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 8079 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 8080 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 8081 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 8082 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 8083 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 8084 | |
| 8085 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 8086 | * but fill SP |
| 8087 | */ |
| 8088 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 8089 | peerStateParams->peerCap.peerMaxSp); |
| 8090 | |
| 8091 | peer_cap->buff_sta_support = |
| 8092 | peerStateParams->peerCap.peerBuffStaSupport; |
| 8093 | peer_cap->off_chan_support = |
| 8094 | peerStateParams->peerCap.peerOffChanSupport; |
| 8095 | peer_cap->peer_curr_operclass = |
| 8096 | peerStateParams->peerCap.peerCurrOperClass; |
| 8097 | /* self curr operclass is not being used and so pass op class for |
| 8098 | * preferred off chan in it. |
| 8099 | */ |
| 8100 | peer_cap->self_curr_operclass = |
| 8101 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 8102 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 8103 | peer_cap->peer_operclass_len = |
| 8104 | peerStateParams->peerCap.peerOperClassLen; |
| 8105 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8106 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8107 | __func__, peer_cap->peer_operclass_len); |
| 8108 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 8109 | peer_cap->peer_operclass[i] = |
| 8110 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8111 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8112 | __func__, i, peer_cap->peer_operclass[i]); |
| 8113 | } |
| 8114 | |
| 8115 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 8116 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 8117 | peer_cap->pref_offchan_bw = |
| 8118 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 8119 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8120 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8121 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 8122 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 8123 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 8124 | " %d, pref_offchan_bw: %d", |
| 8125 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 8126 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 8127 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 8128 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 8129 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 8130 | |
| 8131 | /* next fill variable size array of peer chan info */ |
| 8132 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 8133 | WMITLV_SET_HDR(buf_ptr, |
| 8134 | WMITLV_TAG_ARRAY_STRUC, |
| 8135 | sizeof(wmi_channel) * |
| 8136 | peerStateParams->peerCap.peerChanLen); |
| 8137 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 8138 | |
| 8139 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 8140 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 8141 | WMITLV_TAG_STRUC_wmi_channel, |
| 8142 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 8143 | chan_info->mhz = ch_mhz[i]; |
| 8144 | chan_info->band_center_freq1 = chan_info->mhz; |
| 8145 | chan_info->band_center_freq2 = 0; |
| 8146 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8147 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8148 | |
| 8149 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 8150 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8151 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8152 | peerStateParams->peerCap.peerChan[i].chanId, |
| 8153 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 8154 | } |
| 8155 | |
| 8156 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 8157 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 8158 | else |
| 8159 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 8160 | |
| 8161 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 8162 | peerStateParams->peerCap. |
| 8163 | peerChan[i].pwr); |
| 8164 | |
| 8165 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 8166 | peerStateParams->peerCap.peerChan[i]. |
| 8167 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8168 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8169 | peerStateParams->peerCap.peerChan[i].pwr); |
| 8170 | |
| 8171 | chan_info++; |
| 8172 | } |
| 8173 | |
| 8174 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8175 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8176 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8177 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8178 | qdf_nbuf_free(wmi_buf); |
| 8179 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8180 | } |
| 8181 | |
| 8182 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8183 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8184 | } |
| 8185 | |
| 8186 | /* |
| 8187 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 8188 | * firmware |
| 8189 | * @wmi_handle: Pointer to wmi handle |
| 8190 | * @mem_dump_req: Pointer for mem_dump_req |
| 8191 | * |
| 8192 | * This function sends memory dump request to firmware |
| 8193 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8194 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8195 | * |
| 8196 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8197 | 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] | 8198 | struct fw_dump_req_param *mem_dump_req) |
| 8199 | { |
| 8200 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 8201 | wmi_fw_mem_dump *dump_params; |
| 8202 | struct fw_dump_seg_req *seg_req; |
| 8203 | int32_t len; |
| 8204 | wmi_buf_t buf; |
| 8205 | u_int8_t *buf_ptr; |
| 8206 | int ret, loop; |
| 8207 | |
| 8208 | /* |
| 8209 | * len = sizeof(fixed param) that includes tlv header + |
| 8210 | * tlv header for array of struc + |
| 8211 | * sizeof (each struct) |
| 8212 | */ |
| 8213 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 8214 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 8215 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8216 | |
| 8217 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8218 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 8219 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8220 | } |
| 8221 | |
| 8222 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8223 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8224 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 8225 | |
| 8226 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8227 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 8228 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 8229 | |
| 8230 | cmd->request_id = mem_dump_req->request_id; |
| 8231 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 8232 | |
| 8233 | /* TLV indicating array of structures to follow */ |
| 8234 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 8235 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 8236 | sizeof(wmi_fw_mem_dump) * |
| 8237 | cmd->num_fw_mem_dump_segs); |
| 8238 | |
| 8239 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8240 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 8241 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8242 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8243 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 8244 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
| 8245 | seg_req = (struct fw_dump_seg_req *) |
| 8246 | ((uint8_t *)(mem_dump_req->segment) + |
| 8247 | loop * sizeof(*seg_req)); |
| 8248 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 8249 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 8250 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 8251 | dump_params->seg_id = seg_req->seg_id; |
| 8252 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 8253 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 8254 | dump_params->seg_length = seg_req->seg_length; |
| 8255 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 8256 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8257 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 8258 | 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] | 8259 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 8260 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8261 | 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] | 8262 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 8263 | dump_params->dest_addr_hi); |
| 8264 | dump_params++; |
| 8265 | } |
| 8266 | |
| 8267 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8268 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 8269 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8270 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8271 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8272 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8273 | } |
| 8274 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8275 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 8276 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8277 | } |
| 8278 | |
| 8279 | /* |
| 8280 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 8281 | * @wmi_handle: Pointer to WMi handle |
| 8282 | * @ie_data: Pointer for ie data |
| 8283 | * |
| 8284 | * This function sends IE information to firmware |
| 8285 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8286 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8287 | * |
| 8288 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8289 | 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] | 8290 | struct vdev_ie_info_param *ie_info) |
| 8291 | { |
| 8292 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 8293 | wmi_buf_t buf; |
| 8294 | uint8_t *buf_ptr; |
| 8295 | uint32_t len, ie_len_aligned; |
| 8296 | int ret; |
| 8297 | |
| 8298 | |
| 8299 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 8300 | /* Allocate memory for the WMI command */ |
| 8301 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 8302 | |
| 8303 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8304 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8305 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 8306 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8307 | } |
| 8308 | |
| 8309 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8310 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8311 | |
| 8312 | /* Populate the WMI command */ |
| 8313 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 8314 | |
| 8315 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8316 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 8317 | WMITLV_GET_STRUCT_TLVLEN( |
| 8318 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 8319 | cmd->vdev_id = ie_info->vdev_id; |
| 8320 | cmd->ie_id = ie_info->ie_id; |
| 8321 | cmd->ie_len = ie_info->length; |
| 8322 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8323 | 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] | 8324 | ie_info->length, ie_info->vdev_id); |
| 8325 | |
| 8326 | buf_ptr += sizeof(*cmd); |
| 8327 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 8328 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 8329 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8330 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8331 | |
| 8332 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8333 | WMI_VDEV_SET_IE_CMDID); |
| 8334 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8335 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8336 | wmi_buf_free(buf); |
| 8337 | } |
| 8338 | |
| 8339 | return ret; |
| 8340 | } |
| 8341 | |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8342 | |
| 8343 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
| 8344 | wmi_resource_config *tgt_res_cfg) |
| 8345 | { |
| 8346 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 8347 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 8348 | resource_cfg->num_offload_reorder_buffs = |
| 8349 | tgt_res_cfg->num_offload_reorder_buffs; |
| 8350 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 8351 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 8352 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 8353 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 8354 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 8355 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 8356 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 8357 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 8358 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 8359 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 8360 | resource_cfg->scan_max_pending_req = |
| 8361 | tgt_res_cfg->scan_max_pending_req; |
| 8362 | resource_cfg->bmiss_offload_max_vdev = |
| 8363 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 8364 | resource_cfg->roam_offload_max_vdev = |
| 8365 | tgt_res_cfg->roam_offload_max_vdev; |
| 8366 | resource_cfg->roam_offload_max_ap_profiles = |
| 8367 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 8368 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 8369 | resource_cfg->num_mcast_table_elems = |
| 8370 | tgt_res_cfg->num_mcast_table_elems; |
| 8371 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 8372 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 8373 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 8374 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 8375 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 8376 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 8377 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 8378 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 8379 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 8380 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 8381 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 8382 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 8383 | resource_cfg->num_tdls_conn_table_entries = |
| 8384 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 8385 | resource_cfg->beacon_tx_offload_max_vdev = |
| 8386 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 8387 | resource_cfg->num_multicast_filter_entries = |
| 8388 | tgt_res_cfg->num_multicast_filter_entries; |
| 8389 | resource_cfg->num_wow_filters = |
| 8390 | tgt_res_cfg->num_wow_filters; |
| 8391 | resource_cfg->num_keep_alive_pattern = |
| 8392 | tgt_res_cfg->num_keep_alive_pattern; |
| 8393 | resource_cfg->keep_alive_pattern_size = |
| 8394 | tgt_res_cfg->keep_alive_pattern_size; |
| 8395 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 8396 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 8397 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 8398 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 8399 | resource_cfg->wmi_send_separate = |
| 8400 | tgt_res_cfg->wmi_send_separate; |
| 8401 | resource_cfg->num_ocb_vdevs = |
| 8402 | tgt_res_cfg->num_ocb_vdevs; |
| 8403 | resource_cfg->num_ocb_channels = |
| 8404 | tgt_res_cfg->num_ocb_channels; |
| 8405 | resource_cfg->num_ocb_schedules = |
| 8406 | tgt_res_cfg->num_ocb_schedules; |
| 8407 | |
| 8408 | } |
| 8409 | |
| 8410 | /** |
| 8411 | * send_init_cmd_tlv() - wmi init command |
| 8412 | * @wmi_handle: pointer to wmi handle |
| 8413 | * @res_cfg: resource config |
| 8414 | * @num_mem_chunks: no of mem chunck |
| 8415 | * @mem_chunk: pointer to mem chunck structure |
| 8416 | * |
| 8417 | * This function sends IE information to firmware |
| 8418 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8419 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8420 | * |
| 8421 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8422 | QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8423 | wmi_resource_config *tgt_res_cfg, |
| 8424 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 8425 | bool action) |
| 8426 | { |
| 8427 | wmi_buf_t buf; |
| 8428 | wmi_init_cmd_fixed_param *cmd; |
| 8429 | wmi_abi_version my_vers; |
| 8430 | int num_whitelist; |
| 8431 | uint8_t *buf_ptr; |
| 8432 | wmi_resource_config *resource_cfg; |
| 8433 | wlan_host_memory_chunk *host_mem_chunks; |
| 8434 | uint32_t mem_chunk_len = 0; |
| 8435 | uint16_t idx; |
| 8436 | int len; |
| 8437 | int ret; |
| 8438 | |
| 8439 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 8440 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 8441 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 8442 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8443 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 8444 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8445 | } |
| 8446 | |
| 8447 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8448 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 8449 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 8450 | |
| 8451 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 8452 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 8453 | + WMI_TLV_HDR_SIZE); |
| 8454 | |
| 8455 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8456 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 8457 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 8458 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8459 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8460 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 8461 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 8462 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 8463 | |
| 8464 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 8465 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 8466 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 8467 | WMITLV_GET_STRUCT_TLVLEN |
| 8468 | (wlan_host_memory_chunk)); |
| 8469 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 8470 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 8471 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8472 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8473 | idx, host_mem_chunks[idx].size, |
| 8474 | host_mem_chunks[idx].ptr); |
| 8475 | } |
| 8476 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 8477 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 8478 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 8479 | WMITLV_TAG_ARRAY_STRUC, |
| 8480 | (sizeof(wlan_host_memory_chunk) * |
| 8481 | num_mem_chunks)); |
| 8482 | |
| 8483 | num_whitelist = sizeof(version_whitelist) / |
| 8484 | sizeof(wmi_whitelist_version_info); |
| 8485 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 8486 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 8487 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 8488 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 8489 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 8490 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 8491 | |
| 8492 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 8493 | &my_vers, |
| 8494 | &wmi_handle->fw_abi_version, |
| 8495 | &cmd->host_abi_vers); |
| 8496 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8497 | 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] | 8498 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 8499 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 8500 | cmd->host_abi_vers.abi_version_ns_0, |
| 8501 | cmd->host_abi_vers.abi_version_ns_1, |
| 8502 | cmd->host_abi_vers.abi_version_ns_2, |
| 8503 | cmd->host_abi_vers.abi_version_ns_3); |
| 8504 | |
| 8505 | /* Save version sent from host - |
| 8506 | * Will be used to check ready event |
| 8507 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8508 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8509 | sizeof(wmi_abi_version)); |
| 8510 | |
| 8511 | if (action) { |
| 8512 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8513 | WMI_INIT_CMDID); |
| 8514 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8515 | 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] | 8516 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8517 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8518 | } |
| 8519 | } else { |
| 8520 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 8521 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 8522 | } |
| 8523 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8524 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8525 | |
| 8526 | } |
| 8527 | |
| 8528 | /** |
| 8529 | * send_saved_init_cmd_tlv() - wmi init command |
| 8530 | * @wmi_handle: pointer to wmi handle |
| 8531 | * |
| 8532 | * This function sends IE information to firmware |
| 8533 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8534 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8535 | * |
| 8536 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8537 | QDF_STATUS send_saved_init_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8538 | { |
| 8539 | int status; |
| 8540 | |
| 8541 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 8542 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8543 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 8544 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8545 | } |
| 8546 | status = wmi_unified_cmd_send(wmi_handle, |
| 8547 | wmi_handle->saved_wmi_init_cmd.buf, |
| 8548 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 8549 | WMI_INIT_CMDID); |
| 8550 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8551 | 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] | 8552 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8553 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8554 | } |
| 8555 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 8556 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 8557 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8558 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8559 | } |
| 8560 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8561 | 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] | 8562 | { |
| 8563 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 8564 | wmi_service_ready_event_fixed_param *ev; |
| 8565 | |
| 8566 | |
| 8567 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 8568 | |
| 8569 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 8570 | if (!ev) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8571 | qdf_assert(0); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8572 | |
| 8573 | /*Save fw version from service ready message */ |
| 8574 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8575 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8576 | sizeof(wmi_handle->fw_abi_version)); |
| 8577 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8578 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8579 | } |
| 8580 | |
| 8581 | /** |
| 8582 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 8583 | * @wmi_handle: pointer to wmi handle |
| 8584 | * @res_cfg: resource config |
| 8585 | * @num_mem_chunks: no of mem chunck |
| 8586 | * @mem_chunk: pointer to mem chunck structure |
| 8587 | * |
| 8588 | * This function sends IE information to firmware |
| 8589 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8590 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8591 | * |
| 8592 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8593 | 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] | 8594 | void *evt_buf) |
| 8595 | { |
| 8596 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 8597 | wmi_ready_event_fixed_param *ev = NULL; |
| 8598 | |
| 8599 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 8600 | ev = param_buf->fixed_param; |
| 8601 | |
| 8602 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 8603 | &ev->fw_abi_vers)) { |
| 8604 | /* |
| 8605 | * Error: Our host version and the given firmware version |
| 8606 | * are incompatible. |
| 8607 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8608 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8609 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 8610 | __func__, |
| 8611 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 8612 | abi_version_0), |
| 8613 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 8614 | abi_version_0), |
| 8615 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 8616 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 8617 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 8618 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 8619 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 8620 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 8621 | ev->fw_abi_vers.abi_version_ns_0, |
| 8622 | ev->fw_abi_vers.abi_version_ns_1, |
| 8623 | ev->fw_abi_vers.abi_version_ns_2, |
| 8624 | ev->fw_abi_vers.abi_version_ns_3); |
| 8625 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8626 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8627 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8628 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8629 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8630 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8631 | sizeof(wmi_abi_version)); |
| 8632 | |
| 8633 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8634 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 8635 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8636 | |
| 8637 | /** |
| 8638 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 8639 | * @wmi_handle: wmi handle |
| 8640 | * @custom_addr: base mac address |
| 8641 | * |
| 8642 | * Return: 0 for success or error code |
| 8643 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8644 | 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] | 8645 | uint8_t *custom_addr) |
| 8646 | { |
| 8647 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 8648 | wmi_buf_t buf; |
| 8649 | int err; |
| 8650 | |
| 8651 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8652 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8653 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8654 | return -ENOMEM; |
| 8655 | } |
| 8656 | |
| 8657 | 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] | 8658 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8659 | |
| 8660 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8661 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 8662 | WMITLV_GET_STRUCT_TLVLEN |
| 8663 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 8664 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
| 8665 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 8666 | sizeof(*cmd), |
| 8667 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 8668 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8669 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
| 8670 | qdf_mem_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8671 | return -EIO; |
| 8672 | } |
| 8673 | |
| 8674 | return 0; |
| 8675 | } |
| 8676 | |
| 8677 | /** |
| 8678 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 8679 | * @handle: wmi handle |
| 8680 | * @event: Event received from FW |
| 8681 | * @len: Length of the event |
| 8682 | * |
| 8683 | * Enables the low frequency events and disables the high frequency |
| 8684 | * events. Bit 17 indicates if the event if low/high frequency. |
| 8685 | * 1 - high frequency, 0 - low frequency |
| 8686 | * |
| 8687 | * Return: 0 on successfully enabling/disabling the events |
| 8688 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8689 | 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] | 8690 | uint8_t *event, |
| 8691 | uint32_t len) |
| 8692 | { |
| 8693 | uint32_t num_of_diag_events_logs; |
| 8694 | wmi_diag_event_log_config_fixed_param *cmd; |
| 8695 | wmi_buf_t buf; |
| 8696 | uint8_t *buf_ptr; |
| 8697 | uint32_t *cmd_args, *evt_args; |
| 8698 | uint32_t buf_len, i; |
| 8699 | |
| 8700 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 8701 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 8702 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8703 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8704 | |
| 8705 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 8706 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8707 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8708 | return -EINVAL; |
| 8709 | } |
| 8710 | wmi_event = param_buf->fixed_param; |
| 8711 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 8712 | evt_args = param_buf->diag_events_logs_list; |
| 8713 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8714 | 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] | 8715 | __func__, num_of_diag_events_logs); |
| 8716 | return -EINVAL; |
| 8717 | } |
| 8718 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8719 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8720 | __func__, num_of_diag_events_logs); |
| 8721 | |
| 8722 | /* Free any previous allocation */ |
| 8723 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8724 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8725 | |
| 8726 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8727 | 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] | 8728 | sizeof(uint32_t)); |
| 8729 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8730 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8731 | __func__); |
| 8732 | return -ENOMEM; |
| 8733 | } |
| 8734 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 8735 | |
| 8736 | /* Prepare the send buffer */ |
| 8737 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 8738 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 8739 | |
| 8740 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 8741 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8742 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8743 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8744 | wmi_handle->events_logs_list = NULL; |
| 8745 | return -ENOMEM; |
| 8746 | } |
| 8747 | |
| 8748 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 8749 | buf_ptr = (uint8_t *) cmd; |
| 8750 | |
| 8751 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8752 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 8753 | WMITLV_GET_STRUCT_TLVLEN( |
| 8754 | wmi_diag_event_log_config_fixed_param)); |
| 8755 | |
| 8756 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 8757 | |
| 8758 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 8759 | |
| 8760 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 8761 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 8762 | |
| 8763 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 8764 | |
| 8765 | /* Populate the events */ |
| 8766 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 8767 | /* Low freq (0) - Enable (1) the event |
| 8768 | * High freq (1) - Disable (0) the event |
| 8769 | */ |
| 8770 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 8771 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 8772 | /* Set the event ID */ |
| 8773 | WMI_DIAG_ID_SET(cmd_args[i], |
| 8774 | WMI_DIAG_ID_GET(evt_args[i])); |
| 8775 | /* Set the type */ |
| 8776 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 8777 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8778 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8779 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 8780 | } |
| 8781 | |
| 8782 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 8783 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8784 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8785 | __func__); |
| 8786 | wmi_buf_free(buf); |
| 8787 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 8788 | * Host can still have this list |
| 8789 | */ |
| 8790 | return -EINVAL; |
| 8791 | } |
| 8792 | |
| 8793 | return 0; |
| 8794 | } |
| 8795 | |
| 8796 | /** |
| 8797 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 8798 | * @wmi_handle: wmi handle |
| 8799 | * @start_log: Start logging related parameters |
| 8800 | * |
| 8801 | * Send the command to the FW based on which specific logging of diag |
| 8802 | * event/log id can be started/stopped |
| 8803 | * |
| 8804 | * Return: None |
| 8805 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8806 | 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] | 8807 | struct wmi_wifi_start_log *start_log) |
| 8808 | { |
| 8809 | wmi_diag_event_log_config_fixed_param *cmd; |
| 8810 | wmi_buf_t buf; |
| 8811 | uint8_t *buf_ptr; |
| 8812 | uint32_t len, count, log_level, i; |
| 8813 | uint32_t *cmd_args; |
| 8814 | uint32_t total_len; |
| 8815 | count = 0; |
| 8816 | |
| 8817 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8818 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8819 | __func__); |
| 8820 | return -ENOMEM; |
| 8821 | } |
| 8822 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 8823 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 8824 | */ |
| 8825 | total_len = 0; |
| 8826 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 8827 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 8828 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 8829 | total_len++; |
| 8830 | } |
| 8831 | |
| 8832 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 8833 | (total_len * sizeof(uint32_t)); |
| 8834 | |
| 8835 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8836 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8837 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8838 | return -ENOMEM; |
| 8839 | } |
| 8840 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 8841 | buf_ptr = (uint8_t *) cmd; |
| 8842 | |
| 8843 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8844 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 8845 | WMITLV_GET_STRUCT_TLVLEN( |
| 8846 | wmi_diag_event_log_config_fixed_param)); |
| 8847 | |
| 8848 | cmd->num_of_diag_events_logs = total_len; |
| 8849 | |
| 8850 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 8851 | |
| 8852 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 8853 | (total_len * sizeof(uint32_t))); |
| 8854 | |
| 8855 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 8856 | |
| 8857 | if (start_log->verbose_level >= LOG_LEVEL_ACTIVE) |
| 8858 | log_level = 1; |
| 8859 | else |
| 8860 | log_level = 0; |
| 8861 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8862 | 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] | 8863 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 8864 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 8865 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 8866 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 8867 | |
| 8868 | WMI_DIAG_ID_SET(cmd_args[count], |
| 8869 | WMI_DIAG_ID_GET(val)); |
| 8870 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 8871 | WMI_DIAG_TYPE_GET(val)); |
| 8872 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 8873 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8874 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8875 | count++; |
| 8876 | } |
| 8877 | } |
| 8878 | |
| 8879 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8880 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8881 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8882 | __func__); |
| 8883 | wmi_buf_free(buf); |
| 8884 | return -EINVAL; |
| 8885 | } |
| 8886 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8887 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8888 | } |
| 8889 | |
| 8890 | /** |
| 8891 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 8892 | * @wmi_handle: WMI handle |
| 8893 | * |
| 8894 | * This function is used to send the flush command to the FW, |
| 8895 | * that will flush the fw logs that are residue in the FW |
| 8896 | * |
| 8897 | * Return: None |
| 8898 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8899 | 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] | 8900 | { |
| 8901 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 8902 | wmi_buf_t buf; |
| 8903 | int len = sizeof(*cmd); |
| 8904 | int ret; |
| 8905 | |
| 8906 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8907 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8908 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8909 | return -ENOMEM; |
| 8910 | } |
| 8911 | |
| 8912 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 8913 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8914 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 8915 | WMITLV_GET_STRUCT_TLVLEN( |
| 8916 | wmi_debug_mesg_flush_fixed_param)); |
| 8917 | cmd->reserved0 = 0; |
| 8918 | |
| 8919 | ret = wmi_unified_cmd_send(wmi_handle, |
| 8920 | buf, |
| 8921 | len, |
| 8922 | WMI_DEBUG_MESG_FLUSH_CMDID); |
| 8923 | if (ret != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8924 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8925 | wmi_buf_free(buf); |
| 8926 | return -EINVAL; |
| 8927 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8928 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8929 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8930 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8931 | } |
| 8932 | |
| 8933 | /** |
| 8934 | * send_soc_set_pcl_cmd_tlv() - Send WMI_SOC_SET_PCL_CMDID to FW |
| 8935 | * @wmi_handle: wmi handle |
| 8936 | * @msg: PCL structure containing the PCL and the number of channels |
| 8937 | * |
| 8938 | * WMI_SOC_SET_PCL_CMDID provides a Preferred Channel List (PCL) to the WLAN |
| 8939 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 8940 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 8941 | * to migrate to a new channel without host driver involvement. An example of |
| 8942 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 8943 | * manage the channel selection without firmware involvement. |
| 8944 | * |
| 8945 | * Return: Success if the cmd is sent successfully to the firmware |
| 8946 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8947 | QDF_STATUS send_soc_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8948 | struct wmi_pcl_list *msg) |
| 8949 | { |
| 8950 | wmi_soc_set_pcl_cmd_fixed_param *cmd; |
| 8951 | wmi_buf_t buf; |
| 8952 | uint8_t *buf_ptr; |
| 8953 | uint32_t *cmd_args, i, len; |
| 8954 | |
| 8955 | len = sizeof(*cmd) + |
| 8956 | WMI_TLV_HDR_SIZE + (msg->pcl_len * sizeof(uint32_t)); |
| 8957 | |
| 8958 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8959 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8960 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8961 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8962 | } |
| 8963 | |
| 8964 | cmd = (wmi_soc_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
| 8965 | buf_ptr = (uint8_t *) cmd; |
| 8966 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8967 | WMITLV_TAG_STRUC_wmi_soc_set_pcl_cmd_fixed_param, |
| 8968 | WMITLV_GET_STRUCT_TLVLEN(wmi_soc_set_pcl_cmd_fixed_param)); |
| 8969 | cmd->num_chan = msg->pcl_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8970 | WMI_LOGI("%s: PCL len:%d", __func__, cmd->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8971 | |
| 8972 | buf_ptr += sizeof(wmi_soc_set_pcl_cmd_fixed_param); |
| 8973 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 8974 | (msg->pcl_len * sizeof(uint32_t))); |
| 8975 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 8976 | for (i = 0; i < msg->pcl_len ; i++) { |
| 8977 | cmd_args[i] = msg->pcl_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8978 | WMI_LOGI("%s: PCL chan:%d", __func__, cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8979 | } |
| 8980 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8981 | WMI_SOC_SET_PCL_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8982 | WMI_LOGE("%s: Failed to send WMI_SOC_SET_PCL_CMDID", __func__); |
| 8983 | qdf_nbuf_free(buf); |
| 8984 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8985 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8986 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 8987 | } |
| 8988 | |
| 8989 | /** |
| 8990 | * send_soc_set_hw_mode_cmd_tlv() - Send WMI_SOC_SET_HW_MODE_CMDID to FW |
| 8991 | * @wmi_handle: wmi handle |
| 8992 | * @msg: Structure containing the following parameters |
| 8993 | * |
| 8994 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 8995 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 8996 | * |
| 8997 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 8998 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 8999 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 9000 | * |
| 9001 | * Return: Success if the cmd is sent successfully to the firmware |
| 9002 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9003 | QDF_STATUS send_soc_set_hw_mode_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9004 | uint32_t hw_mode_index) |
| 9005 | { |
| 9006 | wmi_soc_set_hw_mode_cmd_fixed_param *cmd; |
| 9007 | wmi_buf_t buf; |
| 9008 | uint32_t len; |
| 9009 | |
| 9010 | len = sizeof(*cmd); |
| 9011 | |
| 9012 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9013 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9014 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9015 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9016 | } |
| 9017 | |
| 9018 | cmd = (wmi_soc_set_hw_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 9019 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9020 | WMITLV_TAG_STRUC_wmi_soc_set_hw_mode_cmd_fixed_param, |
| 9021 | WMITLV_GET_STRUCT_TLVLEN(wmi_soc_set_hw_mode_cmd_fixed_param)); |
| 9022 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9023 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9024 | |
| 9025 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9026 | WMI_SOC_SET_HW_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9027 | WMI_LOGE("%s: Failed to send WMI_SOC_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9028 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9029 | qdf_nbuf_free(buf); |
| 9030 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9031 | } |
| 9032 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9033 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9034 | } |
| 9035 | |
| 9036 | /** |
| 9037 | * send_soc_set_dual_mac_config_cmd_tlv() - Set dual mac config to FW |
| 9038 | * @wmi_handle: wmi handle |
| 9039 | * @msg: Dual MAC config parameters |
| 9040 | * |
| 9041 | * Configures WLAN firmware with the dual MAC features |
| 9042 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9043 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9044 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9045 | QDF_STATUS send_soc_set_dual_mac_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9046 | struct wmi_dual_mac_config *msg) |
| 9047 | { |
| 9048 | wmi_soc_set_dual_mac_config_cmd_fixed_param *cmd; |
| 9049 | wmi_buf_t buf; |
| 9050 | uint32_t len; |
| 9051 | |
| 9052 | len = sizeof(*cmd); |
| 9053 | |
| 9054 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9055 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9056 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9057 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9058 | } |
| 9059 | |
| 9060 | cmd = (wmi_soc_set_dual_mac_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 9061 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9062 | WMITLV_TAG_STRUC_wmi_soc_set_dual_mac_config_cmd_fixed_param, |
| 9063 | WMITLV_GET_STRUCT_TLVLEN( |
| 9064 | wmi_soc_set_dual_mac_config_cmd_fixed_param)); |
| 9065 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 9066 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9067 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9068 | __func__, msg->scan_config, msg->fw_mode_config); |
| 9069 | |
| 9070 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9071 | WMI_SOC_SET_DUAL_MAC_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9072 | WMI_LOGE("%s: Failed to send WMI_SOC_SET_DUAL_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9073 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9074 | qdf_nbuf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9075 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9076 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9077 | } |
| 9078 | |
| 9079 | /** |
| 9080 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 9081 | * @wma: wmi handle |
| 9082 | * @tpSirHostOffloadReq: offload request |
| 9083 | * @arp_only: flag |
| 9084 | * |
| 9085 | * To configure ARP NS off load data to firmware |
| 9086 | * when target goes to wow mode. |
| 9087 | * |
| 9088 | * Return: CDF Status |
| 9089 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9090 | QDF_STATUS send_enable_arp_ns_offload_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9091 | struct host_offload_req_param *param, bool arp_only, |
| 9092 | uint8_t vdev_id) |
| 9093 | { |
| 9094 | int32_t i; |
| 9095 | int32_t res; |
| 9096 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
| 9097 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 9098 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
| 9099 | A_UINT8 *buf_ptr; |
| 9100 | wmi_buf_t buf; |
| 9101 | int32_t len; |
| 9102 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 9103 | |
| 9104 | |
| 9105 | if (!arp_only) |
| 9106 | count = param->num_ns_offload_count; |
| 9107 | /* |
| 9108 | * TLV place holder size for array of NS tuples |
| 9109 | * TLV place holder size for array of ARP tuples |
| 9110 | */ |
| 9111 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + WMI_TLV_HDR_SIZE + |
| 9112 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + WMI_TLV_HDR_SIZE + |
| 9113 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 9114 | |
| 9115 | /* |
| 9116 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 9117 | * extra length for extended NS offload tuples which follows ARP offload |
| 9118 | * tuples. Host needs to fill this structure in following format: |
| 9119 | * 2 NS ofload tuples |
| 9120 | * 2 ARP offload tuples |
| 9121 | * N numbers of extended NS offload tuples if HDD has given more than |
| 9122 | * 2 NS offload addresses |
| 9123 | */ |
| 9124 | if (!arp_only && count > WMI_MAX_NS_OFFLOADS) { |
| 9125 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
| 9126 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples * |
| 9127 | sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 9128 | } |
| 9129 | |
| 9130 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9131 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9132 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9133 | qdf_mem_free(param); |
| 9134 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9135 | } |
| 9136 | |
| 9137 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 9138 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 9139 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9140 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 9141 | WMITLV_GET_STRUCT_TLVLEN |
| 9142 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 9143 | cmd->flags = 0; |
| 9144 | cmd->vdev_id = vdev_id; |
| 9145 | if (!arp_only) |
| 9146 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
| 9147 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9148 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9149 | |
| 9150 | /* Have copy of arp info to send along with NS, Since FW expects |
| 9151 | * both ARP and NS info in single cmd */ |
| 9152 | if (arp_only) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9153 | qdf_mem_copy(&wmi_handle->arp_info, param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9154 | sizeof(tSirHostOffloadReq)); |
| 9155 | |
| 9156 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
| 9157 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9158 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 9159 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9160 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 9161 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *) buf_ptr; |
| 9162 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 9163 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 9164 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - |
| 9165 | WMI_TLV_HDR_SIZE)); |
| 9166 | |
| 9167 | /* Fill data only for NS offload in the first ARP tuple for LA */ |
| 9168 | if (!arp_only && |
| 9169 | ((param->enableOrDisable & SIR_OFFLOAD_ENABLE))) { |
| 9170 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 9171 | |
| 9172 | #ifdef WLAN_NS_OFFLOAD |
| 9173 | /*Copy the target/solicitation/remote ip addr */ |
| 9174 | if (param->nsOffloadInfo. |
| 9175 | targetIPv6AddrValid[i]) |
| 9176 | A_MEMCPY(&ns_tuple->target_ipaddr[0], |
| 9177 | ¶m->nsOffloadInfo. |
| 9178 | targetIPv6Addr[i], |
| 9179 | sizeof(WMI_IPV6_ADDR)); |
| 9180 | A_MEMCPY(&ns_tuple->solicitation_ipaddr, |
| 9181 | ¶m->nsOffloadInfo. |
| 9182 | selfIPv6Addr[i], sizeof(WMI_IPV6_ADDR)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9183 | WMI_LOGD("NS solicitedIp: %pI6, targetIp: %pI6", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9184 | ¶m->nsOffloadInfo.selfIPv6Addr[i], |
| 9185 | ¶m->nsOffloadInfo. |
| 9186 | targetIPv6Addr[i]); |
| 9187 | |
| 9188 | /* target MAC is optional, check if it is valid, |
| 9189 | * if this is not valid, the target will use the known |
| 9190 | * local MAC address rather than the tuple |
| 9191 | */ |
| 9192 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param-> |
| 9193 | nsOffloadInfo.self_macaddr.bytes, |
| 9194 | &ns_tuple->target_mac); |
| 9195 | #endif /* WLAN_NS_OFFLOAD */ |
| 9196 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 9197 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 9198 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 9199 | } |
| 9200 | } |
| 9201 | buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 9202 | } |
| 9203 | |
| 9204 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9205 | (WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 9206 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9207 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 9208 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *) buf_ptr; |
| 9209 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 9210 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 9211 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 9212 | |
| 9213 | /* Fill data for ARP and NS in the first tupple for LA */ |
| 9214 | if ((wmi_handle->arp_info.enableOrDisable & SIR_OFFLOAD_ENABLE) |
| 9215 | && (i == 0)) { |
| 9216 | /*Copy the target ip addr and flags */ |
| 9217 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 9218 | A_MEMCPY(&arp_tuple->target_ipaddr, |
| 9219 | wmi_handle->arp_info.params.hostIpv4Addr, |
| 9220 | SIR_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9221 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9222 | wmi_handle->arp_info.params.hostIpv4Addr); |
| 9223 | } |
| 9224 | buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 9225 | } |
| 9226 | |
| 9227 | /* Populate extended NS offload tuples */ |
| 9228 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9229 | (num_ns_ext_tuples*sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 9230 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9231 | |
| 9232 | if (num_ns_ext_tuples) { |
| 9233 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 9234 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)buf_ptr; |
| 9235 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 9236 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 9237 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 9238 | |
| 9239 | /* Fill data only for NS offload in the first ARP tuple for LA */ |
| 9240 | if (!arp_only && |
| 9241 | ((param->enableOrDisable & SIR_OFFLOAD_ENABLE))) { |
| 9242 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 9243 | #ifdef WLAN_NS_OFFLOAD |
| 9244 | /*Copy the target/solicitation/remote ip addr */ |
| 9245 | if (param->nsOffloadInfo.targetIPv6AddrValid[i]) |
| 9246 | A_MEMCPY(&ns_tuple->target_ipaddr[0], |
| 9247 | ¶m->nsOffloadInfo.targetIPv6Addr[i], |
| 9248 | sizeof(WMI_IPV6_ADDR)); |
| 9249 | A_MEMCPY(&ns_tuple->solicitation_ipaddr, |
| 9250 | ¶m->nsOffloadInfo.selfIPv6Addr[i], |
| 9251 | sizeof(WMI_IPV6_ADDR)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9252 | WMI_LOGD("Index %d NS solicitedIp: %pI6, targetIp: %pI6", i, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9253 | ¶m->nsOffloadInfo.selfIPv6Addr[i], |
| 9254 | ¶m->nsOffloadInfo.targetIPv6Addr[i]); |
| 9255 | |
| 9256 | /* target MAC is optional, check if it is valid, if this is not valid, |
| 9257 | * the target will use the known local MAC address rather than the tuple */ |
| 9258 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 9259 | param->nsOffloadInfo.self_macaddr.bytes, |
| 9260 | &ns_tuple->target_mac); |
| 9261 | #endif |
| 9262 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 9263 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 9264 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 9265 | } |
| 9266 | } |
| 9267 | buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 9268 | } |
| 9269 | } |
| 9270 | |
| 9271 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9272 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 9273 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9274 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9275 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9276 | qdf_mem_free(param); |
| 9277 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9278 | } |
| 9279 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9280 | qdf_mem_free(param); |
| 9281 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9282 | } |
| 9283 | |
| 9284 | /** |
| 9285 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 9286 | * @wmi_handle: wmi handle |
| 9287 | * @request: SSID hotlist set request |
| 9288 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9289 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9290 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9291 | QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9292 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 9293 | struct ssid_hotlist_request_params *request) |
| 9294 | { |
| 9295 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 9296 | wmi_buf_t wmi_buf; |
| 9297 | uint32_t len; |
| 9298 | uint32_t array_size; |
| 9299 | uint8_t *buf_ptr; |
| 9300 | |
| 9301 | /* length of fixed portion */ |
| 9302 | len = sizeof(*cmd); |
| 9303 | |
| 9304 | /* length of variable portion */ |
| 9305 | array_size = |
| 9306 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 9307 | len += WMI_TLV_HDR_SIZE + array_size; |
| 9308 | |
| 9309 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9310 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9311 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9312 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9313 | } |
| 9314 | |
| 9315 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9316 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 9317 | buf_ptr; |
| 9318 | WMITLV_SET_HDR |
| 9319 | (&cmd->tlv_header, |
| 9320 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 9321 | WMITLV_GET_STRUCT_TLVLEN |
| 9322 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 9323 | |
| 9324 | cmd->request_id = request->request_id; |
| 9325 | cmd->requestor_id = 0; |
| 9326 | cmd->vdev_id = request->session_id; |
| 9327 | cmd->table_id = 0; |
| 9328 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 9329 | cmd->total_entries = request->ssid_count; |
| 9330 | cmd->num_entries_in_page = request->ssid_count; |
| 9331 | cmd->first_entry_index = 0; |
| 9332 | |
| 9333 | buf_ptr += sizeof(*cmd); |
| 9334 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 9335 | |
| 9336 | if (request->ssid_count) { |
| 9337 | wmi_extscan_hotlist_ssid_entry *entry; |
| 9338 | int i; |
| 9339 | |
| 9340 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9341 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 9342 | for (i = 0; i < request->ssid_count; i++) { |
| 9343 | WMITLV_SET_HDR |
| 9344 | (entry, |
| 9345 | WMITLV_TAG_ARRAY_STRUC, |
| 9346 | WMITLV_GET_STRUCT_TLVLEN |
| 9347 | (wmi_extscan_hotlist_ssid_entry)); |
| 9348 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9349 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9350 | request->ssids[i].ssid.mac_ssid, |
| 9351 | request->ssids[i].ssid.length); |
| 9352 | entry->band = request->ssids[i].band; |
| 9353 | entry->min_rssi = request->ssids[i].rssi_low; |
| 9354 | entry->max_rssi = request->ssids[i].rssi_high; |
| 9355 | entry++; |
| 9356 | } |
| 9357 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 9358 | } else { |
| 9359 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 9360 | } |
| 9361 | |
| 9362 | if (wmi_unified_cmd_send |
| 9363 | (wmi_handle, wmi_buf, len, |
| 9364 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9365 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9366 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9367 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9368 | } |
| 9369 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9370 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9371 | } |
| 9372 | |
| 9373 | /** |
| 9374 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 9375 | * @wmi_handle: wmi handle |
| 9376 | * @vdev_id: vdev id |
| 9377 | * |
| 9378 | * This function sends roam synch complete event to fw. |
| 9379 | * |
| 9380 | * Return: CDF STATUS |
| 9381 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9382 | 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] | 9383 | uint8_t vdev_id) |
| 9384 | { |
| 9385 | wmi_roam_synch_complete_fixed_param *cmd; |
| 9386 | wmi_buf_t wmi_buf; |
| 9387 | uint8_t *buf_ptr; |
| 9388 | uint16_t len; |
| 9389 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 9390 | |
| 9391 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9392 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9393 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9394 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9395 | } |
| 9396 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 9397 | buf_ptr = (uint8_t *) cmd; |
| 9398 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9399 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 9400 | WMITLV_GET_STRUCT_TLVLEN |
| 9401 | (wmi_roam_synch_complete_fixed_param)); |
| 9402 | cmd->vdev_id = vdev_id; |
| 9403 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9404 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9405 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9406 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9407 | qdf_nbuf_free(wmi_buf); |
| 9408 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9409 | } |
| 9410 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9411 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9412 | } |
| 9413 | |
| 9414 | /** |
| 9415 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 9416 | * @wmi_handle: wmi handle |
| 9417 | * @wmi_utest: unit test command |
| 9418 | * |
| 9419 | * This function send unit test command to fw. |
| 9420 | * |
| 9421 | * Return: CDF STATUS |
| 9422 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9423 | QDF_STATUS send_unit_test_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9424 | struct wmi_unit_test_cmd *wmi_utest) |
| 9425 | { |
| 9426 | wmi_unit_test_cmd_fixed_param *cmd; |
| 9427 | wmi_buf_t wmi_buf; |
| 9428 | uint8_t *buf_ptr; |
| 9429 | int i; |
| 9430 | uint16_t len, args_tlv_len; |
| 9431 | A_UINT32 *unit_test_cmd_args; |
| 9432 | |
| 9433 | args_tlv_len = |
| 9434 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 9435 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 9436 | |
| 9437 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9438 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9439 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9440 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9441 | } |
| 9442 | |
| 9443 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9444 | buf_ptr = (uint8_t *) cmd; |
| 9445 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9446 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 9447 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 9448 | cmd->vdev_id = wmi_utest->vdev_id; |
| 9449 | cmd->module_id = wmi_utest->module_id; |
| 9450 | cmd->num_args = wmi_utest->num_args; |
| 9451 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 9452 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9453 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 9454 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9455 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9456 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 9457 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9458 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9459 | } |
| 9460 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9461 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9462 | WMI_LOGP("%s: failed to send unit test command", __func__); |
| 9463 | qdf_nbuf_free(wmi_buf); |
| 9464 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9465 | } |
| 9466 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9467 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9468 | } |
| 9469 | |
| 9470 | /** |
| 9471 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 9472 | * @wmi_handle: wma handle |
| 9473 | * @roaminvoke: roam invoke command |
| 9474 | * |
| 9475 | * Send roam invoke command to fw for fastreassoc. |
| 9476 | * |
| 9477 | * Return: CDF STATUS |
| 9478 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9479 | QDF_STATUS send_roam_invoke_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9480 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 9481 | uint32_t ch_hz) |
| 9482 | { |
| 9483 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 9484 | wmi_buf_t wmi_buf; |
| 9485 | u_int8_t *buf_ptr; |
| 9486 | u_int16_t len, args_tlv_len; |
| 9487 | A_UINT32 *channel_list; |
| 9488 | wmi_mac_addr *bssid_list; |
| 9489 | |
| 9490 | /* Host sends only one channel and one bssid */ |
| 9491 | args_tlv_len = 2 * WMI_TLV_HDR_SIZE + sizeof(A_UINT32) + |
| 9492 | sizeof(wmi_mac_addr); |
| 9493 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 9494 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9495 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9496 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9497 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9498 | } |
| 9499 | |
| 9500 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 9501 | buf_ptr = (u_int8_t *) cmd; |
| 9502 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9503 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 9504 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 9505 | cmd->vdev_id = roaminvoke->vdev_id; |
| 9506 | cmd->flags = 0; |
| 9507 | cmd->roam_scan_mode = 0; |
| 9508 | cmd->roam_ap_sel_mode = 0; |
| 9509 | cmd->roam_delay = 0; |
| 9510 | cmd->num_chan = 1; |
| 9511 | cmd->num_bssid = 1; |
| 9512 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 9513 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9514 | (sizeof(u_int32_t))); |
| 9515 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 9516 | *channel_list = ch_hz; |
| 9517 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 9518 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 9519 | (sizeof(wmi_mac_addr))); |
| 9520 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 9521 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
| 9522 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9523 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9524 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9525 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9526 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9527 | } |
| 9528 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9529 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9530 | } |
| 9531 | |
| 9532 | /** |
| 9533 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 9534 | * @wmi_handle: wmi handle |
| 9535 | * @command: command |
| 9536 | * @vdev_id: vdev id |
| 9537 | * |
| 9538 | * This function set roam offload command to fw. |
| 9539 | * |
| 9540 | * Return: CDF status |
| 9541 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9542 | 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] | 9543 | uint32_t command, uint32_t vdev_id) |
| 9544 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9545 | QDF_STATUS qdf_status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9546 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 9547 | wmi_buf_t buf = NULL; |
| 9548 | int status = 0; |
| 9549 | int len; |
| 9550 | uint8_t *buf_ptr; |
| 9551 | |
| 9552 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 9553 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9554 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9555 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9556 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9557 | } |
| 9558 | |
| 9559 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9560 | |
| 9561 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 9562 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 9563 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 9564 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 9565 | cmd_fp->vdev_id = vdev_id; |
| 9566 | cmd_fp->command_arg = command; |
| 9567 | |
| 9568 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9569 | len, WMI_ROAM_SCAN_CMD); |
| 9570 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9571 | 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] | 9572 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9573 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9574 | goto error; |
| 9575 | } |
| 9576 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9577 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 9578 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9579 | |
| 9580 | error: |
| 9581 | wmi_buf_free(buf); |
| 9582 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9583 | return qdf_status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9584 | } |
| 9585 | |
| 9586 | /** |
| 9587 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 9588 | * @wmi_handle: wmi handle |
| 9589 | * @ap_profile_p: ap profile |
| 9590 | * @vdev_id: vdev id |
| 9591 | * |
| 9592 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 9593 | * |
| 9594 | * Return: CDF status |
| 9595 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9596 | 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] | 9597 | wmi_ap_profile *ap_profile_p, |
| 9598 | uint32_t vdev_id) |
| 9599 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9600 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9601 | wmi_buf_t buf = NULL; |
| 9602 | int status = 0; |
| 9603 | int len; |
| 9604 | uint8_t *buf_ptr; |
| 9605 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 9606 | |
| 9607 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 9608 | |
| 9609 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9610 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9611 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9612 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9613 | } |
| 9614 | |
| 9615 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9616 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 9617 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 9618 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 9619 | WMITLV_GET_STRUCT_TLVLEN |
| 9620 | (wmi_roam_ap_profile_fixed_param)); |
| 9621 | /* fill in threshold values */ |
| 9622 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 9623 | roam_ap_profile_fp->id = 0; |
| 9624 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 9625 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9626 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9627 | WMITLV_SET_HDR(buf_ptr, |
| 9628 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 9629 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 9630 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9631 | len, WMI_ROAM_AP_PROFILE); |
| 9632 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9633 | 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] | 9634 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9635 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9636 | goto error; |
| 9637 | } |
| 9638 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9639 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
| 9640 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9641 | error: |
| 9642 | wmi_buf_free(buf); |
| 9643 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9644 | return qdf_status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9645 | } |
| 9646 | |
| 9647 | /** |
| 9648 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 9649 | * @wmi_handle: wmi handle |
| 9650 | * @scan_period: scan period |
| 9651 | * @scan_age: scan age |
| 9652 | * @vdev_id: vdev id |
| 9653 | * |
| 9654 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 9655 | * |
| 9656 | * Return: CDF status |
| 9657 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9658 | 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] | 9659 | uint32_t scan_period, |
| 9660 | uint32_t scan_age, |
| 9661 | uint32_t vdev_id) |
| 9662 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9663 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9664 | wmi_buf_t buf = NULL; |
| 9665 | int status = 0; |
| 9666 | int len; |
| 9667 | uint8_t *buf_ptr; |
| 9668 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 9669 | |
| 9670 | /* Send scan period values */ |
| 9671 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 9672 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9673 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9674 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9675 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9676 | } |
| 9677 | |
| 9678 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9679 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 9680 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 9681 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 9682 | WMITLV_GET_STRUCT_TLVLEN |
| 9683 | (wmi_roam_scan_period_fixed_param)); |
| 9684 | /* fill in scan period values */ |
| 9685 | scan_period_fp->vdev_id = vdev_id; |
| 9686 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 9687 | scan_period_fp->roam_scan_age = scan_age; |
| 9688 | |
| 9689 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9690 | len, WMI_ROAM_SCAN_PERIOD); |
| 9691 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9692 | 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] | 9693 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9694 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9695 | goto error; |
| 9696 | } |
| 9697 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9698 | 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] | 9699 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9700 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9701 | error: |
| 9702 | wmi_buf_free(buf); |
| 9703 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9704 | return qdf_status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9705 | } |
| 9706 | |
| 9707 | /** |
| 9708 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 9709 | * @wmi_handle: wmi handle |
| 9710 | * @chan_count: channel count |
| 9711 | * @chan_list: channel list |
| 9712 | * @list_type: list type |
| 9713 | * @vdev_id: vdev id |
| 9714 | * |
| 9715 | * Set roam offload channel list. |
| 9716 | * |
| 9717 | * Return: CDF status |
| 9718 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9719 | 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] | 9720 | uint8_t chan_count, |
| 9721 | uint8_t *chan_list, |
| 9722 | uint8_t list_type, uint32_t vdev_id) |
| 9723 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9724 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9725 | wmi_buf_t buf = NULL; |
| 9726 | int status = 0; |
| 9727 | int len, list_tlv_len; |
| 9728 | int i; |
| 9729 | uint8_t *buf_ptr; |
| 9730 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 9731 | A_UINT32 *roam_chan_list_array; |
| 9732 | |
| 9733 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9734 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9735 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9736 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9737 | } |
| 9738 | /* Channel list is a table of 2 TLV's */ |
| 9739 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 9740 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 9741 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9742 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9743 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9744 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9745 | } |
| 9746 | |
| 9747 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9748 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 9749 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 9750 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 9751 | WMITLV_GET_STRUCT_TLVLEN |
| 9752 | (wmi_roam_chan_list_fixed_param)); |
| 9753 | chan_list_fp->vdev_id = vdev_id; |
| 9754 | chan_list_fp->num_chan = chan_count; |
| 9755 | if (chan_count > 0 && list_type == CHANNEL_LIST_STATIC) { |
| 9756 | /* external app is controlling channel list */ |
| 9757 | chan_list_fp->chan_list_type = |
| 9758 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 9759 | } else { |
| 9760 | /* umac supplied occupied channel list in LFR */ |
| 9761 | chan_list_fp->chan_list_type = |
| 9762 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 9763 | } |
| 9764 | |
| 9765 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 9766 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9767 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 9768 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9769 | WMI_LOGI("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9770 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 9771 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 9772 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9773 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9774 | } |
| 9775 | |
| 9776 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9777 | len, WMI_ROAM_CHAN_LIST); |
| 9778 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9779 | 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] | 9780 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9781 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9782 | goto error; |
| 9783 | } |
| 9784 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9785 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
| 9786 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9787 | error: |
| 9788 | wmi_buf_free(buf); |
| 9789 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9790 | return qdf_status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9791 | } |
| 9792 | |
| 9793 | /** |
| 9794 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 9795 | * @wmi_handle: wmi handle |
| 9796 | * @rssi_change_thresh: RSSI Change threshold |
| 9797 | * @bcn_rssi_weight: beacon RSSI weight |
| 9798 | * @vdev_id: vdev id |
| 9799 | * |
| 9800 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 9801 | * |
| 9802 | * Return: CDF status |
| 9803 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9804 | 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] | 9805 | uint32_t vdev_id, |
| 9806 | int32_t rssi_change_thresh, |
| 9807 | uint32_t bcn_rssi_weight, |
| 9808 | uint32_t hirssi_delay_btw_scans) |
| 9809 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9810 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9811 | wmi_buf_t buf = NULL; |
| 9812 | int status = 0; |
| 9813 | int len; |
| 9814 | uint8_t *buf_ptr; |
| 9815 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 9816 | |
| 9817 | /* Send rssi change parameters */ |
| 9818 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 9819 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9820 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9821 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9822 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9823 | } |
| 9824 | |
| 9825 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9826 | rssi_change_fp = |
| 9827 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 9828 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 9829 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 9830 | WMITLV_GET_STRUCT_TLVLEN |
| 9831 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 9832 | /* fill in rssi change threshold (hysteresis) values */ |
| 9833 | rssi_change_fp->vdev_id = vdev_id; |
| 9834 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 9835 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 9836 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 9837 | |
| 9838 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9839 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
| 9840 | if (status != EOK) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9841 | 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] | 9842 | status); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9843 | qdf_status = QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9844 | goto error; |
| 9845 | } |
| 9846 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9847 | 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] | 9848 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9849 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 9850 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9851 | error: |
| 9852 | wmi_buf_free(buf); |
| 9853 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9854 | return qdf_status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9855 | } |
| 9856 | |
| 9857 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 9858 | * @wmi_handle: wmi handle. |
| 9859 | * @cmd: size of command structure. |
| 9860 | * @per_entry_size: per entry size. |
| 9861 | * |
| 9862 | * This utility function calculates how many hotlist entries can |
| 9863 | * fit in one page. |
| 9864 | * |
| 9865 | * Return: number of entries |
| 9866 | */ |
| 9867 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 9868 | size_t cmd_size, |
| 9869 | size_t per_entry_size) |
| 9870 | { |
| 9871 | uint32_t avail_space = 0; |
| 9872 | int num_entries = 0; |
| 9873 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 9874 | |
| 9875 | /* Calculate number of hotlist entries that can |
| 9876 | * be passed in wma message request. |
| 9877 | */ |
| 9878 | avail_space = max_msg_len - cmd_size; |
| 9879 | num_entries = avail_space / per_entry_size; |
| 9880 | return num_entries; |
| 9881 | } |
| 9882 | |
| 9883 | /** |
| 9884 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 9885 | * @wmi_handle: wmi handle |
| 9886 | * @photlist: hotlist command params |
| 9887 | * @buf_len: buffer length |
| 9888 | * |
| 9889 | * This function fills individual elements for hotlist request and |
| 9890 | * TLV for bssid entries |
| 9891 | * |
| 9892 | * Return: CDF Status. |
| 9893 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9894 | 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] | 9895 | struct ext_scan_setbssi_hotlist_params * |
| 9896 | photlist, int *buf_len) |
| 9897 | { |
| 9898 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 9899 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 9900 | struct ap_threshold_params *src_ap = photlist->ap; |
| 9901 | wmi_buf_t buf; |
| 9902 | uint8_t *buf_ptr; |
| 9903 | |
| 9904 | int j, index = 0; |
| 9905 | int cmd_len = 0; |
| 9906 | int num_entries; |
| 9907 | int min_entries = 0; |
| 9908 | int numap = photlist->numAp; |
| 9909 | int len = sizeof(*cmd); |
| 9910 | |
| 9911 | len += WMI_TLV_HDR_SIZE; |
| 9912 | cmd_len = len; |
| 9913 | |
| 9914 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 9915 | cmd_len, |
| 9916 | sizeof(*dest_hotlist)); |
| 9917 | /* setbssid hotlist expects the bssid list |
| 9918 | * to be non zero value |
| 9919 | */ |
| 9920 | if (!numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9921 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 9922 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9923 | } |
| 9924 | |
| 9925 | /* Split the hot list entry pages and send multiple command |
| 9926 | * requests if the buffer reaches the maximum request size |
| 9927 | */ |
| 9928 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9929 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9930 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 9931 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9932 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9933 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9934 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9935 | } |
| 9936 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9937 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 9938 | buf_ptr; |
| 9939 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9940 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 9941 | WMITLV_GET_STRUCT_TLVLEN |
| 9942 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 9943 | |
| 9944 | /* Multiple requests are sent until the num_entries_in_page |
| 9945 | * matches the total_entries |
| 9946 | */ |
| 9947 | cmd->request_id = photlist->requestId; |
| 9948 | cmd->vdev_id = photlist->sessionId; |
| 9949 | cmd->total_entries = numap; |
| 9950 | cmd->mode = 1; |
| 9951 | cmd->num_entries_in_page = min_entries; |
| 9952 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 9953 | cmd->first_entry_index = index; |
| 9954 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9955 | 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] | 9956 | __func__, cmd->vdev_id, cmd->total_entries, |
| 9957 | cmd->num_entries_in_page, |
| 9958 | cmd->lost_ap_scan_count); |
| 9959 | |
| 9960 | buf_ptr += sizeof(*cmd); |
| 9961 | WMITLV_SET_HDR(buf_ptr, |
| 9962 | WMITLV_TAG_ARRAY_STRUC, |
| 9963 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 9964 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 9965 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9966 | |
| 9967 | /* Populate bssid, channel info and rssi |
| 9968 | * for the bssid's that are sent as hotlists. |
| 9969 | */ |
| 9970 | for (j = 0; j < min_entries; j++) { |
| 9971 | WMITLV_SET_HDR(dest_hotlist, |
| 9972 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 9973 | WMITLV_GET_STRUCT_TLVLEN |
| 9974 | (wmi_extscan_hotlist_entry)); |
| 9975 | |
| 9976 | dest_hotlist->min_rssi = src_ap->low; |
| 9977 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 9978 | &dest_hotlist->bssid); |
| 9979 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9980 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9981 | __func__, dest_hotlist->channel, |
| 9982 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9983 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9984 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 9985 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 9986 | dest_hotlist->bssid.mac_addr47to32); |
| 9987 | dest_hotlist++; |
| 9988 | src_ap++; |
| 9989 | } |
| 9990 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 9991 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 9992 | |
| 9993 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9994 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9995 | WMI_LOGE("%s: failed to send command", __func__); |
| 9996 | qdf_nbuf_free(buf); |
| 9997 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 9998 | } |
| 9999 | index = index + min_entries; |
| 10000 | num_entries = numap - min_entries; |
| 10001 | len = cmd_len; |
| 10002 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10003 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10004 | } |
| 10005 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10006 | struct wmi_ops tlv_ops = { |
| 10007 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 10008 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 10009 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
| 10010 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 10011 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 10012 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10013 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10014 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10015 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10016 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 10017 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 10018 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 10019 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 10020 | .send_resume_cmd = send_resume_cmd_tlv, |
| 10021 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 10022 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 10023 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 10024 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 10025 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 10026 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 10027 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 10028 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
| 10029 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
| 10030 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 10031 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 10032 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 10033 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10034 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
| 10035 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 10036 | .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] | 10037 | .send_set_sta_uapsd_auto_trig_cmd = |
| 10038 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 10039 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 10040 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 10041 | .send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv, |
| 10042 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 10043 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 10044 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 10045 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 10046 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 10047 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 10048 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 10049 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 10050 | .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] | 10051 | .send_ocb_start_timing_advert_cmd = |
| 10052 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 10053 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 10054 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 10055 | .send_set_mcc_channel_time_latency_cmd = |
| 10056 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 10057 | .send_set_mcc_channel_time_quota_cmd = |
| 10058 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 10059 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 10060 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 10061 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
| 10062 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 10063 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 10064 | .send_vdev_set_gtx_cfg_cmd = send_vdev_set_gtx_cfg_cmd_tlv, |
| 10065 | .send_process_update_edca_param_cmd = |
| 10066 | send_process_update_edca_param_cmd_tlv, |
| 10067 | .send_probe_rsp_tmpl_send_cmd = |
| 10068 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 10069 | .send_p2p_go_set_beacon_ie_cmd = |
| 10070 | send_p2p_go_set_beacon_ie_cmd_tlv, |
| 10071 | .send_set_gateway_params_cmd = |
| 10072 | send_set_gateway_params_cmd_tlv, |
| 10073 | .send_set_rssi_monitoring_cmd = |
| 10074 | send_set_rssi_monitoring_cmd_tlv, |
| 10075 | .send_scan_probe_setoui_cmd = |
| 10076 | send_scan_probe_setoui_cmd_tlv, |
| 10077 | .send_reset_passpoint_network_list_cmd = |
| 10078 | send_reset_passpoint_network_list_cmd_tlv, |
| 10079 | .send_set_passpoint_network_list_cmd = |
| 10080 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame^] | 10081 | .send_roam_scan_offload_mode_cmd = |
| 10082 | send_roam_scan_offload_mode_cmd_tlv, |
| 10083 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 10084 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
| 10085 | .send_roam_scan_filter_cmd = |
| 10086 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 10087 | .send_set_epno_network_list_cmd = |
| 10088 | send_set_epno_network_list_cmd_tlv, |
| 10089 | .send_ipa_offload_control_cmd = |
| 10090 | send_ipa_offload_control_cmd_tlv, |
| 10091 | .send_extscan_get_capabilities_cmd = |
| 10092 | send_extscan_get_capabilities_cmd_tlv, |
| 10093 | .send_extscan_get_cached_results_cmd = |
| 10094 | send_extscan_get_cached_results_cmd_tlv, |
| 10095 | .send_extscan_stop_change_monitor_cmd = |
| 10096 | send_extscan_stop_change_monitor_cmd_tlv, |
| 10097 | .send_extscan_start_change_monitor_cmd = |
| 10098 | send_extscan_start_change_monitor_cmd_tlv, |
| 10099 | .send_extscan_stop_hotlist_monitor_cmd = |
| 10100 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 10101 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 10102 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 10103 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 10104 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 10105 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
| 10106 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
| 10107 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 10108 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 10109 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 10110 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 10111 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10112 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 10113 | .send_snr_cmd = send_snr_cmd_tlv, |
| 10114 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
| 10115 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 10116 | .send_lphb_config_tcp_params_cmd = send_lphb_config_tcp_params_cmd_tlv, |
| 10117 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 10118 | .send_lphb_config_udp_pkt_filter_cmd = |
| 10119 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
| 10120 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 10121 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 10122 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
| 10123 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 10124 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
| 10125 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
| 10126 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 10127 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
| 10128 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 10129 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
| 10130 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 10131 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 10132 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 10133 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 10134 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 10135 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 10136 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 10137 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
| 10138 | .send_enable_disable_packet_filter_cmd = |
| 10139 | send_enable_disable_packet_filter_cmd_tlv, |
| 10140 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
| 10141 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
| 10142 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 10143 | .send_process_gtk_offload_getinfo_cmd = |
| 10144 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 10145 | .send_process_add_periodic_tx_ptrn_cmd = |
| 10146 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 10147 | .send_process_del_periodic_tx_ptrn_cmd = |
| 10148 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 10149 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 10150 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 10151 | .send_set_app_type2_params_in_fw_cmd = |
| 10152 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 10153 | .send_set_auto_shutdown_timer_cmd = |
| 10154 | send_set_auto_shutdown_timer_cmd_tlv, |
| 10155 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 10156 | .send_process_dhcpserver_offload_cmd = |
| 10157 | send_process_dhcpserver_offload_cmd_tlv, |
| 10158 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 10159 | .send_process_ch_avoid_update_cmd = |
| 10160 | send_process_ch_avoid_update_cmd_tlv, |
| 10161 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 10162 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 10163 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 10164 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 10165 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 10166 | .send_process_set_ie_info_cmd = send_process_set_ie_info_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10167 | .send_init_cmd = send_init_cmd_tlv, |
| 10168 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
| 10169 | .check_and_update_fw_version_cmd = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10170 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10171 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10172 | .send_set_base_macaddr_indicate_cmd = |
| 10173 | send_set_base_macaddr_indicate_cmd_tlv, |
| 10174 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 10175 | .send_enable_specific_fw_logs_cmd = |
| 10176 | send_enable_specific_fw_logs_cmd_tlv, |
| 10177 | .send_flush_logs_to_fw_cmd = send_flush_logs_to_fw_cmd_tlv, |
| 10178 | .send_soc_set_pcl_cmd = send_soc_set_pcl_cmd_tlv, |
| 10179 | .send_soc_set_hw_mode_cmd = send_soc_set_hw_mode_cmd_tlv, |
| 10180 | .send_soc_set_dual_mac_config_cmd = |
| 10181 | send_soc_set_dual_mac_config_cmd_tlv, |
| 10182 | .send_enable_arp_ns_offload_cmd = |
| 10183 | send_enable_arp_ns_offload_cmd_tlv, |
| 10184 | .send_app_type1_params_in_fw_cmd = |
| 10185 | send_app_type1_params_in_fw_cmd_tlv, |
| 10186 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 10187 | .send_process_roam_synch_complete_cmd = |
| 10188 | send_process_roam_synch_complete_cmd_tlv, |
| 10189 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 10190 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 10191 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
| 10192 | .send_roam_scan_offload_ap_profile_cmd = |
| 10193 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 10194 | .send_roam_scan_offload_scan_period_cmd = |
| 10195 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 10196 | .send_roam_scan_offload_chan_list_cmd = |
| 10197 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 10198 | .send_roam_scan_offload_rssi_change_cmd = |
| 10199 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 10200 | .send_get_buf_extscan_hotlist_cmd = |
| 10201 | send_get_buf_extscan_hotlist_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 10202 | /* TODO - Add other tlv apis here */ |
| 10203 | }; |
| 10204 | |
| 10205 | /** |
| 10206 | * wmi_get_tlv_ops() - gives pointer to wmi tlv ops |
| 10207 | * |
| 10208 | * Return: pointer to wmi tlv ops |
| 10209 | */ |
| 10210 | struct wmi_ops *wmi_get_tlv_ops(void) |
| 10211 | { |
| 10212 | return &tlv_ops; |
| 10213 | } |
| 10214 | |