Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1 | /* |
Paul Zhang | d19abd8 | 2017-01-04 16:45:42 +0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 28 | #include "wmi_unified_api.h" |
| 29 | #include "wmi.h" |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 30 | #include "wmi_version.h" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 31 | #include "wmi_unified_priv.h" |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 32 | #include "wmi_version_whitelist.h" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 33 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 34 | #ifdef CONVERGED_P2P_ENABLE |
| 35 | #include "wlan_p2p_public_struct.h" |
| 36 | #endif |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 37 | |
| 38 | /* copy_vdev_create_pdev_id() - copy pdev from host params to target command |
| 39 | * buffer. |
| 40 | * @cmd: pointer target vdev create command buffer |
| 41 | * @param: pointer host params for vdev create |
| 42 | * |
| 43 | * Return: None |
| 44 | */ |
| 45 | #ifdef CONFIG_MCL |
| 46 | static inline void copy_vdev_create_pdev_id( |
| 47 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 48 | struct vdev_create_params *param) |
| 49 | { |
| 50 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 51 | } |
| 52 | #else |
| 53 | static inline void copy_vdev_create_pdev_id( |
| 54 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 55 | struct vdev_create_params *param) |
| 56 | { |
| 57 | cmd->pdev_id = param->pdev_id; |
| 58 | } |
| 59 | #endif |
| 60 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 61 | /** |
| 62 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 63 | * @wmi_handle: wmi handle |
| 64 | * @param: pointer to hold vdev create parameter |
| 65 | * @macaddr: vdev mac address |
| 66 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 67 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 68 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 69 | static QDF_STATUS send_vdev_create_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 70 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 71 | struct vdev_create_params *param) |
| 72 | { |
| 73 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 74 | wmi_buf_t buf; |
| 75 | int32_t len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 76 | QDF_STATUS ret; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 77 | int num_bands = 2; |
| 78 | uint8_t *buf_ptr; |
| 79 | wmi_vdev_txrx_streams *txrx_streams; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 80 | |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 81 | len += (num_bands * sizeof(*txrx_streams) + WMI_TLV_HDR_SIZE); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 82 | buf = wmi_buf_alloc(wmi_handle, len); |
| 83 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 84 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 85 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 86 | } |
| 87 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 88 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 89 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 90 | WMITLV_GET_STRUCT_TLVLEN |
| 91 | (wmi_vdev_create_cmd_fixed_param)); |
| 92 | cmd->vdev_id = param->if_id; |
| 93 | cmd->vdev_type = param->type; |
| 94 | cmd->vdev_subtype = param->subtype; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 95 | cmd->num_cfg_txrx_streams = num_bands; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 96 | copy_vdev_create_pdev_id(cmd, param); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 97 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 98 | 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] | 99 | __func__, param->if_id, |
| 100 | macaddr[0], macaddr[1], macaddr[2], |
| 101 | macaddr[3], macaddr[4], macaddr[5]); |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 102 | buf_ptr = (uint8_t *)cmd + sizeof(*cmd); |
| 103 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 104 | (num_bands * sizeof(wmi_vdev_txrx_streams))); |
| 105 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 106 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 107 | WMI_LOGD("%s: type %d, subtype %d, nss_2g %d, nss_5g %d", __func__, |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 108 | param->type, param->subtype, |
| 109 | param->nss_2g, param->nss_5g); |
| 110 | txrx_streams = (wmi_vdev_txrx_streams *)buf_ptr; |
| 111 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_2G; |
| 112 | txrx_streams->supported_tx_streams = param->nss_2g; |
| 113 | txrx_streams->supported_rx_streams = param->nss_2g; |
| 114 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 115 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 116 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
| 117 | |
| 118 | txrx_streams++; |
| 119 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_5G; |
| 120 | txrx_streams->supported_tx_streams = param->nss_5g; |
| 121 | txrx_streams->supported_rx_streams = param->nss_5g; |
| 122 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 123 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 124 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 125 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_VDEV_CREATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 126 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 127 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 128 | wmi_buf_free(buf); |
| 129 | } |
| 130 | |
| 131 | return ret; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 136 | * @wmi_handle: wmi handle |
| 137 | * @if_id: vdev id |
| 138 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 139 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 140 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 141 | static QDF_STATUS send_vdev_delete_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 142 | uint8_t if_id) |
| 143 | { |
| 144 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 145 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 146 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 147 | |
| 148 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 149 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 150 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 151 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 155 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 156 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 157 | WMITLV_GET_STRUCT_TLVLEN |
| 158 | (wmi_vdev_delete_cmd_fixed_param)); |
| 159 | cmd->vdev_id = if_id; |
| 160 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 161 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 162 | WMI_VDEV_DELETE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 163 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 164 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 165 | wmi_buf_free(buf); |
| 166 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 167 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 168 | |
| 169 | return ret; |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 174 | * @wmi: wmi handle |
| 175 | * @vdev_id: vdev id |
| 176 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 177 | * Return: QDF_STATUS_SUCCESS for success or erro code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 178 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 179 | static QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 180 | uint8_t vdev_id) |
| 181 | { |
| 182 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 183 | wmi_buf_t buf; |
| 184 | int32_t len = sizeof(*cmd); |
| 185 | |
| 186 | buf = wmi_buf_alloc(wmi, len); |
| 187 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 188 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 189 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 190 | } |
| 191 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 192 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 193 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 194 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 195 | cmd->vdev_id = vdev_id; |
| 196 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 197 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 198 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 199 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 200 | } |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 201 | WMI_LOGD("%s:vdev id = %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 202 | |
| 203 | return 0; |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 208 | * @wmi: wmi handle |
| 209 | * @vdev_id: vdev id |
| 210 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 211 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 212 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 213 | static 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] | 214 | { |
| 215 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 216 | wmi_buf_t buf; |
| 217 | int32_t len = sizeof(*cmd); |
| 218 | |
| 219 | buf = wmi_buf_alloc(wmi, len); |
| 220 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 221 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 222 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 223 | } |
| 224 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 225 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 226 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 227 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 228 | cmd->vdev_id = vdev_id; |
| 229 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 230 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 231 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 232 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 233 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 234 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 235 | |
| 236 | return 0; |
| 237 | } |
| 238 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 239 | #ifdef CONFIG_MCL |
| 240 | static inline void copy_channel_info( |
| 241 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 242 | wmi_channel *chan, |
| 243 | struct vdev_start_params *req) |
| 244 | { |
| 245 | chan->mhz = req->chan_freq; |
| 246 | |
| 247 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 248 | |
| 249 | chan->band_center_freq1 = req->band_center_freq1; |
| 250 | chan->band_center_freq2 = req->band_center_freq2; |
| 251 | |
| 252 | if (req->is_half_rate) |
| 253 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 254 | else if (req->is_quarter_rate) |
| 255 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 256 | |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 257 | if (req->is_dfs && req->flag_dfs) { |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 258 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 259 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 260 | } |
| 261 | |
| 262 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 263 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 264 | |
| 265 | } |
| 266 | #else |
| 267 | static inline void copy_channel_info( |
| 268 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 269 | wmi_channel *chan, |
| 270 | struct vdev_start_params *req) |
| 271 | { |
| 272 | chan->mhz = req->channel.mhz; |
| 273 | |
| 274 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 275 | |
| 276 | chan->band_center_freq1 = req->channel.cfreq1; |
| 277 | chan->band_center_freq2 = req->channel.cfreq2; |
| 278 | |
| 279 | if (req->channel.half_rate) |
| 280 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 281 | else if (req->channel.quarter_rate) |
| 282 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 283 | |
| 284 | if (req->channel.dfs_set) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 285 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 286 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 287 | } |
| 288 | |
| 289 | /* FIXME: Find out min, max and regulatory power levels */ |
| 290 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
| 291 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxpower); |
| 292 | |
| 293 | } |
| 294 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 295 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 296 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 297 | * @wmi_handle: wmi handle |
| 298 | * @req: vdev start params |
| 299 | * |
| 300 | * Return: QDF status |
| 301 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 302 | static QDF_STATUS send_vdev_start_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 303 | struct vdev_start_params *req) |
| 304 | { |
| 305 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 306 | wmi_buf_t buf; |
| 307 | wmi_channel *chan; |
| 308 | int32_t len, ret; |
| 309 | uint8_t *buf_ptr; |
| 310 | |
| 311 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 312 | buf = wmi_buf_alloc(wmi_handle, len); |
| 313 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 314 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 315 | return QDF_STATUS_E_NOMEM; |
| 316 | } |
| 317 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 318 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 319 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 320 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 321 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 322 | WMITLV_GET_STRUCT_TLVLEN |
| 323 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 324 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 325 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 326 | cmd->vdev_id = req->vdev_id; |
| 327 | |
| 328 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 329 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 330 | |
| 331 | cmd->beacon_interval = req->beacon_intval; |
| 332 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 333 | |
| 334 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 335 | cmd->beacon_interval = req->beacon_intval; |
| 336 | cmd->dtim_period = req->dtim_period; |
| 337 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 338 | /* Copy the SSID */ |
| 339 | if (req->ssid.length) { |
| 340 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 341 | cmd->ssid.ssid_len = req->ssid.length; |
| 342 | else |
| 343 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 344 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 345 | cmd->ssid.ssid_len); |
| 346 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 347 | |
| 348 | if (req->hidden_ssid) |
| 349 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 350 | |
| 351 | if (req->pmf_enabled) |
| 352 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 353 | } |
| 354 | |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 355 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 356 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 357 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 358 | cmd->cac_duration_ms = req->cac_duration_ms; |
| 359 | cmd->regdomain = req->regdomain; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 360 | cmd->he_ops = req->he_ops; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 361 | |
| 362 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 363 | sizeof(wmi_channel)); |
| 364 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 365 | cmd->num_noa_descriptors * |
| 366 | sizeof(wmi_p2p_noa_descriptor)); |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 367 | WMI_LOGA("%s: vdev_id %d freq %d chanmode %d ch_info: 0x%x is_dfs %d " |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 368 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 369 | "reg_info_1: 0x%x reg_info_2: 0x%x, req->max_txpow: 0x%x " |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 370 | "Tx SS %d, Rx SS %d, cac %d, regd %d, HE ops: %d", |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 371 | __func__, req->vdev_id, chan->mhz, req->chan_mode, chan->info, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 372 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 373 | chan->band_center_freq1, chan->band_center_freq2, |
| 374 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 375 | req->preferred_tx_streams, req->preferred_rx_streams, |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 376 | req->cac_duration_ms, req->regdomain, req->he_ops); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 377 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 378 | if (req->is_restart) |
| 379 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 380 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 381 | else |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 382 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 383 | WMI_VDEV_START_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 384 | if (ret) { |
| 385 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 386 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 387 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 388 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 389 | |
| 390 | return QDF_STATUS_SUCCESS; |
| 391 | } |
| 392 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 393 | /** |
| 394 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 395 | * @wmi_handle: wmi handle |
| 396 | * @restart_params: vdev restart params |
| 397 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 398 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 399 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 400 | static QDF_STATUS send_hidden_ssid_vdev_restart_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 401 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 402 | { |
| 403 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 404 | wmi_buf_t buf; |
| 405 | wmi_channel *chan; |
| 406 | int32_t len; |
| 407 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 408 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 409 | |
| 410 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 411 | buf = wmi_buf_alloc(wmi_handle, len); |
| 412 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 413 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 414 | return QDF_STATUS_E_NOMEM; |
| 415 | } |
| 416 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 417 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 418 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 419 | |
| 420 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 421 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 422 | WMITLV_GET_STRUCT_TLVLEN |
| 423 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 424 | |
| 425 | WMITLV_SET_HDR(&chan->tlv_header, |
| 426 | WMITLV_TAG_STRUC_wmi_channel, |
| 427 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 428 | |
| 429 | cmd->vdev_id = restart_params->session_id; |
| 430 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 431 | qdf_mem_copy(cmd->ssid.ssid, |
| 432 | restart_params->ssid, |
| 433 | cmd->ssid.ssid_len); |
| 434 | cmd->flags = restart_params->flags; |
| 435 | cmd->requestor_id = restart_params->requestor_id; |
| 436 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 437 | |
| 438 | chan->mhz = restart_params->mhz; |
| 439 | chan->band_center_freq1 = |
| 440 | restart_params->band_center_freq1; |
| 441 | chan->band_center_freq2 = |
| 442 | restart_params->band_center_freq2; |
| 443 | chan->info = restart_params->info; |
| 444 | chan->reg_info_1 = restart_params->reg_info_1; |
| 445 | chan->reg_info_2 = restart_params->reg_info_2; |
| 446 | |
| 447 | cmd->num_noa_descriptors = 0; |
| 448 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 449 | sizeof(wmi_channel)); |
| 450 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 451 | cmd->num_noa_descriptors * |
| 452 | sizeof(wmi_p2p_noa_descriptor)); |
| 453 | |
| 454 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 455 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 456 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 457 | wmi_buf_free(buf); |
| 458 | return QDF_STATUS_E_FAILURE; |
| 459 | } |
| 460 | return QDF_STATUS_SUCCESS; |
| 461 | } |
| 462 | |
| 463 | |
| 464 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 465 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 466 | * @wmi: wmi handle |
| 467 | * @peer_addr: peer mac address |
| 468 | * @param: pointer to hold peer flush tid parameter |
| 469 | * |
| 470 | * Return: 0 for sucess or error code |
| 471 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 472 | static QDF_STATUS send_peer_flush_tids_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 473 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 474 | struct peer_flush_params *param) |
| 475 | { |
| 476 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 477 | wmi_buf_t buf; |
| 478 | int32_t len = sizeof(*cmd); |
| 479 | |
| 480 | buf = wmi_buf_alloc(wmi, len); |
| 481 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 482 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 483 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 484 | } |
| 485 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 486 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 487 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 488 | WMITLV_GET_STRUCT_TLVLEN |
| 489 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 490 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 491 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 492 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 493 | 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] | 494 | peer_addr, param->vdev_id, |
| 495 | param->peer_tid_bitmap); |
| 496 | 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] | 497 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 498 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 499 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | return 0; |
| 503 | } |
| 504 | |
| 505 | /** |
| 506 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 507 | * @wmi: wmi handle |
| 508 | * @peer_addr: peer mac addr |
| 509 | * @vdev_id: vdev id |
| 510 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 511 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 512 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 513 | static QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 514 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 515 | uint8_t vdev_id) |
| 516 | { |
| 517 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 518 | wmi_buf_t buf; |
| 519 | int32_t len = sizeof(*cmd); |
| 520 | buf = wmi_buf_alloc(wmi, len); |
| 521 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 522 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 523 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 524 | } |
| 525 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 526 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 527 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 528 | WMITLV_GET_STRUCT_TLVLEN |
| 529 | (wmi_peer_delete_cmd_fixed_param)); |
| 530 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 531 | cmd->vdev_id = vdev_id; |
| 532 | |
Orhan K AKYILDIZ | c8d1c4b | 2017-01-10 14:32:18 -0800 | [diff] [blame] | 533 | 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] | 534 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 535 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 536 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 537 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 538 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 539 | |
| 540 | return 0; |
| 541 | } |
| 542 | |
| 543 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 544 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 545 | * to target id. |
| 546 | * @targ_paramid: Target parameter id to hold the result. |
| 547 | * @peer_param_id: host param id. |
| 548 | * |
| 549 | * Return: QDF_STATUS_SUCCESS for success |
| 550 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
| 551 | */ |
| 552 | #ifdef CONFIG_MCL |
| 553 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 554 | uint32_t *targ_paramid, |
| 555 | uint32_t peer_param_id) |
| 556 | { |
| 557 | *targ_paramid = peer_param_id; |
| 558 | return QDF_STATUS_SUCCESS; |
| 559 | } |
| 560 | #else |
| 561 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 562 | uint32_t *targ_paramid, |
| 563 | uint32_t peer_param_id) |
| 564 | { |
| 565 | switch (peer_param_id) { |
| 566 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 567 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 568 | break; |
| 569 | case WMI_HOST_PEER_AMPDU: |
| 570 | *targ_paramid = WMI_PEER_AMPDU; |
| 571 | break; |
| 572 | case WMI_HOST_PEER_AUTHORIZE: |
| 573 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 574 | break; |
| 575 | case WMI_HOST_PEER_CHWIDTH: |
| 576 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 577 | break; |
| 578 | case WMI_HOST_PEER_NSS: |
| 579 | *targ_paramid = WMI_PEER_NSS; |
| 580 | break; |
| 581 | case WMI_HOST_PEER_USE_4ADDR: |
| 582 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 583 | break; |
| 584 | case WMI_HOST_PEER_MEMBERSHIP: |
| 585 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 586 | break; |
| 587 | case WMI_HOST_PEER_USERPOS: |
| 588 | *targ_paramid = WMI_PEER_USERPOS; |
| 589 | break; |
| 590 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 591 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 592 | break; |
| 593 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 594 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 595 | break; |
| 596 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 597 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 598 | break; |
| 599 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 600 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 601 | break; |
| 602 | case WMI_HOST_PEER_PHYMODE: |
| 603 | *targ_paramid = WMI_PEER_PHYMODE; |
| 604 | break; |
| 605 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 606 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 607 | break; |
| 608 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 609 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 610 | break; |
| 611 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 612 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 613 | break; |
| 614 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 615 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 616 | break; |
| 617 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 618 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 619 | break; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 620 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 621 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 622 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 623 | default: |
| 624 | return QDF_STATUS_E_NOSUPPORT; |
| 625 | } |
| 626 | |
| 627 | return QDF_STATUS_SUCCESS; |
| 628 | } |
| 629 | #endif |
| 630 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 631 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 632 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 633 | * @peer_addr: peer mac address |
| 634 | * @param : pointer to hold peer set parameter |
| 635 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 636 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 637 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 638 | static QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 639 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 640 | struct peer_set_params *param) |
| 641 | { |
| 642 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 643 | wmi_buf_t buf; |
| 644 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 645 | uint32_t param_id; |
| 646 | |
| 647 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 648 | param->param_id) != QDF_STATUS_SUCCESS) |
| 649 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 650 | |
| 651 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 652 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 653 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 654 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 655 | } |
| 656 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 657 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 658 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 659 | WMITLV_GET_STRUCT_TLVLEN |
| 660 | (wmi_peer_set_param_cmd_fixed_param)); |
| 661 | cmd->vdev_id = param->vdev_id; |
| 662 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 663 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 664 | cmd->param_value = param->param_value; |
| 665 | err = wmi_unified_cmd_send(wmi, buf, |
| 666 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 667 | WMI_PEER_SET_PARAM_CMDID); |
| 668 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 669 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 670 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 671 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 672 | } |
| 673 | |
| 674 | return 0; |
| 675 | } |
| 676 | |
| 677 | /** |
| 678 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 679 | * @wmi: wmi handle |
| 680 | * @bssid: bssid |
| 681 | * @vdev_up_params: pointer to hold vdev up parameter |
| 682 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 683 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 684 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 685 | static QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 686 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 687 | struct vdev_up_params *params) |
| 688 | { |
| 689 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 690 | wmi_buf_t buf; |
| 691 | int32_t len = sizeof(*cmd); |
| 692 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 693 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 694 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 695 | params->vdev_id, params->assoc_id, bssid); |
| 696 | buf = wmi_buf_alloc(wmi, len); |
| 697 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 698 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 699 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 700 | } |
| 701 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 702 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 703 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 704 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 705 | cmd->vdev_id = params->vdev_id; |
| 706 | cmd->vdev_assoc_id = params->assoc_id; |
| 707 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 708 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 709 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 710 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 711 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 712 | } |
| 713 | |
| 714 | return 0; |
| 715 | } |
| 716 | |
| 717 | /** |
| 718 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 719 | * @wmi: wmi handle |
| 720 | * @peer_addr: peer mac address |
| 721 | * @peer_type: peer type |
| 722 | * @vdev_id: vdev id |
| 723 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 724 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 725 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 726 | static QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 727 | struct peer_create_params *param) |
| 728 | { |
| 729 | wmi_peer_create_cmd_fixed_param *cmd; |
| 730 | wmi_buf_t buf; |
| 731 | int32_t len = sizeof(*cmd); |
| 732 | |
| 733 | buf = wmi_buf_alloc(wmi, len); |
| 734 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 735 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 736 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 737 | } |
| 738 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 739 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 740 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 741 | WMITLV_GET_STRUCT_TLVLEN |
| 742 | (wmi_peer_create_cmd_fixed_param)); |
| 743 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 744 | cmd->peer_type = param->peer_type; |
| 745 | cmd->vdev_id = param->vdev_id; |
| 746 | |
| 747 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 748 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 749 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 750 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 751 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 752 | 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] | 753 | param->vdev_id); |
| 754 | |
| 755 | return 0; |
| 756 | } |
| 757 | |
| 758 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 759 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 760 | * command to fw |
| 761 | * @wmi: wmi handle |
| 762 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 763 | * |
| 764 | * Return: 0 for success or error code |
| 765 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 766 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 767 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 768 | struct rx_reorder_queue_setup_params *param) |
| 769 | { |
| 770 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 771 | wmi_buf_t buf; |
| 772 | int32_t len = sizeof(*cmd); |
| 773 | |
| 774 | buf = wmi_buf_alloc(wmi, len); |
| 775 | if (!buf) { |
| 776 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 777 | return QDF_STATUS_E_NOMEM; |
| 778 | } |
| 779 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 780 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 781 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 782 | WMITLV_GET_STRUCT_TLVLEN |
| 783 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 784 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 785 | cmd->vdev_id = param->vdev_id; |
| 786 | cmd->tid = param->tid; |
| 787 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 788 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 789 | cmd->queue_no = param->queue_no; |
| 790 | |
| 791 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 792 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 793 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 794 | __func__); |
| 795 | qdf_nbuf_free(buf); |
| 796 | return QDF_STATUS_E_FAILURE; |
| 797 | } |
| 798 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 799 | param->peer_macaddr, param->vdev_id, param->tid); |
| 800 | |
| 801 | return QDF_STATUS_SUCCESS; |
| 802 | } |
| 803 | |
| 804 | /** |
| 805 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 806 | * command to fw |
| 807 | * @wmi: wmi handle |
| 808 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 809 | * |
| 810 | * Return: 0 for success or error code |
| 811 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 812 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 813 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 814 | struct rx_reorder_queue_remove_params *param) |
| 815 | { |
| 816 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 817 | wmi_buf_t buf; |
| 818 | int32_t len = sizeof(*cmd); |
| 819 | |
| 820 | buf = wmi_buf_alloc(wmi, len); |
| 821 | if (!buf) { |
| 822 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 823 | return QDF_STATUS_E_NOMEM; |
| 824 | } |
| 825 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 826 | wmi_buf_data(buf); |
| 827 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 828 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 829 | WMITLV_GET_STRUCT_TLVLEN |
| 830 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 831 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 832 | cmd->vdev_id = param->vdev_id; |
| 833 | cmd->tid_mask = param->peer_tid_bitmap; |
| 834 | |
| 835 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 836 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 837 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 838 | __func__); |
| 839 | qdf_nbuf_free(buf); |
| 840 | return QDF_STATUS_E_FAILURE; |
| 841 | } |
| 842 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 843 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 844 | |
| 845 | return QDF_STATUS_SUCCESS; |
| 846 | } |
| 847 | |
| 848 | /** |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 849 | * send_peer_add_wds_entry_cmd_tlv() - send peer add command to fw |
| 850 | * @wmi_handle: wmi handle |
| 851 | * @param: pointer holding peer details |
| 852 | * |
| 853 | * Return: 0 for success or error code |
| 854 | */ |
| 855 | static QDF_STATUS send_peer_add_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 856 | struct peer_add_wds_entry_params *param) |
| 857 | { |
| 858 | wmi_peer_add_wds_entry_cmd_fixed_param *cmd; |
| 859 | wmi_buf_t buf; |
| 860 | int len = sizeof(*cmd); |
| 861 | |
| 862 | buf = wmi_buf_alloc(wmi_handle, len); |
| 863 | if (!buf) { |
| 864 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 865 | return QDF_STATUS_E_FAILURE; |
| 866 | } |
| 867 | cmd = (wmi_peer_add_wds_entry_cmd_fixed_param *) wmi_buf_data(buf); |
| 868 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 869 | WMITLV_TAG_STRUC_wmi_peer_add_wds_entry_cmd_fixed_param, |
| 870 | WMITLV_GET_STRUCT_TLVLEN |
| 871 | (wmi_peer_add_wds_entry_cmd_fixed_param)); |
| 872 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 873 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 874 | cmd->flags = param->flags; |
| 875 | |
| 876 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 877 | WMI_PEER_ADD_WDS_ENTRY_CMDID); |
| 878 | } |
| 879 | |
| 880 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 881 | * send_peer_del_wds_entry_cmd_tlv() - send peer delete command to fw |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 882 | * @wmi_handle: wmi handle |
| 883 | * @param: pointer holding peer details |
| 884 | * |
| 885 | * Return: 0 for success or error code |
| 886 | */ |
| 887 | static QDF_STATUS send_peer_del_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 888 | struct peer_del_wds_entry_params *param) |
| 889 | { |
| 890 | wmi_peer_remove_wds_entry_cmd_fixed_param *cmd; |
| 891 | wmi_buf_t buf; |
| 892 | int len = sizeof(*cmd); |
| 893 | |
| 894 | buf = wmi_buf_alloc(wmi_handle, len); |
| 895 | if (!buf) { |
| 896 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 897 | return QDF_STATUS_E_NOMEM; |
| 898 | } |
| 899 | cmd = (wmi_peer_remove_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 900 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 901 | WMITLV_TAG_STRUC_wmi_peer_remove_wds_entry_cmd_fixed_param, |
| 902 | WMITLV_GET_STRUCT_TLVLEN |
| 903 | (wmi_peer_remove_wds_entry_cmd_fixed_param)); |
| 904 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 905 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 906 | WMI_PEER_REMOVE_WDS_ENTRY_CMDID); |
| 907 | } |
| 908 | |
| 909 | /** |
| 910 | * send_peer_update_wds_entry_cmd_non_tlv() - send peer update command to fw |
| 911 | * @wmi_handle: wmi handle |
| 912 | * @param: pointer holding peer details |
| 913 | * |
| 914 | * Return: 0 for success or error code |
| 915 | */ |
| 916 | static QDF_STATUS send_peer_update_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 917 | struct peer_update_wds_entry_params *param) |
| 918 | { |
| 919 | wmi_peer_update_wds_entry_cmd_fixed_param *cmd; |
| 920 | wmi_buf_t buf; |
| 921 | int len = sizeof(*cmd); |
| 922 | |
| 923 | buf = wmi_buf_alloc(wmi_handle, len); |
| 924 | if (!buf) { |
| 925 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 926 | return QDF_STATUS_E_NOMEM; |
| 927 | } |
| 928 | |
| 929 | /* wmi_buf_alloc returns zeroed command buffer */ |
| 930 | cmd = (wmi_peer_update_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 931 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 932 | WMITLV_TAG_STRUC_wmi_peer_update_wds_entry_cmd_fixed_param, |
| 933 | WMITLV_GET_STRUCT_TLVLEN |
| 934 | (wmi_peer_update_wds_entry_cmd_fixed_param)); |
| 935 | cmd->flags = (param->flags) ? WMI_WDS_FLAG_STATIC : 0; |
| 936 | if (param->wds_macaddr) |
| 937 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->wds_macaddr, |
| 938 | &cmd->wds_macaddr); |
| 939 | if (param->peer_macaddr) |
| 940 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, |
| 941 | &cmd->peer_macaddr); |
| 942 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 943 | WMI_PEER_UPDATE_WDS_ENTRY_CMDID); |
| 944 | } |
| 945 | |
| 946 | |
| 947 | |
| 948 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 949 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 950 | * @wmi_handle: wmi handle |
| 951 | * @value: value |
| 952 | * @mac_id: mac id to have radio context |
| 953 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 954 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 955 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 956 | static 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] | 957 | uint32_t value, uint8_t mac_id) |
| 958 | { |
| 959 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 960 | wmi_buf_t buf; |
| 961 | int32_t len = sizeof(*cmd); |
| 962 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 963 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 964 | |
| 965 | buf = wmi_buf_alloc(wmi_handle, len); |
| 966 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 967 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 968 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 969 | } |
| 970 | |
| 971 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 972 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 973 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 974 | WMITLV_GET_STRUCT_TLVLEN |
| 975 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Kiran Venkatappa | 72da3b0 | 2017-03-28 22:45:27 +0530 | [diff] [blame] | 976 | cmd->pdev_id = mac_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 977 | cmd->enable = value; |
| 978 | |
| 979 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 980 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 981 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 982 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 983 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 984 | } |
| 985 | |
| 986 | return 0; |
| 987 | } |
| 988 | |
| 989 | /** |
| 990 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 991 | * @wmi_handle: wmi handle |
| 992 | * @param: pointer to pdev_utf_params |
| 993 | * @mac_id: mac id to have radio context |
| 994 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 995 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 996 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 997 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 998 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 999 | struct pdev_utf_params *param, |
| 1000 | uint8_t mac_id) |
| 1001 | { |
| 1002 | wmi_buf_t buf; |
| 1003 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 1004 | /* if param->len is 0 no data is sent, return error */ |
| 1005 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1006 | static uint8_t msgref = 1; |
| 1007 | uint8_t segNumber = 0, segInfo, numSegments; |
| 1008 | uint16_t chunk_len, total_bytes; |
| 1009 | uint8_t *bufpos; |
| 1010 | struct seg_hdr_info segHdrInfo; |
| 1011 | |
| 1012 | bufpos = param->utf_payload; |
| 1013 | total_bytes = param->len; |
| 1014 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 1015 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 1016 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 1017 | |
| 1018 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 1019 | numSegments++; |
| 1020 | |
| 1021 | while (param->len) { |
| 1022 | if (param->len > MAX_WMI_UTF_LEN) |
| 1023 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 1024 | else |
| 1025 | chunk_len = param->len; |
| 1026 | |
| 1027 | buf = wmi_buf_alloc(wmi_handle, |
| 1028 | (chunk_len + sizeof(segHdrInfo) + |
| 1029 | WMI_TLV_HDR_SIZE)); |
| 1030 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1031 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1032 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1033 | } |
| 1034 | |
| 1035 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 1036 | |
| 1037 | segHdrInfo.len = total_bytes; |
| 1038 | segHdrInfo.msgref = msgref; |
| 1039 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 1040 | segHdrInfo.segmentInfo = segInfo; |
| 1041 | segHdrInfo.pad = 0; |
| 1042 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1043 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1044 | " segHdrInfo.segmentInfo = %d", |
| 1045 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 1046 | segHdrInfo.segmentInfo); |
| 1047 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1048 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1049 | "chunk len %d", __func__, total_bytes, segNumber, |
| 1050 | numSegments, chunk_len); |
| 1051 | |
| 1052 | segNumber++; |
| 1053 | |
| 1054 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 1055 | (chunk_len + sizeof(segHdrInfo))); |
| 1056 | cmd += WMI_TLV_HDR_SIZE; |
| 1057 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 1058 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 1059 | |
| 1060 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 1061 | (chunk_len + sizeof(segHdrInfo) + |
| 1062 | WMI_TLV_HDR_SIZE), |
| 1063 | WMI_PDEV_UTF_CMDID); |
| 1064 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1065 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1066 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1067 | wmi_buf_free(buf); |
| 1068 | break; |
| 1069 | } |
| 1070 | |
| 1071 | param->len -= chunk_len; |
| 1072 | bufpos += chunk_len; |
| 1073 | } |
| 1074 | |
| 1075 | msgref++; |
| 1076 | |
| 1077 | return ret; |
| 1078 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1079 | #ifdef CONFIG_MCL |
| 1080 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1081 | uint32_t host_param) |
| 1082 | { |
| 1083 | return host_param; |
| 1084 | } |
| 1085 | #else |
| 1086 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1087 | uint32_t host_param) |
| 1088 | { |
| 1089 | if (host_param < wmi_pdev_param_max) |
| 1090 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1091 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1092 | return WMI_UNAVAILABLE_PARAM; |
| 1093 | } |
| 1094 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1095 | /** |
| 1096 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 1097 | * @wmi_handle: wmi handle |
| 1098 | * @param: pointer to pdev parameter |
| 1099 | * @mac_id: radio context |
| 1100 | * |
| 1101 | * Return: 0 on success, errno on failure |
| 1102 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1103 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1104 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 1105 | struct pdev_params *param, |
| 1106 | uint8_t mac_id) |
| 1107 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1108 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1109 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 1110 | wmi_buf_t buf; |
| 1111 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1112 | uint32_t pdev_param; |
| 1113 | |
| 1114 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 1115 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1116 | WMI_LOGW("%s: Unavailable param %d\n", |
| 1117 | __func__, param->param_id); |
| 1118 | return QDF_STATUS_E_INVAL; |
| 1119 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1120 | |
| 1121 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1122 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1123 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1124 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1125 | } |
| 1126 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1127 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1128 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 1129 | WMITLV_GET_STRUCT_TLVLEN |
| 1130 | (wmi_pdev_set_param_cmd_fixed_param)); |
Kiran Venkatappa | 72da3b0 | 2017-03-28 22:45:27 +0530 | [diff] [blame] | 1131 | cmd->pdev_id = mac_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1132 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1133 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1134 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1135 | param->param_value); |
| 1136 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1137 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1138 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1139 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1140 | wmi_buf_free(buf); |
| 1141 | } |
| 1142 | return ret; |
| 1143 | } |
| 1144 | |
| 1145 | /** |
| 1146 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1147 | * @param wmi_handle : handle to WMI. |
| 1148 | * @param param : pointer to hold suspend parameter |
| 1149 | * @mac_id: radio context |
| 1150 | * |
| 1151 | * Return 0 on success and -ve on failure. |
| 1152 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1153 | static QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1154 | struct suspend_params *param, |
| 1155 | uint8_t mac_id) |
| 1156 | { |
| 1157 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1158 | wmi_buf_t wmibuf; |
| 1159 | uint32_t len = sizeof(*cmd); |
| 1160 | int32_t ret; |
| 1161 | |
| 1162 | /* |
| 1163 | * send the comand to Target to ignore the |
| 1164 | * PCIE reset so as to ensure that Host and target |
| 1165 | * states are in sync |
| 1166 | */ |
| 1167 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1168 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1169 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1170 | |
| 1171 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1172 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1173 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1174 | WMITLV_GET_STRUCT_TLVLEN |
| 1175 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1176 | if (param->disable_target_intr) |
| 1177 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1178 | else |
| 1179 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
| 1180 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1181 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1182 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1183 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1184 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1185 | } |
| 1186 | |
| 1187 | return ret; |
| 1188 | } |
| 1189 | |
| 1190 | /** |
| 1191 | * send_resume_cmd_tlv() - WMI resume function |
| 1192 | * @param wmi_handle : handle to WMI. |
| 1193 | * @mac_id: radio context |
| 1194 | * |
| 1195 | * Return: 0 on success and -ve on failure. |
| 1196 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1197 | static QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1198 | uint8_t mac_id) |
| 1199 | { |
| 1200 | wmi_buf_t wmibuf; |
| 1201 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1202 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1203 | |
| 1204 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1205 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1206 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1207 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1208 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1209 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1210 | WMITLV_GET_STRUCT_TLVLEN |
| 1211 | (wmi_pdev_resume_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 1212 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1213 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1214 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1215 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1216 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1217 | wmi_buf_free(wmibuf); |
| 1218 | } |
| 1219 | |
| 1220 | return ret; |
| 1221 | } |
| 1222 | |
| 1223 | /** |
| 1224 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1225 | * @param wmi_handle : handle to WMI. |
| 1226 | * @param param : pointer to hold wow enable parameter |
| 1227 | * @mac_id: radio context |
| 1228 | * |
| 1229 | * Return: 0 on success and -ve on failure. |
| 1230 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1231 | static QDF_STATUS send_wow_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1232 | struct wow_cmd_params *param, |
| 1233 | uint8_t mac_id) |
| 1234 | { |
| 1235 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1236 | wmi_buf_t buf; |
| 1237 | int32_t len; |
| 1238 | int32_t ret; |
| 1239 | |
| 1240 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1241 | |
| 1242 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1243 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1244 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1245 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1246 | } |
| 1247 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1248 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1249 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1250 | WMITLV_GET_STRUCT_TLVLEN |
| 1251 | (wmi_wow_enable_cmd_fixed_param)); |
| 1252 | cmd->enable = param->enable; |
| 1253 | if (param->can_suspend_link) |
| 1254 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1255 | else |
| 1256 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1257 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1258 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1259 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1260 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1261 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1262 | |
| 1263 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1264 | WMI_WOW_ENABLE_CMDID); |
| 1265 | if (ret) |
| 1266 | wmi_buf_free(buf); |
| 1267 | |
| 1268 | return ret; |
| 1269 | } |
| 1270 | |
| 1271 | /** |
| 1272 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1273 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1274 | * @peer_addr: peer mac address |
| 1275 | * @param: pointer to ap_ps parameter structure |
| 1276 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1277 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1278 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1279 | static 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] | 1280 | uint8_t *peer_addr, |
| 1281 | struct ap_ps_params *param) |
| 1282 | { |
| 1283 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1284 | wmi_buf_t buf; |
| 1285 | int32_t err; |
| 1286 | |
| 1287 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1288 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1289 | WMI_LOGE("Failed to allocate buffer to send set_ap_ps_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1290 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1291 | } |
| 1292 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1293 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1294 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1295 | WMITLV_GET_STRUCT_TLVLEN |
| 1296 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1297 | cmd->vdev_id = param->vdev_id; |
| 1298 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1299 | cmd->param = param->param; |
| 1300 | cmd->value = param->value; |
| 1301 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1302 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1303 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1304 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1305 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1306 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1307 | } |
| 1308 | |
| 1309 | return 0; |
| 1310 | } |
| 1311 | |
| 1312 | /** |
| 1313 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1314 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1315 | * @peer_addr: peer mac address |
| 1316 | * @param: pointer to sta_ps parameter structure |
| 1317 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1318 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1319 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1320 | static 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] | 1321 | struct sta_ps_params *param) |
| 1322 | { |
| 1323 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1324 | wmi_buf_t buf; |
| 1325 | int32_t len = sizeof(*cmd); |
| 1326 | |
| 1327 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1328 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1329 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1330 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1331 | } |
| 1332 | |
| 1333 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1334 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1335 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1336 | WMITLV_GET_STRUCT_TLVLEN |
| 1337 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1338 | cmd->vdev_id = param->vdev_id; |
| 1339 | cmd->param = param->param; |
| 1340 | cmd->value = param->value; |
| 1341 | |
| 1342 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1343 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1344 | 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] | 1345 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1346 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1347 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1348 | } |
| 1349 | |
| 1350 | return 0; |
| 1351 | } |
| 1352 | |
| 1353 | /** |
| 1354 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1355 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1356 | * @param: ponirt to crash inject paramter structure |
| 1357 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1358 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1359 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1360 | static QDF_STATUS send_crash_inject_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1361 | struct crash_inject *param) |
| 1362 | { |
| 1363 | int32_t ret = 0; |
| 1364 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1365 | uint16_t len = sizeof(*cmd); |
| 1366 | wmi_buf_t buf; |
| 1367 | |
| 1368 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1369 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1370 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1371 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1372 | } |
| 1373 | |
| 1374 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1375 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1376 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1377 | WMITLV_GET_STRUCT_TLVLEN |
| 1378 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1379 | cmd->type = param->type; |
| 1380 | cmd->delay_time_ms = param->delay_time_ms; |
| 1381 | |
| 1382 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1383 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1384 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1385 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1386 | __func__, ret); |
| 1387 | wmi_buf_free(buf); |
| 1388 | } |
| 1389 | |
| 1390 | return ret; |
| 1391 | } |
| 1392 | |
| 1393 | /** |
| 1394 | * send_dbglog_cmd_tlv() - set debug log level |
| 1395 | * @param wmi_handle : handle to WMI. |
| 1396 | * @param param : pointer to hold dbglog level parameter |
| 1397 | * |
| 1398 | * Return: 0 on success and -ve on failure. |
| 1399 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1400 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1401 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1402 | struct dbglog_params *dbglog_param) |
| 1403 | { |
| 1404 | wmi_buf_t buf; |
| 1405 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
| 1406 | A_STATUS status = A_OK; |
| 1407 | int32_t i; |
| 1408 | int32_t len; |
| 1409 | int8_t *buf_ptr; |
| 1410 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1411 | |
| 1412 | ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
| 1413 | |
| 1414 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1415 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1416 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1417 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1418 | if (buf == NULL) |
| 1419 | return A_NO_MEMORY; |
| 1420 | |
| 1421 | configmsg = |
| 1422 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1423 | buf_ptr = (int8_t *) configmsg; |
| 1424 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1425 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1426 | WMITLV_GET_STRUCT_TLVLEN |
| 1427 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1428 | configmsg->dbg_log_param = dbglog_param->param; |
| 1429 | configmsg->value = dbglog_param->val; |
| 1430 | /* Filling in the data part of second tlv -- should |
| 1431 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1432 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1433 | sizeof |
| 1434 | (wmi_debug_log_config_cmd_fixed_param) |
| 1435 | + WMI_TLV_HDR_SIZE); |
| 1436 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1437 | WMITLV_TAG_ARRAY_UINT32, |
| 1438 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1439 | if (dbglog_param->module_id_bitmap) { |
| 1440 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1441 | module_id_bitmap_array[i] = |
| 1442 | dbglog_param->module_id_bitmap[i]; |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1447 | len, WMI_DBGLOG_CFG_CMDID); |
| 1448 | |
| 1449 | if (status != A_OK) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1450 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1451 | |
| 1452 | return status; |
| 1453 | } |
| 1454 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1455 | #ifdef CONFIG_MCL |
| 1456 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1457 | uint32_t host_param) |
| 1458 | { |
| 1459 | return host_param; |
| 1460 | } |
| 1461 | #else |
| 1462 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1463 | uint32_t host_param) |
| 1464 | { |
| 1465 | if (host_param < wmi_vdev_param_max) |
| 1466 | return wmi_handle->vdev_param[host_param]; |
| 1467 | |
| 1468 | return WMI_UNAVAILABLE_PARAM; |
| 1469 | } |
| 1470 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1471 | /** |
| 1472 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1473 | * @param wmi_handle : handle to WMI. |
| 1474 | * @param macaddr : MAC address |
| 1475 | * @param param : pointer to hold vdev set parameter |
| 1476 | * |
| 1477 | * Return: 0 on success and -ve on failure. |
| 1478 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1479 | static 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] | 1480 | struct vdev_set_params *param) |
| 1481 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1482 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1483 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1484 | wmi_buf_t buf; |
| 1485 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1486 | uint32_t vdev_param; |
| 1487 | |
| 1488 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1489 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1490 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1491 | param->param_id); |
| 1492 | return QDF_STATUS_E_INVAL; |
| 1493 | |
| 1494 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1495 | |
| 1496 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1497 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1498 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1499 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1500 | } |
| 1501 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1502 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1503 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1504 | WMITLV_GET_STRUCT_TLVLEN |
| 1505 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1506 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1507 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1508 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1509 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1510 | param->if_id, param->param_id, param->param_value); |
| 1511 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1512 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1513 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1514 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1515 | wmi_buf_free(buf); |
| 1516 | } |
| 1517 | |
| 1518 | return ret; |
| 1519 | } |
| 1520 | |
| 1521 | /** |
| 1522 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1523 | * @param wmi_handle : handle to WMI. |
| 1524 | * @param macaddr : MAC address |
| 1525 | * @param param : pointer to hold stats request parameter |
| 1526 | * |
| 1527 | * Return: 0 on success and -ve on failure. |
| 1528 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1529 | static QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1530 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1531 | struct stats_request_params *param) |
| 1532 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1533 | int32_t ret; |
| 1534 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1535 | wmi_buf_t buf; |
| 1536 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1537 | |
| 1538 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1539 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1540 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1541 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1542 | } |
| 1543 | |
| 1544 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1545 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1546 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1547 | WMITLV_GET_STRUCT_TLVLEN |
| 1548 | (wmi_request_stats_cmd_fixed_param)); |
| 1549 | cmd->stats_id = param->stats_id; |
| 1550 | cmd->vdev_id = param->vdev_id; |
| 1551 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1552 | WMI_REQUEST_STATS_CMDID); |
| 1553 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1554 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1555 | wmi_buf_free(buf); |
| 1556 | } |
| 1557 | |
| 1558 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1559 | } |
| 1560 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1561 | #ifdef CONFIG_WIN |
| 1562 | /** |
| 1563 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1564 | * @param wmi_handle : handle to WMI. |
| 1565 | * @param macaddr : MAC address |
| 1566 | * @param param : pointer to hold stats request parameter |
| 1567 | * |
| 1568 | * Return: 0 on success and -ve on failure. |
| 1569 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1570 | static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1571 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT) |
| 1572 | { |
| 1573 | return 0; |
| 1574 | } |
| 1575 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1576 | /** |
| 1577 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1578 | * @param wmi_handle : handle to WMI. |
| 1579 | * @param macaddr : MAC address |
| 1580 | * @param param : pointer to hold stats request parameter |
| 1581 | * |
| 1582 | * Return: 0 on success and -ve on failure. |
| 1583 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1584 | static 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] | 1585 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1586 | struct packet_enable_params *param) |
| 1587 | { |
| 1588 | return 0; |
| 1589 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1590 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1591 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1592 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1593 | /** |
| 1594 | * send_beacon_send_cmd_tlv() - WMI beacon send function |
| 1595 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1596 | * @param param : pointer to hold beacon send cmd parameter |
| 1597 | * |
| 1598 | * Return: 0 on success and -ve on failure. |
| 1599 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1600 | static QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1601 | struct beacon_params *param) |
| 1602 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1603 | int32_t ret; |
| 1604 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1605 | wmi_bcn_prb_info *bcn_prb_info; |
| 1606 | wmi_buf_t wmi_buf; |
| 1607 | uint8_t *buf_ptr; |
| 1608 | uint32_t wmi_buf_len; |
| 1609 | |
| 1610 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1611 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1612 | param->tmpl_len_aligned; |
| 1613 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1614 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1615 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1616 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1617 | } |
| 1618 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1619 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1620 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1621 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1622 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1623 | cmd->vdev_id = param->vdev_id; |
| 1624 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1625 | cmd->buf_len = param->tmpl_len; |
| 1626 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1627 | |
| 1628 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1629 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1630 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1631 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1632 | bcn_prb_info->caps = 0; |
| 1633 | bcn_prb_info->erp = 0; |
| 1634 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1635 | |
| 1636 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1637 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1638 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1639 | |
| 1640 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1641 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1642 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1643 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1644 | wmi_buf_free(wmi_buf); |
| 1645 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1646 | return 0; |
| 1647 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1648 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1649 | static QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1650 | struct beacon_params *param) |
| 1651 | { |
| 1652 | return 0; |
| 1653 | } |
| 1654 | |
| 1655 | /** |
| 1656 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1657 | * @param wmi_handle : handle to WMI. |
| 1658 | * @param param : pointer to hold beacon send cmd parameter |
| 1659 | * |
| 1660 | * Return: 0 on success and -ve on failure. |
| 1661 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1662 | static QDF_STATUS send_beacon_tmpl_send_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1663 | struct beacon_tmpl_params *param) |
| 1664 | { |
| 1665 | int32_t ret; |
| 1666 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1667 | wmi_bcn_prb_info *bcn_prb_info; |
| 1668 | wmi_buf_t wmi_buf; |
| 1669 | uint8_t *buf_ptr; |
| 1670 | uint32_t wmi_buf_len; |
| 1671 | |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1672 | WMI_LOGI("%s\n", __func__); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1673 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1674 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1675 | param->tmpl_len_aligned; |
| 1676 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1677 | if (!wmi_buf) { |
| 1678 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1679 | return QDF_STATUS_E_NOMEM; |
| 1680 | } |
| 1681 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1682 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1683 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1684 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1685 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1686 | cmd->vdev_id = param->vdev_id; |
| 1687 | cmd->tim_ie_offset = param->tim_ie_offset; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1688 | cmd->csa_switch_count_offset = param->csa_switch_count_offset; |
| 1689 | cmd->ext_csa_switch_count_offset = param->ext_csa_switch_count_offset; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1690 | cmd->buf_len = param->tmpl_len; |
| 1691 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1692 | |
| 1693 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1694 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1695 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1696 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1697 | bcn_prb_info->caps = 0; |
| 1698 | bcn_prb_info->erp = 0; |
| 1699 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1700 | |
| 1701 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1702 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1703 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1704 | |
| 1705 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1706 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1707 | if (ret) { |
| 1708 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1709 | wmi_buf_free(wmi_buf); |
| 1710 | } |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1711 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1712 | return 0; |
| 1713 | } |
| 1714 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1715 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1716 | #ifdef CONFIG_MCL |
| 1717 | static inline void copy_peer_flags_tlv( |
| 1718 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1719 | struct peer_assoc_params *param) |
| 1720 | { |
| 1721 | cmd->peer_flags = param->peer_flags; |
| 1722 | } |
| 1723 | #else |
| 1724 | static inline void copy_peer_flags_tlv( |
| 1725 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1726 | struct peer_assoc_params *param) |
| 1727 | { |
| 1728 | /* |
| 1729 | * The target only needs a subset of the flags maintained in the host. |
| 1730 | * Just populate those flags and send it down |
| 1731 | */ |
| 1732 | cmd->peer_flags = 0; |
| 1733 | |
| 1734 | /* |
| 1735 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1736 | */ |
| 1737 | if (param->is_wme_set) { |
| 1738 | |
| 1739 | if (param->qos_flag) |
| 1740 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1741 | if (param->apsd_flag) |
| 1742 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1743 | if (param->ht_flag) |
| 1744 | cmd->peer_flags |= WMI_PEER_HT; |
| 1745 | if (param->bw_40) |
| 1746 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1747 | if (param->bw_80) |
| 1748 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1749 | if (param->bw_160) |
| 1750 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1751 | |
| 1752 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1753 | * for HT as well |
| 1754 | **/ |
| 1755 | if (param->stbc_flag) |
| 1756 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1757 | |
| 1758 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1759 | * for HT as well |
| 1760 | **/ |
| 1761 | if (param->ldpc_flag) |
| 1762 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1763 | |
| 1764 | if (param->static_mimops_flag) |
| 1765 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1766 | if (param->dynamic_mimops_flag) |
| 1767 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1768 | if (param->spatial_mux_flag) |
| 1769 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1770 | if (param->vht_flag) |
| 1771 | cmd->peer_flags |= WMI_PEER_VHT; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1772 | if (param->he_flag) |
| 1773 | cmd->peer_flags |= WMI_PEER_HE; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1774 | } |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1775 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1776 | /* |
| 1777 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1778 | * (during re-association). |
| 1779 | * Authorization will be done for these modes on key installation. |
| 1780 | */ |
| 1781 | if (param->auth_flag) |
| 1782 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1783 | if (param->need_ptk_4_way) |
| 1784 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1785 | else |
| 1786 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1787 | if (param->need_gtk_2_way) |
| 1788 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1789 | /* safe mode bypass the 4-way handshake */ |
| 1790 | if (param->safe_mode_enabled) |
| 1791 | cmd->peer_flags &= |
| 1792 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1793 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1794 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1795 | * it |
| 1796 | * if (param->amsdu_disable) Add after FW support |
| 1797 | **/ |
| 1798 | |
| 1799 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1800 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1801 | * iwpriv |
| 1802 | **/ |
| 1803 | if (param->peer_ht_rates.num_rates == 0) |
| 1804 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1805 | } |
| 1806 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1807 | |
| 1808 | #ifdef CONFIG_MCL |
| 1809 | static inline void copy_peer_mac_addr_tlv( |
| 1810 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1811 | struct peer_assoc_params *param) |
| 1812 | { |
| 1813 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1814 | sizeof(param->peer_macaddr)); |
| 1815 | } |
| 1816 | #else |
| 1817 | static inline void copy_peer_mac_addr_tlv( |
| 1818 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1819 | struct peer_assoc_params *param) |
| 1820 | { |
| 1821 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 1822 | } |
| 1823 | #endif |
| 1824 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1825 | /** |
| 1826 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1827 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1828 | * @param param : pointer to peer assoc parameter |
| 1829 | * |
| 1830 | * Return: 0 on success and -ve on failure. |
| 1831 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1832 | static QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1833 | struct peer_assoc_params *param) |
| 1834 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1835 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1836 | wmi_vht_rate_set *mcs; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1837 | wmi_he_rate_set *he_mcs; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1838 | wmi_buf_t buf; |
| 1839 | int32_t len; |
| 1840 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1841 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1842 | uint32_t peer_legacy_rates_align; |
| 1843 | uint32_t peer_ht_rates_align; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1844 | int32_t i; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1845 | |
| 1846 | |
| 1847 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1848 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1849 | |
| 1850 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1851 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
| 1852 | WMI_TLV_HDR_SIZE + |
| 1853 | (peer_ht_rates_align * sizeof(uint8_t)) + |
| 1854 | sizeof(wmi_vht_rate_set) + |
| 1855 | (sizeof(wmi_he_rate_set) * param->peer_he_mcs_count |
| 1856 | + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1857 | |
| 1858 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1859 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1860 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1861 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1862 | } |
| 1863 | |
| 1864 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1865 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1866 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1867 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1868 | WMITLV_GET_STRUCT_TLVLEN |
| 1869 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1870 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1871 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1872 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1873 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1874 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1875 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1876 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1877 | copy_peer_mac_addr_tlv(cmd, param); |
| 1878 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1879 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1880 | cmd->peer_caps = param->peer_caps; |
| 1881 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1882 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1883 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1884 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1885 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1886 | cmd->peer_phymode = param->peer_phymode; |
| 1887 | |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1888 | /* Update 11ax capabilities */ |
| 1889 | cmd->peer_he_cap_info = param->peer_he_cap_macinfo; |
| 1890 | cmd->peer_he_ops = param->peer_he_ops; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1891 | qdf_mem_copy(&cmd->peer_he_cap_phy, ¶m->peer_he_cap_phyinfo, |
| 1892 | sizeof(param->peer_he_cap_phyinfo)); |
| 1893 | qdf_mem_copy(&cmd->peer_ppet, ¶m->peer_ppet, |
| 1894 | sizeof(param->peer_ppet)); |
| 1895 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1896 | /* Update peer legacy rate information */ |
| 1897 | buf_ptr += sizeof(*cmd); |
| 1898 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1899 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1900 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1901 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1902 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1903 | param->peer_legacy_rates.num_rates); |
| 1904 | |
| 1905 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1906 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1907 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1908 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1909 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1910 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1911 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1912 | param->peer_ht_rates.num_rates); |
| 1913 | |
| 1914 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1915 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1916 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 1917 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 1918 | |
| 1919 | cmd->peer_nss = param->peer_nss; |
| 1920 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 1921 | if (param->vht_capable) { |
| 1922 | mcs->rx_max_rate = param->rx_max_rate; |
| 1923 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 1924 | mcs->tx_max_rate = param->tx_max_rate; |
| 1925 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 1926 | } |
| 1927 | |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1928 | /* HE Rates */ |
| 1929 | cmd->peer_he_mcs = param->peer_he_mcs_count; |
| 1930 | buf_ptr += sizeof(wmi_vht_rate_set); |
| 1931 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 1932 | (param->peer_he_mcs_count * sizeof(wmi_he_rate_set))); |
| 1933 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1934 | |
| 1935 | /* Loop through the HE rate set */ |
| 1936 | for (i = 0; i < param->peer_he_mcs_count; i++) { |
| 1937 | he_mcs = (wmi_he_rate_set *) buf_ptr; |
| 1938 | WMITLV_SET_HDR(he_mcs, WMITLV_TAG_STRUC_wmi_he_rate_set, |
| 1939 | WMITLV_GET_STRUCT_TLVLEN(wmi_he_rate_set)); |
| 1940 | |
| 1941 | he_mcs->rx_mcs_set = param->peer_he_rx_mcs_set[i]; |
| 1942 | he_mcs->tx_mcs_set = param->peer_he_tx_mcs_set[i]; |
| 1943 | WMI_LOGD("%s:HE idx %d RxMCSmap %x TxMCSmap %x ", __func__, |
| 1944 | i, he_mcs->rx_mcs_set, he_mcs->tx_mcs_set); |
| 1945 | buf_ptr += sizeof(wmi_he_rate_set); |
| 1946 | } |
| 1947 | |
| 1948 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1949 | 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] | 1950 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 1951 | "nss %d phymode %d peer_mpdu_density %d " |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1952 | "cmd->peer_vht_caps %x " |
| 1953 | "HE cap_info %x ops %x " |
| 1954 | "HE phy %x %x %x ", __func__, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1955 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 1956 | cmd->peer_rate_caps, cmd->peer_caps, |
| 1957 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 1958 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 1959 | cmd->peer_mpdu_density, |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1960 | cmd->peer_vht_caps, cmd->peer_he_cap_info, |
| 1961 | cmd->peer_he_ops, cmd->peer_he_cap_phy[0], |
| 1962 | cmd->peer_he_cap_phy[1], cmd->peer_he_cap_phy[2]); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1963 | |
| 1964 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1965 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1966 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1967 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1968 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1969 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1970 | } |
| 1971 | |
| 1972 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1973 | } |
| 1974 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1975 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 1976 | */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 1977 | static inline void copy_scan_event_cntrl_flags( |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1978 | wmi_start_scan_cmd_fixed_param * cmd, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 1979 | struct scan_req_params *param) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1980 | { |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 1981 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 1982 | /* Scan events subscription */ |
| 1983 | if (param->scan_ev_started) |
| 1984 | cmd->notify_scan_events |= WMI_SCAN_EVENT_STARTED; |
| 1985 | if (param->scan_ev_completed) |
| 1986 | cmd->notify_scan_events |= WMI_SCAN_EVENT_COMPLETED; |
| 1987 | if (param->scan_ev_bss_chan) |
| 1988 | cmd->notify_scan_events |= WMI_SCAN_EVENT_BSS_CHANNEL; |
| 1989 | if (param->scan_ev_foreign_chan) |
| 1990 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL; |
| 1991 | if (param->scan_ev_dequeued) |
| 1992 | cmd->notify_scan_events |= WMI_SCAN_EVENT_DEQUEUED; |
| 1993 | if (param->scan_ev_preempted) |
| 1994 | cmd->notify_scan_events |= WMI_SCAN_EVENT_PREEMPTED; |
| 1995 | if (param->scan_ev_start_failed) |
| 1996 | cmd->notify_scan_events |= WMI_SCAN_EVENT_START_FAILED; |
| 1997 | if (param->scan_ev_restarted) |
| 1998 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESTARTED; |
| 1999 | if (param->scan_ev_foreign_chn_exit) |
| 2000 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 2001 | if (param->scan_ev_suspended) |
| 2002 | cmd->notify_scan_events |= WMI_SCAN_EVENT_SUSPENDED; |
| 2003 | if (param->scan_ev_resumed) |
| 2004 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESUMED; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2005 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2006 | /** Set scan control flags */ |
| 2007 | cmd->scan_ctrl_flags = 0; |
| 2008 | if (param->scan_f_passive) |
| 2009 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; |
| 2010 | if (param->scan_f_strict_passive_pch) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2011 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2012 | if (param->scan_f_promisc_mode) |
| 2013 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROMISCOUS; |
| 2014 | if (param->scan_f_capture_phy_err) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2015 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2016 | if (param->scan_f_half_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2017 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2018 | if (param->scan_f_quarter_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2019 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2020 | if (param->scan_f_cck_rates) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2021 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2022 | if (param->scan_f_ofdm_rates) |
| 2023 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 2024 | if (param->scan_f_chan_stat_evnt) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2025 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2026 | if (param->scan_f_filter_prb_req) |
| 2027 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; |
| 2028 | if (param->scan_f_bcast_probe) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2029 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2030 | if (param->scan_f_offchan_mgmt_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2031 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2032 | if (param->scan_f_offchan_data_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2033 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2034 | if (param->scan_f_force_active_dfs_chn) |
| 2035 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_FORCE_ACTIVE_ON_DFS; |
| 2036 | if (param->scan_f_add_tpc_ie_in_probe) |
| 2037 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_TPC_IE_IN_PROBE_REQ; |
| 2038 | if (param->scan_f_add_ds_ie_in_probe) |
| 2039 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
| 2040 | if (param->scan_f_add_spoofed_mac_in_probe) |
| 2041 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; |
| 2042 | if (param->scan_f_add_rand_seq_in_probe) |
| 2043 | cmd->scan_ctrl_flags |= WMI_SCAN_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 2044 | if (param->scan_f_en_ie_whitelist_in_probe) |
| 2045 | cmd->scan_ctrl_flags |= |
| 2046 | WMI_SCAN_ENABLE_IE_WHTELIST_IN_PROBE_REQ; |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2047 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2048 | /* for adaptive scan mode using 3 bits (21 - 23 bits) */ |
| 2049 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 2050 | param->adaptive_dwell_time_mode); |
| 2051 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2052 | |
| 2053 | /* scan_copy_ie_buffer() - Copy scan ie_data */ |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2054 | static inline void scan_copy_ie_buffer(uint8_t *buf_ptr, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2055 | struct scan_req_params *params) |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2056 | { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2057 | qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len); |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2058 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2059 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2060 | /* |
| 2061 | * get_pdev_wmi_handle() - Helper func to derive pdev wmi handle from vdev_id |
| 2062 | * @param wmi_handle : Handle to WMI |
| 2063 | * @param vdev_id : vdev identifier |
| 2064 | * |
| 2065 | * Return : void * |
| 2066 | */ |
| 2067 | static inline void *get_pdev_wmi_handle(wmi_unified_t wmi_handle, uint8_t vdev_id) |
| 2068 | { |
| 2069 | struct wlan_objmgr_vdev *vdev = NULL; |
| 2070 | struct wlan_objmgr_pdev *pdev = NULL; |
| 2071 | uint8_t pdev_id = 0; |
| 2072 | |
| 2073 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc( |
| 2074 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 2075 | vdev_id, WLAN_SCAN_ID); |
| 2076 | if (vdev) { |
| 2077 | wlan_objmgr_vdev_release_ref(vdev, WLAN_SCAN_ID); |
| 2078 | pdev = wlan_vdev_get_pdev(vdev); |
| 2079 | if (pdev) |
| 2080 | pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); |
| 2081 | else { |
| 2082 | qdf_print("%s : Invalid PDEV, forcing pdev_id to 0\n", __func__); |
| 2083 | } |
| 2084 | } else { |
| 2085 | qdf_print("%s : Invalid VDEV, forcing pdev_id to 0\n", __func__); |
| 2086 | } |
| 2087 | |
| 2088 | return wmi_unified_get_pdev_handle(wmi_handle->soc, pdev_id); |
| 2089 | } |
| 2090 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2091 | /** |
| 2092 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 2093 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2094 | * @param param : pointer to hold scan start cmd parameter |
| 2095 | * |
| 2096 | * Return: 0 on success and -ve on failure. |
| 2097 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2098 | static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2099 | struct scan_req_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2100 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2101 | int32_t ret = 0; |
| 2102 | int32_t i; |
| 2103 | wmi_buf_t wmi_buf; |
| 2104 | wmi_start_scan_cmd_fixed_param *cmd; |
| 2105 | uint8_t *buf_ptr; |
| 2106 | uint32_t *tmp_ptr; |
| 2107 | wmi_ssid *ssid = NULL; |
| 2108 | wmi_mac_addr *bssid; |
| 2109 | int len = sizeof(*cmd); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2110 | uint8_t extraie_len_with_pad = 0; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2111 | |
| 2112 | /* Length TLV placeholder for array of uint32_t */ |
| 2113 | len += WMI_TLV_HDR_SIZE; |
| 2114 | /* calculate the length of buffer required */ |
| 2115 | if (params->num_chan) |
| 2116 | len += params->num_chan * sizeof(uint32_t); |
| 2117 | |
| 2118 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 2119 | len += WMI_TLV_HDR_SIZE; |
| 2120 | if (params->num_ssids) |
| 2121 | len += params->num_ssids * sizeof(wmi_ssid); |
| 2122 | |
| 2123 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 2124 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2125 | if (params->num_bssid) |
| 2126 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2127 | |
| 2128 | /* Length TLV placeholder for array of bytes */ |
| 2129 | len += WMI_TLV_HDR_SIZE; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2130 | if (params->extraie.len) |
| 2131 | extraie_len_with_pad = |
| 2132 | roundup(params->extraie.len, sizeof(uint32_t)); |
| 2133 | len += extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2134 | |
| 2135 | /* Allocate the memory */ |
| 2136 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2137 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2138 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2139 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2140 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2141 | } |
| 2142 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2143 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 2144 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2145 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 2146 | WMITLV_GET_STRUCT_TLVLEN |
| 2147 | (wmi_start_scan_cmd_fixed_param)); |
| 2148 | |
| 2149 | cmd->scan_id = params->scan_id; |
| 2150 | cmd->scan_req_id = params->scan_req_id; |
| 2151 | cmd->vdev_id = params->vdev_id; |
| 2152 | cmd->scan_priority = params->scan_priority; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2153 | |
| 2154 | copy_scan_event_cntrl_flags(cmd, params); |
| 2155 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2156 | cmd->dwell_time_active = params->dwell_time_active; |
| 2157 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 2158 | cmd->min_rest_time = params->min_rest_time; |
| 2159 | cmd->max_rest_time = params->max_rest_time; |
| 2160 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 2161 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 2162 | cmd->idle_time = params->idle_time; |
| 2163 | cmd->max_scan_time = params->max_scan_time; |
| 2164 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2165 | cmd->burst_duration = params->burst_duration; |
| 2166 | cmd->num_chan = params->num_chan; |
| 2167 | cmd->num_bssid = params->num_bssid; |
| 2168 | cmd->num_ssids = params->num_ssids; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2169 | cmd->ie_len = params->extraie.len; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2170 | cmd->n_probes = params->n_probes; |
| 2171 | buf_ptr += sizeof(*cmd); |
| 2172 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2173 | for (i = 0; i < params->num_chan; ++i) |
| 2174 | tmp_ptr[i] = params->chan_list[i]; |
| 2175 | |
| 2176 | WMITLV_SET_HDR(buf_ptr, |
| 2177 | WMITLV_TAG_ARRAY_UINT32, |
| 2178 | (params->num_chan * sizeof(uint32_t))); |
| 2179 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2180 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2181 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2182 | goto error; |
| 2183 | } |
| 2184 | |
| 2185 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2186 | (params->num_ssids * sizeof(wmi_ssid))); |
| 2187 | |
| 2188 | if (params->num_ssids) { |
| 2189 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2190 | for (i = 0; i < params->num_ssids; ++i) { |
| 2191 | ssid->ssid_len = params->ssid[i].length; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2192 | qdf_mem_copy(ssid->ssid, params->ssid[i].ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2193 | params->ssid[i].length); |
| 2194 | ssid++; |
| 2195 | } |
| 2196 | } |
| 2197 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 2198 | |
| 2199 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2200 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 2201 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2202 | |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2203 | if (params->num_bssid) { |
| 2204 | for (i = 0; i < params->num_bssid; ++i) { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2205 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 2206 | ¶ms->bssid_list[i].bytes[0], bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2207 | bssid++; |
| 2208 | } |
| 2209 | } |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2210 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2211 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2212 | (params->num_bssid * sizeof(wmi_mac_addr)); |
| 2213 | |
| 2214 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, extraie_len_with_pad); |
| 2215 | if (params->extraie.len) |
| 2216 | scan_copy_ie_buffer(buf_ptr + WMI_TLV_HDR_SIZE, |
| 2217 | params); |
| 2218 | |
| 2219 | buf_ptr += WMI_TLV_HDR_SIZE + extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2220 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2221 | ret = wmi_unified_cmd_send( |
| 2222 | get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2223 | len, WMI_START_SCAN_CMDID); |
| 2224 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2225 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2226 | wmi_buf_free(wmi_buf); |
| 2227 | } |
| 2228 | return ret; |
| 2229 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2230 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2231 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2232 | } |
| 2233 | |
| 2234 | /** |
| 2235 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 2236 | * @param wmi_handle : handle to WMI. |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2237 | * @param param : pointer to hold scan cancel cmd parameter |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2238 | * |
| 2239 | * Return: 0 on success and -ve on failure. |
| 2240 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2241 | static QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2242 | struct scan_cancel_param *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2243 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2244 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2245 | int ret; |
| 2246 | int len = sizeof(*cmd); |
| 2247 | wmi_buf_t wmi_buf; |
| 2248 | |
| 2249 | /* Allocate the memory */ |
| 2250 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2251 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2252 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2253 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2254 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2255 | goto error; |
| 2256 | } |
| 2257 | |
| 2258 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2259 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2260 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2261 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2262 | cmd->vdev_id = param->vdev_id; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2263 | cmd->requestor = param->requester; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2264 | cmd->scan_id = param->scan_id; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2265 | cmd->pdev_id = param->pdev_id + 1; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2266 | /* stop the scan with the corresponding scan_id */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2267 | if (param->req_type == WLAN_SCAN_CANCEL_PDEV_ALL) { |
| 2268 | /* Cancelling all scans */ |
| 2269 | cmd->req_type = WMI_SCAN_STOP_ALL; |
| 2270 | } else if (param->req_type == WLAN_SCAN_CANCEL_VDEV_ALL) { |
| 2271 | /* Cancelling VAP scans */ |
| 2272 | cmd->req_type = WMI_SCN_STOP_VAP_ALL; |
| 2273 | } else if (param->req_type == WLAN_SCAN_CANCEL_SINGLE) { |
| 2274 | /* Cancelling specific scan */ |
| 2275 | cmd->req_type = WMI_SCAN_STOP_ONE; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2276 | } else { |
| 2277 | WMI_LOGE("%s: Invalid Command : ", __func__); |
| 2278 | wmi_buf_free(wmi_buf); |
| 2279 | return QDF_STATUS_E_INVAL; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2280 | } |
| 2281 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2282 | ret = wmi_unified_cmd_send(get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2283 | len, WMI_STOP_SCAN_CMDID); |
| 2284 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2285 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2286 | wmi_buf_free(wmi_buf); |
| 2287 | } |
| 2288 | |
| 2289 | error: |
| 2290 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2291 | } |
| 2292 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2293 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2294 | /** |
| 2295 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2296 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2297 | * @param param : pointer to hold scan channel list parameter |
| 2298 | * |
| 2299 | * Return: 0 on success and -ve on failure. |
| 2300 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2301 | static 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] | 2302 | struct scan_chan_list_params *chan_list) |
| 2303 | { |
| 2304 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2305 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2306 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2307 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2308 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2309 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2310 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2311 | |
| 2312 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2313 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2314 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2315 | WMI_LOGE("Failed to allocate memory"); |
| 2316 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2317 | goto end; |
| 2318 | } |
| 2319 | |
| 2320 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2321 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2322 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2323 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2324 | WMITLV_GET_STRUCT_TLVLEN |
| 2325 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2326 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2327 | 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] | 2328 | |
| 2329 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2330 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2331 | WMITLV_TAG_ARRAY_STRUC, |
| 2332 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2333 | chan_info = (wmi_channel_param *) |
| 2334 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2335 | tchan_info = chan_list->chan_info; |
| 2336 | |
| 2337 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2338 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2339 | WMITLV_TAG_STRUC_wmi_channel, |
| 2340 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2341 | chan_info->mhz = tchan_info->mhz; |
| 2342 | chan_info->band_center_freq1 = |
| 2343 | tchan_info->band_center_freq1; |
| 2344 | chan_info->band_center_freq2 = |
| 2345 | tchan_info->band_center_freq2; |
| 2346 | chan_info->info = tchan_info->info; |
| 2347 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2348 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2349 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2350 | |
| 2351 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2352 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2353 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2354 | tchan_info++; |
| 2355 | chan_info++; |
| 2356 | } |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2357 | cmd->pdev_id = chan_list->pdev_id + 1; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2358 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2359 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 2360 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2361 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2362 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2363 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2364 | wmi_buf_free(buf); |
| 2365 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2366 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2367 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2368 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2369 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2370 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2371 | static QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2372 | struct scan_chan_list_params *chan_list) |
| 2373 | { |
| 2374 | wmi_buf_t buf; |
| 2375 | QDF_STATUS qdf_status; |
| 2376 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2377 | int i; |
| 2378 | uint8_t *buf_ptr; |
| 2379 | wmi_channel *chan_info; |
| 2380 | struct channel_param *tchan_info; |
| 2381 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2382 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2383 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2384 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2385 | if (!buf) { |
| 2386 | WMI_LOGE("Failed to allocate memory"); |
| 2387 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2388 | goto end; |
| 2389 | } |
| 2390 | |
| 2391 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2392 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2393 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2394 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2395 | WMITLV_GET_STRUCT_TLVLEN |
| 2396 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2397 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2398 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2399 | |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 2400 | cmd->pdev_id = chan_list->pdev_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2401 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2402 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2403 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2404 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2405 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2406 | tchan_info = &(chan_list->ch_param[0]); |
| 2407 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2408 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2409 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2410 | WMITLV_TAG_STRUC_wmi_channel, |
| 2411 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2412 | chan_info->mhz = tchan_info->mhz; |
| 2413 | chan_info->band_center_freq1 = |
| 2414 | tchan_info->cfreq1; |
| 2415 | chan_info->band_center_freq2 = |
| 2416 | tchan_info->cfreq2; |
| 2417 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2418 | if (tchan_info->is_chan_passive) |
| 2419 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2420 | WMI_CHAN_FLAG_PASSIVE); |
| 2421 | |
| 2422 | if (tchan_info->allow_vht) |
| 2423 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2424 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2425 | else if (tchan_info->allow_ht) |
| 2426 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2427 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2428 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2429 | tchan_info->phy_mode); |
| 2430 | |
| 2431 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2432 | * after FW support |
| 2433 | */ |
| 2434 | |
| 2435 | /* also fill in power information */ |
| 2436 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2437 | tchan_info->minpower); |
| 2438 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2439 | tchan_info->maxpower); |
| 2440 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2441 | tchan_info->maxregpower); |
| 2442 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2443 | tchan_info->antennamax); |
| 2444 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2445 | tchan_info->reg_class_id); |
| 2446 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2447 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2448 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2449 | tchan_info++; |
| 2450 | chan_info++; |
| 2451 | } |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2452 | cmd->pdev_id = chan_list->pdev_id + 1; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2453 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2454 | qdf_status = wmi_unified_cmd_send( |
| 2455 | wmi_handle, |
| 2456 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2457 | |
| 2458 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2459 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2460 | wmi_buf_free(buf); |
| 2461 | } |
| 2462 | |
| 2463 | end: |
| 2464 | return qdf_status; |
| 2465 | } |
| 2466 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2467 | /** |
| 2468 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2469 | * @wmi_handle : handle to WMI. |
| 2470 | * @param : pointer to hold mgmt cmd parameter |
| 2471 | * |
| 2472 | * Return: 0 on success and -ve on failure. |
| 2473 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2474 | static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2475 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2476 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2477 | wmi_buf_t buf; |
| 2478 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2479 | int32_t cmd_len; |
| 2480 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2481 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2482 | uint8_t *bufp; |
| 2483 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2484 | mgmt_tx_dl_frm_len; |
| 2485 | |
| 2486 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 2487 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 2488 | |
| 2489 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2490 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2491 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2492 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2493 | } |
| 2494 | |
| 2495 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2496 | bufp = (uint8_t *) cmd; |
| 2497 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2498 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2499 | WMITLV_GET_STRUCT_TLVLEN |
| 2500 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2501 | |
| 2502 | cmd->vdev_id = param->vdev_id; |
| 2503 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2504 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2505 | cmd->chanfreq = param->chanfreq; |
| 2506 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2507 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2508 | sizeof(uint32_t))); |
| 2509 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2510 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2511 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2512 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2513 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
Orhan K AKYILDIZ | 271641f | 2017-01-29 15:17:12 -0800 | [diff] [blame] | 2514 | #if defined(HTT_PADDR64) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2515 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2516 | #endif |
| 2517 | cmd->frame_len = param->frm_len; |
| 2518 | cmd->buf_len = bufp_len; |
| 2519 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2520 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2521 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2522 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2523 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2524 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2525 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2526 | goto err1; |
| 2527 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2528 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2529 | |
| 2530 | err1: |
| 2531 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2532 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2533 | } |
| 2534 | |
| 2535 | /** |
| 2536 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2537 | * @wmi_handle: wmi handle |
| 2538 | * @param_value: parameter value |
| 2539 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2540 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2541 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2542 | static 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] | 2543 | uint32_t param_value) |
| 2544 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2545 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2546 | wmi_modem_power_state_cmd_param *cmd; |
| 2547 | wmi_buf_t buf; |
| 2548 | uint16_t len = sizeof(*cmd); |
| 2549 | |
| 2550 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2551 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2552 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2553 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2554 | } |
| 2555 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2556 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2557 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2558 | WMITLV_GET_STRUCT_TLVLEN |
| 2559 | (wmi_modem_power_state_cmd_param)); |
| 2560 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2561 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2562 | param_value); |
| 2563 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2564 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2565 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2566 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2567 | wmi_buf_free(buf); |
| 2568 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2569 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2570 | return ret; |
| 2571 | } |
| 2572 | |
| 2573 | /** |
| 2574 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2575 | * @wmi_handle: wmi handle |
| 2576 | * @vdev_id: vdev id |
| 2577 | * @val: value |
| 2578 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2579 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2580 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2581 | static 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] | 2582 | uint32_t vdev_id, uint8_t val) |
| 2583 | { |
| 2584 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2585 | wmi_buf_t buf; |
| 2586 | int32_t len = sizeof(*cmd); |
| 2587 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2588 | 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] | 2589 | |
| 2590 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2591 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2592 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2593 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2594 | } |
| 2595 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2596 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2597 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2598 | WMITLV_GET_STRUCT_TLVLEN |
| 2599 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2600 | cmd->vdev_id = vdev_id; |
| 2601 | if (val) |
| 2602 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2603 | else |
| 2604 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2605 | |
| 2606 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2607 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2608 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2609 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2610 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2611 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2612 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2613 | return 0; |
| 2614 | } |
| 2615 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2616 | /** |
| 2617 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2618 | * @wmi_handle: wmi handle |
| 2619 | * @vdev_id: vdev id |
| 2620 | * @value: value |
| 2621 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2622 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2623 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2624 | static QDF_STATUS send_set_mimops_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2625 | uint8_t vdev_id, int value) |
| 2626 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2627 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2628 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2629 | wmi_buf_t buf; |
| 2630 | uint16_t len = sizeof(*cmd); |
| 2631 | |
| 2632 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2633 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2634 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2635 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2636 | } |
| 2637 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2638 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2639 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2640 | WMITLV_GET_STRUCT_TLVLEN |
| 2641 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2642 | |
| 2643 | cmd->vdev_id = vdev_id; |
| 2644 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2645 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2646 | * to SM power save values defined in the specification. |
| 2647 | * Make sure to send the right mapping. |
| 2648 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2649 | switch (value) { |
| 2650 | case 0: |
| 2651 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 2652 | break; |
| 2653 | case 1: |
| 2654 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 2655 | break; |
| 2656 | case 2: |
| 2657 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 2658 | break; |
| 2659 | case 3: |
| 2660 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 2661 | break; |
| 2662 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2663 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 2664 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2665 | } |
| 2666 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2667 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2668 | |
| 2669 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2670 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2671 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2672 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2673 | wmi_buf_free(buf); |
| 2674 | } |
| 2675 | |
| 2676 | return ret; |
| 2677 | } |
| 2678 | |
| 2679 | /** |
| 2680 | * send_set_smps_params_cmd_tlv() - set smps params |
| 2681 | * @wmi_handle: wmi handle |
| 2682 | * @vdev_id: vdev id |
| 2683 | * @value: value |
| 2684 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2685 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2686 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2687 | static 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] | 2688 | int value) |
| 2689 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2690 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2691 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 2692 | wmi_buf_t buf; |
| 2693 | uint16_t len = sizeof(*cmd); |
| 2694 | |
| 2695 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2696 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2697 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2698 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2699 | } |
| 2700 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 2701 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2702 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 2703 | WMITLV_GET_STRUCT_TLVLEN |
| 2704 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 2705 | |
| 2706 | cmd->vdev_id = vdev_id; |
| 2707 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 2708 | cmd->param = |
| 2709 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 2710 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2711 | 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] | 2712 | cmd->param); |
| 2713 | |
| 2714 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2715 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2716 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2717 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2718 | wmi_buf_free(buf); |
| 2719 | } |
| 2720 | |
| 2721 | return ret; |
| 2722 | } |
| 2723 | |
| 2724 | /** |
| 2725 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 2726 | * @wmi_handle: wmi handle |
| 2727 | * @noa: p2p power save parameters |
| 2728 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2729 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2730 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2731 | static 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] | 2732 | struct p2p_ps_params *noa) |
| 2733 | { |
| 2734 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 2735 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 2736 | wmi_buf_t buf; |
| 2737 | uint8_t *buf_ptr; |
| 2738 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2739 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2740 | uint32_t duration; |
| 2741 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2742 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2743 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 2744 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2745 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2746 | WMI_LOGE("Failed to allocate memory"); |
| 2747 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2748 | goto end; |
| 2749 | } |
| 2750 | |
| 2751 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2752 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 2753 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2754 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 2755 | WMITLV_GET_STRUCT_TLVLEN |
| 2756 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 2757 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 2758 | cmd->vdev_id = noa->session_id; |
| 2759 | cmd->enable = (duration) ? true : false; |
| 2760 | cmd->num_noa = 1; |
| 2761 | |
| 2762 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 2763 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 2764 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 2765 | sizeof |
| 2766 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 2767 | + WMI_TLV_HDR_SIZE); |
| 2768 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 2769 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 2770 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 2771 | noa_discriptor->type_count = noa->count; |
| 2772 | noa_discriptor->duration = duration; |
| 2773 | noa_discriptor->interval = noa->interval; |
| 2774 | noa_discriptor->start_time = 0; |
| 2775 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2776 | 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] | 2777 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 2778 | noa->interval); |
| 2779 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2780 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2781 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2782 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2783 | wmi_buf_free(buf); |
| 2784 | } |
| 2785 | |
| 2786 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2787 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2788 | return status; |
| 2789 | } |
| 2790 | |
| 2791 | |
| 2792 | /** |
| 2793 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 2794 | * @wmi_handle: wmi handle |
| 2795 | * @noa: p2p opp power save parameters |
| 2796 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2797 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2798 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2799 | static 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] | 2800 | struct p2p_ps_params *oppps) |
| 2801 | { |
| 2802 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 2803 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2804 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2805 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2806 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2807 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2808 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2809 | WMI_LOGE("Failed to allocate memory"); |
| 2810 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2811 | goto end; |
| 2812 | } |
| 2813 | |
| 2814 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 2815 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2816 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 2817 | WMITLV_GET_STRUCT_TLVLEN |
| 2818 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 2819 | cmd->vdev_id = oppps->session_id; |
| 2820 | if (oppps->ctwindow) |
| 2821 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 2822 | |
| 2823 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2824 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2825 | cmd->vdev_id, oppps->ctwindow); |
| 2826 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 2827 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2828 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2829 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2830 | wmi_buf_free(buf); |
| 2831 | } |
| 2832 | |
| 2833 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2834 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2835 | return status; |
| 2836 | } |
| 2837 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 2838 | #ifdef CONVERGED_P2P_ENABLE |
| 2839 | /** |
| 2840 | * send_p2p_lo_start_cmd_tlv() - send p2p lo start request to fw |
| 2841 | * @wmi_handle: wmi handle |
| 2842 | * @param: p2p listen offload start parameters |
| 2843 | * |
| 2844 | * Return: QDF status |
| 2845 | */ |
| 2846 | static QDF_STATUS send_p2p_lo_start_cmd_tlv(wmi_unified_t wmi_handle, |
| 2847 | struct p2p_lo_start *param) |
| 2848 | { |
| 2849 | wmi_buf_t buf; |
| 2850 | wmi_p2p_lo_start_cmd_fixed_param *cmd; |
| 2851 | int32_t len = sizeof(*cmd); |
| 2852 | uint8_t *buf_ptr; |
| 2853 | QDF_STATUS status; |
| 2854 | int device_types_len_aligned; |
| 2855 | int probe_resp_len_aligned; |
| 2856 | |
| 2857 | if (!param) { |
| 2858 | WMI_LOGE("lo start param is null"); |
| 2859 | return QDF_STATUS_E_INVAL; |
| 2860 | } |
| 2861 | |
| 2862 | WMI_LOGD("%s: vdev_id:%d", __func__, param->vdev_id); |
| 2863 | |
| 2864 | device_types_len_aligned = |
| 2865 | qdf_roundup(param->dev_types_len, |
| 2866 | sizeof(A_UINT32)); |
| 2867 | probe_resp_len_aligned = |
| 2868 | qdf_roundup(param->probe_resp_len, |
| 2869 | sizeof(A_UINT32)); |
| 2870 | |
| 2871 | len += 2 * WMI_TLV_HDR_SIZE + device_types_len_aligned + |
| 2872 | probe_resp_len_aligned; |
| 2873 | |
| 2874 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2875 | if (!buf) { |
| 2876 | WMI_LOGE("%s: Failed to allocate memory for p2p lo start", |
| 2877 | __func__); |
| 2878 | return QDF_STATUS_E_NOMEM; |
| 2879 | } |
| 2880 | |
| 2881 | cmd = (wmi_p2p_lo_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 2882 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2883 | |
| 2884 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2885 | WMITLV_TAG_STRUC_wmi_p2p_lo_start_cmd_fixed_param, |
| 2886 | WMITLV_GET_STRUCT_TLVLEN( |
| 2887 | wmi_p2p_lo_start_cmd_fixed_param)); |
| 2888 | |
| 2889 | cmd->vdev_id = param->vdev_id; |
| 2890 | cmd->ctl_flags = param->ctl_flags; |
| 2891 | cmd->channel = param->freq; |
| 2892 | cmd->period = param->period; |
| 2893 | cmd->interval = param->interval; |
| 2894 | cmd->count = param->count; |
| 2895 | cmd->device_types_len = param->dev_types_len; |
| 2896 | cmd->prob_resp_len = param->probe_resp_len; |
| 2897 | |
| 2898 | buf_ptr += sizeof(wmi_p2p_lo_start_cmd_fixed_param); |
| 2899 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2900 | device_types_len_aligned); |
| 2901 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2902 | qdf_mem_copy(buf_ptr, param->device_types, |
| 2903 | param->dev_types_len); |
| 2904 | |
| 2905 | buf_ptr += device_types_len_aligned; |
| 2906 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 2907 | probe_resp_len_aligned); |
| 2908 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2909 | qdf_mem_copy(buf_ptr, param->probe_resp_tmplt, |
| 2910 | param->probe_resp_len); |
| 2911 | |
| 2912 | WMI_LOGD("%s: Sending WMI_P2P_LO_START command, channel=%d, period=%d, interval=%d, count=%d", __func__, |
| 2913 | cmd->channel, cmd->period, cmd->interval, cmd->count); |
| 2914 | |
| 2915 | status = wmi_unified_cmd_send(wmi_handle, |
| 2916 | buf, len, |
| 2917 | WMI_P2P_LISTEN_OFFLOAD_START_CMDID); |
| 2918 | if (status != QDF_STATUS_SUCCESS) { |
| 2919 | WMI_LOGE("%s: Failed to send p2p lo start: %d", |
| 2920 | __func__, status); |
| 2921 | wmi_buf_free(buf); |
| 2922 | return status; |
| 2923 | } |
| 2924 | |
| 2925 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_START", __func__); |
| 2926 | |
| 2927 | return QDF_STATUS_SUCCESS; |
| 2928 | } |
| 2929 | |
| 2930 | /** |
| 2931 | * send_p2p_lo_stop_cmd_tlv() - send p2p lo stop request to fw |
| 2932 | * @wmi_handle: wmi handle |
| 2933 | * @param: p2p listen offload stop parameters |
| 2934 | * |
| 2935 | * Return: QDF status |
| 2936 | */ |
| 2937 | static QDF_STATUS send_p2p_lo_stop_cmd_tlv(wmi_unified_t wmi_handle, |
| 2938 | uint8_t vdev_id) |
| 2939 | { |
| 2940 | wmi_buf_t buf; |
| 2941 | wmi_p2p_lo_stop_cmd_fixed_param *cmd; |
| 2942 | int32_t len; |
| 2943 | QDF_STATUS status; |
| 2944 | |
| 2945 | WMI_LOGD("%s: vdev_id:%d", __func__, vdev_id); |
| 2946 | |
| 2947 | len = sizeof(*cmd); |
| 2948 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2949 | if (!buf) { |
| 2950 | qdf_print("%s: Failed to allocate memory for p2p lo stop", |
| 2951 | __func__); |
| 2952 | return QDF_STATUS_E_NOMEM; |
| 2953 | } |
| 2954 | cmd = (wmi_p2p_lo_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 2955 | |
| 2956 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2957 | WMITLV_TAG_STRUC_wmi_p2p_lo_stop_cmd_fixed_param, |
| 2958 | WMITLV_GET_STRUCT_TLVLEN( |
| 2959 | wmi_p2p_lo_stop_cmd_fixed_param)); |
| 2960 | |
| 2961 | cmd->vdev_id = vdev_id; |
| 2962 | |
| 2963 | WMI_LOGD("%s: Sending WMI_P2P_LO_STOP command", __func__); |
| 2964 | |
| 2965 | status = wmi_unified_cmd_send(wmi_handle, |
| 2966 | buf, len, |
| 2967 | WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID); |
| 2968 | if (status != QDF_STATUS_SUCCESS) { |
| 2969 | WMI_LOGE("%s: Failed to send p2p lo stop: %d", |
| 2970 | __func__, status); |
| 2971 | wmi_buf_free(buf); |
| 2972 | return status; |
| 2973 | } |
| 2974 | |
| 2975 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_STOP", __func__); |
| 2976 | |
| 2977 | return QDF_STATUS_SUCCESS; |
| 2978 | } |
| 2979 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 2980 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2981 | /** |
| 2982 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 2983 | * @wmi_handle: wmi handle |
| 2984 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2985 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2986 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2987 | static QDF_STATUS send_get_temperature_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2988 | { |
| 2989 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 2990 | wmi_buf_t wmi_buf; |
| 2991 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 2992 | uint8_t *buf_ptr; |
| 2993 | |
| 2994 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2995 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 2996 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2997 | } |
| 2998 | |
| 2999 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 3000 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3001 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3002 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3003 | } |
| 3004 | |
| 3005 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3006 | |
| 3007 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 3008 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3009 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 3010 | WMITLV_GET_STRUCT_TLVLEN |
| 3011 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 3012 | |
| 3013 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 3014 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3015 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3016 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3017 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3018 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3019 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3020 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3021 | } |
| 3022 | |
| 3023 | /** |
| 3024 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 3025 | * @wmi_handle: wmi handle |
| 3026 | * @vdevid: vdev id |
| 3027 | * @peer_addr: peer mac address |
| 3028 | * @auto_triggerparam: auto trigger parameters |
| 3029 | * @num_ac: number of access category |
| 3030 | * |
| 3031 | * This function sets the trigger |
| 3032 | * uapsd params such as service interval, delay interval |
| 3033 | * and suspend interval which will be used by the firmware |
| 3034 | * to send trigger frames periodically when there is no |
| 3035 | * traffic on the transmit side. |
| 3036 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3037 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3038 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3039 | static 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] | 3040 | struct sta_uapsd_trig_params *param) |
| 3041 | { |
| 3042 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3043 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3044 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 3045 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 3046 | uint32_t i; |
| 3047 | wmi_buf_t buf; |
| 3048 | uint8_t *buf_ptr; |
| 3049 | |
| 3050 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 3051 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3052 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3053 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3054 | } |
| 3055 | |
| 3056 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3057 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 3058 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3059 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 3060 | WMITLV_GET_STRUCT_TLVLEN |
| 3061 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 3062 | cmd->vdev_id = param->vdevid; |
| 3063 | cmd->num_ac = param->num_ac; |
| 3064 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 3065 | |
| 3066 | /* TLV indicating array of structures to follow */ |
| 3067 | buf_ptr += sizeof(*cmd); |
| 3068 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 3069 | |
| 3070 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3071 | qdf_mem_copy(buf_ptr, param->auto_triggerparam, param_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3072 | |
| 3073 | /* |
| 3074 | * Update tag and length for uapsd auto trigger params (this will take |
| 3075 | * care of updating tag and length if it is not pre-filled by caller). |
| 3076 | */ |
| 3077 | for (i = 0; i < param->num_ac; i++) { |
| 3078 | WMITLV_SET_HDR((buf_ptr + |
| 3079 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 3080 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 3081 | WMITLV_GET_STRUCT_TLVLEN |
| 3082 | (wmi_sta_uapsd_auto_trig_param)); |
| 3083 | } |
| 3084 | |
| 3085 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3086 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3087 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3088 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3089 | wmi_buf_free(buf); |
| 3090 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3091 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3092 | return ret; |
| 3093 | } |
| 3094 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3095 | /** |
| 3096 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 3097 | * @wmi_handle: pointer to the wmi handle |
| 3098 | * @utc: pointer to the UTC time struct |
| 3099 | * |
| 3100 | * Return: 0 on succes |
| 3101 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3102 | static 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] | 3103 | struct ocb_utc_param *utc) |
| 3104 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3105 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3106 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 3107 | uint8_t *buf_ptr; |
| 3108 | uint32_t len, i; |
| 3109 | wmi_buf_t buf; |
| 3110 | |
| 3111 | len = sizeof(*cmd); |
| 3112 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3113 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3114 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3115 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3116 | } |
| 3117 | |
| 3118 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3119 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 3120 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3121 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 3122 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 3123 | cmd->vdev_id = utc->vdev_id; |
| 3124 | |
| 3125 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 3126 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 3127 | |
| 3128 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 3129 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 3130 | |
| 3131 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3132 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3133 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3134 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3135 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3136 | } |
| 3137 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3138 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3139 | } |
| 3140 | |
| 3141 | /** |
| 3142 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 3143 | * frames on a channel |
| 3144 | * @wmi_handle: pointer to the wmi handle |
| 3145 | * @timing_advert: pointer to the timing advertisement struct |
| 3146 | * |
| 3147 | * Return: 0 on succes |
| 3148 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3149 | static 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] | 3150 | struct ocb_timing_advert_param *timing_advert) |
| 3151 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3152 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3153 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 3154 | uint8_t *buf_ptr; |
| 3155 | uint32_t len, len_template; |
| 3156 | wmi_buf_t buf; |
| 3157 | |
| 3158 | len = sizeof(*cmd) + |
| 3159 | WMI_TLV_HDR_SIZE; |
| 3160 | |
| 3161 | len_template = timing_advert->template_length; |
| 3162 | /* Add padding to the template if needed */ |
| 3163 | if (len_template % 4 != 0) |
| 3164 | len_template += 4 - (len_template % 4); |
| 3165 | len += len_template; |
| 3166 | |
| 3167 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3168 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3169 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3170 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3171 | } |
| 3172 | |
| 3173 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3174 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3175 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3176 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 3177 | WMITLV_GET_STRUCT_TLVLEN( |
| 3178 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 3179 | cmd->vdev_id = timing_advert->vdev_id; |
| 3180 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 3181 | cmd->channel_freq = timing_advert->chan_freq; |
| 3182 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 3183 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 3184 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 3185 | buf_ptr += sizeof(*cmd); |
| 3186 | |
| 3187 | /* Add the timing advert template */ |
| 3188 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3189 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3190 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3191 | (uint8_t *)timing_advert->template_value, |
| 3192 | timing_advert->template_length); |
| 3193 | |
| 3194 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3195 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3196 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3197 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3198 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3199 | } |
| 3200 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3201 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3202 | } |
| 3203 | |
| 3204 | /** |
| 3205 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 3206 | * on a channel |
| 3207 | * @wmi_handle: pointer to the wmi handle |
| 3208 | * @timing_advert: pointer to the timing advertisement struct |
| 3209 | * |
| 3210 | * Return: 0 on succes |
| 3211 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3212 | static 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] | 3213 | struct ocb_timing_advert_param *timing_advert) |
| 3214 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3215 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3216 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 3217 | uint8_t *buf_ptr; |
| 3218 | uint32_t len; |
| 3219 | wmi_buf_t buf; |
| 3220 | |
| 3221 | len = sizeof(*cmd); |
| 3222 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3223 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3224 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3225 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3226 | } |
| 3227 | |
| 3228 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3229 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3230 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3231 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 3232 | WMITLV_GET_STRUCT_TLVLEN( |
| 3233 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 3234 | cmd->vdev_id = timing_advert->vdev_id; |
| 3235 | cmd->channel_freq = timing_advert->chan_freq; |
| 3236 | |
| 3237 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3238 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3239 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3240 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3241 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3242 | } |
| 3243 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3244 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3245 | } |
| 3246 | |
| 3247 | /** |
| 3248 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 3249 | * @wmi_handle: pointer to the wmi handle |
| 3250 | * @request: pointer to the request |
| 3251 | * |
| 3252 | * Return: 0 on succes |
| 3253 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3254 | static 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] | 3255 | uint8_t vdev_id) |
| 3256 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3257 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3258 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 3259 | uint8_t *buf_ptr; |
| 3260 | wmi_buf_t buf; |
| 3261 | int32_t len; |
| 3262 | |
| 3263 | len = sizeof(*cmd); |
| 3264 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3265 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3266 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3267 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3268 | } |
| 3269 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3270 | |
| 3271 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3272 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3273 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3274 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 3275 | WMITLV_GET_STRUCT_TLVLEN( |
| 3276 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 3277 | cmd->vdev_id = vdev_id; |
| 3278 | |
| 3279 | /* Send the WMI command */ |
| 3280 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3281 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 3282 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3283 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3284 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3285 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3286 | } |
| 3287 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3288 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3289 | } |
| 3290 | |
| 3291 | /** |
| 3292 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 3293 | * @wmi_handle: pointer to the wmi handle |
| 3294 | * @get_stats_param: pointer to the dcc stats |
| 3295 | * |
| 3296 | * Return: 0 on succes |
| 3297 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3298 | static 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] | 3299 | struct dcc_get_stats_param *get_stats_param) |
| 3300 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3301 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3302 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 3303 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 3304 | wmi_buf_t buf; |
| 3305 | uint8_t *buf_ptr; |
| 3306 | uint32_t len; |
| 3307 | uint32_t i; |
| 3308 | |
| 3309 | /* Validate the input */ |
| 3310 | if (get_stats_param->request_array_len != |
| 3311 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3312 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3313 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3314 | } |
| 3315 | |
| 3316 | /* Allocate memory for the WMI command */ |
| 3317 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 3318 | get_stats_param->request_array_len; |
| 3319 | |
| 3320 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3321 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3322 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3323 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3324 | } |
| 3325 | |
| 3326 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3327 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3328 | |
| 3329 | /* Populate the WMI command */ |
| 3330 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 3331 | buf_ptr += sizeof(*cmd); |
| 3332 | |
| 3333 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3334 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 3335 | WMITLV_GET_STRUCT_TLVLEN( |
| 3336 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 3337 | cmd->vdev_id = get_stats_param->vdev_id; |
| 3338 | cmd->num_channels = get_stats_param->channel_count; |
| 3339 | |
| 3340 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3341 | get_stats_param->request_array_len); |
| 3342 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3343 | |
| 3344 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3345 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3346 | get_stats_param->request_array_len); |
| 3347 | for (i = 0; i < cmd->num_channels; i++) |
| 3348 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 3349 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 3350 | WMITLV_GET_STRUCT_TLVLEN( |
| 3351 | wmi_dcc_channel_stats_request)); |
| 3352 | |
| 3353 | /* Send the WMI command */ |
| 3354 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3355 | WMI_DCC_GET_STATS_CMDID); |
| 3356 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3357 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3358 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3359 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3360 | } |
| 3361 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3362 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3363 | } |
| 3364 | |
| 3365 | /** |
| 3366 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 3367 | * @wmi_handle: pointer to the wmi handle |
| 3368 | * @vdev_id: vdev id |
| 3369 | * @dcc_stats_bitmap: dcc status bitmap |
| 3370 | * |
| 3371 | * Return: 0 on succes |
| 3372 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3373 | static 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] | 3374 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 3375 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3376 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3377 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 3378 | wmi_buf_t buf; |
| 3379 | uint8_t *buf_ptr; |
| 3380 | uint32_t len; |
| 3381 | |
| 3382 | /* Allocate memory for the WMI command */ |
| 3383 | len = sizeof(*cmd); |
| 3384 | |
| 3385 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3386 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3387 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3388 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3389 | } |
| 3390 | |
| 3391 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3392 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3393 | |
| 3394 | /* Populate the WMI command */ |
| 3395 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 3396 | |
| 3397 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3398 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 3399 | WMITLV_GET_STRUCT_TLVLEN( |
| 3400 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 3401 | cmd->vdev_id = vdev_id; |
| 3402 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 3403 | |
| 3404 | /* Send the WMI command */ |
| 3405 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3406 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3407 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3408 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3409 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3410 | } |
| 3411 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3412 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3413 | } |
| 3414 | |
| 3415 | /** |
| 3416 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 3417 | * @wmi_handle: pointer to the wmi handle |
| 3418 | * @update_ndl_param: pointer to the request parameters |
| 3419 | * |
| 3420 | * Return: 0 on success |
| 3421 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3422 | static 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] | 3423 | struct dcc_update_ndl_param *update_ndl_param) |
| 3424 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3425 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3426 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 3427 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 3428 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 3429 | uint32_t active_state_count; |
| 3430 | wmi_buf_t buf; |
| 3431 | uint8_t *buf_ptr; |
| 3432 | uint32_t len; |
| 3433 | uint32_t i; |
| 3434 | |
| 3435 | /* validate the input */ |
| 3436 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 3437 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3438 | WMI_LOGE(FL("Invalid parameter")); |
| 3439 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3440 | } |
| 3441 | active_state_count = 0; |
| 3442 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 3443 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 3444 | active_state_count += |
| 3445 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 3446 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 3447 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3448 | WMI_LOGE(FL("Invalid parameter")); |
| 3449 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3450 | } |
| 3451 | |
| 3452 | /* Allocate memory for the WMI command */ |
| 3453 | len = sizeof(*cmd) + |
| 3454 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 3455 | WMI_TLV_HDR_SIZE + |
| 3456 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 3457 | |
| 3458 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3459 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3460 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3461 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3462 | } |
| 3463 | |
| 3464 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3465 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3466 | |
| 3467 | /* Populate the WMI command */ |
| 3468 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3469 | buf_ptr += sizeof(*cmd); |
| 3470 | |
| 3471 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3472 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3473 | WMITLV_GET_STRUCT_TLVLEN( |
| 3474 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3475 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3476 | cmd->num_channel = update_ndl_param->channel_count; |
| 3477 | |
| 3478 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3479 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3480 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3481 | |
| 3482 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3483 | 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] | 3484 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3485 | for (i = 0; i < cmd->num_channel; i++) |
| 3486 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3487 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3488 | WMITLV_GET_STRUCT_TLVLEN( |
| 3489 | wmi_dcc_ndl_chan)); |
| 3490 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3491 | |
| 3492 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3493 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3494 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3495 | |
| 3496 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3497 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3498 | update_ndl_param->dcc_ndl_active_state_list, |
| 3499 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3500 | for (i = 0; i < active_state_count; i++) { |
| 3501 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3502 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3503 | WMITLV_GET_STRUCT_TLVLEN( |
| 3504 | wmi_dcc_ndl_active_state_config)); |
| 3505 | } |
| 3506 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3507 | |
| 3508 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3509 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3510 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3511 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3512 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3513 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3514 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3515 | } |
| 3516 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3517 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3518 | } |
| 3519 | |
| 3520 | /** |
| 3521 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3522 | * @wmi_handle: pointer to the wmi handle |
| 3523 | * @config: the OCB configuration |
| 3524 | * |
| 3525 | * Return: 0 on success |
| 3526 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3527 | static 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] | 3528 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3529 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3530 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3531 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3532 | wmi_channel *chan; |
| 3533 | wmi_ocb_channel *ocb_chan; |
| 3534 | wmi_qos_parameter *qos_param; |
| 3535 | wmi_dcc_ndl_chan *ndl_chan; |
| 3536 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3537 | wmi_ocb_schedule_element *sched_elem; |
| 3538 | uint8_t *buf_ptr; |
| 3539 | wmi_buf_t buf; |
| 3540 | int32_t len; |
| 3541 | int32_t i, j, active_state_count; |
| 3542 | |
| 3543 | /* |
| 3544 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3545 | * states. Validate dcc_ndl_active_state_list_len. |
| 3546 | */ |
| 3547 | active_state_count = 0; |
| 3548 | if (config->dcc_ndl_chan_list_len) { |
| 3549 | if (!config->dcc_ndl_chan_list || |
| 3550 | config->dcc_ndl_chan_list_len != |
| 3551 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3552 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3553 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3554 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3555 | } |
| 3556 | |
| 3557 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3558 | i < config->channel_count; ++i, ++ndl_chan) |
| 3559 | active_state_count += |
| 3560 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3561 | |
| 3562 | if (active_state_count) { |
| 3563 | if (!config->dcc_ndl_active_state_list || |
| 3564 | config->dcc_ndl_active_state_list_len != |
| 3565 | active_state_count * |
| 3566 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3567 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3568 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3569 | } |
| 3570 | } |
| 3571 | } |
| 3572 | |
| 3573 | len = sizeof(*cmd) + |
| 3574 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3575 | sizeof(wmi_channel) + |
| 3576 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3577 | sizeof(wmi_ocb_channel) + |
| 3578 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3579 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3580 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3581 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3582 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3583 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3584 | sizeof(wmi_ocb_schedule_element); |
| 3585 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3586 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3587 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3588 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3589 | } |
| 3590 | |
| 3591 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3592 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3593 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3594 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3595 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3596 | cmd->vdev_id = config->session_id; |
| 3597 | cmd->channel_count = config->channel_count; |
| 3598 | cmd->schedule_size = config->schedule_size; |
| 3599 | cmd->flags = config->flags; |
| 3600 | buf_ptr += sizeof(*cmd); |
| 3601 | |
| 3602 | /* Add the wmi_channel info */ |
| 3603 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3604 | config->channel_count*sizeof(wmi_channel)); |
| 3605 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3606 | for (i = 0; i < config->channel_count; i++) { |
| 3607 | chan = (wmi_channel *)buf_ptr; |
| 3608 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3609 | WMITLV_TAG_STRUC_wmi_channel, |
| 3610 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3611 | chan->mhz = config->channels[i].chan_freq; |
| 3612 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3613 | chan->band_center_freq2 = 0; |
| 3614 | chan->info = 0; |
| 3615 | |
| 3616 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3617 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3618 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3619 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3620 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3621 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3622 | config->channels[i].antenna_max); |
| 3623 | |
| 3624 | if (config->channels[i].bandwidth < 10) |
| 3625 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3626 | else if (config->channels[i].bandwidth < 20) |
| 3627 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3628 | buf_ptr += sizeof(*chan); |
| 3629 | } |
| 3630 | |
| 3631 | /* Add the wmi_ocb_channel info */ |
| 3632 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3633 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3634 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3635 | for (i = 0; i < config->channel_count; i++) { |
| 3636 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3637 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3638 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 3639 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 3640 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 3641 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 3642 | config->channels[i].mac_address.bytes, |
| 3643 | &ocb_chan->mac_address); |
| 3644 | buf_ptr += sizeof(*ocb_chan); |
| 3645 | } |
| 3646 | |
| 3647 | /* Add the wmi_qos_parameter info */ |
| 3648 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3649 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 3650 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3651 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 3652 | for (i = 0; i < config->channel_count; i++) { |
| 3653 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 3654 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 3655 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 3656 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 3657 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 3658 | qos_param->aifsn = |
| 3659 | config->channels[i].qos_params[j].aifsn; |
| 3660 | qos_param->cwmin = |
| 3661 | config->channels[i].qos_params[j].cwmin; |
| 3662 | qos_param->cwmax = |
| 3663 | config->channels[i].qos_params[j].cwmax; |
| 3664 | buf_ptr += sizeof(*qos_param); |
| 3665 | } |
| 3666 | } |
| 3667 | |
| 3668 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 3669 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3670 | config->dcc_ndl_chan_list_len); |
| 3671 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3672 | if (config->dcc_ndl_chan_list_len) { |
| 3673 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3674 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3675 | config->dcc_ndl_chan_list_len); |
| 3676 | for (i = 0; i < config->channel_count; i++) |
| 3677 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 3678 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3679 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 3680 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 3681 | } |
| 3682 | |
| 3683 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 3684 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 3685 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 3686 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3687 | if (active_state_count) { |
| 3688 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3689 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3690 | config->dcc_ndl_active_state_list, |
| 3691 | active_state_count * sizeof(*ndl_active_config)); |
| 3692 | for (i = 0; i < active_state_count; ++i) |
| 3693 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 3694 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3695 | WMITLV_GET_STRUCT_TLVLEN( |
| 3696 | wmi_dcc_ndl_active_state_config)); |
| 3697 | buf_ptr += active_state_count * |
| 3698 | sizeof(*ndl_active_config); |
| 3699 | } |
| 3700 | |
| 3701 | /* Add the wmi_ocb_schedule_element info */ |
| 3702 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3703 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 3704 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3705 | for (i = 0; i < config->schedule_size; i++) { |
| 3706 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 3707 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 3708 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 3709 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 3710 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 3711 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 3712 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 3713 | buf_ptr += sizeof(*sched_elem); |
| 3714 | } |
| 3715 | |
| 3716 | |
| 3717 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3718 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3719 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3720 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3721 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3722 | } |
| 3723 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3724 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3725 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3726 | |
| 3727 | /** |
| 3728 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 3729 | * @wmi_handle: wmi handle |
| 3730 | * @mcc_adaptive_scheduler: enable/disable |
| 3731 | * |
| 3732 | * This function enable/disable mcc adaptive scheduler in fw. |
| 3733 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3734 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3735 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3736 | static QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3737 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 3738 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3739 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3740 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3741 | wmi_buf_t buf = 0; |
| 3742 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 3743 | uint16_t len = |
| 3744 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 3745 | |
| 3746 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3747 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3748 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 3749 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3750 | } |
| 3751 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 3752 | wmi_buf_data(buf); |
| 3753 | |
| 3754 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3755 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 3756 | WMITLV_GET_STRUCT_TLVLEN |
| 3757 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 3758 | cmd->enable = mcc_adaptive_scheduler; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3759 | cmd->pdev_id = pdev_id; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3760 | |
| 3761 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3762 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3763 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3764 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3765 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3766 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3767 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3768 | |
| 3769 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3770 | } |
| 3771 | |
| 3772 | /** |
| 3773 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 3774 | * @wmi: wmi handle |
| 3775 | * @mcc_channel: mcc channel |
| 3776 | * @mcc_channel_time_latency: MCC channel time latency. |
| 3777 | * |
| 3778 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 3779 | * channel of it and channel number. The info is provided run time using |
| 3780 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 3781 | * |
| 3782 | * Return: CDF status |
| 3783 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3784 | static 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] | 3785 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 3786 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3787 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3788 | wmi_buf_t buf = 0; |
| 3789 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 3790 | uint16_t len = 0; |
| 3791 | uint8_t *buf_ptr = NULL; |
| 3792 | wmi_resmgr_chan_latency chan_latency; |
| 3793 | /* Note: we only support MCC time latency for a single channel */ |
| 3794 | uint32_t num_channels = 1; |
| 3795 | uint32_t chan1_freq = mcc_channel_freq; |
| 3796 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 3797 | |
| 3798 | |
| 3799 | /* If 0ms latency is provided, then FW will set to a default. |
| 3800 | * Otherwise, latency must be at least 30ms. |
| 3801 | */ |
| 3802 | if ((latency_chan1 > 0) && |
| 3803 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3804 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3805 | "Minimum is 30ms (or 0 to use default value by " |
| 3806 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3807 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3808 | } |
| 3809 | |
| 3810 | /* Set WMI CMD for channel time latency here */ |
| 3811 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 3812 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 3813 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 3814 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3815 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3816 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3817 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3818 | } |
| 3819 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3820 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 3821 | wmi_buf_data(buf); |
| 3822 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 3823 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 3824 | WMITLV_GET_STRUCT_TLVLEN |
| 3825 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 3826 | cmdTL->num_chans = num_channels; |
| 3827 | /* Update channel time latency information for home channel(s) */ |
| 3828 | buf_ptr += sizeof(*cmdTL); |
| 3829 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3830 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 3831 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3832 | chan_latency.chan_mhz = chan1_freq; |
| 3833 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3834 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3835 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3836 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3837 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3838 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3839 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3840 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3841 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3842 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3843 | |
| 3844 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3845 | } |
| 3846 | |
| 3847 | /** |
| 3848 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 3849 | * @wmi: wmi handle |
| 3850 | * @adapter_1_chan_number: adapter 1 channel number |
| 3851 | * @adapter_1_quota: adapter 1 quota |
| 3852 | * @adapter_2_chan_number: adapter 2 channel number |
| 3853 | * |
| 3854 | * Return: CDF status |
| 3855 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3856 | static 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] | 3857 | uint32_t adapter_1_chan_freq, |
| 3858 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 3859 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3860 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3861 | wmi_buf_t buf = 0; |
| 3862 | uint16_t len = 0; |
| 3863 | uint8_t *buf_ptr = NULL; |
| 3864 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 3865 | wmi_resmgr_chan_time_quota chan_quota; |
| 3866 | uint32_t quota_chan1 = adapter_1_quota; |
| 3867 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 3868 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 3869 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 3870 | uint32_t num_channels = 2; |
| 3871 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 3872 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 3873 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3874 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3875 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 3876 | chan1_freq, quota_chan1, chan2_freq, |
| 3877 | quota_chan2); |
| 3878 | |
| 3879 | /* |
| 3880 | * Perform sanity check on time quota values provided. |
| 3881 | */ |
| 3882 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 3883 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3884 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3885 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3886 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3887 | } |
| 3888 | /* Set WMI CMD for channel time quota here */ |
| 3889 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 3890 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 3891 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 3892 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3893 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3894 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3895 | QDF_ASSERT(0); |
| 3896 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3897 | } |
| 3898 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3899 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 3900 | wmi_buf_data(buf); |
| 3901 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 3902 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 3903 | WMITLV_GET_STRUCT_TLVLEN |
| 3904 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 3905 | cmdTQ->num_chans = num_channels; |
| 3906 | |
| 3907 | /* Update channel time quota information for home channel(s) */ |
| 3908 | buf_ptr += sizeof(*cmdTQ); |
| 3909 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3910 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 3911 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3912 | chan_quota.chan_mhz = chan1_freq; |
| 3913 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3914 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3915 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 3916 | buf_ptr += sizeof(chan_quota); |
| 3917 | chan_quota.chan_mhz = chan2_freq; |
| 3918 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3919 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3920 | |
| 3921 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3922 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3923 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3924 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3925 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3926 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3927 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3928 | |
| 3929 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3930 | } |
| 3931 | |
| 3932 | /** |
| 3933 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 3934 | * @wmi_handle: Pointer to wmi handle |
| 3935 | * @thermal_info: Thermal command information |
| 3936 | * |
| 3937 | * This function sends the thermal management command |
| 3938 | * to the firmware |
| 3939 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3940 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3941 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3942 | static 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] | 3943 | struct thermal_cmd_params *thermal_info) |
| 3944 | { |
| 3945 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 3946 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3947 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3948 | uint32_t len = 0; |
| 3949 | |
| 3950 | len = sizeof(*cmd); |
| 3951 | |
| 3952 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3953 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3954 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 3955 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3956 | } |
| 3957 | |
| 3958 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 3959 | |
| 3960 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3961 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 3962 | WMITLV_GET_STRUCT_TLVLEN |
| 3963 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 3964 | |
| 3965 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 3966 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 3967 | cmd->enable = thermal_info->thermal_enable; |
| 3968 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3969 | 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] | 3970 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 3971 | |
| 3972 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3973 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3974 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3975 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3976 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3977 | } |
| 3978 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3979 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3980 | } |
| 3981 | |
| 3982 | |
| 3983 | /** |
| 3984 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3985 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3986 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 3987 | * |
| 3988 | * This function sends down the LRO configuration parameters to |
| 3989 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 3990 | * seed values for the toeplitz hash generation |
| 3991 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3992 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3993 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3994 | static QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3995 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 3996 | { |
| 3997 | wmi_lro_info_cmd_fixed_param *cmd; |
| 3998 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3999 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4000 | |
| 4001 | |
| 4002 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4003 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4004 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4005 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4006 | } |
| 4007 | |
| 4008 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 4009 | |
| 4010 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4011 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 4012 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 4013 | |
| 4014 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 4015 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 4016 | wmi_lro_cmd->tcp_flag); |
| 4017 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 4018 | wmi_lro_cmd->tcp_flag_mask); |
| 4019 | cmd->toeplitz_hash_ipv4_0_3 = |
| 4020 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 4021 | cmd->toeplitz_hash_ipv4_4_7 = |
| 4022 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 4023 | cmd->toeplitz_hash_ipv4_8_11 = |
| 4024 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 4025 | cmd->toeplitz_hash_ipv4_12_15 = |
| 4026 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 4027 | cmd->toeplitz_hash_ipv4_16 = |
| 4028 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 4029 | |
| 4030 | cmd->toeplitz_hash_ipv6_0_3 = |
| 4031 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 4032 | cmd->toeplitz_hash_ipv6_4_7 = |
| 4033 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 4034 | cmd->toeplitz_hash_ipv6_8_11 = |
| 4035 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 4036 | cmd->toeplitz_hash_ipv6_12_15 = |
| 4037 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 4038 | cmd->toeplitz_hash_ipv6_16_19 = |
| 4039 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 4040 | cmd->toeplitz_hash_ipv6_20_23 = |
| 4041 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 4042 | cmd->toeplitz_hash_ipv6_24_27 = |
| 4043 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 4044 | cmd->toeplitz_hash_ipv6_28_31 = |
| 4045 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 4046 | cmd->toeplitz_hash_ipv6_32_35 = |
| 4047 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 4048 | cmd->toeplitz_hash_ipv6_36_39 = |
| 4049 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 4050 | cmd->toeplitz_hash_ipv6_40 = |
| 4051 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 4052 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4053 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4054 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 4055 | |
| 4056 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4057 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4058 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4059 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4060 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4061 | } |
| 4062 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4063 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4064 | } |
| 4065 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4066 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4067 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 4068 | * @wmi_handle: Pointer to wmi handle |
| 4069 | * @rate_report_params: Pointer to peer rate report parameters |
| 4070 | * |
| 4071 | * |
| 4072 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 4073 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4074 | static QDF_STATUS send_peer_rate_report_cmd_tlv(wmi_unified_t wmi_handle, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4075 | struct wmi_peer_rate_report_params *rate_report_params) |
| 4076 | { |
| 4077 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 4078 | wmi_buf_t buf = NULL; |
| 4079 | QDF_STATUS status = 0; |
| 4080 | uint32_t len = 0; |
| 4081 | uint32_t i, j; |
| 4082 | |
| 4083 | len = sizeof(*cmd); |
| 4084 | |
| 4085 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4086 | if (!buf) { |
| 4087 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 4088 | return QDF_STATUS_E_FAILURE; |
| 4089 | } |
| 4090 | |
| 4091 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 4092 | wmi_buf_data(buf); |
| 4093 | |
| 4094 | WMITLV_SET_HDR( |
| 4095 | &cmd->tlv_header, |
| 4096 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 4097 | WMITLV_GET_STRUCT_TLVLEN( |
| 4098 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 4099 | |
| 4100 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 4101 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 4102 | cmd->report_timer_period = rate_report_params->timer_period; |
| 4103 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 4104 | cmd->cond_per_phy[i].val_cond_flags = |
| 4105 | rate_report_params->report_per_phy[i].cond_flags; |
| 4106 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 4107 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 4108 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 4109 | rate_report_params->report_per_phy[i].delta.percent; |
| 4110 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 4111 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 4112 | rate_report_params->report_per_phy[i]. |
| 4113 | report_rate_threshold[j]; |
| 4114 | } |
| 4115 | } |
| 4116 | |
| 4117 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 4118 | cmd->enable_rate_report, |
| 4119 | cmd->report_backoff_time, cmd->report_timer_period); |
| 4120 | |
| 4121 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4122 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 4123 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4124 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4125 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 4126 | __func__); |
| 4127 | } |
| 4128 | return status; |
| 4129 | } |
| 4130 | |
| 4131 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4132 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 4133 | * @wmi_handle: wmi handle |
| 4134 | * @param: bcn ll cmd parameter |
| 4135 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4136 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4137 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4138 | static 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] | 4139 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 4140 | { |
| 4141 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 4142 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4143 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4144 | |
| 4145 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4146 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4147 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4148 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4149 | } |
| 4150 | |
| 4151 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 4152 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4153 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 4154 | WMITLV_GET_STRUCT_TLVLEN |
| 4155 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 4156 | cmd->vdev_id = param->vdev_id; |
| 4157 | cmd->data_len = param->data_len; |
| 4158 | cmd->frame_ctrl = param->frame_ctrl; |
| 4159 | cmd->frag_ptr = param->frag_ptr; |
| 4160 | cmd->dtim_flag = param->dtim_flag; |
| 4161 | |
| 4162 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 4163 | WMI_PDEV_SEND_BCN_CMDID); |
| 4164 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4165 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4166 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4167 | wmi_buf_free(wmi_buf); |
| 4168 | } |
| 4169 | |
| 4170 | return ret; |
| 4171 | } |
| 4172 | |
| 4173 | /** |
| 4174 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 4175 | * @wmi_handle: wmi handle |
| 4176 | * @vdev_id: vdev id |
| 4177 | * @max_retries: max retries |
| 4178 | * @retry_interval: retry interval |
| 4179 | * This function sets sta query related parameters in fw. |
| 4180 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4181 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4182 | */ |
| 4183 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4184 | static 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] | 4185 | uint8_t vdev_id, uint32_t max_retries, |
| 4186 | uint32_t retry_interval) |
| 4187 | { |
| 4188 | wmi_buf_t buf; |
| 4189 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 4190 | int len; |
| 4191 | |
| 4192 | len = sizeof(*cmd); |
| 4193 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4194 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4195 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 4196 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4197 | } |
| 4198 | |
| 4199 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 4200 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4201 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 4202 | WMITLV_GET_STRUCT_TLVLEN |
| 4203 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 4204 | |
| 4205 | |
| 4206 | cmd->vdev_id = vdev_id; |
| 4207 | cmd->sa_query_max_retry_count = max_retries; |
| 4208 | cmd->sa_query_retry_interval = retry_interval; |
| 4209 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4210 | 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] | 4211 | vdev_id, retry_interval, max_retries); |
| 4212 | |
| 4213 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4214 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4215 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4216 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4217 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4218 | } |
| 4219 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4220 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4221 | return 0; |
| 4222 | } |
| 4223 | |
| 4224 | /** |
| 4225 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 4226 | * @wmi_handle: wmi handle |
| 4227 | * @params: sta keep alive parameter |
| 4228 | * |
| 4229 | * This function sets keep alive related parameters in fw. |
| 4230 | * |
| 4231 | * Return: CDF status |
| 4232 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4233 | static 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] | 4234 | struct sta_params *params) |
| 4235 | { |
| 4236 | wmi_buf_t buf; |
| 4237 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 4238 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 4239 | uint8_t *buf_ptr; |
| 4240 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4241 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4242 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4243 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4244 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4245 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 4246 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4247 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4248 | WMI_LOGE("wmi_buf_alloc failed"); |
| 4249 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4250 | } |
| 4251 | |
| 4252 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 4253 | buf_ptr = (uint8_t *) cmd; |
| 4254 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4255 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 4256 | WMITLV_GET_STRUCT_TLVLEN |
| 4257 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 4258 | cmd->interval = params->timeperiod; |
| 4259 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 4260 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4261 | 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] | 4262 | params->timeperiod, params->method); |
| 4263 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 4264 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 4265 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 4266 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 4267 | |
| 4268 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 4269 | if ((NULL == params->hostv4addr) || |
| 4270 | (NULL == params->destv4addr) || |
| 4271 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4272 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4273 | "destv4addr:%p destmac:%p ", __func__, |
| 4274 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4275 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4276 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4277 | } |
| 4278 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4279 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4280 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4281 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4282 | WMI_IPV4_ADDR_LEN); |
| 4283 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 4284 | } else { |
| 4285 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 4286 | } |
| 4287 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4288 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4289 | WMI_STA_KEEPALIVE_CMDID); |
| 4290 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4291 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4292 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4293 | } |
| 4294 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4295 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4296 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4297 | } |
| 4298 | |
| 4299 | /** |
| 4300 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 4301 | * @wmi_handle: wmi handle |
| 4302 | * @if_id: vdev id |
| 4303 | * @gtx_info: GTX config params |
| 4304 | * |
| 4305 | * This function set GTX related params in firmware. |
| 4306 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4307 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4308 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4309 | static 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] | 4310 | struct wmi_gtx_config *gtx_info) |
| 4311 | { |
| 4312 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 4313 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4314 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4315 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4316 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4317 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4318 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4319 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4320 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4321 | } |
| 4322 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 4323 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4324 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 4325 | WMITLV_GET_STRUCT_TLVLEN |
| 4326 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 4327 | cmd->vdev_id = if_id; |
| 4328 | |
| 4329 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 4330 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 4331 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 4332 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 4333 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 4334 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 4335 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 4336 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 4337 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4338 | 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] | 4339 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 4340 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 4341 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 4342 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 4343 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4344 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4345 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4346 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4347 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 4348 | wmi_buf_free(buf); |
| 4349 | } |
| 4350 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4351 | } |
| 4352 | |
| 4353 | /** |
| 4354 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 4355 | * @wmi_handle: wmi handle |
| 4356 | * @edca_params: edca parameters |
| 4357 | * |
| 4358 | * This function updates EDCA parameters to the target |
| 4359 | * |
| 4360 | * Return: CDF Status |
| 4361 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4362 | static 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] | 4363 | uint8_t vdev_id, |
| 4364 | wmi_wmm_vparams gwmm_param[WMI_MAX_NUM_AC]) |
| 4365 | { |
| 4366 | uint8_t *buf_ptr; |
| 4367 | wmi_buf_t buf; |
| 4368 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
| 4369 | wmi_wmm_vparams *wmm_param, *twmm_param; |
| 4370 | int len = sizeof(*cmd); |
| 4371 | int ac; |
| 4372 | |
| 4373 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4374 | |
| 4375 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4376 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4377 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4378 | } |
| 4379 | |
| 4380 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4381 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 4382 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4383 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4384 | WMITLV_GET_STRUCT_TLVLEN |
| 4385 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 4386 | cmd->vdev_id = vdev_id; |
| 4387 | |
| 4388 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 4389 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
| 4390 | twmm_param = (wmi_wmm_vparams *) (&gwmm_param[ac]); |
| 4391 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 4392 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4393 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 4394 | wmm_param->cwmin = twmm_param->cwmin; |
| 4395 | wmm_param->cwmax = twmm_param->cwmax; |
| 4396 | wmm_param->aifs = twmm_param->aifs; |
| 4397 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 4398 | wmm_param->acm = twmm_param->acm; |
| 4399 | wmm_param->no_ack = twmm_param->no_ack; |
| 4400 | } |
| 4401 | |
| 4402 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4403 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 4404 | goto fail; |
| 4405 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4406 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4407 | |
| 4408 | fail: |
| 4409 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4410 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 4411 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4412 | } |
| 4413 | |
| 4414 | /** |
| 4415 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 4416 | * @wmi_handle: wmi handle |
| 4417 | * @vdev_id: vdev id |
| 4418 | * @probe_rsp_info: probe response info |
| 4419 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4420 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4421 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4422 | static 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] | 4423 | uint8_t vdev_id, |
| 4424 | struct wmi_probe_resp_params *probe_rsp_info, |
| 4425 | uint8_t *frm) |
| 4426 | { |
| 4427 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 4428 | wmi_bcn_prb_info *bcn_prb_info; |
| 4429 | wmi_buf_t wmi_buf; |
| 4430 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 4431 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4432 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4433 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4434 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4435 | |
| 4436 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 4437 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 4438 | |
| 4439 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 4440 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 4441 | tmpl_len_aligned; |
| 4442 | |
| 4443 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4444 | 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] | 4445 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4446 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4447 | } |
| 4448 | |
| 4449 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4450 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4451 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4452 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4453 | } |
| 4454 | |
| 4455 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4456 | |
| 4457 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 4458 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4459 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 4460 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 4461 | cmd->vdev_id = vdev_id; |
| 4462 | cmd->buf_len = tmpl_len; |
| 4463 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 4464 | |
| 4465 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4466 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4467 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4468 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4469 | bcn_prb_info->caps = 0; |
| 4470 | bcn_prb_info->erp = 0; |
| 4471 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4472 | |
| 4473 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4474 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4475 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4476 | |
| 4477 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4478 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4479 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4480 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4481 | wmi_buf_free(wmi_buf); |
| 4482 | } |
| 4483 | |
| 4484 | return ret; |
| 4485 | } |
| 4486 | |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4487 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4488 | #define WPI_IV_LEN 16 |
| 4489 | |
| 4490 | /** |
| 4491 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4492 | * |
| 4493 | * @dest_tx: destination address of tsc key counter |
| 4494 | * @src_tx: source address of tsc key counter |
| 4495 | * @dest_rx: destination address of rsc key counter |
| 4496 | * @src_rx: source address of rsc key counter |
| 4497 | * |
| 4498 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4499 | * |
| 4500 | * Return: None |
| 4501 | * |
| 4502 | */ |
| 4503 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4504 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4505 | { |
| 4506 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4507 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4508 | } |
| 4509 | #else |
| 4510 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4511 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4512 | { |
| 4513 | return; |
| 4514 | } |
| 4515 | #endif |
| 4516 | |
| 4517 | /** |
| 4518 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4519 | * @wmi_handle: wmi handle |
| 4520 | * @key_params: key parameters |
| 4521 | * |
| 4522 | * This function fills structure from information |
| 4523 | * passed in key_params. |
| 4524 | * |
| 4525 | * Return: QDF_STATUS_SUCCESS - success |
| 4526 | * QDF_STATUS_E_FAILURE - failure |
| 4527 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4528 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4529 | static QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4530 | struct set_key_params *key_params) |
| 4531 | { |
| 4532 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4533 | wmi_buf_t buf; |
| 4534 | uint8_t *buf_ptr; |
| 4535 | uint32_t len; |
| 4536 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4537 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4538 | |
| 4539 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4540 | WMI_TLV_HDR_SIZE; |
| 4541 | |
| 4542 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4543 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4544 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4545 | return QDF_STATUS_E_NOMEM; |
| 4546 | } |
| 4547 | |
| 4548 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4549 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4550 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4551 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4552 | WMITLV_GET_STRUCT_TLVLEN |
| 4553 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4554 | cmd->vdev_id = key_params->vdev_id; |
| 4555 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4556 | |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4557 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4558 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4559 | cmd->key_flags |= key_params->key_flags; |
| 4560 | cmd->key_cipher = key_params->key_cipher; |
| 4561 | if ((key_params->key_txmic_len) && |
| 4562 | (key_params->key_rxmic_len)) { |
| 4563 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4564 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4565 | } |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4566 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4567 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4568 | key_params->tx_iv, |
| 4569 | cmd->wpi_key_rsc_counter, |
| 4570 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4571 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4572 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4573 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4574 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4575 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4576 | qdf_mem_copy((void *)key_data, |
| 4577 | (const void *)key_params->key_data, key_params->key_len); |
| 4578 | cmd->key_len = key_params->key_len; |
| 4579 | |
| 4580 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4581 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4582 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4583 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4584 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4585 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4586 | } |
| 4587 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4588 | /** |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 4589 | * send_sar_limit_cmd_tlv() - send sar limit cmd to fw |
| 4590 | * @wmi_handle: wmi handle |
| 4591 | * @params: sar limit params |
| 4592 | * |
| 4593 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4594 | */ |
| 4595 | static QDF_STATUS send_sar_limit_cmd_tlv(wmi_unified_t wmi_handle, |
| 4596 | struct sar_limit_cmd_params *sar_limit_params) |
| 4597 | { |
| 4598 | wmi_buf_t buf; |
| 4599 | QDF_STATUS qdf_status; |
| 4600 | wmi_sar_limits_cmd_fixed_param *cmd; |
| 4601 | int i; |
| 4602 | uint8_t *buf_ptr; |
| 4603 | wmi_sar_limit_cmd_row *wmi_sar_rows_list; |
| 4604 | struct sar_limit_cmd_row *sar_rows_list; |
| 4605 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4606 | |
| 4607 | len += sizeof(wmi_sar_limit_cmd_row) * sar_limit_params->num_limit_rows; |
| 4608 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4609 | if (!buf) { |
| 4610 | WMI_LOGE("Failed to allocate memory"); |
| 4611 | qdf_status = QDF_STATUS_E_NOMEM; |
| 4612 | goto end; |
| 4613 | } |
| 4614 | |
| 4615 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4616 | cmd = (wmi_sar_limits_cmd_fixed_param *) buf_ptr; |
| 4617 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4618 | WMITLV_TAG_STRUC_wmi_sar_limits_cmd_fixed_param, |
| 4619 | WMITLV_GET_STRUCT_TLVLEN |
| 4620 | (wmi_sar_limits_cmd_fixed_param)); |
| 4621 | cmd->sar_enable = sar_limit_params->sar_enable; |
| 4622 | cmd->commit_limits = sar_limit_params->commit_limits; |
| 4623 | cmd->num_limit_rows = sar_limit_params->num_limit_rows; |
| 4624 | |
| 4625 | WMI_LOGD("no of sar rows = %d, len = %d", |
| 4626 | sar_limit_params->num_limit_rows, len); |
| 4627 | buf_ptr += sizeof(*cmd); |
| 4628 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4629 | sizeof(wmi_sar_limit_cmd_row) * |
| 4630 | sar_limit_params->num_limit_rows); |
| 4631 | if (cmd->num_limit_rows == 0) |
| 4632 | goto send_sar_limits; |
| 4633 | |
| 4634 | wmi_sar_rows_list = (wmi_sar_limit_cmd_row *) |
| 4635 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4636 | sar_rows_list = sar_limit_params->sar_limit_row_list; |
| 4637 | |
| 4638 | for (i = 0; i < sar_limit_params->num_limit_rows; i++) { |
| 4639 | WMITLV_SET_HDR(&wmi_sar_rows_list->tlv_header, |
| 4640 | WMITLV_TAG_STRUC_wmi_sar_limit_cmd_row, |
| 4641 | WMITLV_GET_STRUCT_TLVLEN(wmi_sar_limit_cmd_row)); |
| 4642 | wmi_sar_rows_list->band_id = sar_rows_list->band_id; |
| 4643 | wmi_sar_rows_list->chain_id = sar_rows_list->chain_id; |
| 4644 | wmi_sar_rows_list->mod_id = sar_rows_list->mod_id; |
| 4645 | wmi_sar_rows_list->limit_value = sar_rows_list->limit_value; |
| 4646 | wmi_sar_rows_list->validity_bitmap = |
| 4647 | sar_rows_list->validity_bitmap; |
| 4648 | WMI_LOGD("row %d, band_id = %d, chain_id = %d, mod_id = %d, limit_value = %d, validity_bitmap = %d", |
| 4649 | i, wmi_sar_rows_list->band_id, |
| 4650 | wmi_sar_rows_list->chain_id, |
| 4651 | wmi_sar_rows_list->mod_id, |
| 4652 | wmi_sar_rows_list->limit_value, |
| 4653 | wmi_sar_rows_list->validity_bitmap); |
| 4654 | sar_rows_list++; |
| 4655 | wmi_sar_rows_list++; |
| 4656 | } |
| 4657 | send_sar_limits: |
| 4658 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4659 | WMI_SAR_LIMITS_CMDID); |
| 4660 | |
| 4661 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 4662 | WMI_LOGE("Failed to send WMI_SAR_LIMITS_CMDID"); |
| 4663 | wmi_buf_free(buf); |
| 4664 | } |
| 4665 | |
| 4666 | end: |
| 4667 | return qdf_status; |
| 4668 | } |
| 4669 | |
| 4670 | /** |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4671 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 4672 | * @wmi_handle: wmi handle |
| 4673 | * @params: encrypt/decrypt params |
| 4674 | * |
| 4675 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4676 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 4677 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4678 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 4679 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 4680 | { |
| 4681 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 4682 | wmi_buf_t wmi_buf; |
| 4683 | uint8_t *buf_ptr; |
| 4684 | QDF_STATUS ret; |
| 4685 | uint32_t len; |
| 4686 | |
| 4687 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 4688 | |
| 4689 | len = sizeof(*cmd) + |
| 4690 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 4691 | WMI_TLV_HDR_SIZE; |
| 4692 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4693 | if (!wmi_buf) { |
| 4694 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 4695 | __func__); |
| 4696 | return QDF_STATUS_E_NOMEM; |
| 4697 | } |
| 4698 | |
| 4699 | buf_ptr = wmi_buf_data(wmi_buf); |
| 4700 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 4701 | |
| 4702 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4703 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 4704 | WMITLV_GET_STRUCT_TLVLEN( |
| 4705 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 4706 | |
| 4707 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 4708 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 4709 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 4710 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 4711 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 4712 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 4713 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 4714 | |
| 4715 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 4716 | encrypt_decrypt_params->key_len); |
| 4717 | |
| 4718 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 4719 | MAX_MAC_HEADER_LEN); |
| 4720 | |
| 4721 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 4722 | |
| 4723 | if (cmd->data_len) { |
| 4724 | buf_ptr += sizeof(*cmd); |
| 4725 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4726 | roundup(encrypt_decrypt_params->data_len, |
| 4727 | sizeof(A_UINT32))); |
| 4728 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4729 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 4730 | encrypt_decrypt_params->data_len); |
| 4731 | } |
| 4732 | |
| 4733 | /* This conversion is to facilitate data to FW in little endian */ |
| 4734 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 4735 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 4736 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 4737 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 4738 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 4739 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 4740 | |
| 4741 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4742 | wmi_buf, len, |
| 4743 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 4744 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4745 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 4746 | wmi_buf_free(wmi_buf); |
| 4747 | } |
| 4748 | |
| 4749 | return ret; |
| 4750 | } |
| 4751 | |
| 4752 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4753 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4754 | /** |
| 4755 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 4756 | * @wmi_handle: wmi handle |
| 4757 | * @vdev_id: vdev id |
| 4758 | * @p2p_ie: p2p IE |
| 4759 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4760 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4761 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4762 | static 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] | 4763 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 4764 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4765 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4766 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 4767 | wmi_buf_t wmi_buf; |
| 4768 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 4769 | uint8_t *buf_ptr; |
| 4770 | |
| 4771 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 4772 | |
| 4773 | /* More than one P2P IE may be included in a single frame. |
| 4774 | If multiple P2P IEs are present, the complete P2P attribute |
| 4775 | data consists of the concatenation of the P2P Attribute |
| 4776 | fields of the P2P IEs. The P2P Attributes field of each |
| 4777 | P2P IE may be any length up to the maximum (251 octets). |
| 4778 | In this case host sends one P2P IE to firmware so the length |
| 4779 | should not exceed more than 251 bytes |
| 4780 | */ |
| 4781 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4782 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4783 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4784 | } |
| 4785 | |
| 4786 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 4787 | |
| 4788 | wmi_buf_len = |
| 4789 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 4790 | WMI_TLV_HDR_SIZE; |
| 4791 | |
| 4792 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4793 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4794 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4795 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4796 | } |
| 4797 | |
| 4798 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4799 | |
| 4800 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 4801 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4802 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 4803 | WMITLV_GET_STRUCT_TLVLEN |
| 4804 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 4805 | cmd->vdev_id = vdev_id; |
| 4806 | cmd->ie_buf_len = ie_len; |
| 4807 | |
| 4808 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 4809 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 4810 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4811 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4812 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4813 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4814 | |
| 4815 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4816 | wmi_buf, wmi_buf_len, |
| 4817 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4818 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4819 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4820 | wmi_buf_free(wmi_buf); |
| 4821 | } |
| 4822 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4823 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4824 | return ret; |
| 4825 | } |
| 4826 | |
| 4827 | /** |
| 4828 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 4829 | * @wmi_handle: wmi handle |
| 4830 | * @req: gateway parameter update request structure |
| 4831 | * |
| 4832 | * This function reads the incoming @req and fill in the destination |
| 4833 | * WMI structure and sends down the gateway configs down to the firmware |
| 4834 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4835 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4836 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4837 | static 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] | 4838 | struct gateway_update_req_param *req) |
| 4839 | { |
| 4840 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 4841 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4842 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4843 | int len = sizeof(*cmd); |
| 4844 | |
| 4845 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4846 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4847 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4848 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4849 | } |
| 4850 | |
| 4851 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 4852 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4853 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 4854 | WMITLV_GET_STRUCT_TLVLEN( |
| 4855 | wmi_roam_subnet_change_config_fixed_param)); |
| 4856 | |
| 4857 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4858 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 4859 | QDF_IPV4_ADDR_SIZE); |
| 4860 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 4861 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4862 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 4863 | &cmd->inet_gw_mac_addr); |
| 4864 | cmd->max_retries = req->max_retries; |
| 4865 | cmd->timeout = req->timeout; |
| 4866 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 4867 | cmd->flag = 0; |
| 4868 | if (req->ipv4_addr_type) |
| 4869 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 4870 | |
| 4871 | if (req->ipv6_addr_type) |
| 4872 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 4873 | |
| 4874 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4875 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4876 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4877 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4878 | ret); |
| 4879 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4880 | } |
| 4881 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4882 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4883 | } |
| 4884 | |
| 4885 | /** |
| 4886 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 4887 | * @wmi_handle: wmi handle |
| 4888 | * @req: rssi monitoring request structure |
| 4889 | * |
| 4890 | * This function reads the incoming @req and fill in the destination |
| 4891 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 4892 | * |
| 4893 | * Return: 0 on success; error number otherwise |
| 4894 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4895 | static 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] | 4896 | struct rssi_monitor_param *req) |
| 4897 | { |
| 4898 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 4899 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4900 | QDF_STATUS ret; |
| 4901 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4902 | |
| 4903 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4904 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4905 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4906 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4907 | } |
| 4908 | |
| 4909 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 4910 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4911 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 4912 | WMITLV_GET_STRUCT_TLVLEN( |
| 4913 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 4914 | |
| 4915 | cmd->vdev_id = req->session_id; |
| 4916 | cmd->request_id = req->request_id; |
| 4917 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 4918 | cmd->hi_rssi_reenable_histeresis = 0; |
| 4919 | cmd->min_report_interval = 0; |
| 4920 | cmd->max_num_report = 1; |
| 4921 | if (req->control) { |
| 4922 | /* enable one threshold for each min/max */ |
| 4923 | cmd->enabled_bitmap = 0x09; |
| 4924 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 4925 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 4926 | } else { |
| 4927 | cmd->enabled_bitmap = 0; |
| 4928 | cmd->low_rssi_breach_threshold[0] = 0; |
| 4929 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 4930 | } |
| 4931 | |
| 4932 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4933 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4934 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4935 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4936 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4937 | } |
| 4938 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4939 | WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4940 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4941 | } |
| 4942 | |
| 4943 | /** |
| 4944 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 4945 | * @wmi_handle: wmi handle |
| 4946 | * @psetoui: OUI parameters |
| 4947 | * |
| 4948 | * set scan probe OUI parameters in firmware |
| 4949 | * |
| 4950 | * Return: CDF status |
| 4951 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4952 | static 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] | 4953 | struct scan_mac_oui *psetoui) |
| 4954 | { |
| 4955 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 4956 | wmi_buf_t wmi_buf; |
| 4957 | uint32_t len; |
| 4958 | uint8_t *buf_ptr; |
| 4959 | uint32_t *oui_buf; |
| 4960 | |
| 4961 | len = sizeof(*cmd); |
| 4962 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4963 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4964 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4965 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4966 | } |
| 4967 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4968 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 4969 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4970 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 4971 | WMITLV_GET_STRUCT_TLVLEN |
| 4972 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 4973 | |
| 4974 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4975 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4976 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 4977 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4978 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4979 | cmd->prob_req_oui); |
| 4980 | |
| 4981 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 4982 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4983 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4984 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4985 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4986 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4987 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4988 | } |
| 4989 | |
| 4990 | /** |
| 4991 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 4992 | * @wmi_handle: wmi handle |
| 4993 | * @req: passpoint network request structure |
| 4994 | * |
| 4995 | * This function sends down WMI command with network id set to wildcard id. |
| 4996 | * firmware shall clear all the config entries |
| 4997 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4998 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4999 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5000 | static 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] | 5001 | struct wifi_passpoint_req_param *req) |
| 5002 | { |
| 5003 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5004 | wmi_buf_t buf; |
| 5005 | uint32_t len; |
| 5006 | int ret; |
| 5007 | |
| 5008 | len = sizeof(*cmd); |
| 5009 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5010 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5011 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5012 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5013 | } |
| 5014 | |
| 5015 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5016 | |
| 5017 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5018 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5019 | WMITLV_GET_STRUCT_TLVLEN( |
| 5020 | wmi_passpoint_config_cmd_fixed_param)); |
| 5021 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 5022 | |
| 5023 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5024 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5025 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5026 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5027 | __func__); |
| 5028 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5029 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5030 | } |
| 5031 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5032 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5033 | } |
| 5034 | |
| 5035 | /** |
| 5036 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 5037 | * @wmi_handle: wmi handle |
| 5038 | * @req: passpoint network request structure |
| 5039 | * |
| 5040 | * This function reads the incoming @req and fill in the destination |
| 5041 | * WMI structure and send down the passpoint configs down to the firmware |
| 5042 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5043 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5044 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5045 | static 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] | 5046 | struct wifi_passpoint_req_param *req) |
| 5047 | { |
| 5048 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5049 | u_int8_t i, j, *bytes; |
| 5050 | wmi_buf_t buf; |
| 5051 | uint32_t len; |
| 5052 | int ret; |
| 5053 | |
| 5054 | len = sizeof(*cmd); |
| 5055 | for (i = 0; i < req->num_networks; i++) { |
| 5056 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5057 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5058 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5059 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5060 | } |
| 5061 | |
| 5062 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 5063 | wmi_buf_data(buf); |
| 5064 | |
| 5065 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5066 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5067 | WMITLV_GET_STRUCT_TLVLEN( |
| 5068 | wmi_passpoint_config_cmd_fixed_param)); |
| 5069 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5070 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 5071 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5072 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5073 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5074 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 5075 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5076 | 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] | 5077 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 5078 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 5079 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5080 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5081 | &req->networks[i].roaming_consortium_ids[j], |
| 5082 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 5083 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5084 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5085 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5086 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5087 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 5088 | |
| 5089 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5090 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5091 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5092 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5093 | __func__); |
| 5094 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5095 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5096 | } |
| 5097 | } |
| 5098 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5099 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5100 | } |
| 5101 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5102 | /** |
| 5103 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 5104 | * @wmi_handle: wmi handle |
| 5105 | * @scan_cmd_fp: start scan command ptr |
| 5106 | * @roam_req: roam request param |
| 5107 | * |
| 5108 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 5109 | * of WMI_ROAM_SCAN_MODE. |
| 5110 | * |
| 5111 | * Return: QDF status |
| 5112 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5113 | static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5114 | wmi_start_scan_cmd_fixed_param * |
| 5115 | scan_cmd_fp, |
| 5116 | struct roam_offload_scan_params *roam_req) |
| 5117 | { |
| 5118 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5119 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5120 | int len; |
| 5121 | uint8_t *buf_ptr; |
| 5122 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5123 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5124 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5125 | int auth_mode = roam_req->auth_mode; |
| 5126 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 5127 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 5128 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 5129 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5130 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5131 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5132 | /* Need to create a buf with roam_scan command at |
| 5133 | * front and piggyback with scan command */ |
| 5134 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 5135 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5136 | (2 * WMI_TLV_HDR_SIZE) + |
| 5137 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5138 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 5139 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5140 | if (roam_req->is_roam_req_valid && |
| 5141 | roam_req->roam_offload_enabled) { |
| 5142 | len += sizeof(wmi_roam_offload_tlv_param); |
| 5143 | len += WMI_TLV_HDR_SIZE; |
| 5144 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5145 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5146 | (auth_mode == WMI_AUTH_OPEN && |
| 5147 | roam_req->mdid.mdie_present) || |
| 5148 | roam_req->is_ese_assoc)) { |
| 5149 | len += WMI_TLV_HDR_SIZE; |
| 5150 | if (roam_req->is_ese_assoc) |
| 5151 | len += |
| 5152 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5153 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 5154 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 5155 | (auth_mode == WMI_AUTH_OPEN && |
| 5156 | roam_req->mdid.mdie_present)) |
| 5157 | len += |
| 5158 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5159 | else |
| 5160 | len += |
| 5161 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5162 | } else { |
| 5163 | len += WMI_TLV_HDR_SIZE; |
| 5164 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5165 | |
| 5166 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 5167 | + roundup(roam_req->assoc_ie_length, |
| 5168 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5169 | } else { |
| 5170 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5171 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5172 | __func__, roam_req->roam_offload_enabled); |
| 5173 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5174 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5175 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5176 | } |
| 5177 | if (roam_req->is_roam_req_valid && |
| 5178 | roam_req->roam_offload_enabled) { |
| 5179 | roam_req->mode = roam_req->mode | |
| 5180 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 5181 | } |
| 5182 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5183 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5184 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 5185 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 5186 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 5187 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5188 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5189 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5190 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5191 | return QDF_STATUS_E_NOMEM; |
| 5192 | } |
| 5193 | |
| 5194 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5195 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5196 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 5197 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 5198 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 5199 | WMITLV_GET_STRUCT_TLVLEN |
| 5200 | (wmi_roam_scan_mode_fixed_param)); |
| 5201 | |
| 5202 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 5203 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5204 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 5205 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 5206 | goto send_roam_scan_mode_cmd; |
| 5207 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5208 | /* Fill in scan parameters suitable for roaming scan */ |
| 5209 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5210 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5211 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 5212 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 5213 | /* Ensure there is no additional IEs */ |
| 5214 | scan_cmd_fp->ie_len = 0; |
| 5215 | WMITLV_SET_HDR(buf_ptr, |
| 5216 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 5217 | WMITLV_GET_STRUCT_TLVLEN |
| 5218 | (wmi_start_scan_cmd_fixed_param)); |
| 5219 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5220 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 5221 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 5222 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5223 | sizeof(wmi_roam_offload_tlv_param)); |
| 5224 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5225 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 5226 | WMITLV_SET_HDR(buf_ptr, |
| 5227 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 5228 | WMITLV_GET_STRUCT_TLVLEN |
| 5229 | (wmi_roam_offload_tlv_param)); |
| 5230 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 5231 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 5232 | roam_offload_params->select_5g_margin = |
| 5233 | roam_req->select_5ghz_margin; |
| 5234 | roam_offload_params->reassoc_failure_timeout = |
| 5235 | roam_req->reassoc_failure_timeout; |
| 5236 | |
| 5237 | /* Fill the capabilities */ |
| 5238 | roam_offload_params->capability = |
| 5239 | roam_req->roam_offload_params.capability; |
| 5240 | roam_offload_params->ht_caps_info = |
| 5241 | roam_req->roam_offload_params.ht_caps_info; |
| 5242 | roam_offload_params->ampdu_param = |
| 5243 | roam_req->roam_offload_params.ampdu_param; |
| 5244 | roam_offload_params->ht_ext_cap = |
| 5245 | roam_req->roam_offload_params.ht_ext_cap; |
| 5246 | roam_offload_params->ht_txbf = |
| 5247 | roam_req->roam_offload_params.ht_txbf; |
| 5248 | roam_offload_params->asel_cap = |
| 5249 | roam_req->roam_offload_params.asel_cap; |
| 5250 | roam_offload_params->qos_caps = |
| 5251 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 5252 | roam_offload_params->qos_enabled = |
| 5253 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5254 | roam_offload_params->wmm_caps = |
| 5255 | roam_req->roam_offload_params.wmm_caps; |
| 5256 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 5257 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 5258 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 5259 | |
| 5260 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 5261 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 5262 | * they are filled in the same order.Depending on the |
| 5263 | * authentication type, the other mode TLV's are nullified |
| 5264 | * and only headers are filled.*/ |
| 5265 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5266 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5267 | (auth_mode == WMI_AUTH_OPEN |
| 5268 | && roam_req->mdid.mdie_present) || |
| 5269 | roam_req->is_ese_assoc)) { |
| 5270 | if (roam_req->is_ese_assoc) { |
| 5271 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5272 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5273 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5274 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5275 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5276 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5277 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5278 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 5279 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5280 | roam_offload_ese = |
| 5281 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 5282 | qdf_mem_copy(roam_offload_ese->krk, |
| 5283 | roam_req->krk, |
| 5284 | sizeof(roam_req->krk)); |
| 5285 | qdf_mem_copy(roam_offload_ese->btk, |
| 5286 | roam_req->btk, |
| 5287 | sizeof(roam_req->btk)); |
| 5288 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 5289 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 5290 | WMITLV_GET_STRUCT_TLVLEN |
| 5291 | (wmi_roam_ese_offload_tlv_param)); |
| 5292 | buf_ptr += |
| 5293 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5294 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 5295 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 5296 | || (auth_mode == WMI_AUTH_OPEN |
| 5297 | && roam_req->mdid.mdie_present)) { |
| 5298 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5299 | 0); |
| 5300 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5301 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5302 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 5303 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5304 | roam_offload_11r = |
| 5305 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 5306 | roam_offload_11r->r0kh_id_len = |
| 5307 | roam_req->rokh_id_length; |
| 5308 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 5309 | roam_req->rokh_id, |
| 5310 | roam_offload_11r->r0kh_id_len); |
| 5311 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 5312 | roam_req->psk_pmk, |
| 5313 | sizeof(roam_req->psk_pmk)); |
| 5314 | roam_offload_11r->psk_msk_len = |
| 5315 | roam_req->pmk_len; |
| 5316 | roam_offload_11r->mdie_present = |
| 5317 | roam_req->mdid.mdie_present; |
| 5318 | roam_offload_11r->mdid = |
| 5319 | roam_req->mdid.mobility_domain; |
| 5320 | if (auth_mode == WMI_AUTH_OPEN) { |
| 5321 | /* If FT-Open ensure pmk length |
| 5322 | and r0khid len are zero */ |
| 5323 | roam_offload_11r->r0kh_id_len = 0; |
| 5324 | roam_offload_11r->psk_msk_len = 0; |
| 5325 | } |
| 5326 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 5327 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 5328 | WMITLV_GET_STRUCT_TLVLEN |
| 5329 | (wmi_roam_11r_offload_tlv_param)); |
| 5330 | buf_ptr += |
| 5331 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5332 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5333 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5334 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5335 | } else { |
| 5336 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5337 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 5338 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5339 | roam_offload_11i = |
| 5340 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 5341 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 5342 | roam_req->okc_enabled) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5343 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 5344 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5345 | WMI_LOGE("LFR3:OKC Enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5346 | } else { |
| 5347 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 5348 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5349 | WMI_LOGE("LFR3:OKC Disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5350 | } |
| 5351 | |
| 5352 | qdf_mem_copy(roam_offload_11i->pmk, |
| 5353 | roam_req->psk_pmk, |
| 5354 | sizeof(roam_req->psk_pmk)); |
| 5355 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 5356 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 5357 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 5358 | WMITLV_GET_STRUCT_TLVLEN |
| 5359 | (wmi_roam_11i_offload_tlv_param)); |
| 5360 | buf_ptr += |
| 5361 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5362 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5363 | 0); |
| 5364 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5365 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5366 | 0); |
| 5367 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5368 | } |
| 5369 | } else { |
| 5370 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5371 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5372 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5373 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5374 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5375 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5376 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5377 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5378 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5379 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5380 | |
| 5381 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5382 | sizeof(*assoc_ies)); |
| 5383 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5384 | |
| 5385 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 5386 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 5387 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 5388 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 5389 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 5390 | |
| 5391 | buf_ptr += sizeof(*assoc_ies); |
| 5392 | |
| 5393 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5394 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 5395 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5396 | |
| 5397 | if (assoc_ies->buf_len != 0) { |
| 5398 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 5399 | assoc_ies->buf_len); |
| 5400 | } |
| 5401 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5402 | } else { |
| 5403 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5404 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5405 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5406 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5407 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5408 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5409 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5410 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5411 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5412 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5413 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5414 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5415 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5416 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5417 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5418 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5419 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5420 | } |
| 5421 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5422 | |
| 5423 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5424 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5425 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5426 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5427 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5428 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 5429 | status); |
| 5430 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5431 | } |
| 5432 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5433 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5434 | } |
| 5435 | |
| 5436 | |
| 5437 | /** |
| 5438 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 5439 | * rssi threashold |
| 5440 | * @wmi_handle: wmi handle |
| 5441 | * @roam_req: Roaming request buffer |
| 5442 | * |
| 5443 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 5444 | * |
| 5445 | * Return: QDF status |
| 5446 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5447 | static QDF_STATUS send_roam_scan_offload_rssi_thresh_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5448 | struct roam_offload_scan_rssi_params *roam_req) |
| 5449 | { |
| 5450 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5451 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5452 | int len; |
| 5453 | uint8_t *buf_ptr; |
| 5454 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 5455 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 5456 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5457 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5458 | |
| 5459 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5460 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5461 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5462 | len += WMI_TLV_HDR_SIZE; |
| 5463 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5464 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 5465 | len += sizeof(wmi_roam_dense_thres_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5466 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5467 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5468 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5469 | return QDF_STATUS_E_NOMEM; |
| 5470 | } |
| 5471 | |
| 5472 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5473 | rssi_threshold_fp = |
| 5474 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 5475 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 5476 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 5477 | WMITLV_GET_STRUCT_TLVLEN |
| 5478 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 5479 | /* fill in threshold values */ |
| 5480 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 5481 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 5482 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 5483 | rssi_threshold_fp->hirssi_scan_max_count = |
| 5484 | roam_req->hi_rssi_scan_max_count; |
| 5485 | rssi_threshold_fp->hirssi_scan_delta = |
| 5486 | roam_req->hi_rssi_scan_rssi_delta; |
| 5487 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
| 5488 | |
| 5489 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5490 | WMITLV_SET_HDR(buf_ptr, |
| 5491 | WMITLV_TAG_ARRAY_STRUC, |
| 5492 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 5493 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5494 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 5495 | |
| 5496 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 5497 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 5498 | ext_thresholds->boost_threshold_5g = |
| 5499 | roam_req->boost_threshold_5g; |
| 5500 | |
| 5501 | ext_thresholds->boost_algorithm_5g = |
| 5502 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5503 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 5504 | ext_thresholds->penalty_algorithm_5g = |
| 5505 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5506 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 5507 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 5508 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 5509 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 5510 | |
| 5511 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 5512 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 5513 | WMITLV_GET_STRUCT_TLVLEN |
| 5514 | (wmi_roam_scan_extended_threshold_param)); |
| 5515 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5516 | WMITLV_SET_HDR(buf_ptr, |
| 5517 | WMITLV_TAG_ARRAY_STRUC, |
| 5518 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 5519 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5520 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 5521 | early_stop_thresholds->roam_earlystop_thres_min = |
| 5522 | roam_req->roam_earlystop_thres_min; |
| 5523 | early_stop_thresholds->roam_earlystop_thres_max = |
| 5524 | roam_req->roam_earlystop_thres_max; |
| 5525 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 5526 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 5527 | WMITLV_GET_STRUCT_TLVLEN |
| 5528 | (wmi_roam_earlystop_rssi_thres_param)); |
| 5529 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5530 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 5531 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5532 | sizeof(wmi_roam_dense_thres_param)); |
| 5533 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5534 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 5535 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 5536 | roam_req->dense_rssi_thresh_offset; |
| 5537 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 5538 | dense_thresholds->roam_dense_traffic_thres = |
| 5539 | roam_req->traffic_threshold; |
| 5540 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 5541 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 5542 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 5543 | WMITLV_GET_STRUCT_TLVLEN |
| 5544 | (wmi_roam_dense_thres_param)); |
| 5545 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5546 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5547 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5548 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5549 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5550 | status); |
| 5551 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5552 | } |
| 5553 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5554 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5555 | } |
| 5556 | |
| 5557 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5558 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 5559 | * configuration params |
| 5560 | * @wma_handle: wma handler |
| 5561 | * @dwelltime_params: pointer to dwelltime_params |
| 5562 | * |
| 5563 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 5564 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5565 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5566 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5567 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 5568 | { |
| 5569 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 5570 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 5571 | wmi_buf_t buf; |
| 5572 | uint8_t *buf_ptr; |
| 5573 | int32_t err; |
| 5574 | int len; |
| 5575 | |
| 5576 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5577 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5578 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 5579 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5580 | if (!buf) { |
| 5581 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 5582 | __func__); |
| 5583 | return QDF_STATUS_E_NOMEM; |
| 5584 | } |
| 5585 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5586 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 5587 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 5588 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 5589 | WMITLV_GET_STRUCT_TLVLEN |
| 5590 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 5591 | |
| 5592 | dwell_param->enable = dwelltime_params->is_enabled; |
| 5593 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5594 | WMITLV_SET_HDR(buf_ptr, |
| 5595 | WMITLV_TAG_ARRAY_STRUC, |
| 5596 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5597 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5598 | |
| 5599 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 5600 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5601 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 5602 | WMITLV_GET_STRUCT_TLVLEN( |
| 5603 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5604 | |
| 5605 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 5606 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 5607 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 5608 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 5609 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 5610 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 5611 | if (err) { |
| 5612 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 5613 | wmi_buf_free(buf); |
| 5614 | return QDF_STATUS_E_FAILURE; |
| 5615 | } |
| 5616 | |
| 5617 | return QDF_STATUS_SUCCESS; |
| 5618 | } |
| 5619 | |
| 5620 | |
| 5621 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5622 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 5623 | * @wmi_handle: wmi handle |
| 5624 | * @roam_req: Request which contains the filters |
| 5625 | * |
| 5626 | * There are filters such as whitelist, blacklist and preferred |
| 5627 | * list that need to be applied to the scan results to form the |
| 5628 | * probable candidates for roaming. |
| 5629 | * |
| 5630 | * Return: Return success upon succesfully passing the |
| 5631 | * parameters to the firmware, otherwise failure. |
| 5632 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5633 | static QDF_STATUS send_roam_scan_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5634 | struct roam_scan_filter_params *roam_req) |
| 5635 | { |
| 5636 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5637 | QDF_STATUS status; |
| 5638 | uint32_t i; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5639 | uint32_t len; |
| 5640 | uint8_t *buf_ptr; |
| 5641 | wmi_roam_filter_fixed_param *roam_filter; |
| 5642 | uint8_t *bssid_src_ptr = NULL; |
| 5643 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 5644 | wmi_ssid *ssid_ptr = NULL; |
| 5645 | uint32_t *bssid_preferred_factor_ptr = NULL; |
| 5646 | |
| 5647 | len = sizeof(wmi_roam_filter_fixed_param); |
| 5648 | len += WMI_TLV_HDR_SIZE; |
| 5649 | len += roam_req->len; |
| 5650 | |
| 5651 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5652 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5653 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5654 | return QDF_STATUS_E_NOMEM; |
| 5655 | } |
| 5656 | |
| 5657 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 5658 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 5659 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 5660 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 5661 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 5662 | /* fill in fixed values */ |
| 5663 | roam_filter->vdev_id = roam_req->session_id; |
| 5664 | roam_filter->flags = 0; |
| 5665 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 5666 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 5667 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 5668 | roam_filter->num_bssid_preferred_list = |
| 5669 | roam_req->num_bssid_preferred_list; |
| 5670 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 5671 | |
| 5672 | WMITLV_SET_HDR((buf_ptr), |
| 5673 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5674 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 5675 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 5676 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5677 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 5678 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 5679 | bssid_src_ptr += ATH_MAC_LEN; |
| 5680 | bssid_dst_ptr++; |
| 5681 | } |
| 5682 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5683 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 5684 | WMITLV_SET_HDR((buf_ptr), |
| 5685 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5686 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 5687 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5688 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 5689 | qdf_mem_copy(&ssid_ptr->ssid, |
| 5690 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 5691 | roam_req->ssid_allowed_list[i].length); |
| 5692 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 5693 | ssid_ptr++; |
| 5694 | } |
| 5695 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 5696 | sizeof(wmi_ssid)); |
| 5697 | WMITLV_SET_HDR((buf_ptr), |
| 5698 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5699 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 5700 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 5701 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5702 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5703 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 5704 | (wmi_mac_addr *)bssid_dst_ptr); |
| 5705 | bssid_src_ptr += ATH_MAC_LEN; |
| 5706 | bssid_dst_ptr++; |
| 5707 | } |
| 5708 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5709 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 5710 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 5711 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 5712 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5713 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5714 | *bssid_preferred_factor_ptr = |
| 5715 | roam_req->bssid_favored_factor[i]; |
| 5716 | bssid_preferred_factor_ptr++; |
| 5717 | } |
| 5718 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5719 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 5720 | |
| 5721 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5722 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5723 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5724 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5725 | status); |
| 5726 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5727 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5728 | |
| 5729 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5730 | } |
| 5731 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5732 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 5733 | * @wmi_handle: wmi handle |
| 5734 | * @req: epno config params request structure |
| 5735 | * |
| 5736 | * This function reads the incoming epno config request structure |
| 5737 | * and constructs the WMI message to the firmware. |
| 5738 | * |
| 5739 | * Returns: 0 on success, error number otherwise |
| 5740 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5741 | static 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] | 5742 | struct wifi_enhanched_pno_params *req) |
| 5743 | { |
| 5744 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 5745 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5746 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5747 | u_int8_t i, *buf_ptr; |
| 5748 | wmi_buf_t buf; |
| 5749 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5750 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5751 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5752 | /* Fixed Params */ |
| 5753 | len = sizeof(*cmd); |
| 5754 | if (req->num_networks) { |
| 5755 | /* TLV place holder for array of structures |
| 5756 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 5757 | */ |
| 5758 | len += WMI_TLV_HDR_SIZE; |
| 5759 | len += (sizeof(nlo_configured_parameters) |
| 5760 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 5761 | /* TLV for array of uint32 channel_list */ |
| 5762 | len += WMI_TLV_HDR_SIZE; |
| 5763 | /* TLV for nlo_channel_prediction_cfg */ |
| 5764 | len += WMI_TLV_HDR_SIZE; |
| 5765 | /* TLV for candidate score params */ |
| 5766 | len += sizeof(enlo_candidate_score_params); |
| 5767 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5768 | |
| 5769 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5770 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5771 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5772 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5773 | } |
| 5774 | |
| 5775 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5776 | |
| 5777 | buf_ptr = (u_int8_t *) cmd; |
| 5778 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5779 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5780 | WMITLV_GET_STRUCT_TLVLEN( |
| 5781 | wmi_nlo_config_cmd_fixed_param)); |
| 5782 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5783 | |
| 5784 | /* set flag to reset if num of networks are 0 */ |
| 5785 | cmd->flags = (req->num_networks == 0 ? |
| 5786 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5787 | |
| 5788 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 5789 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5790 | cmd->no_of_ssids = QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5791 | WMI_LOGD("SSID count: %d flags: %d", |
| 5792 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5793 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5794 | /* Fill nlo_config only when num_networks are non zero */ |
| 5795 | if (cmd->no_of_ssids) { |
| 5796 | /* Fill networks */ |
| 5797 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5798 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 5799 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5800 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5801 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 5802 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 5803 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 5804 | WMITLV_TAG_ARRAY_BYTE, |
| 5805 | WMITLV_GET_STRUCT_TLVLEN( |
| 5806 | nlo_configured_parameters)); |
| 5807 | /* Copy ssid and it's length */ |
| 5808 | nlo_list[i].ssid.valid = true; |
| 5809 | nlo_list[i].ssid.ssid.ssid_len = |
| 5810 | req->networks[i].ssid.length; |
| 5811 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 5812 | req->networks[i].ssid.mac_ssid, |
| 5813 | nlo_list[i].ssid.ssid.ssid_len); |
| 5814 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 5815 | nlo_list[i].ssid.ssid.ssid_len, |
| 5816 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 5817 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5818 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5819 | /* Copy pno flags */ |
| 5820 | nlo_list[i].bcast_nw_type.valid = true; |
| 5821 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 5822 | req->networks[i].flags; |
| 5823 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5824 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 5825 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5826 | /* Copy auth bit field */ |
| 5827 | nlo_list[i].auth_type.valid = true; |
| 5828 | nlo_list[i].auth_type.auth_type = |
| 5829 | req->networks[i].auth_bit_field; |
| 5830 | WMI_LOGD("Auth bit field (%u)", |
| 5831 | nlo_list[i].auth_type.auth_type); |
| 5832 | } |
| 5833 | |
| 5834 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 5835 | /* Fill the channel list */ |
| 5836 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 5837 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5838 | |
| 5839 | /* Fill prediction_param */ |
| 5840 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5841 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5842 | |
| 5843 | /* Fill epno candidate score params */ |
| 5844 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 5845 | WMITLV_SET_HDR(buf_ptr, |
| 5846 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 5847 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 5848 | cand_score_params->min5GHz_rssi = |
| 5849 | req->min_5ghz_rssi; |
| 5850 | cand_score_params->min24GHz_rssi = |
| 5851 | req->min_24ghz_rssi; |
| 5852 | cand_score_params->initial_score_max = |
| 5853 | req->initial_score_max; |
| 5854 | cand_score_params->current_connection_bonus = |
| 5855 | req->current_connection_bonus; |
| 5856 | cand_score_params->same_network_bonus = |
| 5857 | req->same_network_bonus; |
| 5858 | cand_score_params->secure_bonus = |
| 5859 | req->secure_bonus; |
| 5860 | cand_score_params->band5GHz_bonus = |
| 5861 | req->band_5ghz_bonus; |
| 5862 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5863 | } |
| 5864 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5865 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5866 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5867 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5868 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5869 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5870 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5871 | } |
| 5872 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5873 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5874 | req->session_id); |
| 5875 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5876 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5877 | } |
| 5878 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5879 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5880 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 5881 | * @wmi_handle: wmi handle |
| 5882 | * @ipa_offload: ipa offload control parameter |
| 5883 | * |
| 5884 | * Returns: 0 on success, error number otherwise |
| 5885 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5886 | static 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] | 5887 | struct ipa_offload_control_params *ipa_offload) |
| 5888 | { |
| 5889 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 5890 | wmi_buf_t wmi_buf; |
| 5891 | uint32_t len; |
| 5892 | u_int8_t *buf_ptr; |
| 5893 | |
| 5894 | len = sizeof(*cmd); |
| 5895 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5896 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5897 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 5898 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5899 | } |
| 5900 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5901 | WMI_LOGE("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5902 | ipa_offload->offload_type, ipa_offload->enable); |
| 5903 | |
| 5904 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 5905 | |
| 5906 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 5907 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5908 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 5909 | WMITLV_GET_STRUCT_TLVLEN( |
| 5910 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 5911 | |
| 5912 | cmd->offload_type = ipa_offload->offload_type; |
| 5913 | cmd->vdev_id = ipa_offload->vdev_id; |
| 5914 | cmd->enable = ipa_offload->enable; |
| 5915 | |
| 5916 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5917 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5918 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5919 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5920 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5921 | } |
| 5922 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5923 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5924 | } |
| 5925 | |
| 5926 | /** |
| 5927 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 5928 | * @wmi_handle: wmi handle |
| 5929 | * @pgetcapab: get capabilities params |
| 5930 | * |
| 5931 | * This function send request to fw to get extscan capabilities. |
| 5932 | * |
| 5933 | * Return: CDF status |
| 5934 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5935 | static 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] | 5936 | struct extscan_capabilities_params *pgetcapab) |
| 5937 | { |
| 5938 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 5939 | wmi_buf_t wmi_buf; |
| 5940 | uint32_t len; |
| 5941 | uint8_t *buf_ptr; |
| 5942 | |
| 5943 | len = sizeof(*cmd); |
| 5944 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5945 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5946 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5947 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5948 | } |
| 5949 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5950 | |
| 5951 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 5952 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5953 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 5954 | WMITLV_GET_STRUCT_TLVLEN |
| 5955 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 5956 | |
| 5957 | cmd->request_id = pgetcapab->request_id; |
| 5958 | |
| 5959 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5960 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5961 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5962 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5963 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5964 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5965 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5966 | } |
| 5967 | |
| 5968 | /** |
| 5969 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 5970 | * @wmi_handle: wmi handle |
| 5971 | * @pcached_results: cached results parameters |
| 5972 | * |
| 5973 | * This function send request to fw to get cached results. |
| 5974 | * |
| 5975 | * Return: CDF status |
| 5976 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5977 | static 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] | 5978 | struct extscan_cached_result_params *pcached_results) |
| 5979 | { |
| 5980 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 5981 | wmi_buf_t wmi_buf; |
| 5982 | uint32_t len; |
| 5983 | uint8_t *buf_ptr; |
| 5984 | |
| 5985 | len = sizeof(*cmd); |
| 5986 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5987 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5988 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5989 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5990 | } |
| 5991 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5992 | |
| 5993 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 5994 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5995 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 5996 | WMITLV_GET_STRUCT_TLVLEN |
| 5997 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 5998 | |
| 5999 | cmd->request_id = pcached_results->request_id; |
| 6000 | cmd->vdev_id = pcached_results->session_id; |
| 6001 | cmd->control_flags = pcached_results->flush; |
| 6002 | |
| 6003 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6004 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6005 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6006 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6007 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6008 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6009 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6010 | } |
| 6011 | |
| 6012 | /** |
| 6013 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 6014 | * @wmi_handle: wmi handle |
| 6015 | * @reset_req: Reset change request params |
| 6016 | * |
| 6017 | * This function sends stop change monitor request to fw. |
| 6018 | * |
| 6019 | * Return: CDF status |
| 6020 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6021 | static 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] | 6022 | struct extscan_capabilities_reset_params *reset_req) |
| 6023 | { |
| 6024 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6025 | wmi_buf_t wmi_buf; |
| 6026 | uint32_t len; |
| 6027 | uint8_t *buf_ptr; |
| 6028 | int change_list = 0; |
| 6029 | |
| 6030 | len = sizeof(*cmd); |
| 6031 | |
| 6032 | /* reset significant change tlv is set to 0 */ |
| 6033 | len += WMI_TLV_HDR_SIZE; |
| 6034 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6035 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6036 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6037 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6038 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6039 | } |
| 6040 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6041 | |
| 6042 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6043 | buf_ptr; |
| 6044 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6045 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6046 | WMITLV_GET_STRUCT_TLVLEN |
| 6047 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6048 | |
| 6049 | cmd->request_id = reset_req->request_id; |
| 6050 | cmd->vdev_id = reset_req->session_id; |
| 6051 | cmd->mode = 0; |
| 6052 | |
| 6053 | buf_ptr += sizeof(*cmd); |
| 6054 | WMITLV_SET_HDR(buf_ptr, |
| 6055 | WMITLV_TAG_ARRAY_STRUC, |
| 6056 | change_list * |
| 6057 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6058 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 6059 | sizeof |
| 6060 | (wmi_extscan_wlan_change_bssid_param)); |
| 6061 | |
| 6062 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6063 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6064 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6065 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6066 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6067 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6068 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6069 | } |
| 6070 | |
| 6071 | /** |
| 6072 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 6073 | * @wmi_handle: wmi handle |
| 6074 | * @psigchange: change monitor request params |
| 6075 | * @buf: wmi buffer |
| 6076 | * @buf_len: buffer length |
| 6077 | * |
| 6078 | * This function fills elements of change monitor request buffer. |
| 6079 | * |
| 6080 | * Return: CDF status |
| 6081 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6082 | 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] | 6083 | struct extscan_set_sig_changereq_params |
| 6084 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 6085 | { |
| 6086 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6087 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 6088 | uint8_t *buf_ptr; |
| 6089 | int j; |
| 6090 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6091 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6092 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 6093 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6094 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6095 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 6096 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6097 | } |
| 6098 | len += WMI_TLV_HDR_SIZE; |
| 6099 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6100 | |
| 6101 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6102 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6103 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6104 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6105 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6106 | } |
| 6107 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6108 | cmd = |
| 6109 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6110 | buf_ptr; |
| 6111 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6112 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6113 | WMITLV_GET_STRUCT_TLVLEN |
| 6114 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6115 | |
| 6116 | cmd->request_id = psigchange->request_id; |
| 6117 | cmd->vdev_id = psigchange->session_id; |
| 6118 | cmd->total_entries = numap; |
| 6119 | cmd->mode = 1; |
| 6120 | cmd->num_entries_in_page = numap; |
| 6121 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 6122 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 6123 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 6124 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 6125 | |
| 6126 | buf_ptr += sizeof(*cmd); |
| 6127 | WMITLV_SET_HDR(buf_ptr, |
| 6128 | WMITLV_TAG_ARRAY_STRUC, |
| 6129 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6130 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 6131 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6132 | |
| 6133 | for (j = 0; j < numap; j++) { |
| 6134 | WMITLV_SET_HDR(dest_chglist, |
| 6135 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6136 | WMITLV_GET_STRUCT_TLVLEN |
| 6137 | (wmi_extscan_wlan_change_bssid_param)); |
| 6138 | |
| 6139 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 6140 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 6141 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 6142 | &dest_chglist->bssid); |
| 6143 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6144 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6145 | dest_chglist->lower_rssi_limit); |
| 6146 | dest_chglist++; |
| 6147 | src_ap++; |
| 6148 | } |
| 6149 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6150 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6151 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6152 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6153 | } |
| 6154 | |
| 6155 | /** |
| 6156 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 6157 | * @wmi_handle: wmi handle |
| 6158 | * @psigchange: change monitor request params |
| 6159 | * |
| 6160 | * This function sends start change monitor request to fw. |
| 6161 | * |
| 6162 | * Return: CDF status |
| 6163 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6164 | static 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] | 6165 | struct extscan_set_sig_changereq_params * |
| 6166 | psigchange) |
| 6167 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6168 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6169 | wmi_buf_t buf; |
| 6170 | int len; |
| 6171 | |
| 6172 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6173 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6174 | psigchange, &buf, |
| 6175 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6176 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6177 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6178 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6179 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6180 | } |
| 6181 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6182 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 6183 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6184 | } |
| 6185 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6186 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6187 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6188 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6189 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6190 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6191 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6192 | } |
| 6193 | |
| 6194 | /** |
| 6195 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 6196 | * @wmi_handle: wmi handle |
| 6197 | * @photlist_reset: hotlist reset params |
| 6198 | * |
| 6199 | * This function configures hotlist monitor to stop in fw. |
| 6200 | * |
| 6201 | * Return: CDF status |
| 6202 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6203 | static 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] | 6204 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 6205 | { |
| 6206 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 6207 | wmi_buf_t wmi_buf; |
| 6208 | uint32_t len; |
| 6209 | uint8_t *buf_ptr; |
| 6210 | int hotlist_entries = 0; |
| 6211 | |
| 6212 | len = sizeof(*cmd); |
| 6213 | |
| 6214 | /* reset bssid hotlist with tlv set to 0 */ |
| 6215 | len += WMI_TLV_HDR_SIZE; |
| 6216 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 6217 | |
| 6218 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6219 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6220 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6221 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6222 | } |
| 6223 | |
| 6224 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6225 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 6226 | buf_ptr; |
| 6227 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6228 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 6229 | WMITLV_GET_STRUCT_TLVLEN |
| 6230 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 6231 | |
| 6232 | cmd->request_id = photlist_reset->request_id; |
| 6233 | cmd->vdev_id = photlist_reset->session_id; |
| 6234 | cmd->mode = 0; |
| 6235 | |
| 6236 | buf_ptr += sizeof(*cmd); |
| 6237 | WMITLV_SET_HDR(buf_ptr, |
| 6238 | WMITLV_TAG_ARRAY_STRUC, |
| 6239 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6240 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6241 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6242 | |
| 6243 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6244 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6245 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6246 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6247 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6248 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6249 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6250 | } |
| 6251 | |
| 6252 | /** |
| 6253 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 6254 | * @wmi_handle: wmi handle |
| 6255 | * @pstopcmd: stop scan command request params |
| 6256 | * |
| 6257 | * This function sends stop extscan request to fw. |
| 6258 | * |
| 6259 | * Return: CDF Status. |
| 6260 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6261 | static QDF_STATUS send_stop_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6262 | struct extscan_stop_req_params *pstopcmd) |
| 6263 | { |
| 6264 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 6265 | wmi_buf_t wmi_buf; |
| 6266 | uint32_t len; |
| 6267 | uint8_t *buf_ptr; |
| 6268 | |
| 6269 | len = sizeof(*cmd); |
| 6270 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6271 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6272 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6273 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6274 | } |
| 6275 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6276 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 6277 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6278 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 6279 | WMITLV_GET_STRUCT_TLVLEN |
| 6280 | (wmi_extscan_stop_cmd_fixed_param)); |
| 6281 | |
| 6282 | cmd->request_id = pstopcmd->request_id; |
| 6283 | cmd->vdev_id = pstopcmd->session_id; |
| 6284 | |
| 6285 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6286 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6287 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6288 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6289 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6290 | } |
| 6291 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6292 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6293 | } |
| 6294 | |
| 6295 | /** |
| 6296 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 6297 | * @wmi_handle: wmi handle |
| 6298 | * @pstart: scan command request params |
| 6299 | * @buf: event buffer |
| 6300 | * @buf_len: length of buffer |
| 6301 | * |
| 6302 | * This function fills individual elements of extscan request and |
| 6303 | * TLV for buckets, channel list. |
| 6304 | * |
| 6305 | * Return: CDF Status. |
| 6306 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6307 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6308 | 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] | 6309 | struct wifi_scan_cmd_req_params *pstart, |
| 6310 | wmi_buf_t *buf, int *buf_len) |
| 6311 | { |
| 6312 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 6313 | wmi_extscan_bucket *dest_blist; |
| 6314 | wmi_extscan_bucket_channel *dest_clist; |
| 6315 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 6316 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 6317 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 6318 | |
| 6319 | uint8_t *buf_ptr; |
| 6320 | int i, k, count = 0; |
| 6321 | int len = sizeof(*cmd); |
| 6322 | int nbuckets = pstart->numBuckets; |
| 6323 | int nchannels = 0; |
| 6324 | |
| 6325 | /* These TLV's are are NULL by default */ |
| 6326 | uint32_t ie_len_with_pad = 0; |
| 6327 | int num_ssid = 0; |
| 6328 | int num_bssid = 0; |
| 6329 | int ie_len = 0; |
| 6330 | |
| 6331 | uint32_t base_period = pstart->basePeriod; |
| 6332 | |
| 6333 | /* TLV placeholder for ssid_list (NULL) */ |
| 6334 | len += WMI_TLV_HDR_SIZE; |
| 6335 | len += num_ssid * sizeof(wmi_ssid); |
| 6336 | |
| 6337 | /* TLV placeholder for bssid_list (NULL) */ |
| 6338 | len += WMI_TLV_HDR_SIZE; |
| 6339 | len += num_bssid * sizeof(wmi_mac_addr); |
| 6340 | |
| 6341 | /* TLV placeholder for ie_data (NULL) */ |
| 6342 | len += WMI_TLV_HDR_SIZE; |
| 6343 | len += ie_len * sizeof(uint32_t); |
| 6344 | |
| 6345 | /* TLV placeholder for bucket */ |
| 6346 | len += WMI_TLV_HDR_SIZE; |
| 6347 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 6348 | |
| 6349 | /* TLV channel placeholder */ |
| 6350 | len += WMI_TLV_HDR_SIZE; |
| 6351 | for (i = 0; i < nbuckets; i++) { |
| 6352 | nchannels += src_bucket->numChannels; |
| 6353 | src_bucket++; |
| 6354 | } |
| 6355 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6356 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6357 | __func__, nbuckets, nchannels); |
| 6358 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 6359 | /* Allocate the memory */ |
| 6360 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6361 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6362 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6363 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6364 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6365 | } |
| 6366 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6367 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 6368 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6369 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 6370 | WMITLV_GET_STRUCT_TLVLEN |
| 6371 | (wmi_extscan_start_cmd_fixed_param)); |
| 6372 | |
| 6373 | cmd->request_id = pstart->requestId; |
| 6374 | cmd->vdev_id = pstart->sessionId; |
| 6375 | cmd->base_period = pstart->basePeriod; |
| 6376 | cmd->num_buckets = nbuckets; |
| 6377 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 6378 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6379 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6380 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6381 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6382 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6383 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 6384 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6385 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 6386 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 6387 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6388 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 6389 | |
| 6390 | /* The max dwell time is retrieved from the first channel |
| 6391 | * of the first bucket and kept common for all channels. |
| 6392 | */ |
| 6393 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 6394 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 6395 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 6396 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 6397 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 6398 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 6399 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 6400 | |
| 6401 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6402 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6403 | cmd->probe_delay = 0; |
| 6404 | cmd->probe_spacing_time = 0; |
| 6405 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6406 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 6407 | WMI_SCAN_ADD_CCK_RATES | |
| 6408 | WMI_SCAN_ADD_OFDM_RATES | |
| 6409 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 6410 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6411 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 6412 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 6413 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6414 | cmd->num_ssids = 0; |
| 6415 | cmd->num_bssid = 0; |
| 6416 | cmd->ie_len = 0; |
| 6417 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 6418 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 6419 | |
| 6420 | buf_ptr += sizeof(*cmd); |
| 6421 | WMITLV_SET_HDR(buf_ptr, |
| 6422 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6423 | num_ssid * sizeof(wmi_ssid)); |
| 6424 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 6425 | |
| 6426 | WMITLV_SET_HDR(buf_ptr, |
| 6427 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6428 | num_bssid * sizeof(wmi_mac_addr)); |
| 6429 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 6430 | |
| 6431 | ie_len_with_pad = 0; |
| 6432 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 6433 | ie_len_with_pad); |
| 6434 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 6435 | |
| 6436 | WMITLV_SET_HDR(buf_ptr, |
| 6437 | WMITLV_TAG_ARRAY_STRUC, |
| 6438 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 6439 | dest_blist = (wmi_extscan_bucket *) |
| 6440 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6441 | src_bucket = pstart->buckets; |
| 6442 | |
| 6443 | /* Retrieve scanning information from each bucket and |
| 6444 | * channels and send it to the target |
| 6445 | */ |
| 6446 | for (i = 0; i < nbuckets; i++) { |
| 6447 | WMITLV_SET_HDR(dest_blist, |
| 6448 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6449 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 6450 | |
| 6451 | dest_blist->bucket_id = src_bucket->bucket; |
| 6452 | dest_blist->base_period_multiplier = |
| 6453 | src_bucket->period / base_period; |
| 6454 | dest_blist->min_period = src_bucket->period; |
| 6455 | dest_blist->max_period = src_bucket->max_period; |
| 6456 | dest_blist->exp_backoff = src_bucket->exponent; |
| 6457 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 6458 | dest_blist->channel_band = src_bucket->band; |
| 6459 | dest_blist->num_channels = src_bucket->numChannels; |
| 6460 | dest_blist->notify_extscan_events = 0; |
| 6461 | |
| 6462 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 6463 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 6464 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 6465 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6466 | |
| 6467 | if (src_bucket->reportEvents & |
| 6468 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 6469 | dest_blist->forwarding_flags = |
| 6470 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 6471 | dest_blist->notify_extscan_events |= |
| 6472 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 6473 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 6474 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 6475 | } else { |
| 6476 | dest_blist->forwarding_flags = |
| 6477 | WMI_EXTSCAN_NO_FORWARDING; |
| 6478 | } |
| 6479 | |
| 6480 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 6481 | dest_blist->configuration_flags = 0; |
| 6482 | else |
| 6483 | dest_blist->configuration_flags = |
| 6484 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 6485 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6486 | 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] | 6487 | __func__, dest_blist->notify_extscan_events, |
| 6488 | dest_blist->configuration_flags, |
| 6489 | dest_blist->forwarding_flags); |
| 6490 | |
| 6491 | dest_blist->min_dwell_time_active = |
| 6492 | src_bucket->min_dwell_time_active; |
| 6493 | dest_blist->max_dwell_time_active = |
| 6494 | src_bucket->max_dwell_time_active; |
| 6495 | dest_blist->min_dwell_time_passive = |
| 6496 | src_bucket->min_dwell_time_passive; |
| 6497 | dest_blist->max_dwell_time_passive = |
| 6498 | src_bucket->max_dwell_time_passive; |
| 6499 | src_channel = src_bucket->channels; |
| 6500 | |
| 6501 | /* save the channel info to later populate |
| 6502 | * the channel TLV |
| 6503 | */ |
| 6504 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 6505 | save_channel[count++].channel = src_channel->channel; |
| 6506 | src_channel++; |
| 6507 | } |
| 6508 | dest_blist++; |
| 6509 | src_bucket++; |
| 6510 | } |
| 6511 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 6512 | WMITLV_SET_HDR(buf_ptr, |
| 6513 | WMITLV_TAG_ARRAY_STRUC, |
| 6514 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6515 | dest_clist = (wmi_extscan_bucket_channel *) |
| 6516 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6517 | |
| 6518 | /* Active or passive scan is based on the bucket dwell time |
| 6519 | * and channel specific active,passive scans are not |
| 6520 | * supported yet |
| 6521 | */ |
| 6522 | for (i = 0; i < nchannels; i++) { |
| 6523 | WMITLV_SET_HDR(dest_clist, |
| 6524 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 6525 | WMITLV_GET_STRUCT_TLVLEN |
| 6526 | (wmi_extscan_bucket_channel)); |
| 6527 | dest_clist->channel = save_channel[i].channel; |
| 6528 | dest_clist++; |
| 6529 | } |
| 6530 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6531 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6532 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6533 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6534 | } |
| 6535 | |
| 6536 | /** |
| 6537 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 6538 | * @wmi_handle: wmi handle |
| 6539 | * @pstart: scan command request params |
| 6540 | * |
| 6541 | * This function sends start extscan request to fw. |
| 6542 | * |
| 6543 | * Return: CDF Status. |
| 6544 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6545 | static QDF_STATUS send_start_extscan_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6546 | struct wifi_scan_cmd_req_params *pstart) |
| 6547 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6548 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6549 | wmi_buf_t buf; |
| 6550 | int len; |
| 6551 | |
| 6552 | /* Fill individual elements of extscan request and |
| 6553 | * TLV for buckets, channel list. |
| 6554 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6555 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6556 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6557 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6558 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 6559 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6560 | } |
| 6561 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6562 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6563 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6564 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6565 | } |
| 6566 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 6567 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6568 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6569 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6570 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6571 | } |
| 6572 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6573 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6574 | } |
| 6575 | |
| 6576 | /** |
| 6577 | * send_plm_stop_cmd_tlv() - plm stop request |
| 6578 | * @wmi_handle: wmi handle |
| 6579 | * @plm: plm request parameters |
| 6580 | * |
| 6581 | * This function request FW to stop PLM. |
| 6582 | * |
| 6583 | * Return: CDF status |
| 6584 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6585 | static QDF_STATUS send_plm_stop_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6586 | const struct plm_req_params *plm) |
| 6587 | { |
| 6588 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 6589 | int32_t len; |
| 6590 | wmi_buf_t buf; |
| 6591 | uint8_t *buf_ptr; |
| 6592 | int ret; |
| 6593 | |
| 6594 | len = sizeof(*cmd); |
| 6595 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6596 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6597 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6598 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6599 | } |
| 6600 | |
| 6601 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 6602 | |
| 6603 | buf_ptr = (uint8_t *) cmd; |
| 6604 | |
| 6605 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6606 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 6607 | WMITLV_GET_STRUCT_TLVLEN |
| 6608 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 6609 | |
| 6610 | cmd->vdev_id = plm->session_id; |
| 6611 | |
| 6612 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6613 | 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] | 6614 | |
| 6615 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6616 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 6617 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6618 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6619 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6620 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6621 | } |
| 6622 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6623 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6624 | } |
| 6625 | |
| 6626 | /** |
| 6627 | * send_plm_start_cmd_tlv() - plm start request |
| 6628 | * @wmi_handle: wmi handle |
| 6629 | * @plm: plm request parameters |
| 6630 | * |
| 6631 | * This function request FW to start PLM. |
| 6632 | * |
| 6633 | * Return: CDF status |
| 6634 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6635 | static QDF_STATUS send_plm_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6636 | const struct plm_req_params *plm, |
| 6637 | uint32_t *gchannel_list) |
| 6638 | { |
| 6639 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 6640 | uint32_t *channel_list; |
| 6641 | int32_t len; |
| 6642 | wmi_buf_t buf; |
| 6643 | uint8_t *buf_ptr; |
| 6644 | uint8_t count; |
| 6645 | int ret; |
| 6646 | |
| 6647 | /* TLV place holder for channel_list */ |
| 6648 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 6649 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 6650 | |
| 6651 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6652 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6653 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6654 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6655 | } |
| 6656 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 6657 | |
| 6658 | buf_ptr = (uint8_t *) cmd; |
| 6659 | |
| 6660 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6661 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 6662 | WMITLV_GET_STRUCT_TLVLEN |
| 6663 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 6664 | |
| 6665 | cmd->vdev_id = plm->session_id; |
| 6666 | |
| 6667 | cmd->meas_token = plm->meas_token; |
| 6668 | cmd->dialog_token = plm->diag_token; |
| 6669 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6670 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6671 | cmd->off_duration = plm->meas_duration; |
| 6672 | cmd->burst_cycle = plm->burst_len; |
| 6673 | cmd->tx_power = plm->desired_tx_pwr; |
| 6674 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 6675 | cmd->num_chans = plm->plm_num_ch; |
| 6676 | |
| 6677 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 6678 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6679 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 6680 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 6681 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 6682 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 6683 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 6684 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 6685 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 6686 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6687 | |
| 6688 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6689 | (cmd->num_chans * sizeof(uint32_t))); |
| 6690 | |
| 6691 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6692 | if (cmd->num_chans) { |
| 6693 | channel_list = (uint32_t *) buf_ptr; |
| 6694 | for (count = 0; count < cmd->num_chans; count++) { |
| 6695 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6696 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6697 | channel_list[count] = |
| 6698 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6699 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6700 | } |
| 6701 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 6702 | } |
| 6703 | |
| 6704 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6705 | WMI_VDEV_PLMREQ_START_CMDID); |
| 6706 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6707 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6708 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6709 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6710 | } |
| 6711 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6712 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6713 | } |
| 6714 | |
| 6715 | /** |
| 6716 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 6717 | * @wmi_handle: wmi handle |
| 6718 | * @vdev_id: vdev id |
| 6719 | * |
| 6720 | * This function request FW to stop ongoing PNO operation. |
| 6721 | * |
| 6722 | * Return: CDF status |
| 6723 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6724 | static 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] | 6725 | { |
| 6726 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6727 | int32_t len = sizeof(*cmd); |
| 6728 | wmi_buf_t buf; |
| 6729 | uint8_t *buf_ptr; |
| 6730 | int ret; |
| 6731 | |
| 6732 | /* |
| 6733 | * TLV place holder for array of structures nlo_configured_parameters |
| 6734 | * TLV place holder for array of uint32_t channel_list |
| 6735 | * TLV place holder for chnl prediction cfg |
| 6736 | */ |
| 6737 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6738 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6739 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6740 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6741 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6742 | } |
| 6743 | |
| 6744 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6745 | buf_ptr = (uint8_t *) cmd; |
| 6746 | |
| 6747 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6748 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6749 | WMITLV_GET_STRUCT_TLVLEN |
| 6750 | (wmi_nlo_config_cmd_fixed_param)); |
| 6751 | |
| 6752 | cmd->vdev_id = vdev_id; |
| 6753 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 6754 | buf_ptr += sizeof(*cmd); |
| 6755 | |
| 6756 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6757 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6758 | |
| 6759 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6760 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6761 | |
| 6762 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6763 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6764 | |
| 6765 | |
| 6766 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6767 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6768 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6769 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6770 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6771 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6772 | } |
| 6773 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6774 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6775 | } |
| 6776 | |
| 6777 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6778 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 6779 | * @buf_ptr: Buffer passed by upper layers |
| 6780 | * @pno: Buffer to be sent to the firmware |
| 6781 | * |
| 6782 | * Copy the PNO Channel prediction configuration parameters |
| 6783 | * passed by the upper layers to a WMI format TLV and send it |
| 6784 | * down to the firmware. |
| 6785 | * |
| 6786 | * Return: None |
| 6787 | */ |
| 6788 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 6789 | struct pno_scan_req_params *pno) |
| 6790 | { |
| 6791 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 6792 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 6793 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 6794 | WMITLV_TAG_ARRAY_BYTE, |
| 6795 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6796 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6797 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 6798 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 6799 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 6800 | channel_prediction_cfg->full_scan_period_ms = |
| 6801 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6802 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6803 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 6804 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 6805 | channel_prediction_cfg->enable, |
| 6806 | channel_prediction_cfg->top_k_num, |
| 6807 | channel_prediction_cfg->stationary_threshold, |
| 6808 | channel_prediction_cfg->full_scan_period_ms); |
| 6809 | } |
| 6810 | |
| 6811 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6812 | * send_pno_start_cmd_tlv() - PNO start request |
| 6813 | * @wmi_handle: wmi handle |
| 6814 | * @pno: PNO request |
| 6815 | * |
| 6816 | * This function request FW to start PNO request. |
| 6817 | * Request: CDF status |
| 6818 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6819 | static QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6820 | struct pno_scan_req_params *pno, |
| 6821 | uint32_t *gchannel_freq_list) |
| 6822 | { |
| 6823 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6824 | nlo_configured_parameters *nlo_list; |
| 6825 | uint32_t *channel_list; |
| 6826 | int32_t len; |
| 6827 | wmi_buf_t buf; |
| 6828 | uint8_t *buf_ptr; |
| 6829 | uint8_t i; |
| 6830 | int ret; |
| 6831 | |
| 6832 | /* |
| 6833 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 6834 | * TLV place holder for array of uint32_t channel_list |
| 6835 | * TLV place holder for chnnl prediction cfg |
| 6836 | */ |
| 6837 | len = sizeof(*cmd) + |
| 6838 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6839 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6840 | len += sizeof(uint32_t) * QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6841 | WMI_NLO_MAX_CHAN); |
| 6842 | len += sizeof(nlo_configured_parameters) * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6843 | QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6844 | len += sizeof(nlo_channel_prediction_cfg); |
| 6845 | |
| 6846 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6847 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6848 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6849 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6850 | } |
| 6851 | |
| 6852 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6853 | |
| 6854 | buf_ptr = (uint8_t *) cmd; |
| 6855 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6856 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6857 | WMITLV_GET_STRUCT_TLVLEN |
| 6858 | (wmi_nlo_config_cmd_fixed_param)); |
| 6859 | cmd->vdev_id = pno->sessionId; |
| 6860 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 6861 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6862 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6863 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
| 6864 | pno->pnoscan_adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6865 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6866 | /* Current FW does not support min-max range for dwell time */ |
| 6867 | cmd->active_dwell_time = pno->active_max_time; |
| 6868 | cmd->passive_dwell_time = pno->passive_max_time; |
| 6869 | |
| 6870 | /* Copy scan interval */ |
| 6871 | cmd->fast_scan_period = pno->fast_scan_period; |
| 6872 | cmd->slow_scan_period = pno->slow_scan_period; |
Arif Hussain | 17ff203 | 2017-03-02 11:56:04 -0800 | [diff] [blame] | 6873 | cmd->delay_start_time = WMI_SEC_TO_MSEC(pno->delay_start_time); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6874 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6875 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6876 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6877 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6878 | |
| 6879 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6880 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6881 | cmd->no_of_ssids = QDF_MIN(pno->ucNetworksCount, WMI_NLO_MAX_SSIDS); |
| 6882 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6883 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6884 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6885 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6886 | |
| 6887 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6888 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6889 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6890 | WMITLV_TAG_ARRAY_BYTE, |
| 6891 | WMITLV_GET_STRUCT_TLVLEN |
| 6892 | (nlo_configured_parameters)); |
| 6893 | /* Copy ssid and it's length */ |
| 6894 | nlo_list[i].ssid.valid = true; |
| 6895 | nlo_list[i].ssid.ssid.ssid_len = pno->aNetworks[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6896 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6897 | pno->aNetworks[i].ssid.mac_ssid, |
| 6898 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6899 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6900 | nlo_list[i].ssid.ssid.ssid_len, |
| 6901 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 6902 | nlo_list[i].ssid.ssid.ssid_len); |
| 6903 | |
| 6904 | /* Copy rssi threshold */ |
| 6905 | if (pno->aNetworks[i].rssiThreshold && |
| 6906 | pno->aNetworks[i].rssiThreshold > WMI_RSSI_THOLD_DEFAULT) { |
| 6907 | nlo_list[i].rssi_cond.valid = true; |
| 6908 | nlo_list[i].rssi_cond.rssi = |
| 6909 | pno->aNetworks[i].rssiThreshold; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6910 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6911 | nlo_list[i].rssi_cond.rssi); |
| 6912 | } |
| 6913 | nlo_list[i].bcast_nw_type.valid = true; |
| 6914 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6915 | pno->aNetworks[i].bcastNetwType; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6916 | WMI_LOGI("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6917 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6918 | } |
| 6919 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6920 | |
| 6921 | /* Copy channel info */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6922 | cmd->num_of_channels = QDF_MIN(pno->aNetworks[0].ucChannelCount, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6923 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6924 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6925 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6926 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 6927 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6928 | |
| 6929 | channel_list = (uint32_t *) buf_ptr; |
| 6930 | for (i = 0; i < cmd->num_of_channels; i++) { |
| 6931 | channel_list[i] = pno->aNetworks[0].aChannels[i]; |
| 6932 | |
| 6933 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
| 6934 | channel_list[i] = gchannel_freq_list[i]; |
| 6935 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6936 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6937 | } |
| 6938 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 6939 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6940 | sizeof(nlo_channel_prediction_cfg)); |
| 6941 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6942 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6943 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6944 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 6945 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 6946 | */ |
| 6947 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6948 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6949 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6950 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6951 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6952 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6953 | } |
| 6954 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6955 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6956 | } |
| 6957 | |
| 6958 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 6959 | * @wmi_handle: wmi handle |
| 6960 | * @msg: message |
| 6961 | * @is_add_ts: is addts required |
| 6962 | * |
| 6963 | * This function sets ric request element for 11r roaming. |
| 6964 | * |
| 6965 | * Return: CDF status |
| 6966 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6967 | static 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] | 6968 | void *msg, uint8_t is_add_ts) |
| 6969 | { |
| 6970 | wmi_ric_request_fixed_param *cmd; |
| 6971 | wmi_ric_tspec *tspec_param; |
| 6972 | wmi_buf_t buf; |
| 6973 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6974 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6975 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 6976 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 6977 | |
| 6978 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6979 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6980 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 6981 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6982 | } |
| 6983 | |
| 6984 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6985 | |
| 6986 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 6987 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6988 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 6989 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 6990 | if (is_add_ts) |
| 6991 | cmd->vdev_id = ((struct add_ts_param *) msg)->sessionId; |
| 6992 | else |
| 6993 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 6994 | cmd->num_ric_request = 1; |
| 6995 | cmd->is_add_ric = is_add_ts; |
| 6996 | |
| 6997 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 6998 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 6999 | |
| 7000 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7001 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 7002 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 7003 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 7004 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 7005 | |
| 7006 | if (is_add_ts) |
| 7007 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7008 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7009 | else |
| 7010 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7011 | #endif |
| 7012 | if (ptspecIE) { |
| 7013 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7014 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7015 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 7016 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7017 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7018 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 7019 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7020 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 7021 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7022 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 7023 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 7024 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 7025 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 7026 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 7027 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 7028 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 7029 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 7030 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 7031 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 7032 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 7033 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 7034 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 7035 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 7036 | tspec_param->medium_time = 0; |
| 7037 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7038 | 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] | 7039 | |
| 7040 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7041 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7042 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7043 | __func__); |
| 7044 | if (is_add_ts) |
| 7045 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7046 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7047 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7048 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7049 | } |
| 7050 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7051 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7052 | } |
| 7053 | |
| 7054 | /** |
| 7055 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 7056 | * @wmi_handle: wmi handle |
| 7057 | * @clear_req: ll stats clear request command params |
| 7058 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7059 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7060 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7061 | static 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] | 7062 | const struct ll_stats_clear_params *clear_req, |
| 7063 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7064 | { |
| 7065 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 7066 | int32_t len; |
| 7067 | wmi_buf_t buf; |
| 7068 | uint8_t *buf_ptr; |
| 7069 | int ret; |
| 7070 | |
| 7071 | len = sizeof(*cmd); |
| 7072 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7073 | |
| 7074 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7075 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7076 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7077 | } |
| 7078 | |
| 7079 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7080 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7081 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 7082 | |
| 7083 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7084 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 7085 | WMITLV_GET_STRUCT_TLVLEN |
| 7086 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 7087 | |
| 7088 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 7089 | cmd->vdev_id = clear_req->sta_id; |
| 7090 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 7091 | |
| 7092 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7093 | &cmd->peer_macaddr); |
| 7094 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7095 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 7096 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 7097 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 7098 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 7099 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7100 | cmd->peer_macaddr); */ |
| 7101 | |
| 7102 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7103 | WMI_CLEAR_LINK_STATS_CMDID); |
| 7104 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7105 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7106 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7107 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7108 | } |
| 7109 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7110 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 7111 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7112 | } |
| 7113 | |
| 7114 | /** |
| 7115 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 7116 | * @wmi_handle: wmi handle |
| 7117 | * @setReq: ll stats set request command params |
| 7118 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7119 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7120 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7121 | static 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] | 7122 | const struct ll_stats_set_params *set_req) |
| 7123 | { |
| 7124 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 7125 | int32_t len; |
| 7126 | wmi_buf_t buf; |
| 7127 | uint8_t *buf_ptr; |
| 7128 | int ret; |
| 7129 | |
| 7130 | len = sizeof(*cmd); |
| 7131 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7132 | |
| 7133 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7134 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7135 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7136 | } |
| 7137 | |
| 7138 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7139 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7140 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 7141 | |
| 7142 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7143 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 7144 | WMITLV_GET_STRUCT_TLVLEN |
| 7145 | (wmi_start_link_stats_cmd_fixed_param)); |
| 7146 | |
| 7147 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 7148 | cmd->aggressive_statistics_gathering = |
| 7149 | set_req->aggressive_statistics_gathering; |
| 7150 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7151 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 7152 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 7153 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7154 | |
| 7155 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7156 | WMI_START_LINK_STATS_CMDID); |
| 7157 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7158 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7159 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7160 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7161 | } |
| 7162 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7163 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7164 | } |
| 7165 | |
| 7166 | /** |
| 7167 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 7168 | * @wmi_handle:wmi handle |
| 7169 | * @get_req:ll stats get request command params |
| 7170 | * @addr: mac address |
| 7171 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7172 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7173 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7174 | static 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] | 7175 | const struct ll_stats_get_params *get_req, |
| 7176 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7177 | { |
| 7178 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 7179 | int32_t len; |
| 7180 | wmi_buf_t buf; |
| 7181 | uint8_t *buf_ptr; |
| 7182 | int ret; |
| 7183 | |
| 7184 | len = sizeof(*cmd); |
| 7185 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7186 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 7187 | if (!buf) { |
| 7188 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 7189 | return QDF_STATUS_E_NOMEM; |
| 7190 | } |
| 7191 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7192 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7193 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7194 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 7195 | |
| 7196 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7197 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 7198 | WMITLV_GET_STRUCT_TLVLEN |
| 7199 | (wmi_request_link_stats_cmd_fixed_param)); |
| 7200 | |
| 7201 | cmd->request_id = get_req->req_id; |
| 7202 | cmd->stats_type = get_req->param_id_mask; |
| 7203 | cmd->vdev_id = get_req->sta_id; |
| 7204 | |
| 7205 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7206 | &cmd->peer_macaddr); |
| 7207 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7208 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
| 7209 | WMI_LOGD("Request ID : %d", cmd->request_id); |
| 7210 | WMI_LOGD("Stats Type : %d", cmd->stats_type); |
| 7211 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 7212 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7213 | |
| 7214 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7215 | WMI_REQUEST_LINK_STATS_CMDID); |
| 7216 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7217 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7218 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7219 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7220 | } |
| 7221 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7222 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7223 | } |
| 7224 | |
| 7225 | /** |
| 7226 | * send_get_stats_cmd_tlv() - get stats request |
| 7227 | * @wmi_handle: wmi handle |
| 7228 | * @get_stats_param: stats params |
| 7229 | * @addr: mac address |
| 7230 | * |
| 7231 | * Return: CDF status |
| 7232 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7233 | static QDF_STATUS send_get_stats_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7234 | struct pe_stats_req *get_stats_param, |
| 7235 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7236 | { |
| 7237 | wmi_buf_t buf; |
| 7238 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7239 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7240 | |
| 7241 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7242 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7243 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 7244 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7245 | } |
| 7246 | |
| 7247 | |
| 7248 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7249 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7250 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7251 | WMITLV_GET_STRUCT_TLVLEN |
| 7252 | (wmi_request_stats_cmd_fixed_param)); |
| 7253 | cmd->stats_id = |
| 7254 | WMI_REQUEST_PEER_STAT | WMI_REQUEST_PDEV_STAT | |
Himanshu Agarwal | c9fc2a3 | 2016-07-21 14:46:58 +0530 | [diff] [blame] | 7255 | WMI_REQUEST_VDEV_STAT | WMI_REQUEST_RSSI_PER_CHAIN_STAT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7256 | cmd->vdev_id = get_stats_param->session_id; |
| 7257 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7258 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7259 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7260 | WMI_REQUEST_STATS_CMDID)) { |
| 7261 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7262 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7263 | __func__); |
| 7264 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7265 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7266 | } |
| 7267 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7268 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7269 | |
| 7270 | } |
| 7271 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7272 | /** |
| 7273 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 7274 | * @wmi_handle: wmi handle |
| 7275 | * @rssi_req: get RSSI request |
| 7276 | * |
| 7277 | * Return: CDF status |
| 7278 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7279 | static QDF_STATUS send_snr_request_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7280 | { |
| 7281 | wmi_buf_t buf; |
| 7282 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7283 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7284 | |
| 7285 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7286 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7287 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7288 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7289 | } |
| 7290 | |
| 7291 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7292 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7293 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7294 | WMITLV_GET_STRUCT_TLVLEN |
| 7295 | (wmi_request_stats_cmd_fixed_param)); |
| 7296 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 7297 | if (wmi_unified_cmd_send |
| 7298 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7299 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7300 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7301 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7302 | } |
| 7303 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7304 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7305 | } |
| 7306 | |
| 7307 | /** |
| 7308 | * send_snr_cmd_tlv() - get RSSI from fw |
| 7309 | * @wmi_handle: wmi handle |
| 7310 | * @vdev_id: vdev id |
| 7311 | * |
| 7312 | * Return: CDF status |
| 7313 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7314 | static 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] | 7315 | { |
| 7316 | wmi_buf_t buf; |
| 7317 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7318 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7319 | |
| 7320 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7321 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7322 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7323 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7324 | } |
| 7325 | |
| 7326 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7327 | cmd->vdev_id = vdev_id; |
| 7328 | |
| 7329 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7330 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7331 | WMITLV_GET_STRUCT_TLVLEN |
| 7332 | (wmi_request_stats_cmd_fixed_param)); |
| 7333 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 7334 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7335 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7336 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7337 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7338 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7339 | } |
| 7340 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7341 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7342 | } |
| 7343 | |
| 7344 | /** |
| 7345 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 7346 | * @wmi_handle: wmi handle |
| 7347 | * @link_status: get link params |
| 7348 | * |
| 7349 | * Return: CDF status |
| 7350 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7351 | static 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] | 7352 | struct link_status_params *link_status) |
| 7353 | { |
| 7354 | wmi_buf_t buf; |
| 7355 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7356 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7357 | |
| 7358 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7359 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7360 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7361 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7362 | } |
| 7363 | |
| 7364 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7365 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7366 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7367 | WMITLV_GET_STRUCT_TLVLEN |
| 7368 | (wmi_request_stats_cmd_fixed_param)); |
| 7369 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 7370 | cmd->vdev_id = link_status->session_id; |
| 7371 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7372 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7373 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7374 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7375 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7376 | } |
| 7377 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7378 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7379 | } |
| 7380 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7381 | /** |
| 7382 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 7383 | * @wmi_handle: wmi handle |
| 7384 | * @ta_dhcp_ind: DHCP indication parameter |
| 7385 | * |
| 7386 | * Return: CDF Status |
| 7387 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7388 | static 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] | 7389 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 7390 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7391 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7392 | wmi_buf_t buf = NULL; |
| 7393 | uint8_t *buf_ptr; |
| 7394 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 7395 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 7396 | |
| 7397 | |
| 7398 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7399 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7400 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7401 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7402 | } |
| 7403 | |
| 7404 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7405 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 7406 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 7407 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 7408 | WMITLV_GET_STRUCT_TLVLEN |
| 7409 | (wmi_peer_set_param_cmd_fixed_param)); |
| 7410 | |
| 7411 | /* fill in values */ |
| 7412 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 7413 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 7414 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7415 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7416 | &ta_dhcp_ind->peer_macaddr, |
| 7417 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 7418 | |
| 7419 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7420 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7421 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7422 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7423 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7424 | wmi_buf_free(buf); |
| 7425 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7426 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7427 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7428 | } |
| 7429 | |
| 7430 | /** |
| 7431 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 7432 | * @wmi_handle: wmi handle |
| 7433 | * @pLinkSpeed: link speed info |
| 7434 | * |
| 7435 | * Return: CDF status |
| 7436 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7437 | static 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] | 7438 | wmi_mac_addr peer_macaddr) |
| 7439 | { |
| 7440 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 7441 | wmi_buf_t wmi_buf; |
| 7442 | uint32_t len; |
| 7443 | uint8_t *buf_ptr; |
| 7444 | |
| 7445 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 7446 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7447 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7448 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7449 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7450 | } |
| 7451 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7452 | |
| 7453 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 7454 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7455 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 7456 | WMITLV_GET_STRUCT_TLVLEN |
| 7457 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 7458 | |
| 7459 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7460 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7461 | &peer_macaddr, |
| 7462 | sizeof(peer_macaddr)); |
| 7463 | |
| 7464 | |
| 7465 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7466 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7467 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7468 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7469 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7470 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7471 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7472 | } |
| 7473 | |
| 7474 | /** |
| 7475 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 7476 | * @wmi_handle: wmi handler |
| 7477 | * @egap_params: pointer to egap_params |
| 7478 | * |
| 7479 | * Return: 0 for success, otherwise appropriate error code |
| 7480 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7481 | static 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] | 7482 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 7483 | { |
| 7484 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 7485 | wmi_buf_t buf; |
| 7486 | int32_t err; |
| 7487 | |
| 7488 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7489 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7490 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 7491 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7492 | } |
| 7493 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 7494 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7495 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 7496 | WMITLV_GET_STRUCT_TLVLEN( |
| 7497 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 7498 | |
| 7499 | cmd->enable = egap_params->enable; |
| 7500 | cmd->inactivity_time = egap_params->inactivity_time; |
| 7501 | cmd->wait_time = egap_params->wait_time; |
| 7502 | cmd->flags = egap_params->flags; |
| 7503 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7504 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 7505 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7506 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7507 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7508 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7509 | } |
| 7510 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7511 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7512 | } |
| 7513 | |
| 7514 | /** |
| 7515 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 7516 | * @wmi_handl: wmi handle |
| 7517 | * @cmd: Profiling command index |
| 7518 | * @value1: parameter1 value |
| 7519 | * @value2: parameter2 value |
| 7520 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7521 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7522 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7523 | static QDF_STATUS send_fw_profiling_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7524 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 7525 | { |
| 7526 | wmi_buf_t buf; |
| 7527 | int32_t len = 0; |
| 7528 | int ret; |
| 7529 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 7530 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 7531 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 7532 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 7533 | |
| 7534 | switch (cmd) { |
| 7535 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 7536 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 7537 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7538 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7539 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7540 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7541 | } |
| 7542 | prof_trig_cmd = |
| 7543 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 7544 | wmi_buf_data(buf); |
| 7545 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 7546 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 7547 | WMITLV_GET_STRUCT_TLVLEN |
| 7548 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 7549 | prof_trig_cmd->enable = value1; |
| 7550 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7551 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 7552 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7553 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7554 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7555 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7556 | return ret; |
| 7557 | } |
| 7558 | break; |
| 7559 | |
| 7560 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 7561 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 7562 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7563 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7564 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7565 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7566 | } |
| 7567 | profile_getdata_cmd = |
| 7568 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 7569 | wmi_buf_data(buf); |
| 7570 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 7571 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 7572 | WMITLV_GET_STRUCT_TLVLEN |
| 7573 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 7574 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7575 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 7576 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7577 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7578 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7579 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7580 | return ret; |
| 7581 | } |
| 7582 | break; |
| 7583 | |
| 7584 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 7585 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 7586 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7587 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7588 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7589 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7590 | } |
| 7591 | hist_intvl_cmd = |
| 7592 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 7593 | wmi_buf_data(buf); |
| 7594 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 7595 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 7596 | WMITLV_GET_STRUCT_TLVLEN |
| 7597 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 7598 | hist_intvl_cmd->profile_id = value1; |
| 7599 | hist_intvl_cmd->value = value2; |
| 7600 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7601 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 7602 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7603 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7604 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7605 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7606 | return ret; |
| 7607 | } |
| 7608 | break; |
| 7609 | |
| 7610 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 7611 | len = |
| 7612 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 7613 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7614 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7615 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7616 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7617 | } |
| 7618 | profile_enable_cmd = |
| 7619 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 7620 | wmi_buf_data(buf); |
| 7621 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 7622 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 7623 | WMITLV_GET_STRUCT_TLVLEN |
| 7624 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 7625 | profile_enable_cmd->profile_id = value1; |
| 7626 | profile_enable_cmd->enable = value2; |
| 7627 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7628 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 7629 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7630 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7631 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7632 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7633 | return ret; |
| 7634 | } |
| 7635 | break; |
| 7636 | |
| 7637 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7638 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7639 | break; |
| 7640 | } |
| 7641 | |
| 7642 | return 0; |
| 7643 | } |
| 7644 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7645 | /** |
| 7646 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 7647 | * @wmi_handle: wmi handle |
| 7648 | * @vdev_id: vdev id |
| 7649 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7650 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7651 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7652 | static 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] | 7653 | { |
| 7654 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 7655 | wmi_buf_t buf; |
| 7656 | int32_t len = sizeof(*cmd); |
| 7657 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7658 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7659 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7660 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7661 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7662 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7663 | } |
| 7664 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 7665 | wmi_buf_data(buf); |
| 7666 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7667 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 7668 | WMITLV_GET_STRUCT_TLVLEN |
| 7669 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 7670 | cmd->vdev_id = vdev_id; |
| 7671 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 7672 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7673 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7674 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7675 | __func__); |
| 7676 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7677 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7678 | } |
| 7679 | |
| 7680 | return 0; |
| 7681 | } |
| 7682 | |
| 7683 | /** |
| 7684 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 7685 | * @wmi_handle: wmi handle |
| 7686 | * @vdev_id: vdev id |
| 7687 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7688 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7689 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7690 | static 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] | 7691 | uint8_t vdev_id) |
| 7692 | { |
| 7693 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 7694 | wmi_buf_t buf; |
| 7695 | int32_t len = sizeof(*cmd); |
| 7696 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7697 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7698 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7699 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7700 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7701 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7702 | } |
| 7703 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 7704 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7705 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 7706 | WMITLV_GET_STRUCT_TLVLEN |
| 7707 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 7708 | cmd->vdev_id = vdev_id; |
| 7709 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 7710 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7711 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7712 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7713 | __func__); |
| 7714 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7715 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7716 | } |
| 7717 | |
| 7718 | return 0; |
| 7719 | } |
| 7720 | |
| 7721 | /** |
| 7722 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 7723 | * @wmi_handle: wmi handle |
| 7724 | * @startOemDataReq: start request params |
| 7725 | * |
| 7726 | * Return: CDF status |
| 7727 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7728 | static QDF_STATUS send_start_oem_data_cmd_tlv(wmi_unified_t wmi_handle, |
Krishna Kumaar Natarajan | b16bb27 | 2016-07-21 15:02:44 -0700 | [diff] [blame] | 7729 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7730 | uint8_t *data) |
| 7731 | { |
| 7732 | wmi_buf_t buf; |
| 7733 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7734 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7735 | |
| 7736 | buf = wmi_buf_alloc(wmi_handle, |
| 7737 | (data_len + WMI_TLV_HDR_SIZE)); |
| 7738 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7739 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 7740 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7741 | } |
| 7742 | |
| 7743 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 7744 | |
| 7745 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 7746 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7747 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7748 | data_len); |
| 7749 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7750 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7751 | data_len); |
| 7752 | |
| 7753 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 7754 | (data_len + |
| 7755 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 7756 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7757 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7758 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7759 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7760 | } |
| 7761 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7762 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7763 | } |
| 7764 | |
| 7765 | /** |
| 7766 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 7767 | * @wmi_handle: wmi handle |
| 7768 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 7769 | * |
| 7770 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 7771 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 7772 | * to firmware based on phyerr filtering |
| 7773 | * offload status. |
| 7774 | * |
| 7775 | * Return: 1 success, 0 failure |
| 7776 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7777 | static QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7778 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 7779 | bool dfs_phyerr_filter_offload) |
| 7780 | { |
| 7781 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 7782 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 7783 | wmi_buf_t buf; |
| 7784 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7785 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7786 | |
| 7787 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 7788 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7789 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7790 | __func__); |
| 7791 | len = sizeof(*disable_phyerr_offload_cmd); |
| 7792 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7793 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7794 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7795 | return 0; |
| 7796 | } |
| 7797 | disable_phyerr_offload_cmd = |
| 7798 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 7799 | wmi_buf_data(buf); |
| 7800 | |
| 7801 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 7802 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 7803 | WMITLV_GET_STRUCT_TLVLEN |
| 7804 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 7805 | |
| 7806 | /* |
| 7807 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 7808 | * to the firmware to disable the phyerror |
| 7809 | * filtering offload. |
| 7810 | */ |
| 7811 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7812 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7813 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7814 | 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] | 7815 | __func__, ret); |
| 7816 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7817 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7818 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7819 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7820 | __func__); |
| 7821 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7822 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7823 | __func__); |
| 7824 | |
| 7825 | len = sizeof(*enable_phyerr_offload_cmd); |
| 7826 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7827 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7828 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7829 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7830 | } |
| 7831 | |
| 7832 | enable_phyerr_offload_cmd = |
| 7833 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 7834 | wmi_buf_data(buf); |
| 7835 | |
| 7836 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 7837 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 7838 | WMITLV_GET_STRUCT_TLVLEN |
| 7839 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 7840 | |
| 7841 | /* |
| 7842 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 7843 | * to the firmware to enable the phyerror |
| 7844 | * filtering offload. |
| 7845 | */ |
| 7846 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7847 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 7848 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7849 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7850 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7851 | __func__, ret); |
| 7852 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7853 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7854 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7855 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7856 | __func__); |
| 7857 | } |
| 7858 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7859 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7860 | } |
| 7861 | |
| 7862 | #if !defined(REMOVE_PKT_LOG) |
| 7863 | /** |
| 7864 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 7865 | * @wmi_handle: wmi handle |
| 7866 | * @pktlog_event: pktlog event |
| 7867 | * @cmd_id: pktlog cmd id |
| 7868 | * |
| 7869 | * Return: CDF status |
| 7870 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7871 | static 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] | 7872 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7873 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7874 | { |
| 7875 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 7876 | WMI_CMD_ID CMD_ID; |
| 7877 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 7878 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 7879 | int len = 0; |
| 7880 | wmi_buf_t buf; |
| 7881 | |
| 7882 | PKTLOG_EVENT = pktlog_event; |
| 7883 | CMD_ID = cmd_id; |
| 7884 | |
| 7885 | switch (CMD_ID) { |
| 7886 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 7887 | len = sizeof(*cmd); |
| 7888 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7889 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7890 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7891 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7892 | } |
| 7893 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 7894 | wmi_buf_data(buf); |
| 7895 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7896 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 7897 | WMITLV_GET_STRUCT_TLVLEN |
| 7898 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 7899 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 7900 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 7901 | : WMI_PKTLOG_ENABLE_AUTO; |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7902 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7903 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7904 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7905 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7906 | goto wmi_send_failed; |
| 7907 | } |
| 7908 | break; |
| 7909 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 7910 | len = sizeof(*disable_cmd); |
| 7911 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7912 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7913 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 7914 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7915 | } |
| 7916 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 7917 | wmi_buf_data(buf); |
| 7918 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 7919 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 7920 | WMITLV_GET_STRUCT_TLVLEN |
| 7921 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 7922 | disable_cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7923 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7924 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7925 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7926 | goto wmi_send_failed; |
| 7927 | } |
| 7928 | break; |
| 7929 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7930 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7931 | break; |
| 7932 | } |
| 7933 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7934 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7935 | |
| 7936 | wmi_send_failed: |
| 7937 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7938 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7939 | } |
| 7940 | #endif /* REMOVE_PKT_LOG */ |
| 7941 | |
| 7942 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7943 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 7944 | * @wmi_handle: wmi handle |
| 7945 | * @ptrn_id: pattern id |
| 7946 | * @vdev_id: vdev id |
| 7947 | * |
| 7948 | * Return: CDF status |
| 7949 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 7950 | static QDF_STATUS send_wow_delete_pattern_cmd_tlv(wmi_unified_t wmi_handle, |
| 7951 | uint8_t ptrn_id, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7952 | { |
| 7953 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 7954 | wmi_buf_t buf; |
| 7955 | int32_t len; |
| 7956 | int ret; |
| 7957 | |
| 7958 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 7959 | |
| 7960 | |
| 7961 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7962 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7963 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7964 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7965 | } |
| 7966 | |
| 7967 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 7968 | |
| 7969 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7970 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 7971 | WMITLV_GET_STRUCT_TLVLEN( |
| 7972 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 7973 | cmd->vdev_id = vdev_id; |
| 7974 | cmd->pattern_id = ptrn_id; |
| 7975 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 7976 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7977 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7978 | cmd->pattern_id, vdev_id); |
| 7979 | |
| 7980 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7981 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 7982 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7983 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7984 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7985 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7986 | } |
| 7987 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7988 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7989 | } |
| 7990 | |
| 7991 | /** |
| 7992 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 7993 | * @wmi_handle: wmi handle |
| 7994 | * |
| 7995 | * Sends host wakeup indication to FW. On receiving this indication, |
| 7996 | * FW will come out of WOW. |
| 7997 | * |
| 7998 | * Return: CDF status |
| 7999 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8000 | static 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] | 8001 | { |
| 8002 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 8003 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8004 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8005 | int32_t len; |
| 8006 | int ret; |
| 8007 | |
| 8008 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 8009 | |
| 8010 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8011 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8012 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8013 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8014 | } |
| 8015 | |
| 8016 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 8017 | wmi_buf_data(buf); |
| 8018 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8019 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 8020 | WMITLV_GET_STRUCT_TLVLEN |
| 8021 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 8022 | |
| 8023 | |
| 8024 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8025 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 8026 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8027 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8028 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8029 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8030 | } |
| 8031 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8032 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8033 | } |
| 8034 | |
| 8035 | /** |
| 8036 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8037 | * @wmi_handle: wmi handle |
| 8038 | * @msg: delts params |
| 8039 | * |
| 8040 | * Return: CDF status |
| 8041 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8042 | static 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] | 8043 | uint8_t ac) |
| 8044 | { |
| 8045 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8046 | wmi_buf_t buf; |
| 8047 | int32_t len = sizeof(*cmd); |
| 8048 | |
| 8049 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8050 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8051 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8052 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8053 | } |
| 8054 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8055 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8056 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8057 | WMITLV_GET_STRUCT_TLVLEN |
| 8058 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8059 | cmd->vdev_id = vdev_id; |
| 8060 | cmd->ac = ac; |
| 8061 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8062 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8063 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8064 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8065 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8066 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8067 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8068 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8069 | } |
| 8070 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8071 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8072 | } |
| 8073 | |
| 8074 | /** |
| 8075 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8076 | * @wmi_handle: handle to wmi |
| 8077 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8078 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8079 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8080 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8081 | * active flow. |
| 8082 | * |
| 8083 | * Return: CDF status |
| 8084 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8085 | static QDF_STATUS send_aggr_qos_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8086 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8087 | { |
| 8088 | int i = 0; |
| 8089 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8090 | wmi_buf_t buf; |
| 8091 | int32_t len = sizeof(*cmd); |
| 8092 | |
| 8093 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 8094 | /* if flow in this AC is active */ |
| 8095 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 8096 | /* |
| 8097 | * as per implementation of wma_add_ts_req() we |
| 8098 | * are not waiting any response from firmware so |
| 8099 | * apart from sending ADDTS to firmware just send |
| 8100 | * success to upper layers |
| 8101 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8102 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8103 | |
| 8104 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8105 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8106 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8107 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8108 | } |
| 8109 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 8110 | wmi_buf_data(buf); |
| 8111 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8112 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8113 | WMITLV_GET_STRUCT_TLVLEN |
| 8114 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8115 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 8116 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 8117 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8118 | traffic.userPrio); |
| 8119 | cmd->medium_time_us = |
| 8120 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 8121 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8122 | 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] | 8123 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 8124 | cmd->medium_time_us, cmd->downgrade_type); |
| 8125 | if (wmi_unified_cmd_send |
| 8126 | (wmi_handle, buf, len, |
| 8127 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8128 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8129 | __func__); |
| 8130 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8131 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8132 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8133 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8134 | } |
| 8135 | } |
| 8136 | } |
| 8137 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8138 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8139 | } |
| 8140 | |
| 8141 | /** |
| 8142 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 8143 | * @wmi_handle: wmi handle |
| 8144 | * @msg: ADDTS params |
| 8145 | * |
| 8146 | * Return: CDF status |
| 8147 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8148 | static QDF_STATUS send_add_ts_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8149 | struct add_ts_param *msg) |
| 8150 | { |
| 8151 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8152 | wmi_buf_t buf; |
| 8153 | int32_t len = sizeof(*cmd); |
| 8154 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8155 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8156 | |
| 8157 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8158 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8159 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8160 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8161 | } |
| 8162 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8163 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8164 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8165 | WMITLV_GET_STRUCT_TLVLEN |
| 8166 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8167 | cmd->vdev_id = msg->sme_session_id; |
| 8168 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 8169 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 8170 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8171 | 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] | 8172 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 8173 | cmd->downgrade_type, __func__, __LINE__); |
| 8174 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8175 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8176 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 8177 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8178 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8179 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8180 | } |
| 8181 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8182 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8183 | } |
| 8184 | |
| 8185 | /** |
| 8186 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter in target |
| 8187 | * @wmi_handle: wmi handle |
| 8188 | * @vdev_id: vdev id |
| 8189 | * @enable: Flag to enable/disable packet filter |
| 8190 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8191 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8192 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8193 | static 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] | 8194 | uint8_t vdev_id, bool enable) |
| 8195 | { |
| 8196 | int32_t len; |
| 8197 | int ret = 0; |
| 8198 | wmi_buf_t buf; |
| 8199 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 8200 | |
| 8201 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 8202 | |
| 8203 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8204 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8205 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8206 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8207 | } |
| 8208 | |
| 8209 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 8210 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8211 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 8212 | WMITLV_GET_STRUCT_TLVLEN( |
| 8213 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 8214 | |
| 8215 | cmd->vdev_id = vdev_id; |
| 8216 | if (enable) |
| 8217 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 8218 | else |
| 8219 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 8220 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8221 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8222 | __func__, cmd->enable, vdev_id); |
| 8223 | |
| 8224 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8225 | WMI_PACKET_FILTER_ENABLE_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8226 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8227 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8228 | wmi_buf_free(buf); |
| 8229 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8230 | |
| 8231 | return ret; |
| 8232 | } |
| 8233 | |
| 8234 | /** |
| 8235 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 8236 | * @wmi_handle: wmi handle |
| 8237 | * @vdev_id: vdev id |
| 8238 | * @rcv_filter_param: Packet filter parameters |
| 8239 | * @filter_id: Filter id |
| 8240 | * @enable: Flag to add/delete packet filter configuration |
| 8241 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8242 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8243 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8244 | static 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] | 8245 | uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param, |
| 8246 | uint8_t filter_id, bool enable) |
| 8247 | { |
| 8248 | int len, i; |
| 8249 | int err = 0; |
| 8250 | wmi_buf_t buf; |
| 8251 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 8252 | |
| 8253 | |
| 8254 | /* allocate the memory */ |
| 8255 | len = sizeof(*cmd); |
| 8256 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8257 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8258 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8259 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8260 | } |
| 8261 | |
| 8262 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 8263 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8264 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 8265 | WMITLV_GET_STRUCT_TLVLEN |
| 8266 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 8267 | |
| 8268 | cmd->vdev_id = vdev_id; |
| 8269 | cmd->filter_id = filter_id; |
| 8270 | if (enable) |
| 8271 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 8272 | else |
| 8273 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 8274 | |
| 8275 | if (enable) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8276 | cmd->num_params = QDF_MIN( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8277 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 8278 | rcv_filter_param->numFieldParams); |
| 8279 | cmd->filter_type = rcv_filter_param->filterType; |
| 8280 | cmd->coalesce_time = rcv_filter_param->coalesceTime; |
| 8281 | |
| 8282 | for (i = 0; i < cmd->num_params; i++) { |
| 8283 | cmd->paramsData[i].proto_type = |
| 8284 | rcv_filter_param->paramsData[i].protocolLayer; |
| 8285 | cmd->paramsData[i].cmp_type = |
| 8286 | rcv_filter_param->paramsData[i].cmpFlag; |
| 8287 | cmd->paramsData[i].data_length = |
| 8288 | rcv_filter_param->paramsData[i].dataLength; |
| 8289 | cmd->paramsData[i].data_offset = |
| 8290 | rcv_filter_param->paramsData[i].dataOffset; |
| 8291 | memcpy(&cmd->paramsData[i].compareData, |
| 8292 | rcv_filter_param->paramsData[i].compareData, |
| 8293 | sizeof(cmd->paramsData[i].compareData)); |
| 8294 | memcpy(&cmd->paramsData[i].dataMask, |
| 8295 | rcv_filter_param->paramsData[i].dataMask, |
| 8296 | sizeof(cmd->paramsData[i].dataMask)); |
| 8297 | } |
| 8298 | } |
| 8299 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8300 | 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] | 8301 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 8302 | /* send the command along with data */ |
| 8303 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8304 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 8305 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8306 | WMI_LOGE("Failed to send pkt_filter cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8307 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8308 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8309 | } |
| 8310 | |
| 8311 | |
| 8312 | return 0; |
| 8313 | } |
| 8314 | |
| 8315 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8316 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 8317 | * @wmi_handle: wmi handle |
| 8318 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 8319 | * |
| 8320 | * Retrun: CDF status |
| 8321 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8322 | static 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] | 8323 | struct periodic_tx_pattern * |
| 8324 | pAddPeriodicTxPtrnParams, |
| 8325 | uint8_t vdev_id) |
| 8326 | { |
| 8327 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8328 | wmi_buf_t wmi_buf; |
| 8329 | uint32_t len; |
| 8330 | uint8_t *buf_ptr; |
| 8331 | uint32_t ptrn_len, ptrn_len_aligned; |
| 8332 | int j; |
| 8333 | |
| 8334 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8335 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 8336 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 8337 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 8338 | |
| 8339 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8340 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8341 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8342 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8343 | } |
| 8344 | |
| 8345 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8346 | |
| 8347 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 8348 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8349 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8350 | WMITLV_GET_STRUCT_TLVLEN |
| 8351 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8352 | |
| 8353 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8354 | cmd->vdev_id = vdev_id; |
| 8355 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 8356 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 8357 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8358 | |
| 8359 | /* Pattern info */ |
| 8360 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8361 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 8362 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8363 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8364 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8365 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8366 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8367 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8368 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8369 | |
| 8370 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8371 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8372 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8373 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8374 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8375 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8376 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8377 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8378 | } |
| 8379 | |
| 8380 | /** |
| 8381 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 8382 | * @wmi_handle: wmi handle |
| 8383 | * @vdev_id: vdev id |
| 8384 | * @pattern_id: pattern id |
| 8385 | * |
| 8386 | * Retrun: CDF status |
| 8387 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8388 | static 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] | 8389 | uint8_t vdev_id, |
| 8390 | uint8_t pattern_id) |
| 8391 | { |
| 8392 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8393 | wmi_buf_t wmi_buf; |
| 8394 | uint32_t len = |
| 8395 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8396 | |
| 8397 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8398 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8399 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8400 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8401 | } |
| 8402 | |
| 8403 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 8404 | wmi_buf_data(wmi_buf); |
| 8405 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8406 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8407 | WMITLV_GET_STRUCT_TLVLEN |
| 8408 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8409 | |
| 8410 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8411 | cmd->vdev_id = vdev_id; |
| 8412 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8413 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8414 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8415 | |
| 8416 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8417 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8418 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8419 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8420 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8421 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8422 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8423 | } |
| 8424 | |
| 8425 | /** |
| 8426 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 8427 | * @wmi_handle: wmi handle |
| 8428 | * @preq: stats ext params |
| 8429 | * |
| 8430 | * Return: CDF status |
| 8431 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8432 | static 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] | 8433 | struct stats_ext_params *preq) |
| 8434 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8435 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8436 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 8437 | wmi_buf_t buf; |
| 8438 | uint16_t len; |
| 8439 | uint8_t *buf_ptr; |
| 8440 | |
| 8441 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 8442 | |
| 8443 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8444 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8445 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8446 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8447 | } |
| 8448 | |
| 8449 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8450 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 8451 | |
| 8452 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8453 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 8454 | WMITLV_GET_STRUCT_TLVLEN |
| 8455 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 8456 | cmd->vdev_id = preq->vdev_id; |
| 8457 | cmd->data_len = preq->request_data_len; |
| 8458 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8459 | 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] | 8460 | __func__, preq->request_data_len, preq->vdev_id); |
| 8461 | |
| 8462 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 8463 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 8464 | |
| 8465 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8466 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8467 | |
| 8468 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8469 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8470 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8471 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8472 | ret); |
| 8473 | wmi_buf_free(buf); |
| 8474 | } |
| 8475 | |
| 8476 | return ret; |
| 8477 | } |
| 8478 | |
| 8479 | /** |
| 8480 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 8481 | * @wmi_handle: wmi handle |
| 8482 | * @params: ext wow params |
| 8483 | * |
| 8484 | * Return:0 for success or error code |
| 8485 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8486 | static 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] | 8487 | struct ext_wow_params *params) |
| 8488 | { |
| 8489 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 8490 | wmi_buf_t buf; |
| 8491 | int32_t len; |
| 8492 | int ret; |
| 8493 | |
| 8494 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 8495 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8496 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8497 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8498 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8499 | } |
| 8500 | |
| 8501 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8502 | |
| 8503 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8504 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 8505 | WMITLV_GET_STRUCT_TLVLEN |
| 8506 | (wmi_extwow_enable_cmd_fixed_param)); |
| 8507 | |
| 8508 | cmd->vdev_id = params->vdev_id; |
| 8509 | cmd->type = params->type; |
| 8510 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 8511 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8512 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8513 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 8514 | |
| 8515 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8516 | WMI_EXTWOW_ENABLE_CMDID); |
| 8517 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8518 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8519 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8520 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8521 | } |
| 8522 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8523 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8524 | |
| 8525 | } |
| 8526 | |
| 8527 | /** |
| 8528 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 8529 | * @wmi_handle: wmi handle |
| 8530 | * @app_type1_params: app type1 params |
| 8531 | * |
| 8532 | * Return: CDF status |
| 8533 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8534 | static 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] | 8535 | struct app_type1_params *app_type1_params) |
| 8536 | { |
| 8537 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 8538 | wmi_buf_t buf; |
| 8539 | int32_t len; |
| 8540 | int ret; |
| 8541 | |
| 8542 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 8543 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8544 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8545 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8546 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8547 | } |
| 8548 | |
| 8549 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 8550 | wmi_buf_data(buf); |
| 8551 | |
| 8552 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8553 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 8554 | WMITLV_GET_STRUCT_TLVLEN |
| 8555 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 8556 | |
| 8557 | cmd->vdev_id = app_type1_params->vdev_id; |
| 8558 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 8559 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8560 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8561 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8562 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8563 | cmd->passwd_len = app_type1_params->pass_length; |
| 8564 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8565 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8566 | "identification_id %.8s id_length %u " |
| 8567 | "password %.16s pass_length %u", |
| 8568 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 8569 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 8570 | |
| 8571 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8572 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 8573 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8574 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8575 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8576 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8577 | } |
| 8578 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8579 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8580 | } |
| 8581 | |
| 8582 | /** |
| 8583 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 8584 | * @wmi_handle: wmi handle |
| 8585 | * @appType2Params: app type2 params |
| 8586 | * |
| 8587 | * Return: CDF status |
| 8588 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8589 | static 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] | 8590 | struct app_type2_params *appType2Params) |
| 8591 | { |
| 8592 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 8593 | wmi_buf_t buf; |
| 8594 | int32_t len; |
| 8595 | int ret; |
| 8596 | |
| 8597 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 8598 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8599 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8600 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8601 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8602 | } |
| 8603 | |
| 8604 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 8605 | wmi_buf_data(buf); |
| 8606 | |
| 8607 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8608 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 8609 | WMITLV_GET_STRUCT_TLVLEN |
| 8610 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 8611 | |
| 8612 | cmd->vdev_id = appType2Params->vdev_id; |
| 8613 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8614 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8615 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 8616 | |
| 8617 | cmd->ip_id = appType2Params->ip_id; |
| 8618 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 8619 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 8620 | |
| 8621 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 8622 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 8623 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 8624 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 8625 | |
| 8626 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 8627 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 8628 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 8629 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 8630 | |
| 8631 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 8632 | &cmd->gateway_mac); |
| 8633 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 8634 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 8635 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8636 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8637 | "rc4_key %.16s rc4_key_len %u " |
| 8638 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 8639 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 8640 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 8641 | "keepalive_max %u keepalive_inc %u " |
| 8642 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 8643 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 8644 | cmd->rc4_key, cmd->rc4_key_len, |
| 8645 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 8646 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 8647 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 8648 | cmd->keepalive_max, cmd->keepalive_inc, |
| 8649 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 8650 | |
| 8651 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8652 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 8653 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8654 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8655 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8656 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8657 | } |
| 8658 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8659 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8660 | |
| 8661 | } |
| 8662 | |
| 8663 | /** |
| 8664 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 8665 | * @wmi_handle: wmi handle |
| 8666 | * @timer_val: auto shutdown timer value |
| 8667 | * |
| 8668 | * Return: CDF status |
| 8669 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8670 | static 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] | 8671 | uint32_t timer_val) |
| 8672 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8673 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8674 | wmi_buf_t buf = NULL; |
| 8675 | uint8_t *buf_ptr; |
| 8676 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 8677 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 8678 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8679 | 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] | 8680 | __func__, timer_val); |
| 8681 | |
| 8682 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8683 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8684 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8685 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8686 | } |
| 8687 | |
| 8688 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8689 | wmi_auto_sh_cmd = |
| 8690 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 8691 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 8692 | |
| 8693 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 8694 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 8695 | WMITLV_GET_STRUCT_TLVLEN |
| 8696 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 8697 | |
| 8698 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8699 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8700 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8701 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8702 | __func__, status); |
| 8703 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8704 | } |
| 8705 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8706 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8707 | } |
| 8708 | |
| 8709 | /** |
| 8710 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 8711 | * @wmi_handle: wmi handle |
| 8712 | * @nan_req: request data which will be non-null |
| 8713 | * |
| 8714 | * Return: CDF status |
| 8715 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8716 | static QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8717 | struct nan_req_params *nan_req) |
| 8718 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8719 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8720 | wmi_nan_cmd_param *cmd; |
| 8721 | wmi_buf_t buf; |
| 8722 | uint16_t len = sizeof(*cmd); |
| 8723 | uint16_t nan_data_len, nan_data_len_aligned; |
| 8724 | uint8_t *buf_ptr; |
| 8725 | |
| 8726 | /* |
| 8727 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 8728 | * +------------+----------+-----------------------+--------------+ |
| 8729 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 8730 | * +------------+----------+-----------------------+--------------+ |
| 8731 | */ |
| 8732 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8733 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 8734 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8735 | } |
| 8736 | nan_data_len = nan_req->request_data_len; |
| 8737 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 8738 | sizeof(uint32_t)); |
| 8739 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 8740 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8741 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8742 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8743 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8744 | } |
| 8745 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8746 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 8747 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8748 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 8749 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 8750 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8751 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8752 | __func__, nan_req->request_data_len); |
| 8753 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 8754 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 8755 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8756 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8757 | |
| 8758 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8759 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8760 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8761 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8762 | __func__, ret); |
| 8763 | wmi_buf_free(buf); |
| 8764 | } |
| 8765 | |
| 8766 | return ret; |
| 8767 | } |
| 8768 | |
| 8769 | /** |
| 8770 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 8771 | * @wmi_handle: wmi handle |
| 8772 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 8773 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8774 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8775 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8776 | static 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] | 8777 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 8778 | { |
| 8779 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 8780 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8781 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8782 | |
| 8783 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8784 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8785 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8786 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8787 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8788 | } |
| 8789 | |
| 8790 | 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] | 8791 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8792 | |
| 8793 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8794 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 8795 | WMITLV_GET_STRUCT_TLVLEN |
| 8796 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 8797 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 8798 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 8799 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 8800 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 8801 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8802 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8803 | sizeof(*cmd), |
| 8804 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8805 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8806 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8807 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8808 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8809 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8810 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8811 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8812 | |
| 8813 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8814 | } |
| 8815 | |
| 8816 | /** |
| 8817 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 8818 | * @wmi_handle: wmi handle |
| 8819 | * @flashing: flashing request |
| 8820 | * |
| 8821 | * Return: CDF status |
| 8822 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8823 | static 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] | 8824 | struct flashing_req_params *flashing) |
| 8825 | { |
| 8826 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8827 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8828 | wmi_buf_t buf; |
| 8829 | uint8_t *buf_ptr; |
| 8830 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 8831 | |
| 8832 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8833 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8834 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8835 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8836 | } |
| 8837 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8838 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 8839 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8840 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 8841 | WMITLV_GET_STRUCT_TLVLEN |
| 8842 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 8843 | cmd->pattern_id = flashing->pattern_id; |
| 8844 | cmd->led_x0 = flashing->led_x0; |
| 8845 | cmd->led_x1 = flashing->led_x1; |
| 8846 | |
| 8847 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8848 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8849 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8850 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8851 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8852 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8853 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8854 | |
| 8855 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8856 | } |
| 8857 | |
| 8858 | /** |
| 8859 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 8860 | * @wmi_handle: wmi handle |
| 8861 | * @ch_avoid_update_req: channel avoid update params |
| 8862 | * |
| 8863 | * Return: CDF status |
| 8864 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8865 | static 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] | 8866 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8867 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8868 | wmi_buf_t buf = NULL; |
| 8869 | uint8_t *buf_ptr; |
| 8870 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 8871 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 8872 | |
| 8873 | |
| 8874 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8875 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8876 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8877 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8878 | } |
| 8879 | |
| 8880 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8881 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 8882 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 8883 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 8884 | WMITLV_GET_STRUCT_TLVLEN |
| 8885 | (wmi_chan_avoid_update_cmd_param)); |
| 8886 | |
| 8887 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8888 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8889 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8890 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8891 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 8892 | " returned Error %d", status); |
| 8893 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8894 | } |
| 8895 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8896 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8897 | } |
| 8898 | |
| 8899 | /** |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 8900 | * send_pdev_set_regdomain_cmd_tlv() - send set regdomain command to fw |
| 8901 | * @wmi_handle: wmi handle |
| 8902 | * @param: pointer to pdev regdomain params |
| 8903 | * |
| 8904 | * Return: 0 for success or error code |
| 8905 | */ |
| 8906 | static QDF_STATUS |
| 8907 | send_pdev_set_regdomain_cmd_tlv(wmi_unified_t wmi_handle, |
| 8908 | struct pdev_set_regdomain_params *param) |
| 8909 | { |
| 8910 | wmi_buf_t buf; |
| 8911 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 8912 | int32_t len = sizeof(*cmd); |
| 8913 | |
| 8914 | |
| 8915 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8916 | if (!buf) { |
| 8917 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8918 | return QDF_STATUS_E_NOMEM; |
| 8919 | } |
| 8920 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 8921 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8922 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 8923 | WMITLV_GET_STRUCT_TLVLEN |
| 8924 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 8925 | |
| 8926 | cmd->reg_domain = param->currentRDinuse; |
| 8927 | cmd->reg_domain_2G = param->currentRD2G; |
| 8928 | cmd->reg_domain_5G = param->currentRD5G; |
| 8929 | cmd->conformance_test_limit_2G = param->ctl_2G; |
| 8930 | cmd->conformance_test_limit_5G = param->ctl_5G; |
| 8931 | cmd->dfs_domain = param->dfsDomain; |
| 8932 | cmd->pdev_id = param->pdev_id; |
| 8933 | |
| 8934 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8935 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
| 8936 | WMI_LOGE("%s: Failed to send pdev set regdomain command", |
| 8937 | __func__); |
| 8938 | wmi_buf_free(buf); |
| 8939 | return QDF_STATUS_E_FAILURE; |
| 8940 | } |
| 8941 | |
| 8942 | return QDF_STATUS_SUCCESS; |
| 8943 | } |
| 8944 | |
| 8945 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8946 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 8947 | * @wmi_handle: wmi handle |
| 8948 | * @reg_dmn: reg domain |
| 8949 | * @regdmn2G: 2G reg domain |
| 8950 | * @regdmn5G: 5G reg domain |
| 8951 | * @ctl2G: 2G test limit |
| 8952 | * @ctl5G: 5G test limit |
| 8953 | * |
| 8954 | * Return: none |
| 8955 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8956 | static 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] | 8957 | uint32_t reg_dmn, uint16_t regdmn2G, |
| 8958 | uint16_t regdmn5G, int8_t ctl2G, |
| 8959 | int8_t ctl5G) |
| 8960 | { |
| 8961 | wmi_buf_t buf; |
| 8962 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 8963 | int32_t len = sizeof(*cmd); |
| 8964 | |
| 8965 | |
| 8966 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8967 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8968 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8969 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8970 | } |
| 8971 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 8972 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8973 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 8974 | WMITLV_GET_STRUCT_TLVLEN |
| 8975 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 8976 | cmd->reg_domain = reg_dmn; |
| 8977 | cmd->reg_domain_2G = regdmn2G; |
| 8978 | cmd->reg_domain_5G = regdmn5G; |
| 8979 | cmd->conformance_test_limit_2G = ctl2G; |
| 8980 | cmd->conformance_test_limit_5G = ctl5G; |
| 8981 | |
| 8982 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8983 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8984 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8985 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8986 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8987 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8988 | } |
| 8989 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8990 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8991 | } |
| 8992 | |
| 8993 | |
| 8994 | /** |
| 8995 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 8996 | * @wmi_handle: wmi handle |
| 8997 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 8998 | * |
| 8999 | * This function sets tdls off channel mode |
| 9000 | * |
| 9001 | * Return: 0 on success; Negative errno otherwise |
| 9002 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9003 | static 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] | 9004 | struct tdls_channel_switch_params *chan_switch_params) |
| 9005 | { |
| 9006 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9007 | wmi_buf_t wmi_buf; |
| 9008 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9009 | |
| 9010 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9011 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9012 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9013 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9014 | } |
| 9015 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9016 | wmi_buf_data(wmi_buf); |
| 9017 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9018 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9019 | WMITLV_GET_STRUCT_TLVLEN( |
| 9020 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9021 | |
| 9022 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9023 | &cmd->peer_macaddr); |
| 9024 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9025 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9026 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9027 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9028 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9029 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9030 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9031 | 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] | 9032 | cmd->peer_macaddr.mac_addr31to0, |
| 9033 | cmd->peer_macaddr.mac_addr47to32); |
| 9034 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9035 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9036 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9037 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9038 | ), |
| 9039 | cmd->vdev_id, |
| 9040 | cmd->offchan_mode, |
| 9041 | cmd->offchan_num, |
| 9042 | cmd->offchan_bw_bitmap, |
| 9043 | cmd->is_peer_responder, |
| 9044 | cmd->offchan_oper_class); |
| 9045 | |
| 9046 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9047 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9048 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9049 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9050 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9051 | } |
| 9052 | |
| 9053 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9054 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9055 | } |
| 9056 | |
| 9057 | /** |
| 9058 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9059 | * @wmi_handle: wmi handle |
| 9060 | * @pwmaTdlsparams: TDLS params |
| 9061 | * |
| 9062 | * Return: 0 for sucess or error code |
| 9063 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9064 | static 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] | 9065 | void *tdls_param, uint8_t tdls_state) |
| 9066 | { |
| 9067 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9068 | wmi_buf_t wmi_buf; |
| 9069 | |
| 9070 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9071 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9072 | |
| 9073 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9074 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9075 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9076 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9077 | } |
| 9078 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9079 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9080 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9081 | WMITLV_GET_STRUCT_TLVLEN |
| 9082 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9083 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9084 | cmd->state = tdls_state; |
| 9085 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9086 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9087 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9088 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9089 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9090 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9091 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9092 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9093 | wmi_tdls->peer_traffic_response_timeout; |
| 9094 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9095 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9096 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9097 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9098 | cmd->teardown_notification_ms = |
| 9099 | wmi_tdls->teardown_notification_ms; |
| 9100 | cmd->tdls_peer_kickout_threshold = |
| 9101 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9102 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9103 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9104 | "notification_interval_ms: %d, " |
| 9105 | "tx_discovery_threshold: %d, " |
| 9106 | "tx_teardown_threshold: %d, " |
| 9107 | "rssi_teardown_threshold: %d, " |
| 9108 | "rssi_delta: %d, " |
| 9109 | "tdls_options: 0x%x, " |
| 9110 | "tdls_peer_traffic_ind_window: %d, " |
| 9111 | "tdls_peer_traffic_response_timeout: %d, " |
| 9112 | "tdls_puapsd_mask: 0x%x, " |
| 9113 | "tdls_puapsd_inactivity_time: %d, " |
| 9114 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9115 | "teardown_notification_ms: %d, " |
| 9116 | "tdls_peer_kickout_threshold: %d", |
| 9117 | __func__, tdls_state, cmd->state, |
| 9118 | cmd->notification_interval_ms, |
| 9119 | cmd->tx_discovery_threshold, |
| 9120 | cmd->tx_teardown_threshold, |
| 9121 | cmd->rssi_teardown_threshold, |
| 9122 | cmd->rssi_delta, |
| 9123 | cmd->tdls_options, |
| 9124 | cmd->tdls_peer_traffic_ind_window, |
| 9125 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9126 | cmd->tdls_puapsd_mask, |
| 9127 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9128 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9129 | cmd->teardown_notification_ms, |
| 9130 | cmd->tdls_peer_kickout_threshold); |
| 9131 | |
| 9132 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9133 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9134 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9135 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9136 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9137 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9138 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9139 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9140 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9141 | } |
| 9142 | |
| 9143 | /** |
| 9144 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9145 | * @wmi_handle: wmi handle |
| 9146 | * @peerStateParams: TDLS peer state params |
| 9147 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9148 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9149 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9150 | static 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] | 9151 | struct tdls_peer_state_params *peerStateParams, |
| 9152 | uint32_t *ch_mhz) |
| 9153 | { |
| 9154 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9155 | wmi_tdls_peer_capabilities *peer_cap; |
| 9156 | wmi_channel *chan_info; |
| 9157 | wmi_buf_t wmi_buf; |
| 9158 | uint8_t *buf_ptr; |
| 9159 | uint32_t i; |
| 9160 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9161 | sizeof(wmi_tdls_peer_capabilities); |
| 9162 | |
| 9163 | |
| 9164 | len += WMI_TLV_HDR_SIZE + |
| 9165 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9166 | |
| 9167 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9168 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9169 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9170 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9171 | } |
| 9172 | |
| 9173 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9174 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9175 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9176 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9177 | WMITLV_GET_STRUCT_TLVLEN |
| 9178 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9179 | |
| 9180 | cmd->vdev_id = peerStateParams->vdevId; |
| 9181 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9182 | &cmd->peer_macaddr); |
| 9183 | |
| 9184 | |
| 9185 | cmd->peer_state = peerStateParams->peerState; |
| 9186 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9187 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9188 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9189 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9190 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9191 | cmd->peer_macaddr.mac_addr31to0, |
| 9192 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9193 | |
| 9194 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9195 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9196 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9197 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9198 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9199 | |
| 9200 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9201 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9202 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9203 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9204 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9205 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9206 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9207 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9208 | |
| 9209 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9210 | * but fill SP |
| 9211 | */ |
| 9212 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9213 | peerStateParams->peerCap.peerMaxSp); |
| 9214 | |
| 9215 | peer_cap->buff_sta_support = |
| 9216 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9217 | peer_cap->off_chan_support = |
| 9218 | peerStateParams->peerCap.peerOffChanSupport; |
| 9219 | peer_cap->peer_curr_operclass = |
| 9220 | peerStateParams->peerCap.peerCurrOperClass; |
| 9221 | /* self curr operclass is not being used and so pass op class for |
| 9222 | * preferred off chan in it. |
| 9223 | */ |
| 9224 | peer_cap->self_curr_operclass = |
| 9225 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 9226 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 9227 | peer_cap->peer_operclass_len = |
| 9228 | peerStateParams->peerCap.peerOperClassLen; |
| 9229 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9230 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9231 | __func__, peer_cap->peer_operclass_len); |
| 9232 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 9233 | peer_cap->peer_operclass[i] = |
| 9234 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9235 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9236 | __func__, i, peer_cap->peer_operclass[i]); |
| 9237 | } |
| 9238 | |
| 9239 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 9240 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 9241 | peer_cap->pref_offchan_bw = |
| 9242 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 9243 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9244 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9245 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 9246 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 9247 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 9248 | " %d, pref_offchan_bw: %d", |
| 9249 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 9250 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 9251 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 9252 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 9253 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 9254 | |
| 9255 | /* next fill variable size array of peer chan info */ |
| 9256 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 9257 | WMITLV_SET_HDR(buf_ptr, |
| 9258 | WMITLV_TAG_ARRAY_STRUC, |
| 9259 | sizeof(wmi_channel) * |
| 9260 | peerStateParams->peerCap.peerChanLen); |
| 9261 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9262 | |
| 9263 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 9264 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 9265 | WMITLV_TAG_STRUC_wmi_channel, |
| 9266 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 9267 | chan_info->mhz = ch_mhz[i]; |
| 9268 | chan_info->band_center_freq1 = chan_info->mhz; |
| 9269 | chan_info->band_center_freq2 = 0; |
| 9270 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9271 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9272 | |
| 9273 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 9274 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9275 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9276 | peerStateParams->peerCap.peerChan[i].chanId, |
| 9277 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 9278 | } |
| 9279 | |
| 9280 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 9281 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 9282 | else |
| 9283 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 9284 | |
| 9285 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 9286 | peerStateParams->peerCap. |
| 9287 | peerChan[i].pwr); |
| 9288 | |
| 9289 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 9290 | peerStateParams->peerCap.peerChan[i]. |
| 9291 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9292 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9293 | peerStateParams->peerCap.peerChan[i].pwr); |
| 9294 | |
| 9295 | chan_info++; |
| 9296 | } |
| 9297 | |
| 9298 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9299 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9300 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9301 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9302 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9303 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9304 | } |
| 9305 | |
| 9306 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9307 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9308 | } |
| 9309 | |
| 9310 | /* |
| 9311 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 9312 | * firmware |
| 9313 | * @wmi_handle: Pointer to wmi handle |
| 9314 | * @mem_dump_req: Pointer for mem_dump_req |
| 9315 | * |
| 9316 | * This function sends memory dump request to firmware |
| 9317 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9318 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9319 | * |
| 9320 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9321 | static 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] | 9322 | struct fw_dump_req_param *mem_dump_req) |
| 9323 | { |
| 9324 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 9325 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9326 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9327 | int32_t len; |
| 9328 | wmi_buf_t buf; |
| 9329 | u_int8_t *buf_ptr; |
| 9330 | int ret, loop; |
| 9331 | |
| 9332 | /* |
| 9333 | * len = sizeof(fixed param) that includes tlv header + |
| 9334 | * tlv header for array of struc + |
| 9335 | * sizeof (each struct) |
| 9336 | */ |
| 9337 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9338 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 9339 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9340 | |
| 9341 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9342 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 9343 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9344 | } |
| 9345 | |
| 9346 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9347 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9348 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 9349 | |
| 9350 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9351 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 9352 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 9353 | |
| 9354 | cmd->request_id = mem_dump_req->request_id; |
| 9355 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 9356 | |
| 9357 | /* TLV indicating array of structures to follow */ |
| 9358 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 9359 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9360 | sizeof(wmi_fw_mem_dump) * |
| 9361 | cmd->num_fw_mem_dump_segs); |
| 9362 | |
| 9363 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9364 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 9365 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9366 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9367 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 9368 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9369 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9370 | ((uint8_t *)(mem_dump_req->segment) + |
| 9371 | loop * sizeof(*seg_req)); |
| 9372 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 9373 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 9374 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 9375 | dump_params->seg_id = seg_req->seg_id; |
| 9376 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 9377 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 9378 | dump_params->seg_length = seg_req->seg_length; |
| 9379 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 9380 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9381 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 9382 | 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] | 9383 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 9384 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9385 | 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] | 9386 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 9387 | dump_params->dest_addr_hi); |
| 9388 | dump_params++; |
| 9389 | } |
| 9390 | |
| 9391 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9392 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 9393 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9394 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9395 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9396 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9397 | } |
| 9398 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9399 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 9400 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9401 | } |
| 9402 | |
| 9403 | /* |
| 9404 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 9405 | * @wmi_handle: Pointer to WMi handle |
| 9406 | * @ie_data: Pointer for ie data |
| 9407 | * |
| 9408 | * This function sends IE information to firmware |
| 9409 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9410 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9411 | * |
| 9412 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9413 | static 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] | 9414 | struct vdev_ie_info_param *ie_info) |
| 9415 | { |
| 9416 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 9417 | wmi_buf_t buf; |
| 9418 | uint8_t *buf_ptr; |
| 9419 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9420 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9421 | |
| 9422 | |
| 9423 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 9424 | /* Allocate memory for the WMI command */ |
| 9425 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 9426 | |
| 9427 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9428 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9429 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9430 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9431 | } |
| 9432 | |
| 9433 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9434 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9435 | |
| 9436 | /* Populate the WMI command */ |
| 9437 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 9438 | |
| 9439 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9440 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 9441 | WMITLV_GET_STRUCT_TLVLEN( |
| 9442 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 9443 | cmd->vdev_id = ie_info->vdev_id; |
| 9444 | cmd->ie_id = ie_info->ie_id; |
| 9445 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 9446 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9447 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9448 | 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] | 9449 | ie_info->length, ie_info->vdev_id); |
| 9450 | |
| 9451 | buf_ptr += sizeof(*cmd); |
| 9452 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 9453 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9454 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9455 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9456 | |
| 9457 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9458 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9459 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9460 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9461 | wmi_buf_free(buf); |
| 9462 | } |
| 9463 | |
| 9464 | return ret; |
| 9465 | } |
| 9466 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9467 | /** |
| 9468 | * send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function |
| 9469 | * |
| 9470 | * @param wmi_handle : handle to WMI. |
| 9471 | * @param param : pointer to antenna param |
| 9472 | * |
| 9473 | * This function sends smart antenna enable command to FW |
| 9474 | * |
| 9475 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9476 | */ |
| 9477 | static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 9478 | struct smart_ant_enable_params *param) |
| 9479 | { |
| 9480 | /* Send WMI COMMAND to Enable */ |
| 9481 | wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd; |
| 9482 | wmi_pdev_smart_ant_gpio_handle *gpio_param; |
| 9483 | wmi_buf_t buf; |
| 9484 | uint8_t *buf_ptr; |
| 9485 | int len = 0; |
| 9486 | QDF_STATUS ret; |
| 9487 | int loop = 0; |
| 9488 | |
| 9489 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9490 | len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle); |
| 9491 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9492 | |
| 9493 | if (!buf) { |
| 9494 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9495 | return QDF_STATUS_E_NOMEM; |
| 9496 | } |
| 9497 | |
| 9498 | buf_ptr = wmi_buf_data(buf); |
| 9499 | qdf_mem_zero(buf_ptr, len); |
| 9500 | cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr; |
| 9501 | |
| 9502 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9503 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param, |
| 9504 | WMITLV_GET_STRUCT_TLVLEN( |
| 9505 | wmi_pdev_smart_ant_enable_cmd_fixed_param)); |
| 9506 | |
| 9507 | cmd->pdev_id = param->pdev_id; |
| 9508 | cmd->enable = param->enable; |
| 9509 | cmd->mode = param->mode; |
| 9510 | cmd->rx_antenna = param->rx_antenna; |
| 9511 | cmd->tx_default_antenna = param->rx_antenna; |
| 9512 | |
| 9513 | /* TLV indicating array of structures to follow */ |
| 9514 | buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param); |
| 9515 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9516 | WMI_HAL_MAX_SANTENNA * |
| 9517 | sizeof(wmi_pdev_smart_ant_gpio_handle)); |
| 9518 | |
| 9519 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9520 | gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr; |
| 9521 | |
| 9522 | for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) { |
| 9523 | WMITLV_SET_HDR(&gpio_param->tlv_header, |
| 9524 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle, |
| 9525 | WMITLV_GET_STRUCT_TLVLEN( |
| 9526 | wmi_pdev_smart_ant_gpio_handle)); |
| 9527 | if (param->mode == SMART_ANT_MODE_SERIAL) { |
| 9528 | if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) { |
| 9529 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 9530 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 9531 | } else { |
| 9532 | gpio_param->gpio_pin = 0; |
| 9533 | gpio_param->gpio_func = 0; |
| 9534 | } |
| 9535 | } else if (param->mode == SMART_ANT_MODE_PARALLEL) { |
| 9536 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 9537 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 9538 | } |
| 9539 | /* Setting it to 0 for now */ |
| 9540 | gpio_param->pdev_id = param->pdev_id; |
| 9541 | gpio_param++; |
| 9542 | } |
| 9543 | |
| 9544 | ret = wmi_unified_cmd_send(wmi_handle, |
| 9545 | buf, |
| 9546 | len, |
| 9547 | WMI_PDEV_SMART_ANT_ENABLE_CMDID); |
| 9548 | |
| 9549 | if (ret != 0) { |
| 9550 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 9551 | WMI_LOGE("enable:%d mode:%d rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n", |
| 9552 | cmd->enable, |
| 9553 | cmd->mode, |
| 9554 | cmd->rx_antenna, |
| 9555 | param->gpio_pin[0], param->gpio_pin[1], |
| 9556 | param->gpio_pin[2], param->gpio_pin[3], |
| 9557 | param->gpio_func[0], param->gpio_func[1], |
| 9558 | param->gpio_func[2], param->gpio_func[3], |
| 9559 | ret); |
| 9560 | wmi_buf_free(buf); |
| 9561 | } |
| 9562 | |
| 9563 | return ret; |
| 9564 | } |
| 9565 | |
| 9566 | /** |
| 9567 | * send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function |
| 9568 | * |
| 9569 | * @param wmi_handle : handle to WMI. |
| 9570 | * @param param : pointer to rx antenna param |
| 9571 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9572 | */ |
| 9573 | static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 9574 | struct smart_ant_rx_ant_params *param) |
| 9575 | { |
| 9576 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd; |
| 9577 | wmi_buf_t buf; |
| 9578 | uint8_t *buf_ptr; |
| 9579 | uint32_t len; |
| 9580 | QDF_STATUS ret; |
| 9581 | |
| 9582 | len = sizeof(*cmd); |
| 9583 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9584 | WMI_LOGD("%s:\n", __func__); |
| 9585 | if (!buf) { |
| 9586 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9587 | return QDF_STATUS_E_NOMEM; |
| 9588 | } |
| 9589 | |
| 9590 | buf_ptr = wmi_buf_data(buf); |
| 9591 | cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr; |
| 9592 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9593 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param, |
| 9594 | WMITLV_GET_STRUCT_TLVLEN( |
| 9595 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param)); |
| 9596 | cmd->rx_antenna = param->antenna; |
| 9597 | cmd->pdev_id = param->pdev_id; |
| 9598 | |
| 9599 | ret = wmi_unified_cmd_send(wmi_handle, |
| 9600 | buf, |
| 9601 | len, |
| 9602 | WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID); |
| 9603 | |
| 9604 | if (ret != 0) { |
| 9605 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 9606 | WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n", |
| 9607 | __func__, |
| 9608 | cmd->rx_antenna, |
| 9609 | ret); |
| 9610 | wmi_buf_free(buf); |
| 9611 | } |
| 9612 | |
| 9613 | return ret; |
| 9614 | } |
| 9615 | |
| 9616 | /** |
| 9617 | * send_set_ctl_table_cmd_tlv() - send ctl table cmd to fw |
| 9618 | * @wmi_handle: wmi handle |
| 9619 | * @param: pointer to hold ctl table param |
| 9620 | * |
| 9621 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9622 | */ |
| 9623 | static QDF_STATUS |
| 9624 | send_set_ctl_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 9625 | struct ctl_table_params *param) |
| 9626 | { |
| 9627 | uint16_t len, ctl_tlv_len; |
| 9628 | uint8_t *buf_ptr; |
| 9629 | wmi_buf_t buf; |
| 9630 | wmi_pdev_set_ctl_table_cmd_fixed_param *cmd; |
| 9631 | uint32_t *ctl_array; |
| 9632 | |
| 9633 | if (!param->ctl_array) |
| 9634 | return QDF_STATUS_E_FAILURE; |
| 9635 | |
| 9636 | if (param->ctl_cmd_len != |
| 9637 | WMI_HOST_NUM_CTLS_2G * WMI_HOST_NUM_BAND_EDGES_2G * 2 + |
| 9638 | WMI_HOST_NUM_CTLS_5G * WMI_HOST_NUM_BAND_EDGES_5G * 2) { |
| 9639 | qdf_print("CTL array len not correct\n"); |
| 9640 | return QDF_STATUS_E_FAILURE; |
| 9641 | } |
| 9642 | |
| 9643 | ctl_tlv_len = WMI_TLV_HDR_SIZE + |
| 9644 | roundup(param->ctl_cmd_len, sizeof(A_UINT32)); |
| 9645 | len = sizeof(*cmd) + ctl_tlv_len; |
| 9646 | |
| 9647 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9648 | if (!buf) { |
| 9649 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9650 | return QDF_STATUS_E_FAILURE; |
| 9651 | } |
| 9652 | |
| 9653 | buf_ptr = wmi_buf_data(buf); |
| 9654 | qdf_mem_zero(buf_ptr, len); |
| 9655 | |
| 9656 | cmd = (wmi_pdev_set_ctl_table_cmd_fixed_param *)buf_ptr; |
| 9657 | |
| 9658 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9659 | WMITLV_TAG_STRUC_wmi_pdev_set_ctl_table_cmd_fixed_param, |
| 9660 | WMITLV_GET_STRUCT_TLVLEN( |
| 9661 | wmi_pdev_set_ctl_table_cmd_fixed_param)); |
| 9662 | cmd->ctl_len = param->ctl_cmd_len; |
| 9663 | cmd->pdev_id = param->pdev_id; |
| 9664 | |
| 9665 | buf_ptr += sizeof(*cmd); |
| 9666 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9667 | (cmd->ctl_len)); |
| 9668 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9669 | ctl_array = (uint32_t *)buf_ptr; |
| 9670 | |
| 9671 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[0], ¶m->ctl_band, |
| 9672 | sizeof(param->ctl_band)); |
| 9673 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[1], param->ctl_array, |
| 9674 | param->ctl_cmd_len - |
| 9675 | sizeof(param->ctl_band)); |
| 9676 | |
| 9677 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9678 | WMI_PDEV_SET_CTL_TABLE_CMDID)) { |
| 9679 | WMI_LOGE("%s:Failed to send command\n", __func__); |
| 9680 | wmi_buf_free(buf); |
| 9681 | return QDF_STATUS_E_FAILURE; |
| 9682 | } |
| 9683 | |
| 9684 | return QDF_STATUS_SUCCESS; |
| 9685 | } |
| 9686 | |
| 9687 | /** |
| 9688 | * send_set_mimogain_table_cmd_tlv() - send mimogain table cmd to fw |
| 9689 | * @wmi_handle: wmi handle |
| 9690 | * @param: pointer to hold mimogain table param |
| 9691 | * |
| 9692 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9693 | */ |
| 9694 | static QDF_STATUS |
| 9695 | send_set_mimogain_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 9696 | struct mimogain_table_params *param) |
| 9697 | { |
| 9698 | uint16_t len, table_tlv_len; |
| 9699 | wmi_buf_t buf; |
| 9700 | uint8_t *buf_ptr; |
| 9701 | wmi_pdev_set_mimogain_table_cmd_fixed_param *cmd; |
| 9702 | uint32_t *gain_table; |
| 9703 | |
| 9704 | if (!param->array_gain) |
| 9705 | return QDF_STATUS_E_FAILURE; |
| 9706 | |
| 9707 | /* len must be multiple of a single array gain table */ |
| 9708 | if (param->tbl_len % |
| 9709 | ((WMI_HOST_TX_NUM_CHAIN-1) * WMI_HOST_TPC_REGINDEX_MAX * |
| 9710 | WMI_HOST_ARRAY_GAIN_NUM_STREAMS) != 0) { |
| 9711 | WMI_LOGE("Array gain table len not correct\n"); |
| 9712 | return QDF_STATUS_E_FAILURE; |
| 9713 | } |
| 9714 | |
| 9715 | table_tlv_len = WMI_TLV_HDR_SIZE + |
| 9716 | roundup(param->tbl_len, sizeof(uint32_t)); |
| 9717 | len = sizeof(*cmd) + table_tlv_len; |
| 9718 | |
| 9719 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9720 | if (!buf) { |
| 9721 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9722 | return QDF_STATUS_E_FAILURE; |
| 9723 | } |
| 9724 | |
| 9725 | buf_ptr = wmi_buf_data(buf); |
| 9726 | qdf_mem_zero(buf_ptr, len); |
| 9727 | |
| 9728 | cmd = (wmi_pdev_set_mimogain_table_cmd_fixed_param *)buf_ptr; |
| 9729 | |
| 9730 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9731 | WMITLV_TAG_STRUC_wmi_pdev_set_mimogain_table_cmd_fixed_param, |
| 9732 | WMITLV_GET_STRUCT_TLVLEN( |
| 9733 | wmi_pdev_set_mimogain_table_cmd_fixed_param)); |
| 9734 | |
| 9735 | cmd->pdev_id = param->pdev_id; |
| 9736 | WMI_MIMOGAIN_ARRAY_GAIN_LEN_SET(cmd->mimogain_info, param->tbl_len); |
| 9737 | WMI_MIMOGAIN_MULTI_CHAIN_BYPASS_SET(cmd->mimogain_info, |
| 9738 | param->multichain_gain_bypass); |
| 9739 | |
| 9740 | buf_ptr += sizeof(*cmd); |
| 9741 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9742 | (param->tbl_len)); |
| 9743 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9744 | gain_table = (uint32_t *)buf_ptr; |
| 9745 | |
| 9746 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(gain_table, |
| 9747 | param->array_gain, |
| 9748 | param->tbl_len); |
| 9749 | |
| 9750 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9751 | WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID)) { |
| 9752 | return QDF_STATUS_E_FAILURE; |
| 9753 | } |
| 9754 | |
| 9755 | return QDF_STATUS_SUCCESS; |
| 9756 | } |
| 9757 | |
| 9758 | /** |
| 9759 | * send_packet_power_info_get_cmd_tlv() - send request to get packet power |
| 9760 | * info to fw |
| 9761 | * @wmi_handle: wmi handle |
| 9762 | * @param: pointer to hold packet power info param |
| 9763 | * |
| 9764 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9765 | */ |
| 9766 | static QDF_STATUS |
| 9767 | send_packet_power_info_get_cmd_tlv(wmi_unified_t wmi_handle, |
| 9768 | struct packet_power_info_params *param) |
| 9769 | { |
| 9770 | wmi_pdev_get_tpc_cmd_fixed_param *cmd; |
| 9771 | wmi_buf_t wmibuf; |
| 9772 | uint8_t *buf_ptr; |
| 9773 | u_int32_t len = sizeof(wmi_pdev_get_tpc_cmd_fixed_param); |
| 9774 | |
| 9775 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 9776 | if (wmibuf == NULL) |
| 9777 | return QDF_STATUS_E_NOMEM; |
| 9778 | |
| 9779 | buf_ptr = (uint8_t *)wmi_buf_data(wmibuf); |
| 9780 | |
| 9781 | cmd = (wmi_pdev_get_tpc_cmd_fixed_param *)buf_ptr; |
| 9782 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9783 | WMITLV_TAG_STRUC_wmi_pdev_get_tpc_cmd_fixed_param, |
| 9784 | WMITLV_GET_STRUCT_TLVLEN( |
| 9785 | wmi_pdev_get_tpc_cmd_fixed_param)); |
| 9786 | cmd->pdev_id = param->pdev_id; |
| 9787 | cmd->rate_flags = param->rate_flags; |
| 9788 | cmd->nss = param->nss; |
| 9789 | cmd->preamble = param->preamble; |
| 9790 | cmd->hw_rate = param->hw_rate; |
| 9791 | WMI_LOGI("%s[%d] commandID %d, wmi_pdev_get_tpc_cmd=0x%x\n", |
| 9792 | __func__, |
| 9793 | __LINE__, |
| 9794 | WMI_PDEV_GET_TPC_CMDID, |
| 9795 | *((u_int32_t *)cmd)); |
| 9796 | if (wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 9797 | WMI_PDEV_GET_TPC_CMDID)) { |
| 9798 | WMI_LOGE(FL("Failed to get tpc command\n")); |
| 9799 | wmi_buf_free(wmibuf); |
| 9800 | return QDF_STATUS_E_FAILURE; |
| 9801 | } |
| 9802 | |
| 9803 | return QDF_STATUS_SUCCESS; |
| 9804 | } |
| 9805 | |
| 9806 | /** |
| 9807 | * send_vdev_config_ratemask_cmd_tlv() - config ratemask param in fw |
| 9808 | * @wmi_handle: wmi handle |
| 9809 | * @param: pointer to hold config ratemask params |
| 9810 | * |
| 9811 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9812 | */ |
| 9813 | static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle, |
| 9814 | struct config_ratemask_params *param) |
| 9815 | { |
| 9816 | wmi_vdev_config_ratemask_cmd_fixed_param *cmd; |
| 9817 | wmi_buf_t buf; |
| 9818 | int32_t len = sizeof(*cmd); |
| 9819 | |
| 9820 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9821 | if (!buf) { |
| 9822 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9823 | return QDF_STATUS_E_FAILURE; |
| 9824 | } |
| 9825 | cmd = (wmi_vdev_config_ratemask_cmd_fixed_param *)wmi_buf_data(buf); |
| 9826 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9827 | WMITLV_TAG_STRUC_wmi_vdev_config_ratemask_fixed_param, |
| 9828 | WMITLV_GET_STRUCT_TLVLEN( |
| 9829 | wmi_vdev_config_ratemask_cmd_fixed_param)); |
| 9830 | cmd->vdev_id = param->vdev_id; |
| 9831 | cmd->type = param->type; |
| 9832 | cmd->mask_lower32 = param->lower32; |
| 9833 | cmd->mask_higher32 = param->higher32; |
| 9834 | WMI_LOGI("Setting vdev ratemask vdev id = 0x%X, type = 0x%X, mask_l32 = 0x%X mask_h32 = 0x%X\n", |
| 9835 | param->vdev_id, param->type, param->lower32, param->higher32); |
| 9836 | |
| 9837 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9838 | WMI_VDEV_RATEMASK_CMDID)) { |
| 9839 | WMI_LOGE("Seting vdev ratemask failed\n"); |
| 9840 | wmi_buf_free(buf); |
| 9841 | return QDF_STATUS_E_FAILURE; |
| 9842 | } |
| 9843 | |
| 9844 | return QDF_STATUS_SUCCESS; |
| 9845 | } |
| 9846 | |
| 9847 | /** |
| 9848 | * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw |
| 9849 | * @wmi_handle: wmi handle |
| 9850 | * @param: pointer to hold vap dscp tid map param |
| 9851 | * |
| 9852 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9853 | */ |
| 9854 | static QDF_STATUS |
| 9855 | send_set_vap_dscp_tid_map_cmd_tlv(wmi_unified_t wmi_handle, |
| 9856 | struct vap_dscp_tid_map_params *param) |
| 9857 | { |
| 9858 | wmi_buf_t buf; |
| 9859 | wmi_vdev_set_dscp_tid_map_cmd_fixed_param *cmd; |
| 9860 | int32_t len = sizeof(*cmd); |
| 9861 | |
| 9862 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9863 | if (!buf) { |
| 9864 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9865 | return QDF_STATUS_E_FAILURE; |
| 9866 | } |
| 9867 | |
| 9868 | cmd = (wmi_vdev_set_dscp_tid_map_cmd_fixed_param *)wmi_buf_data(buf); |
| 9869 | qdf_mem_copy(cmd->dscp_to_tid_map, param->dscp_to_tid_map, |
| 9870 | sizeof(A_UINT32) * WMI_DSCP_MAP_MAX); |
| 9871 | |
| 9872 | cmd->vdev_id = param->vdev_id; |
| 9873 | cmd->enable_override = 0; |
| 9874 | |
| 9875 | WMI_LOGI("Setting dscp for vap id: %d\n", cmd->vdev_id); |
| 9876 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9877 | WMI_VDEV_SET_DSCP_TID_MAP_CMDID)) { |
| 9878 | WMI_LOGE("Failed to set dscp cmd\n"); |
| 9879 | wmi_buf_free(buf); |
| 9880 | return QDF_STATUS_E_FAILURE; |
| 9881 | } |
| 9882 | |
| 9883 | return QDF_STATUS_SUCCESS; |
| 9884 | } |
| 9885 | |
| 9886 | /** |
| 9887 | * send_vdev_set_neighbour_rx_cmd_tlv() - set neighbour rx param in fw |
| 9888 | * @wmi_handle: wmi handle |
| 9889 | * @macaddr: vdev mac address |
| 9890 | * @param: pointer to hold neigbour rx param |
| 9891 | * |
| 9892 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9893 | */ |
| 9894 | static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(wmi_unified_t wmi_handle, |
| 9895 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 9896 | struct set_neighbour_rx_params *param) |
| 9897 | { |
| 9898 | wmi_vdev_filter_nrp_config_cmd_fixed_param *cmd; |
| 9899 | wmi_buf_t buf; |
| 9900 | int32_t len = sizeof(*cmd); |
| 9901 | |
| 9902 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9903 | if (!buf) { |
| 9904 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9905 | return QDF_STATUS_E_FAILURE; |
| 9906 | } |
| 9907 | cmd = (wmi_vdev_filter_nrp_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 9908 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9909 | WMITLV_TAG_STRUC_wmi_vdev_filter_nrp_config_cmd_fixed_param, |
| 9910 | WMITLV_GET_STRUCT_TLVLEN( |
| 9911 | wmi_vdev_filter_nrp_config_cmd_fixed_param)); |
| 9912 | cmd->vdev_id = param->vdev_id; |
| 9913 | cmd->bssid_idx = param->idx; |
| 9914 | cmd->action = param->action; |
| 9915 | cmd->type = param->type; |
| 9916 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr); |
| 9917 | cmd->flag = 0; |
| 9918 | |
| 9919 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9920 | WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID)) { |
| 9921 | WMI_LOGE("Failed to set neighbour rx param\n"); |
| 9922 | wmi_buf_free(buf); |
| 9923 | return QDF_STATUS_E_FAILURE; |
| 9924 | } |
| 9925 | |
| 9926 | return QDF_STATUS_SUCCESS; |
| 9927 | } |
| 9928 | |
| 9929 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 9930 | * send_smart_ant_set_tx_ant_cmd_tlv() - WMI set tx antenna function |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9931 | * @param wmi_handle : handle to WMI. |
| 9932 | * @param macaddr : vdev mac address |
| 9933 | * @param param : pointer to tx antenna param |
| 9934 | * |
| 9935 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9936 | */ |
| 9937 | static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 9938 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 9939 | struct smart_ant_tx_ant_params *param) |
| 9940 | { |
| 9941 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd; |
| 9942 | wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series; |
| 9943 | wmi_buf_t buf; |
| 9944 | int32_t len = 0; |
| 9945 | int i; |
| 9946 | uint8_t *buf_ptr; |
| 9947 | QDF_STATUS ret; |
| 9948 | |
| 9949 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9950 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 9951 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series); |
| 9952 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9953 | |
| 9954 | if (!buf) { |
| 9955 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9956 | return QDF_STATUS_E_NOMEM; |
| 9957 | } |
| 9958 | |
| 9959 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 9960 | qdf_mem_zero(buf_ptr, len); |
| 9961 | cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr; |
| 9962 | |
| 9963 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9964 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param, |
| 9965 | WMITLV_GET_STRUCT_TLVLEN( |
| 9966 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param)); |
| 9967 | |
| 9968 | cmd->vdev_id = param->vdev_id; |
| 9969 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 9970 | |
| 9971 | buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param); |
| 9972 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9973 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series)); |
| 9974 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9975 | ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr; |
| 9976 | |
| 9977 | for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) { |
| 9978 | WMITLV_SET_HDR(&ant_tx_series->tlv_header, |
| 9979 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series, |
| 9980 | WMITLV_GET_STRUCT_TLVLEN( |
| 9981 | wmi_peer_smart_ant_set_tx_antenna_series)); |
| 9982 | ant_tx_series->antenna_series = param->antenna_array[i]; |
| 9983 | ant_tx_series++; |
| 9984 | } |
| 9985 | |
| 9986 | ret = wmi_unified_cmd_send(wmi_handle, |
| 9987 | buf, |
| 9988 | len, |
| 9989 | WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID); |
| 9990 | |
| 9991 | if (ret != 0) { |
| 9992 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 9993 | wmi_buf_free(buf); |
| 9994 | } |
| 9995 | |
| 9996 | return ret; |
| 9997 | } |
| 9998 | |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 9999 | /** |
| 10000 | * send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw |
| 10001 | * @wmi_handle: wmi handle |
| 10002 | * @param: pointer to hold ant switch tbl param |
| 10003 | * |
| 10004 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10005 | */ |
| 10006 | static QDF_STATUS |
| 10007 | send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10008 | struct ant_switch_tbl_params *param) |
| 10009 | { |
| 10010 | uint8_t len; |
| 10011 | wmi_buf_t buf; |
| 10012 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd; |
| 10013 | wmi_pdev_set_ant_ctrl_chain *ctrl_chain; |
| 10014 | uint8_t *buf_ptr; |
| 10015 | |
| 10016 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10017 | len += sizeof(wmi_pdev_set_ant_ctrl_chain); |
| 10018 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10019 | |
| 10020 | if (!buf) { |
| 10021 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10022 | return QDF_STATUS_E_NOMEM; |
| 10023 | } |
| 10024 | |
| 10025 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10026 | qdf_mem_zero(buf_ptr, len); |
| 10027 | cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr; |
| 10028 | |
| 10029 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10030 | WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param, |
| 10031 | WMITLV_GET_STRUCT_TLVLEN( |
| 10032 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param)); |
| 10033 | |
| 10034 | cmd->antCtrlCommon1 = param->ant_ctrl_common1; |
| 10035 | cmd->antCtrlCommon2 = param->ant_ctrl_common2; |
| 10036 | cmd->mac_id = param->pdev_id; /* Setting it to 0 for now */ |
| 10037 | |
| 10038 | /* TLV indicating array of structures to follow */ |
| 10039 | buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param); |
| 10040 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10041 | sizeof(wmi_pdev_set_ant_ctrl_chain)); |
| 10042 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10043 | ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr; |
| 10044 | |
| 10045 | ctrl_chain->pdev_id = param->pdev_id; |
| 10046 | ctrl_chain->antCtrlChain = param->antCtrlChain; |
| 10047 | |
| 10048 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10049 | WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) { |
| 10050 | wmi_buf_free(buf); |
| 10051 | return QDF_STATUS_E_FAILURE; |
| 10052 | } |
| 10053 | |
| 10054 | return QDF_STATUS_SUCCESS; |
| 10055 | } |
| 10056 | |
| 10057 | /** |
| 10058 | * send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna |
| 10059 | * training information function |
| 10060 | * @param wmi_handle : handle to WMI. |
| 10061 | * @macaddr : vdev mac address |
| 10062 | * @param param : pointer to tx antenna param |
| 10063 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10064 | */ |
| 10065 | static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv( |
| 10066 | wmi_unified_t wmi_handle, |
| 10067 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10068 | struct smart_ant_training_info_params *param) |
| 10069 | { |
| 10070 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd; |
| 10071 | wmi_peer_smart_ant_set_train_antenna_param *train_param; |
| 10072 | wmi_buf_t buf; |
| 10073 | uint8_t *buf_ptr; |
| 10074 | int32_t len = 0; |
| 10075 | QDF_STATUS ret; |
| 10076 | int loop; |
| 10077 | |
| 10078 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10079 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10080 | sizeof(wmi_peer_smart_ant_set_train_antenna_param); |
| 10081 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10082 | |
| 10083 | if (!buf) { |
| 10084 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10085 | return QDF_STATUS_E_NOMEM; |
| 10086 | } |
| 10087 | |
| 10088 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10089 | qdf_mem_zero(buf_ptr, len); |
| 10090 | cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr; |
| 10091 | |
| 10092 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10093 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param, |
| 10094 | WMITLV_GET_STRUCT_TLVLEN( |
| 10095 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param)); |
| 10096 | |
| 10097 | cmd->vdev_id = param->vdev_id; |
| 10098 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10099 | cmd->num_pkts = param->numpkts; |
| 10100 | |
| 10101 | buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param); |
| 10102 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10103 | sizeof(wmi_peer_smart_ant_set_train_antenna_param) * |
| 10104 | WMI_SMART_ANT_MAX_RATE_SERIES); |
| 10105 | |
| 10106 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10107 | train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr; |
| 10108 | |
| 10109 | for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) { |
| 10110 | WMITLV_SET_HDR(&train_param->tlv_header, |
| 10111 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param, |
| 10112 | WMITLV_GET_STRUCT_TLVLEN( |
| 10113 | wmi_peer_smart_ant_set_train_antenna_param)); |
| 10114 | train_param->train_rate_series = param->rate_array[loop]; |
| 10115 | train_param->train_antenna_series = param->antenna_array[loop]; |
| 10116 | train_param->rc_flags = 0; |
| 10117 | WMI_LOGI(FL("Series number:%d\n"), loop); |
| 10118 | WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"), |
| 10119 | train_param->train_rate_series, |
| 10120 | train_param->train_antenna_series); |
| 10121 | train_param++; |
| 10122 | } |
| 10123 | |
| 10124 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10125 | buf, |
| 10126 | len, |
| 10127 | WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID); |
| 10128 | |
| 10129 | if (ret != 0) { |
| 10130 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10131 | wmi_buf_free(buf); |
| 10132 | return QDF_STATUS_E_FAILURE; |
| 10133 | } |
| 10134 | |
| 10135 | return ret; |
| 10136 | } |
| 10137 | |
| 10138 | /** |
| 10139 | * send_smart_ant_set_node_config_cmd_tlv() - WMI set node |
| 10140 | * configuration function |
| 10141 | * @param wmi_handle : handle to WMI. |
| 10142 | * @macaddr : vdev mad address |
| 10143 | * @param param : pointer to tx antenna param |
| 10144 | * |
| 10145 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10146 | */ |
| 10147 | static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv( |
| 10148 | wmi_unified_t wmi_handle, |
| 10149 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10150 | struct smart_ant_node_config_params *param) |
| 10151 | { |
| 10152 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd; |
| 10153 | wmi_buf_t buf; |
| 10154 | uint8_t *buf_ptr; |
| 10155 | int32_t len = 0, args_tlv_len; |
| 10156 | int ret; |
| 10157 | int i = 0; |
| 10158 | A_UINT32 *node_config_args; |
| 10159 | |
| 10160 | args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(A_UINT32); |
| 10161 | len = sizeof(*cmd) + args_tlv_len; |
| 10162 | |
| 10163 | if ((param->args_count == 0)) { |
| 10164 | WMI_LOGE("%s: Can't send a command with %d arguments\n", |
| 10165 | __func__, param->args_count); |
| 10166 | return QDF_STATUS_E_FAILURE; |
| 10167 | } |
| 10168 | |
| 10169 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10170 | if (!buf) { |
| 10171 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10172 | return QDF_STATUS_E_NOMEM; |
| 10173 | } |
| 10174 | |
| 10175 | cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *) |
| 10176 | wmi_buf_data(buf); |
| 10177 | buf_ptr = (uint8_t *)cmd; |
| 10178 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10179 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param, |
| 10180 | WMITLV_GET_STRUCT_TLVLEN( |
| 10181 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param)); |
| 10182 | cmd->vdev_id = param->vdev_id; |
| 10183 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10184 | cmd->cmd_id = param->cmd_id; |
| 10185 | cmd->args_count = param->args_count; |
| 10186 | buf_ptr += sizeof( |
| 10187 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param); |
| 10188 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10189 | (cmd->args_count * sizeof(A_UINT32))); |
| 10190 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10191 | node_config_args = (A_UINT32 *)buf_ptr; |
| 10192 | |
| 10193 | for (i = 0; i < param->args_count; i++) { |
| 10194 | node_config_args[i] = param->args_arr[i]; |
| 10195 | WMI_LOGI("%d", param->args_arr[i]); |
| 10196 | } |
| 10197 | |
| 10198 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10199 | buf, |
| 10200 | len, |
| 10201 | WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID); |
| 10202 | |
| 10203 | if (ret != 0) { |
| 10204 | WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n", |
| 10205 | __func__, param->cmd_id, macaddr[0], |
| 10206 | macaddr[1], macaddr[2], macaddr[3], |
| 10207 | macaddr[4], macaddr[5], ret); |
| 10208 | wmi_buf_free(buf); |
| 10209 | } |
| 10210 | |
| 10211 | return ret; |
| 10212 | } |
| 10213 | |
| 10214 | /** |
| 10215 | * send_set_atf_cmd_tlv() - send set atf command to fw |
| 10216 | * @wmi_handle: wmi handle |
| 10217 | * @param: pointer to set atf param |
| 10218 | * |
| 10219 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10220 | */ |
| 10221 | static QDF_STATUS |
| 10222 | send_set_atf_cmd_tlv(wmi_unified_t wmi_handle, |
| 10223 | struct set_atf_params *param) |
| 10224 | { |
| 10225 | wmi_atf_peer_info *peer_info; |
| 10226 | wmi_peer_atf_request_fixed_param *cmd; |
| 10227 | wmi_buf_t buf; |
| 10228 | uint8_t *buf_ptr; |
| 10229 | int i; |
| 10230 | int32_t len = 0; |
| 10231 | QDF_STATUS retval; |
| 10232 | |
| 10233 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10234 | len += param->num_peers * sizeof(wmi_atf_peer_info); |
| 10235 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10236 | if (!buf) { |
| 10237 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10238 | return QDF_STATUS_E_FAILURE; |
| 10239 | } |
| 10240 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10241 | cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr; |
| 10242 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10243 | WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param, |
| 10244 | WMITLV_GET_STRUCT_TLVLEN( |
| 10245 | wmi_peer_atf_request_fixed_param)); |
| 10246 | cmd->num_peers = param->num_peers; |
| 10247 | |
| 10248 | buf_ptr += sizeof(*cmd); |
| 10249 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10250 | sizeof(wmi_atf_peer_info) * |
| 10251 | cmd->num_peers); |
| 10252 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10253 | peer_info = (wmi_atf_peer_info *)buf_ptr; |
| 10254 | |
| 10255 | for (i = 0; i < cmd->num_peers; i++) { |
| 10256 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 10257 | WMITLV_TAG_STRUC_wmi_atf_peer_info, |
| 10258 | WMITLV_GET_STRUCT_TLVLEN( |
| 10259 | wmi_atf_peer_info)); |
| 10260 | peer_info->atf_units = param->peer_info[i].percentage_peer; |
| 10261 | /* |
| 10262 | * TLV definition for peer atf request fixed param combines |
| 10263 | * extension stats. Legacy FW for WIN (Non-TLV) has peer atf |
| 10264 | * stats and atf extension stats as two different |
| 10265 | * implementations. |
| 10266 | * Need to discuss with FW on this. |
| 10267 | * |
| 10268 | * peer_info->atf_groupid = param->peer_ext_info[i].group_index; |
| 10269 | * peer_info->atf_units_reserved = |
| 10270 | * param->peer_ext_info[i].atf_index_reserved; |
| 10271 | */ |
| 10272 | peer_info++; |
| 10273 | } |
| 10274 | |
| 10275 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10276 | WMI_PEER_ATF_REQUEST_CMDID); |
| 10277 | |
| 10278 | if (retval != QDF_STATUS_SUCCESS) { |
| 10279 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 10280 | wmi_buf_free(buf); |
| 10281 | } |
| 10282 | |
| 10283 | return retval; |
| 10284 | } |
| 10285 | |
| 10286 | /** |
| 10287 | * send_vdev_set_fwtest_param_cmd_tlv() - send fwtest param in fw |
| 10288 | * @wmi_handle: wmi handle |
| 10289 | * @param: pointer to hold fwtest param |
| 10290 | * |
| 10291 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10292 | */ |
| 10293 | static QDF_STATUS send_vdev_set_fwtest_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 10294 | struct set_fwtest_params *param) |
| 10295 | { |
| 10296 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 10297 | wmi_buf_t buf; |
| 10298 | int32_t len = sizeof(*cmd); |
| 10299 | |
| 10300 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10301 | |
| 10302 | if (!buf) { |
| 10303 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10304 | return QDF_STATUS_E_FAILURE; |
| 10305 | } |
| 10306 | |
| 10307 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 10308 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10309 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 10310 | WMITLV_GET_STRUCT_TLVLEN( |
| 10311 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 10312 | cmd->param_id = param->arg; |
| 10313 | cmd->param_value = param->value; |
| 10314 | |
| 10315 | if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FWTEST_CMDID)) { |
| 10316 | WMI_LOGE("Setting FW test param failed\n"); |
| 10317 | wmi_buf_free(buf); |
| 10318 | return QDF_STATUS_E_FAILURE; |
| 10319 | } |
| 10320 | |
| 10321 | return QDF_STATUS_SUCCESS; |
| 10322 | } |
| 10323 | |
| 10324 | /** |
| 10325 | * send_set_qboost_param_cmd_tlv() - send set qboost command to fw |
| 10326 | * @wmi_handle: wmi handle |
| 10327 | * @param: pointer to qboost params |
| 10328 | * @macaddr: vdev mac address |
| 10329 | * |
| 10330 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10331 | */ |
| 10332 | static QDF_STATUS |
| 10333 | send_set_qboost_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 10334 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10335 | struct set_qboost_params *param) |
| 10336 | { |
| 10337 | WMI_QBOOST_CFG_CMD_fixed_param *cmd; |
| 10338 | wmi_buf_t buf; |
| 10339 | int32_t len; |
| 10340 | QDF_STATUS ret; |
| 10341 | |
| 10342 | len = sizeof(*cmd); |
| 10343 | |
| 10344 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10345 | if (!buf) { |
| 10346 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10347 | return QDF_STATUS_E_FAILURE; |
| 10348 | } |
| 10349 | |
| 10350 | cmd = (WMI_QBOOST_CFG_CMD_fixed_param *)wmi_buf_data(buf); |
| 10351 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10352 | WMITLV_TAG_STRUC_WMI_QBOOST_CFG_CMD_fixed_param, |
| 10353 | WMITLV_GET_STRUCT_TLVLEN( |
| 10354 | WMI_QBOOST_CFG_CMD_fixed_param)); |
| 10355 | cmd->vdev_id = param->vdev_id; |
| 10356 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10357 | cmd->qb_enable = param->value; |
| 10358 | |
| 10359 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10360 | WMI_QBOOST_CFG_CMDID); |
| 10361 | |
| 10362 | if (ret != 0) { |
| 10363 | WMI_LOGE("Setting qboost cmd failed\n"); |
| 10364 | wmi_buf_free(buf); |
| 10365 | } |
| 10366 | |
| 10367 | return ret; |
| 10368 | } |
| 10369 | |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 10370 | /** |
| 10371 | * send_gpio_config_cmd_tlv() - send gpio config to fw |
| 10372 | * @wmi_handle: wmi handle |
| 10373 | * @param: pointer to hold gpio config param |
| 10374 | * |
| 10375 | * Return: 0 for success or error code |
| 10376 | */ |
| 10377 | static QDF_STATUS |
| 10378 | send_gpio_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 10379 | struct gpio_config_params *param) |
| 10380 | { |
| 10381 | wmi_gpio_config_cmd_fixed_param *cmd; |
| 10382 | wmi_buf_t buf; |
| 10383 | int32_t len; |
| 10384 | QDF_STATUS ret; |
| 10385 | |
| 10386 | len = sizeof(*cmd); |
| 10387 | |
| 10388 | /* Sanity Checks */ |
| 10389 | if (param->pull_type > WMI_GPIO_PULL_DOWN || |
| 10390 | param->intr_mode > WMI_GPIO_INTTYPE_LEVEL_HIGH) { |
| 10391 | return QDF_STATUS_E_FAILURE; |
| 10392 | } |
| 10393 | |
| 10394 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10395 | if (!buf) { |
| 10396 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10397 | return QDF_STATUS_E_FAILURE; |
| 10398 | } |
| 10399 | |
| 10400 | cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 10401 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10402 | WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param, |
| 10403 | WMITLV_GET_STRUCT_TLVLEN( |
| 10404 | wmi_gpio_config_cmd_fixed_param)); |
| 10405 | cmd->gpio_num = param->gpio_num; |
| 10406 | cmd->input = param->input; |
| 10407 | cmd->pull_type = param->pull_type; |
| 10408 | cmd->intr_mode = param->intr_mode; |
| 10409 | |
| 10410 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10411 | WMI_GPIO_CONFIG_CMDID); |
| 10412 | |
| 10413 | if (ret != 0) { |
| 10414 | WMI_LOGE("Sending GPIO config cmd failed\n"); |
| 10415 | wmi_buf_free(buf); |
| 10416 | } |
| 10417 | |
| 10418 | return ret; |
| 10419 | } |
| 10420 | |
| 10421 | /** |
| 10422 | * send_gpio_output_cmd_tlv() - send gpio output to fw |
| 10423 | * @wmi_handle: wmi handle |
| 10424 | * @param: pointer to hold gpio output param |
| 10425 | * |
| 10426 | * Return: 0 for success or error code |
| 10427 | */ |
| 10428 | static QDF_STATUS |
| 10429 | send_gpio_output_cmd_tlv(wmi_unified_t wmi_handle, |
| 10430 | struct gpio_output_params *param) |
| 10431 | { |
| 10432 | wmi_gpio_output_cmd_fixed_param *cmd; |
| 10433 | wmi_buf_t buf; |
| 10434 | int32_t len; |
| 10435 | QDF_STATUS ret; |
| 10436 | |
| 10437 | len = sizeof(*cmd); |
| 10438 | |
| 10439 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10440 | if (!buf) { |
| 10441 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10442 | return QDF_STATUS_E_FAILURE; |
| 10443 | } |
| 10444 | |
| 10445 | cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf); |
| 10446 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10447 | WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param, |
| 10448 | WMITLV_GET_STRUCT_TLVLEN( |
| 10449 | wmi_gpio_output_cmd_fixed_param)); |
| 10450 | cmd->gpio_num = param->gpio_num; |
| 10451 | cmd->set = param->set; |
| 10452 | |
| 10453 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10454 | WMI_GPIO_OUTPUT_CMDID); |
| 10455 | |
| 10456 | if (ret != 0) { |
| 10457 | WMI_LOGE("Sending GPIO output cmd failed\n"); |
| 10458 | wmi_buf_free(buf); |
| 10459 | } |
| 10460 | |
| 10461 | return ret; |
| 10462 | |
| 10463 | } |
| 10464 | |
| 10465 | /** |
| 10466 | * send_phyerr_disable_cmd_tlv() - WMI phyerr disable function |
| 10467 | * |
| 10468 | * @param wmi_handle : handle to WMI. |
| 10469 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10470 | */ |
| 10471 | static QDF_STATUS send_phyerr_disable_cmd_tlv(wmi_unified_t wmi_handle) |
| 10472 | { |
| 10473 | wmi_pdev_dfs_disable_cmd_fixed_param *cmd; |
| 10474 | wmi_buf_t buf; |
| 10475 | QDF_STATUS ret; |
| 10476 | int32_t len; |
| 10477 | |
| 10478 | len = sizeof(*cmd); |
| 10479 | |
| 10480 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10481 | if (!buf) { |
| 10482 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10483 | return QDF_STATUS_E_FAILURE; |
| 10484 | } |
| 10485 | |
| 10486 | cmd = (wmi_pdev_dfs_disable_cmd_fixed_param *)wmi_buf_data(buf); |
| 10487 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10488 | WMITLV_TAG_STRUC_wmi_pdev_dfs_disable_cmd_fixed_param, |
| 10489 | WMITLV_GET_STRUCT_TLVLEN( |
| 10490 | wmi_pdev_dfs_disable_cmd_fixed_param)); |
| 10491 | /* Filling it with WMI_PDEV_ID_SOC for now */ |
| 10492 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 10493 | |
| 10494 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10495 | WMI_PDEV_DFS_DISABLE_CMDID); |
| 10496 | |
| 10497 | if (ret != 0) { |
| 10498 | WMI_LOGE("Sending PDEV DFS disable cmd failed\n"); |
| 10499 | wmi_buf_free(buf); |
| 10500 | } |
| 10501 | |
| 10502 | return ret; |
| 10503 | } |
| 10504 | |
| 10505 | /** |
| 10506 | * send_phyerr_enable_cmd_tlv() - WMI phyerr disable function |
| 10507 | * |
| 10508 | * @param wmi_handle : handle to WMI. |
| 10509 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10510 | */ |
| 10511 | static QDF_STATUS send_phyerr_enable_cmd_tlv(wmi_unified_t wmi_handle) |
| 10512 | { |
| 10513 | wmi_pdev_dfs_enable_cmd_fixed_param *cmd; |
| 10514 | wmi_buf_t buf; |
| 10515 | QDF_STATUS ret; |
| 10516 | int32_t len; |
| 10517 | |
| 10518 | len = sizeof(*cmd); |
| 10519 | |
| 10520 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10521 | if (!buf) { |
| 10522 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10523 | return QDF_STATUS_E_FAILURE; |
| 10524 | } |
| 10525 | |
| 10526 | cmd = (wmi_pdev_dfs_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 10527 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10528 | WMITLV_TAG_STRUC_wmi_pdev_dfs_enable_cmd_fixed_param, |
| 10529 | WMITLV_GET_STRUCT_TLVLEN( |
| 10530 | wmi_pdev_dfs_enable_cmd_fixed_param)); |
| 10531 | /* Reserved for future use */ |
| 10532 | cmd->reserved0 = 0; |
| 10533 | |
| 10534 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10535 | WMI_PDEV_DFS_ENABLE_CMDID); |
| 10536 | |
| 10537 | if (ret != 0) { |
| 10538 | WMI_LOGE("Sending PDEV DFS enable cmd failed\n"); |
| 10539 | wmi_buf_free(buf); |
| 10540 | } |
| 10541 | |
| 10542 | return ret; |
| 10543 | } |
| 10544 | |
| 10545 | /** |
| 10546 | * send_nf_dbr_dbm_info_get_cmd_tlv() - send request to get nf to fw |
| 10547 | * @wmi_handle: wmi handle |
| 10548 | * |
| 10549 | * Return: 0 for success or error code |
| 10550 | */ |
| 10551 | static QDF_STATUS |
| 10552 | send_nf_dbr_dbm_info_get_cmd_tlv(wmi_unified_t wmi_handle) |
| 10553 | { |
| 10554 | wmi_buf_t buf; |
| 10555 | QDF_STATUS ret; |
| 10556 | |
| 10557 | buf = wmi_buf_alloc(wmi_handle, 0); |
| 10558 | if (buf == NULL) |
| 10559 | return QDF_STATUS_E_NOMEM; |
| 10560 | |
| 10561 | ret = wmi_unified_cmd_send(wmi_handle, buf, 0, |
| 10562 | WMI_PDEV_GET_NFCAL_POWER_CMDID); |
| 10563 | if (ret != 0) { |
| 10564 | WMI_LOGE("Sending get nfcal power cmd failed\n"); |
| 10565 | wmi_buf_free(buf); |
| 10566 | } |
| 10567 | |
| 10568 | return ret; |
| 10569 | } |
| 10570 | |
| 10571 | /** |
| 10572 | * send_set_ht_ie_cmd_tlv() - send ht ie command to fw |
| 10573 | * @wmi_handle: wmi handle |
| 10574 | * @param: pointer to ht ie param |
| 10575 | * |
| 10576 | * Return: 0 for success or error code |
| 10577 | */ |
| 10578 | static QDF_STATUS |
| 10579 | send_set_ht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 10580 | struct ht_ie_params *param) |
| 10581 | { |
| 10582 | wmi_pdev_set_ht_ie_cmd_fixed_param *cmd; |
| 10583 | wmi_buf_t buf; |
| 10584 | QDF_STATUS ret; |
| 10585 | int32_t len; |
| 10586 | uint8_t *buf_ptr; |
| 10587 | |
| 10588 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10589 | roundup(param->ie_len, sizeof(uint32_t)); |
| 10590 | |
| 10591 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10592 | if (!buf) { |
| 10593 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10594 | return QDF_STATUS_E_FAILURE; |
| 10595 | } |
| 10596 | |
| 10597 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10598 | cmd = (wmi_pdev_set_ht_ie_cmd_fixed_param *)buf_ptr; |
| 10599 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10600 | WMITLV_TAG_STRUC_wmi_pdev_set_ht_ie_cmd_fixed_param, |
| 10601 | WMITLV_GET_STRUCT_TLVLEN( |
| 10602 | wmi_pdev_set_ht_ie_cmd_fixed_param)); |
| 10603 | cmd->reserved0 = 0; |
| 10604 | cmd->ie_len = param->ie_len; |
| 10605 | cmd->tx_streams = param->tx_streams; |
| 10606 | cmd->rx_streams = param->rx_streams; |
| 10607 | |
| 10608 | buf_ptr += sizeof(*cmd); |
| 10609 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 10610 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10611 | if (param->ie_len) |
| 10612 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 10613 | cmd->ie_len); |
| 10614 | |
| 10615 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10616 | WMI_PDEV_SET_HT_CAP_IE_CMDID); |
| 10617 | |
| 10618 | if (ret != 0) { |
| 10619 | WMI_LOGE("Sending set ht ie cmd failed\n"); |
| 10620 | wmi_buf_free(buf); |
| 10621 | } |
| 10622 | |
| 10623 | return ret; |
| 10624 | } |
| 10625 | |
| 10626 | /** |
| 10627 | * send_set_vht_ie_cmd_tlv() - send vht ie command to fw |
| 10628 | * @wmi_handle: wmi handle |
| 10629 | * @param: pointer to vht ie param |
| 10630 | * |
| 10631 | * Return: 0 for success or error code |
| 10632 | */ |
| 10633 | static QDF_STATUS |
| 10634 | send_set_vht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 10635 | struct vht_ie_params *param) |
| 10636 | { |
| 10637 | wmi_pdev_set_vht_ie_cmd_fixed_param *cmd; |
| 10638 | wmi_buf_t buf; |
| 10639 | QDF_STATUS ret; |
| 10640 | int32_t len; |
| 10641 | uint8_t *buf_ptr; |
| 10642 | |
| 10643 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10644 | roundup(param->ie_len, sizeof(uint32_t)); |
| 10645 | |
| 10646 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10647 | if (!buf) { |
| 10648 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10649 | return QDF_STATUS_E_FAILURE; |
| 10650 | } |
| 10651 | |
| 10652 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10653 | cmd = (wmi_pdev_set_vht_ie_cmd_fixed_param *)buf_ptr; |
| 10654 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10655 | WMITLV_TAG_STRUC_wmi_pdev_set_vht_ie_cmd_fixed_param, |
| 10656 | WMITLV_GET_STRUCT_TLVLEN( |
| 10657 | wmi_pdev_set_vht_ie_cmd_fixed_param)); |
| 10658 | cmd->reserved0 = 0; |
| 10659 | cmd->ie_len = param->ie_len; |
| 10660 | cmd->tx_streams = param->tx_streams; |
| 10661 | cmd->rx_streams = param->rx_streams; |
| 10662 | |
| 10663 | buf_ptr += sizeof(*cmd); |
| 10664 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 10665 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10666 | if (param->ie_len) |
| 10667 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 10668 | cmd->ie_len); |
| 10669 | |
| 10670 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10671 | WMI_PDEV_SET_VHT_CAP_IE_CMDID); |
| 10672 | |
| 10673 | if (ret != 0) { |
| 10674 | WMI_LOGE("Sending set vht ie cmd failed\n"); |
| 10675 | wmi_buf_free(buf); |
| 10676 | } |
| 10677 | |
| 10678 | return ret; |
| 10679 | } |
| 10680 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 10681 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10682 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10683 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10684 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10685 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10686 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 10687 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 10688 | resource_cfg->num_offload_reorder_buffs = |
| 10689 | tgt_res_cfg->num_offload_reorder_buffs; |
| 10690 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 10691 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 10692 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 10693 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 10694 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 10695 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 10696 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 10697 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 10698 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 10699 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 10700 | resource_cfg->scan_max_pending_req = |
| 10701 | tgt_res_cfg->scan_max_pending_req; |
| 10702 | resource_cfg->bmiss_offload_max_vdev = |
| 10703 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 10704 | resource_cfg->roam_offload_max_vdev = |
| 10705 | tgt_res_cfg->roam_offload_max_vdev; |
| 10706 | resource_cfg->roam_offload_max_ap_profiles = |
| 10707 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 10708 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 10709 | resource_cfg->num_mcast_table_elems = |
| 10710 | tgt_res_cfg->num_mcast_table_elems; |
| 10711 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 10712 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 10713 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 10714 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 10715 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 10716 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 10717 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 10718 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 10719 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 10720 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 10721 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 10722 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 10723 | resource_cfg->num_tdls_conn_table_entries = |
| 10724 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 10725 | resource_cfg->beacon_tx_offload_max_vdev = |
| 10726 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 10727 | resource_cfg->num_multicast_filter_entries = |
| 10728 | tgt_res_cfg->num_multicast_filter_entries; |
| 10729 | resource_cfg->num_wow_filters = |
| 10730 | tgt_res_cfg->num_wow_filters; |
| 10731 | resource_cfg->num_keep_alive_pattern = |
| 10732 | tgt_res_cfg->num_keep_alive_pattern; |
| 10733 | resource_cfg->keep_alive_pattern_size = |
| 10734 | tgt_res_cfg->keep_alive_pattern_size; |
| 10735 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 10736 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 10737 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 10738 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 10739 | resource_cfg->wmi_send_separate = |
| 10740 | tgt_res_cfg->wmi_send_separate; |
| 10741 | resource_cfg->num_ocb_vdevs = |
| 10742 | tgt_res_cfg->num_ocb_vdevs; |
| 10743 | resource_cfg->num_ocb_channels = |
| 10744 | tgt_res_cfg->num_ocb_channels; |
| 10745 | resource_cfg->num_ocb_schedules = |
| 10746 | tgt_res_cfg->num_ocb_schedules; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 10747 | resource_cfg->bpf_instruction_size = tgt_res_cfg->bpf_instruction_size; |
| 10748 | resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters; |
| 10749 | resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10750 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 10751 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10752 | /** |
| 10753 | * send_init_cmd_tlv() - wmi init command |
| 10754 | * @wmi_handle: pointer to wmi handle |
| 10755 | * @res_cfg: resource config |
| 10756 | * @num_mem_chunks: no of mem chunck |
| 10757 | * @mem_chunk: pointer to mem chunck structure |
| 10758 | * |
| 10759 | * This function sends IE information to firmware |
| 10760 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10761 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10762 | * |
| 10763 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10764 | static QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10765 | wmi_resource_config *tgt_res_cfg, |
| 10766 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 10767 | bool action) |
| 10768 | { |
| 10769 | wmi_buf_t buf; |
| 10770 | wmi_init_cmd_fixed_param *cmd; |
| 10771 | wmi_abi_version my_vers; |
| 10772 | int num_whitelist; |
| 10773 | uint8_t *buf_ptr; |
| 10774 | wmi_resource_config *resource_cfg; |
| 10775 | wlan_host_memory_chunk *host_mem_chunks; |
| 10776 | uint32_t mem_chunk_len = 0; |
| 10777 | uint16_t idx; |
| 10778 | int len; |
| 10779 | int ret; |
| 10780 | |
| 10781 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 10782 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 10783 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 10784 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10785 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 10786 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10787 | } |
| 10788 | |
| 10789 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 10790 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 10791 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 10792 | |
| 10793 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 10794 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 10795 | + WMI_TLV_HDR_SIZE); |
| 10796 | |
| 10797 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10798 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 10799 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 10800 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10801 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10802 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 10803 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 10804 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 10805 | |
| 10806 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 10807 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 10808 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 10809 | WMITLV_GET_STRUCT_TLVLEN |
| 10810 | (wlan_host_memory_chunk)); |
| 10811 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 10812 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 10813 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10814 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10815 | idx, host_mem_chunks[idx].size, |
| 10816 | host_mem_chunks[idx].ptr); |
| 10817 | } |
| 10818 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 10819 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 10820 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 10821 | WMITLV_TAG_ARRAY_STRUC, |
| 10822 | (sizeof(wlan_host_memory_chunk) * |
| 10823 | num_mem_chunks)); |
| 10824 | |
| 10825 | num_whitelist = sizeof(version_whitelist) / |
| 10826 | sizeof(wmi_whitelist_version_info); |
| 10827 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 10828 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 10829 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 10830 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 10831 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 10832 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10833 | #ifdef CONFIG_MCL |
| 10834 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 10835 | * on wmi_unified.h from priv.h for using wmi_abi_version type */ |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10836 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 10837 | &my_vers, |
| 10838 | &wmi_handle->fw_abi_version, |
| 10839 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10840 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10841 | 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] | 10842 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 10843 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 10844 | cmd->host_abi_vers.abi_version_ns_0, |
| 10845 | cmd->host_abi_vers.abi_version_ns_1, |
| 10846 | cmd->host_abi_vers.abi_version_ns_2, |
| 10847 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10848 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10849 | /* Save version sent from host - |
| 10850 | * Will be used to check ready event |
| 10851 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10852 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10853 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10854 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10855 | if (action) { |
| 10856 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10857 | WMI_INIT_CMDID); |
| 10858 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10859 | 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] | 10860 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10861 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10862 | } |
| 10863 | } else { |
| 10864 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 10865 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 10866 | } |
| 10867 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10868 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10869 | |
| 10870 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 10871 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10872 | /** |
| 10873 | * send_saved_init_cmd_tlv() - wmi init command |
| 10874 | * @wmi_handle: pointer to wmi handle |
| 10875 | * |
| 10876 | * This function sends IE information to firmware |
| 10877 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10878 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10879 | * |
| 10880 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10881 | static QDF_STATUS send_saved_init_cmd_tlv(wmi_unified_t wmi_handle) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10882 | { |
| 10883 | int status; |
| 10884 | |
| 10885 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 10886 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10887 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 10888 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10889 | } |
| 10890 | status = wmi_unified_cmd_send(wmi_handle, |
| 10891 | wmi_handle->saved_wmi_init_cmd.buf, |
| 10892 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 10893 | WMI_INIT_CMDID); |
| 10894 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10895 | 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] | 10896 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10897 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10898 | } |
| 10899 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 10900 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 10901 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10902 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10903 | } |
| 10904 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10905 | static 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] | 10906 | { |
| 10907 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 10908 | wmi_service_ready_event_fixed_param *ev; |
| 10909 | |
| 10910 | |
| 10911 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 10912 | |
| 10913 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 10914 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10915 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10916 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10917 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10918 | /*Save fw version from service ready message */ |
| 10919 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10920 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10921 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10922 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10923 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10924 | } |
| 10925 | |
| 10926 | /** |
| 10927 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 10928 | * @wmi_handle: pointer to wmi handle |
| 10929 | * @res_cfg: resource config |
| 10930 | * @num_mem_chunks: no of mem chunck |
| 10931 | * @mem_chunk: pointer to mem chunck structure |
| 10932 | * |
| 10933 | * This function sends IE information to firmware |
| 10934 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10935 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10936 | * |
| 10937 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10938 | static 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] | 10939 | void *evt_buf) |
| 10940 | { |
| 10941 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 10942 | wmi_ready_event_fixed_param *ev = NULL; |
| 10943 | |
| 10944 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 10945 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10946 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10947 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 10948 | &ev->fw_abi_vers)) { |
| 10949 | /* |
| 10950 | * Error: Our host version and the given firmware version |
| 10951 | * are incompatible. |
| 10952 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10953 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10954 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 10955 | __func__, |
| 10956 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 10957 | abi_version_0), |
| 10958 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 10959 | abi_version_0), |
| 10960 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 10961 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 10962 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 10963 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 10964 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 10965 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 10966 | ev->fw_abi_vers.abi_version_ns_0, |
| 10967 | ev->fw_abi_vers.abi_version_ns_1, |
| 10968 | ev->fw_abi_vers.abi_version_ns_2, |
| 10969 | ev->fw_abi_vers.abi_version_ns_3); |
| 10970 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10971 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10972 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10973 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10974 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10975 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10976 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 10977 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10978 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10979 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 10980 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10981 | |
| 10982 | /** |
| 10983 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 10984 | * @wmi_handle: wmi handle |
| 10985 | * @custom_addr: base mac address |
| 10986 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10987 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 10988 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10989 | static 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] | 10990 | uint8_t *custom_addr) |
| 10991 | { |
| 10992 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 10993 | wmi_buf_t buf; |
| 10994 | int err; |
| 10995 | |
| 10996 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 10997 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10998 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10999 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11000 | } |
| 11001 | |
| 11002 | 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] | 11003 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11004 | |
| 11005 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11006 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 11007 | WMITLV_GET_STRUCT_TLVLEN |
| 11008 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 11009 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 11010 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11011 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 11012 | sizeof(*cmd), |
| 11013 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 11014 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11015 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11016 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11017 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11018 | } |
| 11019 | |
| 11020 | return 0; |
| 11021 | } |
| 11022 | |
| 11023 | /** |
| 11024 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 11025 | * @handle: wmi handle |
| 11026 | * @event: Event received from FW |
| 11027 | * @len: Length of the event |
| 11028 | * |
| 11029 | * Enables the low frequency events and disables the high frequency |
| 11030 | * events. Bit 17 indicates if the event if low/high frequency. |
| 11031 | * 1 - high frequency, 0 - low frequency |
| 11032 | * |
| 11033 | * Return: 0 on successfully enabling/disabling the events |
| 11034 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11035 | static 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] | 11036 | uint8_t *event, |
| 11037 | uint32_t len) |
| 11038 | { |
| 11039 | uint32_t num_of_diag_events_logs; |
| 11040 | wmi_diag_event_log_config_fixed_param *cmd; |
| 11041 | wmi_buf_t buf; |
| 11042 | uint8_t *buf_ptr; |
| 11043 | uint32_t *cmd_args, *evt_args; |
| 11044 | uint32_t buf_len, i; |
| 11045 | |
| 11046 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 11047 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 11048 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11049 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11050 | |
| 11051 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 11052 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11053 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11054 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11055 | } |
| 11056 | wmi_event = param_buf->fixed_param; |
| 11057 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 11058 | evt_args = param_buf->diag_events_logs_list; |
| 11059 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11060 | 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] | 11061 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11062 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11063 | } |
| 11064 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11065 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11066 | __func__, num_of_diag_events_logs); |
| 11067 | |
| 11068 | /* Free any previous allocation */ |
| 11069 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11070 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11071 | |
| 11072 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11073 | 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] | 11074 | sizeof(uint32_t)); |
| 11075 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11076 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11077 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11078 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11079 | } |
| 11080 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 11081 | |
| 11082 | /* Prepare the send buffer */ |
| 11083 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11084 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 11085 | |
| 11086 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 11087 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11088 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11089 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11090 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11091 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11092 | } |
| 11093 | |
| 11094 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 11095 | buf_ptr = (uint8_t *) cmd; |
| 11096 | |
| 11097 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11098 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 11099 | WMITLV_GET_STRUCT_TLVLEN( |
| 11100 | wmi_diag_event_log_config_fixed_param)); |
| 11101 | |
| 11102 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 11103 | |
| 11104 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 11105 | |
| 11106 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11107 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 11108 | |
| 11109 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11110 | |
| 11111 | /* Populate the events */ |
| 11112 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 11113 | /* Low freq (0) - Enable (1) the event |
| 11114 | * High freq (1) - Disable (0) the event |
| 11115 | */ |
| 11116 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 11117 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 11118 | /* Set the event ID */ |
| 11119 | WMI_DIAG_ID_SET(cmd_args[i], |
| 11120 | WMI_DIAG_ID_GET(evt_args[i])); |
| 11121 | /* Set the type */ |
| 11122 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 11123 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11124 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11125 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 11126 | } |
| 11127 | |
| 11128 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 11129 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11130 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11131 | __func__); |
| 11132 | wmi_buf_free(buf); |
| 11133 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 11134 | * Host can still have this list |
| 11135 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11136 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11137 | } |
| 11138 | |
| 11139 | return 0; |
| 11140 | } |
| 11141 | |
| 11142 | /** |
| 11143 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 11144 | * @wmi_handle: wmi handle |
| 11145 | * @start_log: Start logging related parameters |
| 11146 | * |
| 11147 | * Send the command to the FW based on which specific logging of diag |
| 11148 | * event/log id can be started/stopped |
| 11149 | * |
| 11150 | * Return: None |
| 11151 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11152 | static 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] | 11153 | struct wmi_wifi_start_log *start_log) |
| 11154 | { |
| 11155 | wmi_diag_event_log_config_fixed_param *cmd; |
| 11156 | wmi_buf_t buf; |
| 11157 | uint8_t *buf_ptr; |
| 11158 | uint32_t len, count, log_level, i; |
| 11159 | uint32_t *cmd_args; |
| 11160 | uint32_t total_len; |
| 11161 | count = 0; |
| 11162 | |
| 11163 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11164 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11165 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11166 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11167 | } |
| 11168 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 11169 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 11170 | */ |
| 11171 | total_len = 0; |
| 11172 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 11173 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 11174 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 11175 | total_len++; |
| 11176 | } |
| 11177 | |
| 11178 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11179 | (total_len * sizeof(uint32_t)); |
| 11180 | |
| 11181 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11182 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11183 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11184 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11185 | } |
| 11186 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 11187 | buf_ptr = (uint8_t *) cmd; |
| 11188 | |
| 11189 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11190 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 11191 | WMITLV_GET_STRUCT_TLVLEN( |
| 11192 | wmi_diag_event_log_config_fixed_param)); |
| 11193 | |
| 11194 | cmd->num_of_diag_events_logs = total_len; |
| 11195 | |
| 11196 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 11197 | |
| 11198 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11199 | (total_len * sizeof(uint32_t))); |
| 11200 | |
| 11201 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11202 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 11203 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11204 | log_level = 1; |
| 11205 | else |
| 11206 | log_level = 0; |
| 11207 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11208 | 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] | 11209 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 11210 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 11211 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 11212 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 11213 | |
| 11214 | WMI_DIAG_ID_SET(cmd_args[count], |
| 11215 | WMI_DIAG_ID_GET(val)); |
| 11216 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 11217 | WMI_DIAG_TYPE_GET(val)); |
| 11218 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 11219 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11220 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11221 | count++; |
| 11222 | } |
| 11223 | } |
| 11224 | |
| 11225 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11226 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11227 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11228 | __func__); |
| 11229 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11230 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11231 | } |
| 11232 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11233 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11234 | } |
| 11235 | |
| 11236 | /** |
| 11237 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 11238 | * @wmi_handle: WMI handle |
| 11239 | * |
| 11240 | * This function is used to send the flush command to the FW, |
| 11241 | * that will flush the fw logs that are residue in the FW |
| 11242 | * |
| 11243 | * Return: None |
| 11244 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11245 | static 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] | 11246 | { |
| 11247 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 11248 | wmi_buf_t buf; |
| 11249 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11250 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11251 | |
| 11252 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11253 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11254 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11255 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11256 | } |
| 11257 | |
| 11258 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 11259 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11260 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 11261 | WMITLV_GET_STRUCT_TLVLEN( |
| 11262 | wmi_debug_mesg_flush_fixed_param)); |
| 11263 | cmd->reserved0 = 0; |
| 11264 | |
| 11265 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11266 | buf, |
| 11267 | len, |
| 11268 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11269 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11270 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11271 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11272 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11273 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11274 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11275 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11276 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11277 | } |
| 11278 | |
| 11279 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11280 | * send_pdev_set_pcl_cmd_tlv() - Send WMI_SOC_SET_PCL_CMDID to FW |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11281 | * @wmi_handle: wmi handle |
| 11282 | * @msg: PCL structure containing the PCL and the number of channels |
| 11283 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11284 | * WMI_PDEV_SET_PCL_CMDID provides a Preferred Channel List (PCL) to the WLAN |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11285 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 11286 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 11287 | * to migrate to a new channel without host driver involvement. An example of |
| 11288 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 11289 | * manage the channel selection without firmware involvement. |
| 11290 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11291 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 11292 | * channel list. The weights corresponds to the channels sent in |
| 11293 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 11294 | * weightage compared to the non PCL channels. |
| 11295 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11296 | * Return: Success if the cmd is sent successfully to the firmware |
| 11297 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11298 | static QDF_STATUS send_pdev_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11299 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11300 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11301 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11302 | wmi_buf_t buf; |
| 11303 | uint8_t *buf_ptr; |
| 11304 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11305 | uint32_t chan_len; |
| 11306 | |
| 11307 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11308 | |
| 11309 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11310 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11311 | |
| 11312 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11313 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11314 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11315 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11316 | } |
| 11317 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11318 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11319 | buf_ptr = (uint8_t *) cmd; |
| 11320 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11321 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 11322 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11323 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11324 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 11325 | cmd->num_chan = chan_len; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11326 | WMI_LOGI("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11327 | |
| 11328 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11329 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11330 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11331 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11332 | for (i = 0; i < chan_len ; i++) { |
| 11333 | cmd_args[i] = msg->weighed_valid_list[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11334 | WMI_LOGI("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11335 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11336 | } |
| 11337 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 11338 | WMI_PDEV_SET_PCL_CMDID)) { |
| 11339 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11340 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11341 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11342 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11343 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11344 | } |
| 11345 | |
| 11346 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11347 | * send_pdev_set_hw_mode_cmd_tlv() - Send WMI_PDEV_SET_HW_MODE_CMDID to FW |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11348 | * @wmi_handle: wmi handle |
| 11349 | * @msg: Structure containing the following parameters |
| 11350 | * |
| 11351 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 11352 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 11353 | * |
| 11354 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 11355 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 11356 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 11357 | * |
| 11358 | * Return: Success if the cmd is sent successfully to the firmware |
| 11359 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11360 | static QDF_STATUS send_pdev_set_hw_mode_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11361 | uint32_t hw_mode_index) |
| 11362 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11363 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11364 | wmi_buf_t buf; |
| 11365 | uint32_t len; |
| 11366 | |
| 11367 | len = sizeof(*cmd); |
| 11368 | |
| 11369 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11370 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11371 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11372 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11373 | } |
| 11374 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11375 | cmd = (wmi_pdev_set_hw_mode_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11376 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11377 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 11378 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 11379 | |
| 11380 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11381 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11382 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11383 | |
| 11384 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 11385 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 11386 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11387 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11388 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11389 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11390 | } |
| 11391 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11392 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11393 | } |
| 11394 | |
| 11395 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11396 | * send_pdev_set_dual_mac_config_cmd_tlv() - Set dual mac config to FW |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11397 | * @wmi_handle: wmi handle |
| 11398 | * @msg: Dual MAC config parameters |
| 11399 | * |
| 11400 | * Configures WLAN firmware with the dual MAC features |
| 11401 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11402 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11403 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11404 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11405 | QDF_STATUS send_pdev_set_dual_mac_config_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11406 | struct wmi_dual_mac_config *msg) |
| 11407 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11408 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11409 | wmi_buf_t buf; |
| 11410 | uint32_t len; |
| 11411 | |
| 11412 | len = sizeof(*cmd); |
| 11413 | |
| 11414 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11415 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11416 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11417 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11418 | } |
| 11419 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11420 | cmd = (wmi_pdev_set_mac_config_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11421 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11422 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11423 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11424 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 11425 | |
| 11426 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11427 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 11428 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11429 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11430 | __func__, msg->scan_config, msg->fw_mode_config); |
| 11431 | |
| 11432 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 11433 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 11434 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11435 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11436 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11437 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11438 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11439 | } |
| 11440 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 11441 | #ifdef BIG_ENDIAN_HOST |
| 11442 | /** |
| 11443 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 11444 | * @param data_len - data length |
| 11445 | * @param data - pointer to data |
| 11446 | * |
| 11447 | * Return: QDF_STATUS - success or error status |
| 11448 | */ |
| 11449 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 11450 | struct fips_params *param) |
| 11451 | { |
| 11452 | unsigned char *key_unaligned, *data_unaligned; |
| 11453 | int c; |
| 11454 | u_int8_t *key_aligned = NULL; |
| 11455 | u_int8_t *data_aligned = NULL; |
| 11456 | |
| 11457 | /* Assigning unaligned space to copy the key */ |
| 11458 | key_unaligned = qdf_mem_malloc( |
| 11459 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 11460 | data_unaligned = qdf_mem_malloc( |
| 11461 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 11462 | |
| 11463 | /* Checking if kmalloc is succesful to allocate space */ |
| 11464 | if (key_unaligned == NULL) |
| 11465 | return QDF_STATUS_SUCCESS; |
| 11466 | /* Checking if space is aligned */ |
| 11467 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 11468 | /* align to 4 */ |
| 11469 | key_aligned = |
| 11470 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 11471 | FIPS_ALIGN); |
| 11472 | } else { |
| 11473 | key_aligned = (u_int8_t *)key_unaligned; |
| 11474 | } |
| 11475 | |
| 11476 | /* memset and copy content from key to key aligned */ |
| 11477 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 11478 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 11479 | |
| 11480 | /* print a hexdump for host debug */ |
| 11481 | print_hex_dump(KERN_DEBUG, |
| 11482 | "\t Aligned and Copied Key:@@@@ ", |
| 11483 | DUMP_PREFIX_NONE, |
| 11484 | 16, 1, key_aligned, param->key_len, true); |
| 11485 | |
| 11486 | /* Checking if kmalloc is succesful to allocate space */ |
| 11487 | if (data_unaligned == NULL) |
| 11488 | return QDF_STATUS_SUCCESS; |
| 11489 | /* Checking of space is aligned */ |
| 11490 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 11491 | /* align to 4 */ |
| 11492 | data_aligned = |
| 11493 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 11494 | FIPS_ALIGN); |
| 11495 | } else { |
| 11496 | data_aligned = (u_int8_t *)data_unaligned; |
| 11497 | } |
| 11498 | |
| 11499 | /* memset and copy content from data to data aligned */ |
| 11500 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 11501 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 11502 | |
| 11503 | /* print a hexdump for host debug */ |
| 11504 | print_hex_dump(KERN_DEBUG, |
| 11505 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 11506 | DUMP_PREFIX_NONE, |
| 11507 | 16, 1, data_aligned, param->data_len, true); |
| 11508 | |
| 11509 | /* converting to little Endian both key_aligned and |
| 11510 | * data_aligned*/ |
| 11511 | for (c = 0; c < param->key_len/4; c++) { |
| 11512 | *((u_int32_t *)key_aligned+c) = |
| 11513 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 11514 | } |
| 11515 | for (c = 0; c < param->data_len/4; c++) { |
| 11516 | *((u_int32_t *)data_aligned+c) = |
| 11517 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 11518 | } |
| 11519 | |
| 11520 | /* update endian data to key and data vectors */ |
| 11521 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 11522 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 11523 | |
| 11524 | /* clean up allocated spaces */ |
| 11525 | qdf_mem_free(key_unaligned); |
| 11526 | key_unaligned = NULL; |
| 11527 | key_aligned = NULL; |
| 11528 | |
| 11529 | qdf_mem_free(data_unaligned); |
| 11530 | data_unaligned = NULL; |
| 11531 | data_aligned = NULL; |
| 11532 | |
| 11533 | return QDF_STATUS_SUCCESS; |
| 11534 | } |
| 11535 | #else |
| 11536 | /** |
| 11537 | * fips_align_data_be() - DUMMY for LE platform |
| 11538 | * |
| 11539 | * Return: QDF_STATUS - success |
| 11540 | */ |
| 11541 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 11542 | struct fips_params *param) |
| 11543 | { |
| 11544 | return QDF_STATUS_SUCCESS; |
| 11545 | } |
| 11546 | #endif |
| 11547 | |
| 11548 | |
| 11549 | /** |
| 11550 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 11551 | * @wmi_handle: wmi handle |
| 11552 | * @param: pointer to hold pdev fips param |
| 11553 | * |
| 11554 | * Return: 0 for success or error code |
| 11555 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11556 | static QDF_STATUS |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 11557 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 11558 | struct fips_params *param) |
| 11559 | { |
| 11560 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 11561 | wmi_buf_t buf; |
| 11562 | uint8_t *buf_ptr; |
| 11563 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 11564 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 11565 | |
| 11566 | /* Length TLV placeholder for array of bytes */ |
| 11567 | len += WMI_TLV_HDR_SIZE; |
| 11568 | if (param->data_len) |
| 11569 | len += (param->data_len*sizeof(uint8_t)); |
| 11570 | |
| 11571 | /* |
| 11572 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 11573 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 11574 | * wmi_pdev_fips_cmd structure |
| 11575 | */ |
| 11576 | |
| 11577 | /* do sanity on the input */ |
| 11578 | if (!(((param->data_len & 0xF) == 0) && |
| 11579 | ((param->data_len > 0) && |
| 11580 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 11581 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 11582 | return QDF_STATUS_E_INVAL; |
| 11583 | } |
| 11584 | |
| 11585 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11586 | if (!buf) { |
| 11587 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 11588 | return QDF_STATUS_E_FAILURE; |
| 11589 | } |
| 11590 | |
| 11591 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11592 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 11593 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11594 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 11595 | WMITLV_GET_STRUCT_TLVLEN |
| 11596 | (wmi_pdev_fips_cmd_fixed_param)); |
| 11597 | |
| 11598 | cmd->pdev_id = param->pdev_id; |
| 11599 | if (param->key != NULL && param->data != NULL) { |
| 11600 | cmd->key_len = param->key_len; |
| 11601 | cmd->data_len = param->data_len; |
| 11602 | cmd->fips_cmd = !!(param->op); |
| 11603 | |
| 11604 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 11605 | return QDF_STATUS_E_FAILURE; |
| 11606 | |
| 11607 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 11608 | |
| 11609 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 11610 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 11611 | cmd->mode = param->mode; |
| 11612 | } else { |
| 11613 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 11614 | } |
| 11615 | qdf_print(KERN_ERR "Key len = %d, Data len = %d\n", |
| 11616 | cmd->key_len, cmd->data_len); |
| 11617 | |
| 11618 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 11619 | cmd->key, cmd->key_len, true); |
| 11620 | buf_ptr += sizeof(*cmd); |
| 11621 | |
| 11622 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 11623 | |
| 11624 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11625 | if (param->data_len) |
| 11626 | qdf_mem_copy(buf_ptr, |
| 11627 | (uint8_t *) param->data, param->data_len); |
| 11628 | |
| 11629 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 11630 | 16, 1, buf_ptr, cmd->data_len, true); |
| 11631 | |
| 11632 | buf_ptr += param->data_len; |
| 11633 | |
| 11634 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11635 | WMI_PDEV_FIPS_CMDID); |
| 11636 | qdf_print("%s return value %d\n", __func__, retval); |
| 11637 | } else { |
| 11638 | qdf_print("\n%s:%d Key or Data is NULL\n", __func__, __LINE__); |
| 11639 | wmi_buf_free(buf); |
| 11640 | retval = -QDF_STATUS_E_BADMSG; |
| 11641 | } |
| 11642 | |
| 11643 | return retval; |
| 11644 | } |
| 11645 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11646 | #ifdef WLAN_PMO_ENABLE |
| 11647 | /** |
| 11648 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 11649 | * @wmi_handle: wmi handle |
| 11650 | * @vdev_id: vdev id |
| 11651 | * @bitmap: Event bitmap |
| 11652 | * @enable: enable/disable |
| 11653 | * |
| 11654 | * Return: CDF status |
| 11655 | */ |
| 11656 | static QDF_STATUS send_add_wow_wakeup_event_cmd_tlv(wmi_unified_t wmi_handle, |
| 11657 | uint32_t vdev_id, |
| 11658 | uint32_t bitmap, |
| 11659 | bool enable) |
| 11660 | { |
| 11661 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 11662 | uint16_t len; |
| 11663 | wmi_buf_t buf; |
| 11664 | int ret; |
| 11665 | |
| 11666 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 11667 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11668 | if (!buf) { |
| 11669 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 11670 | return QDF_STATUS_E_NOMEM; |
| 11671 | } |
| 11672 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 11673 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11674 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 11675 | WMITLV_GET_STRUCT_TLVLEN |
| 11676 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 11677 | cmd->vdev_id = vdev_id; |
| 11678 | cmd->is_add = enable; |
| 11679 | cmd->event_bitmap = bitmap; |
| 11680 | |
| 11681 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11682 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 11683 | if (ret) { |
| 11684 | WMI_LOGE("Failed to config wow wakeup event"); |
| 11685 | wmi_buf_free(buf); |
| 11686 | return QDF_STATUS_E_FAILURE; |
| 11687 | } |
| 11688 | |
| 11689 | WMI_LOGD("Wakeup pattern 0x%x %s in fw", bitmap, |
| 11690 | enable ? "enabled" : "disabled"); |
| 11691 | |
| 11692 | return QDF_STATUS_SUCCESS; |
| 11693 | } |
| 11694 | |
| 11695 | /** |
| 11696 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 11697 | * @wmi_handle: wmi handle |
| 11698 | * @vdev_id: vdev id |
| 11699 | * @ptrn_id: pattern id |
| 11700 | * @ptrn: pattern |
| 11701 | * @ptrn_len: pattern length |
| 11702 | * @ptrn_offset: pattern offset |
| 11703 | * @mask: mask |
| 11704 | * @mask_len: mask length |
| 11705 | * @user: true for user configured pattern and false for default pattern |
| 11706 | * @default_patterns: default patterns |
| 11707 | * |
| 11708 | * Return: CDF status |
| 11709 | */ |
| 11710 | static QDF_STATUS send_wow_patterns_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
| 11711 | uint8_t vdev_id, uint8_t ptrn_id, |
| 11712 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 11713 | uint8_t ptrn_offset, const uint8_t *mask, |
| 11714 | uint8_t mask_len, bool user, |
| 11715 | uint8_t default_patterns) |
| 11716 | { |
| 11717 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 11718 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 11719 | wmi_buf_t buf; |
| 11720 | uint8_t *buf_ptr; |
| 11721 | int32_t len; |
| 11722 | int ret; |
| 11723 | |
| 11724 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 11725 | WMI_TLV_HDR_SIZE + |
| 11726 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 11727 | WMI_TLV_HDR_SIZE + |
| 11728 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 11729 | WMI_TLV_HDR_SIZE + |
| 11730 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 11731 | WMI_TLV_HDR_SIZE + |
| 11732 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 11733 | WMI_TLV_HDR_SIZE + |
| 11734 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 11735 | |
| 11736 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11737 | if (!buf) { |
| 11738 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 11739 | return QDF_STATUS_E_NOMEM; |
| 11740 | } |
| 11741 | |
| 11742 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 11743 | buf_ptr = (uint8_t *) cmd; |
| 11744 | |
| 11745 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11746 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 11747 | WMITLV_GET_STRUCT_TLVLEN |
| 11748 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 11749 | cmd->vdev_id = vdev_id; |
| 11750 | cmd->pattern_id = ptrn_id; |
| 11751 | |
| 11752 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 11753 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 11754 | |
| 11755 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11756 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 11757 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11758 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 11759 | |
| 11760 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 11761 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 11762 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 11763 | |
| 11764 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 11765 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
| 11766 | |
| 11767 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 11768 | bitmap_pattern->pattern_len = ptrn_len; |
| 11769 | |
| 11770 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 11771 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 11772 | |
| 11773 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 11774 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 11775 | |
| 11776 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 11777 | bitmap_pattern->pattern_id = ptrn_id; |
| 11778 | |
| 11779 | WMI_LOGI("vdev: %d, ptrn id: %d, ptrn len: %d, ptrn offset: %d user %d", |
| 11780 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 11781 | bitmap_pattern->pattern_offset, user); |
| 11782 | WMI_LOGI("Pattern : "); |
| 11783 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 11784 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 11785 | |
| 11786 | WMI_LOGI("Mask : "); |
| 11787 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 11788 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
| 11789 | |
| 11790 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 11791 | |
| 11792 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 11793 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 11794 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11795 | |
| 11796 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 11797 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 11798 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11799 | |
| 11800 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 11801 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 11802 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11803 | |
| 11804 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 11805 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 11806 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11807 | |
| 11808 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 11809 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 11810 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11811 | *(A_UINT32 *) buf_ptr = 0; |
| 11812 | |
| 11813 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11814 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 11815 | if (ret) { |
| 11816 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
| 11817 | wmi_buf_free(buf); |
| 11818 | return QDF_STATUS_E_FAILURE; |
| 11819 | } |
| 11820 | |
| 11821 | return QDF_STATUS_SUCCESS; |
| 11822 | } |
| 11823 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11824 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11825 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 11826 | * @wmi_handle: wmi handle |
| 11827 | * @offload_req: offload request |
| 11828 | * @buf_ptr: buffer pointer |
| 11829 | * |
| 11830 | * To fill ARP offload data to firmware |
| 11831 | * when target goes to wow mode. |
| 11832 | * |
| 11833 | * Return: None |
| 11834 | */ |
| 11835 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11836 | struct pmo_arp_offload_params *offload_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11837 | { |
| 11838 | |
| 11839 | int i; |
| 11840 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11841 | bool enable_or_disable = offload_req->enable; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11842 | |
| 11843 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11844 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 11845 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 11846 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 11847 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 11848 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 11849 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 11850 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 11851 | |
| 11852 | /* Fill data for ARP and NS in the first tupple for LA */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11853 | if ((enable_or_disable & PMO_OFFLOAD_ENABLE) && (i == 0)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11854 | /* Copy the target ip addr and flags */ |
| 11855 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 11856 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11857 | offload_req->host_ipv4_addr, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11858 | WMI_IPV4_ADDR_LEN); |
| 11859 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11860 | offload_req->host_ipv4_addr); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11861 | } |
| 11862 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 11863 | } |
| 11864 | } |
| 11865 | |
| 11866 | #ifdef WLAN_NS_OFFLOAD |
| 11867 | /** |
| 11868 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 11869 | * @wmi|_handle: wmi handle |
| 11870 | * @offload_req: offload request |
| 11871 | * @buf_ptr: buffer pointer |
| 11872 | * |
| 11873 | * To fill NS offload data to firmware |
| 11874 | * when target goes to wow mode. |
| 11875 | * |
| 11876 | * Return: None |
| 11877 | */ |
| 11878 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11879 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11880 | { |
| 11881 | |
| 11882 | int i; |
| 11883 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11884 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11885 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11886 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 11887 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 11888 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 11889 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 11890 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 11891 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 11892 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 11893 | |
| 11894 | /* |
| 11895 | * Fill data only for NS offload in the first ARP tuple for LA |
| 11896 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11897 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11898 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 11899 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11900 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11901 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11902 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11903 | sizeof(WMI_IPV6_ADDR)); |
| 11904 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11905 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11906 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11907 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11908 | ns_tuple->flags |= |
| 11909 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 11910 | } |
| 11911 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11912 | i, &ns_req->self_ipv6_addr[i], |
| 11913 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11914 | |
| 11915 | /* target MAC is optional, check if it is valid, |
| 11916 | * if this is not valid, the target will use the known |
| 11917 | * local MAC address rather than the tuple |
| 11918 | */ |
| 11919 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11920 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11921 | &ns_tuple->target_mac); |
| 11922 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 11923 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 11924 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 11925 | } |
| 11926 | } |
| 11927 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 11928 | } |
| 11929 | } |
| 11930 | |
| 11931 | |
| 11932 | /** |
| 11933 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 11934 | * @wmi: wmi handle |
| 11935 | * @offload_req: offload request |
| 11936 | * @buf_ptr: buffer pointer |
| 11937 | * |
| 11938 | * To fill extended NS offload extended data to firmware |
| 11939 | * when target goes to wow mode. |
| 11940 | * |
| 11941 | * Return: None |
| 11942 | */ |
| 11943 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11944 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11945 | { |
| 11946 | int i; |
| 11947 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 11948 | uint32_t count, num_ns_ext_tuples; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11949 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11950 | count = ns_req->num_ns_offload_count; |
| 11951 | num_ns_ext_tuples = ns_req->num_ns_offload_count - |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11952 | WMI_MAX_NS_OFFLOADS; |
| 11953 | |
| 11954 | /* Populate extended NS offload tuples */ |
| 11955 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11956 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 11957 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 11958 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 11959 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 11960 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 11961 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 11962 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 11963 | |
| 11964 | /* |
| 11965 | * Fill data only for NS offload in the first ARP tuple for LA |
| 11966 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11967 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11968 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 11969 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11970 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11971 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11972 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11973 | sizeof(WMI_IPV6_ADDR)); |
| 11974 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11975 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11976 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11977 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11978 | ns_tuple->flags |= |
| 11979 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 11980 | } |
| 11981 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11982 | i, &ns_req->self_ipv6_addr[i], |
| 11983 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11984 | |
| 11985 | /* target MAC is optional, check if it is valid, |
| 11986 | * if this is not valid, the target will use the |
| 11987 | * known local MAC address rather than the tuple |
| 11988 | */ |
| 11989 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 11990 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 11991 | &ns_tuple->target_mac); |
| 11992 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 11993 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 11994 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 11995 | } |
| 11996 | } |
| 11997 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 11998 | } |
| 11999 | } |
| 12000 | #else |
| 12001 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12002 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12003 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12004 | } |
| 12005 | |
| 12006 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12007 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12008 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12009 | } |
| 12010 | #endif |
| 12011 | |
| 12012 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12013 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 12014 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12015 | * @arp_offload_req: arp offload request |
| 12016 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12017 | * @arp_only: flag |
| 12018 | * |
| 12019 | * To configure ARP NS off load data to firmware |
| 12020 | * when target goes to wow mode. |
| 12021 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12022 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12023 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12024 | static QDF_STATUS send_enable_arp_ns_offload_cmd_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12025 | struct pmo_arp_offload_params *arp_offload_req, |
| 12026 | struct pmo_ns_offload_params *ns_offload_req, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12027 | uint8_t vdev_id) |
| 12028 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12029 | int32_t res; |
| 12030 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12031 | A_UINT8 *buf_ptr; |
| 12032 | wmi_buf_t buf; |
| 12033 | int32_t len; |
| 12034 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 12035 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12036 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12037 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12038 | /* |
| 12039 | * TLV place holder size for array of NS tuples |
| 12040 | * TLV place holder size for array of ARP tuples |
| 12041 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12042 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 12043 | WMI_TLV_HDR_SIZE + |
| 12044 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 12045 | WMI_TLV_HDR_SIZE + |
| 12046 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12047 | |
| 12048 | /* |
| 12049 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 12050 | * extra length for extended NS offload tuples which follows ARP offload |
| 12051 | * tuples. Host needs to fill this structure in following format: |
| 12052 | * 2 NS ofload tuples |
| 12053 | * 2 ARP offload tuples |
| 12054 | * N numbers of extended NS offload tuples if HDD has given more than |
| 12055 | * 2 NS offload addresses |
| 12056 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12057 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12058 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12059 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 12060 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12061 | } |
| 12062 | |
| 12063 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12064 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12065 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12066 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12067 | } |
| 12068 | |
| 12069 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 12070 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 12071 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12072 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 12073 | WMITLV_GET_STRUCT_TLVLEN |
| 12074 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 12075 | cmd->flags = 0; |
| 12076 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12077 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12078 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12079 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12080 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12081 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12082 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 12083 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 12084 | if (num_ns_ext_tuples) |
| 12085 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12086 | |
| 12087 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12088 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 12089 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12090 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12091 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12092 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12093 | } |
| 12094 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12095 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12096 | } |
| 12097 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12098 | /** |
| 12099 | * send_enable_enhance_multicast_offload_tlv() - send enhance multicast offload |
| 12100 | * @wmi_handle: wmi handle |
| 12101 | * @vdev_id: vdev id |
| 12102 | * @action: true for enable else false |
| 12103 | * |
| 12104 | * To enable enhance multicast offload to firmware |
| 12105 | * when target goes to wow mode. |
| 12106 | * |
| 12107 | * Return: QDF Status |
| 12108 | */ |
| 12109 | |
| 12110 | static |
| 12111 | QDF_STATUS send_enable_enhance_multicast_offload_tlv( |
| 12112 | wmi_unified_t wmi_handle, |
| 12113 | uint8_t vdev_id, bool action) |
| 12114 | { |
| 12115 | QDF_STATUS status; |
| 12116 | wmi_buf_t buf; |
| 12117 | wmi_config_enhanced_mcast_filter_cmd_fixed_param *cmd; |
| 12118 | |
| 12119 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12120 | if (!buf) { |
| 12121 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 12122 | return QDF_STATUS_E_NOMEM; |
| 12123 | } |
| 12124 | |
| 12125 | cmd = (wmi_config_enhanced_mcast_filter_cmd_fixed_param *) |
| 12126 | wmi_buf_data(buf); |
| 12127 | |
| 12128 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12129 | WMITLV_TAG_STRUC_wmi_config_enhanced_mcast_filter_fixed_param, |
| 12130 | WMITLV_GET_STRUCT_TLVLEN( |
| 12131 | wmi_config_enhanced_mcast_filter_cmd_fixed_param)); |
| 12132 | |
| 12133 | cmd->vdev_id = vdev_id; |
| 12134 | cmd->enable = ((action == 0) ? ENHANCED_MCAST_FILTER_DISABLED : |
| 12135 | ENHANCED_MCAST_FILTER_ENABLED); |
| 12136 | WMI_LOGD("%s: config enhance multicast offload action %d for vdev %d", |
| 12137 | __func__, action, vdev_id); |
| 12138 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 12139 | sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID); |
| 12140 | if (status != QDF_STATUS_SUCCESS) { |
| 12141 | qdf_nbuf_free(buf); |
| 12142 | WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID", |
| 12143 | __func__); |
| 12144 | } |
| 12145 | |
| 12146 | return status; |
| 12147 | } |
| 12148 | |
| 12149 | /** |
| 12150 | * extract_gtk_rsp_event_tlv() - extract gtk rsp params from event |
| 12151 | * @wmi_handle: wmi handle |
| 12152 | * @param evt_buf: pointer to event buffer |
| 12153 | * @param hdr: Pointer to hold header |
| 12154 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 12155 | * |
| 12156 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12157 | */ |
| 12158 | static QDF_STATUS extract_gtk_rsp_event_tlv(wmi_unified_t wmi_handle, |
| 12159 | void *evt_buf, struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len) |
| 12160 | { |
| 12161 | WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *fixed_param; |
| 12162 | WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *param_buf; |
| 12163 | |
| 12164 | param_buf = (WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *)evt_buf; |
| 12165 | if (!param_buf) { |
| 12166 | WMI_LOGE("gtk param_buf is NULL"); |
| 12167 | return QDF_STATUS_E_INVAL; |
| 12168 | } |
| 12169 | |
| 12170 | if (len < sizeof(WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param)) { |
| 12171 | WMI_LOGE("Invalid length for GTK status"); |
| 12172 | return QDF_STATUS_E_INVAL; |
| 12173 | } |
| 12174 | |
| 12175 | fixed_param = (WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *) |
| 12176 | param_buf->fixed_param; |
| 12177 | gtk_rsp_param->vdev_id = fixed_param->vdev_id; |
| 12178 | gtk_rsp_param->status_flag = QDF_STATUS_SUCCESS; |
| 12179 | gtk_rsp_param->refresh_cnt = fixed_param->refresh_cnt; |
| 12180 | qdf_mem_copy(>k_rsp_param->replay_counter, |
| 12181 | &fixed_param->replay_counter, |
| 12182 | GTK_REPLAY_COUNTER_BYTES); |
| 12183 | |
| 12184 | return QDF_STATUS_SUCCESS; |
| 12185 | |
| 12186 | } |
| 12187 | |
| 12188 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 12189 | /** |
| 12190 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 12191 | * @wmi_handle: wmi handle |
| 12192 | * @vdev_id: vdev id |
| 12193 | * |
| 12194 | * Return: CDF status |
| 12195 | */ |
| 12196 | static QDF_STATUS send_wow_sta_ra_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 12197 | uint8_t vdev_id, uint8_t default_pattern, |
| 12198 | uint16_t rate_limit_interval) |
| 12199 | { |
| 12200 | |
| 12201 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 12202 | wmi_buf_t buf; |
| 12203 | uint8_t *buf_ptr; |
| 12204 | int32_t len; |
| 12205 | int ret; |
| 12206 | |
| 12207 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 12208 | WMI_TLV_HDR_SIZE + |
| 12209 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 12210 | WMI_TLV_HDR_SIZE + |
| 12211 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 12212 | WMI_TLV_HDR_SIZE + |
| 12213 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 12214 | WMI_TLV_HDR_SIZE + |
| 12215 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 12216 | WMI_TLV_HDR_SIZE + |
| 12217 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 12218 | |
| 12219 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12220 | if (!buf) { |
| 12221 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 12222 | return QDF_STATUS_E_NOMEM; |
| 12223 | } |
| 12224 | |
| 12225 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 12226 | buf_ptr = (uint8_t *) cmd; |
| 12227 | |
| 12228 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12229 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 12230 | WMITLV_GET_STRUCT_TLVLEN |
| 12231 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 12232 | cmd->vdev_id = vdev_id; |
| 12233 | cmd->pattern_id = default_pattern, |
| 12234 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 12235 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 12236 | |
| 12237 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 12238 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12239 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12240 | |
| 12241 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 12242 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12243 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12244 | |
| 12245 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 12246 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12247 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12248 | |
| 12249 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 12250 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12251 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12252 | |
| 12253 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 12254 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 12255 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12256 | |
| 12257 | /* Fill TLV for ra_ratelimit_interval. */ |
| 12258 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 12259 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12260 | |
| 12261 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 12262 | |
| 12263 | WMI_LOGD("%s: send RA rate limit [%d] to fw vdev = %d", __func__, |
| 12264 | rate_limit_interval, vdev_id); |
| 12265 | |
| 12266 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12267 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 12268 | if (ret) { |
| 12269 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
| 12270 | wmi_buf_free(buf); |
| 12271 | return QDF_STATUS_E_FAILURE; |
| 12272 | } |
| 12273 | |
| 12274 | return QDF_STATUS_SUCCESS; |
| 12275 | |
| 12276 | } |
| 12277 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 12278 | |
| 12279 | /** |
| 12280 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 12281 | * @wmi_handle: wmi handle |
| 12282 | * @vdev_id: vdev id |
| 12283 | * @multicastAddr: mcast address |
| 12284 | * @clearList: clear list flag |
| 12285 | * |
| 12286 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12287 | */ |
| 12288 | static QDF_STATUS send_add_clear_mcbc_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 12289 | uint8_t vdev_id, |
| 12290 | struct qdf_mac_addr multicast_addr, |
| 12291 | bool clearList) |
| 12292 | { |
| 12293 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 12294 | wmi_buf_t buf; |
| 12295 | int err; |
| 12296 | |
| 12297 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12298 | if (!buf) { |
| 12299 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 12300 | return QDF_STATUS_E_NOMEM; |
| 12301 | } |
| 12302 | |
| 12303 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
| 12304 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 12305 | |
| 12306 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12307 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 12308 | WMITLV_GET_STRUCT_TLVLEN |
| 12309 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 12310 | cmd->action = |
| 12311 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 12312 | cmd->vdev_id = vdev_id; |
| 12313 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
| 12314 | |
| 12315 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 12316 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 12317 | |
| 12318 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 12319 | sizeof(*cmd), |
| 12320 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 12321 | if (err) { |
| 12322 | WMI_LOGE("Failed to send set_param cmd"); |
| 12323 | wmi_buf_free(buf); |
| 12324 | return QDF_STATUS_E_FAILURE; |
| 12325 | } |
| 12326 | |
| 12327 | return QDF_STATUS_SUCCESS; |
| 12328 | } |
| 12329 | |
| 12330 | /** |
| 12331 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 12332 | * @wmi_handle: wmi handle |
| 12333 | * @vdev_id: vdev id |
| 12334 | * @params: GTK offload parameters |
| 12335 | * |
| 12336 | * Return: CDF status |
| 12337 | */ |
| 12338 | static |
| 12339 | QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
| 12340 | struct pmo_gtk_req *params, |
| 12341 | bool enable_offload, |
| 12342 | uint32_t gtk_offload_opcode) |
| 12343 | { |
| 12344 | int len; |
| 12345 | wmi_buf_t buf; |
| 12346 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 12347 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12348 | |
| 12349 | WMI_LOGD("%s Enter", __func__); |
| 12350 | |
| 12351 | len = sizeof(*cmd); |
| 12352 | |
| 12353 | /* alloc wmi buffer */ |
| 12354 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12355 | if (!buf) { |
| 12356 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 12357 | status = QDF_STATUS_E_NOMEM; |
| 12358 | goto out; |
| 12359 | } |
| 12360 | |
| 12361 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 12362 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12363 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 12364 | WMITLV_GET_STRUCT_TLVLEN |
| 12365 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 12366 | |
| 12367 | cmd->vdev_id = vdev_id; |
| 12368 | |
| 12369 | /* Request target to enable GTK offload */ |
| 12370 | if (enable_offload == PMO_GTK_OFFLOAD_ENABLE) { |
| 12371 | cmd->flags = gtk_offload_opcode; |
| 12372 | |
| 12373 | /* Copy the keys and replay counter */ |
| 12374 | qdf_mem_copy(cmd->KCK, params->kck, PMO_KCK_LEN); |
| 12375 | qdf_mem_copy(cmd->KEK, params->kek, PMO_KEK_LEN); |
| 12376 | qdf_mem_copy(cmd->replay_counter, ¶ms->replay_counter, |
| 12377 | GTK_REPLAY_COUNTER_BYTES); |
| 12378 | } else { |
| 12379 | cmd->flags = gtk_offload_opcode; |
| 12380 | } |
| 12381 | |
| 12382 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 12383 | |
| 12384 | /* send the wmi command */ |
| 12385 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12386 | WMI_GTK_OFFLOAD_CMDID)) { |
| 12387 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
| 12388 | wmi_buf_free(buf); |
| 12389 | status = QDF_STATUS_E_FAILURE; |
| 12390 | } |
| 12391 | |
| 12392 | out: |
| 12393 | WMI_LOGD("%s Exit", __func__); |
| 12394 | return status; |
| 12395 | } |
| 12396 | |
| 12397 | /** |
| 12398 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 12399 | * @wmi_handle: wmi handle |
| 12400 | * @params: GTK offload params |
| 12401 | * |
| 12402 | * Return: CDF status |
| 12403 | */ |
| 12404 | static QDF_STATUS send_process_gtk_offload_getinfo_cmd_tlv( |
| 12405 | wmi_unified_t wmi_handle, |
| 12406 | uint8_t vdev_id, |
| 12407 | uint64_t offload_req_opcode) |
| 12408 | { |
| 12409 | int len; |
| 12410 | wmi_buf_t buf; |
| 12411 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 12412 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12413 | |
| 12414 | len = sizeof(*cmd); |
| 12415 | |
| 12416 | /* alloc wmi buffer */ |
| 12417 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12418 | if (!buf) { |
| 12419 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 12420 | status = QDF_STATUS_E_NOMEM; |
| 12421 | goto out; |
| 12422 | } |
| 12423 | |
| 12424 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 12425 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12426 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 12427 | WMITLV_GET_STRUCT_TLVLEN |
| 12428 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 12429 | |
| 12430 | /* Request for GTK offload status */ |
| 12431 | cmd->flags = offload_req_opcode; |
| 12432 | cmd->vdev_id = vdev_id; |
| 12433 | |
| 12434 | /* send the wmi command */ |
| 12435 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12436 | WMI_GTK_OFFLOAD_CMDID)) { |
| 12437 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
| 12438 | wmi_buf_free(buf); |
| 12439 | status = QDF_STATUS_E_FAILURE; |
| 12440 | } |
| 12441 | |
| 12442 | out: |
| 12443 | return status; |
| 12444 | } |
| 12445 | |
| 12446 | /** |
| 12447 | * send_action_frame_patterns_cmd_tlv() - send wmi cmd of action filter params |
| 12448 | * @wmi_handle: wmi handler |
| 12449 | * @action_params: pointer to action_params |
| 12450 | * |
| 12451 | * Return: 0 for success, otherwise appropriate error code |
| 12452 | */ |
| 12453 | static QDF_STATUS send_action_frame_patterns_cmd_tlv(wmi_unified_t wmi_handle, |
| 12454 | struct pmo_action_wakeup_set_params *action_params) |
| 12455 | { |
| 12456 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *cmd; |
| 12457 | wmi_buf_t buf; |
| 12458 | int i; |
| 12459 | int32_t err; |
| 12460 | |
| 12461 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12462 | if (!buf) { |
| 12463 | WMI_LOGE("Failed to allocate buffer to send action filter cmd"); |
| 12464 | return QDF_STATUS_E_NOMEM; |
| 12465 | } |
| 12466 | cmd = (WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *) wmi_buf_data(buf); |
| 12467 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12468 | WMITLV_TAG_STRUC_wmi_wow_set_action_wake_up_cmd_fixed_param, |
| 12469 | WMITLV_GET_STRUCT_TLVLEN( |
| 12470 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param)); |
| 12471 | |
| 12472 | cmd->vdev_id = action_params->vdev_id; |
| 12473 | cmd->operation = action_params->operation; |
| 12474 | |
| 12475 | for (i = 0; i < MAX_SUPPORTED_ACTION_CATEGORY_ELE_LIST; i++) |
| 12476 | cmd->action_category_map[i] = |
| 12477 | action_params->action_category_map[i]; |
| 12478 | |
| 12479 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 12480 | sizeof(*cmd), WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
| 12481 | if (err) { |
| 12482 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
| 12483 | wmi_buf_free(buf); |
| 12484 | return QDF_STATUS_E_FAILURE; |
| 12485 | } |
| 12486 | |
| 12487 | return QDF_STATUS_SUCCESS; |
| 12488 | } |
| 12489 | |
| 12490 | #ifdef FEATURE_WLAN_LPHB |
| 12491 | |
| 12492 | /** |
| 12493 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 12494 | * @wmi_handle: wmi handle |
| 12495 | * @lphb_conf_req: configuration info |
| 12496 | * |
| 12497 | * Return: CDF status |
| 12498 | */ |
| 12499 | static QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle, |
| 12500 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 12501 | { |
| 12502 | QDF_STATUS status; |
| 12503 | wmi_buf_t buf = NULL; |
| 12504 | uint8_t *buf_ptr; |
| 12505 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 12506 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 12507 | |
| 12508 | |
| 12509 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12510 | if (!buf) { |
| 12511 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 12512 | return QDF_STATUS_E_NOMEM; |
| 12513 | } |
| 12514 | |
| 12515 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12516 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 12517 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 12518 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 12519 | WMITLV_GET_STRUCT_TLVLEN |
| 12520 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 12521 | |
| 12522 | /* fill in values */ |
| 12523 | hb_enable_fp->vdev_id = params->session; |
| 12524 | hb_enable_fp->enable = params->enable; |
| 12525 | hb_enable_fp->item = params->item; |
| 12526 | hb_enable_fp->session = params->session; |
| 12527 | |
| 12528 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 12529 | len, WMI_HB_SET_ENABLE_CMDID); |
| 12530 | if (QDF_IS_STATUS_ERROR(status)) { |
| 12531 | WMI_LOGE("cmd_send WMI_HB_SET_ENABLE returned Error %d", |
| 12532 | status); |
| 12533 | wmi_buf_free(buf); |
| 12534 | } |
| 12535 | |
| 12536 | return status; |
| 12537 | } |
| 12538 | |
| 12539 | /** |
| 12540 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 12541 | * @wmi_handle: wmi handle |
| 12542 | * @lphb_conf_req: lphb config request |
| 12543 | * |
| 12544 | * Return: CDF status |
| 12545 | */ |
| 12546 | static QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 12547 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 12548 | { |
| 12549 | QDF_STATUS status; |
| 12550 | wmi_buf_t buf = NULL; |
| 12551 | uint8_t *buf_ptr; |
| 12552 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 12553 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 12554 | |
| 12555 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12556 | if (!buf) { |
| 12557 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 12558 | return QDF_STATUS_E_NOMEM; |
| 12559 | } |
| 12560 | |
| 12561 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12562 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 12563 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 12564 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 12565 | WMITLV_GET_STRUCT_TLVLEN |
| 12566 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 12567 | |
| 12568 | /* fill in values */ |
| 12569 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 12570 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 12571 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 12572 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 12573 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 12574 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 12575 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 12576 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 12577 | hb_tcp_params_fp->session = lphb_conf_req->session; |
| 12578 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
| 12579 | &lphb_conf_req->gateway_mac, |
| 12580 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 12581 | |
| 12582 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 12583 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
| 12584 | if (QDF_IS_STATUS_ERROR(status)) { |
| 12585 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", |
| 12586 | status); |
| 12587 | wmi_buf_free(buf); |
| 12588 | } |
| 12589 | |
| 12590 | return status; |
| 12591 | } |
| 12592 | |
| 12593 | /** |
| 12594 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 12595 | * @wmi_handle: wmi handle |
| 12596 | * @lphb_conf_req: lphb config request |
| 12597 | * |
| 12598 | * Return: CDF status |
| 12599 | */ |
| 12600 | static |
| 12601 | QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 12602 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 12603 | { |
| 12604 | QDF_STATUS status; |
| 12605 | wmi_buf_t buf = NULL; |
| 12606 | uint8_t *buf_ptr; |
| 12607 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 12608 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 12609 | |
| 12610 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12611 | if (!buf) { |
| 12612 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 12613 | return QDF_STATUS_E_NOMEM; |
| 12614 | } |
| 12615 | |
| 12616 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12617 | hb_tcp_filter_fp = |
| 12618 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 12619 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 12620 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 12621 | WMITLV_GET_STRUCT_TLVLEN |
| 12622 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 12623 | |
| 12624 | /* fill in values */ |
| 12625 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 12626 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 12627 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 12628 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 12629 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 12630 | (void *)&g_hb_tcp_filter_fp->filter, |
| 12631 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 12632 | |
| 12633 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 12634 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 12635 | if (QDF_IS_STATUS_ERROR(status)) { |
| 12636 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", |
| 12637 | status); |
| 12638 | wmi_buf_free(buf); |
| 12639 | } |
| 12640 | |
| 12641 | return status; |
| 12642 | } |
| 12643 | |
| 12644 | /** |
| 12645 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 12646 | * @wmi_handle: wmi handle |
| 12647 | * @lphb_conf_req: lphb config request |
| 12648 | * |
| 12649 | * Return: CDF status |
| 12650 | */ |
| 12651 | static QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 12652 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 12653 | { |
| 12654 | QDF_STATUS status; |
| 12655 | wmi_buf_t buf = NULL; |
| 12656 | uint8_t *buf_ptr; |
| 12657 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 12658 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 12659 | |
| 12660 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12661 | if (!buf) { |
| 12662 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 12663 | return QDF_STATUS_E_NOMEM; |
| 12664 | } |
| 12665 | |
| 12666 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12667 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 12668 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 12669 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 12670 | WMITLV_GET_STRUCT_TLVLEN |
| 12671 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 12672 | |
| 12673 | /* fill in values */ |
| 12674 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 12675 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 12676 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 12677 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 12678 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 12679 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 12680 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 12681 | hb_udp_params_fp->session = lphb_conf_req->session; |
| 12682 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
| 12683 | &lphb_conf_req->gateway_mac, |
| 12684 | sizeof(lphb_conf_req->gateway_mac)); |
| 12685 | |
| 12686 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 12687 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
| 12688 | if (QDF_IS_STATUS_ERROR(status)) { |
| 12689 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", |
| 12690 | status); |
| 12691 | wmi_buf_free(buf); |
| 12692 | } |
| 12693 | |
| 12694 | return status; |
| 12695 | } |
| 12696 | |
| 12697 | /** |
| 12698 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 12699 | * @wmi_handle: wmi handle |
| 12700 | * @lphb_conf_req: lphb config request |
| 12701 | * |
| 12702 | * Return: CDF status |
| 12703 | */ |
| 12704 | static |
| 12705 | QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 12706 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 12707 | { |
| 12708 | QDF_STATUS status; |
| 12709 | wmi_buf_t buf = NULL; |
| 12710 | uint8_t *buf_ptr; |
| 12711 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 12712 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 12713 | |
| 12714 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12715 | if (!buf) { |
| 12716 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 12717 | return QDF_STATUS_E_NOMEM; |
| 12718 | } |
| 12719 | |
| 12720 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12721 | hb_udp_filter_fp = |
| 12722 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 12723 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 12724 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 12725 | WMITLV_GET_STRUCT_TLVLEN |
| 12726 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 12727 | |
| 12728 | /* fill in values */ |
| 12729 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 12730 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 12731 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 12732 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 12733 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 12734 | (void *)&lphb_conf_req->filter, |
| 12735 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 12736 | |
| 12737 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 12738 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 12739 | if (QDF_IS_STATUS_ERROR(status)) { |
| 12740 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", |
| 12741 | status); |
| 12742 | wmi_buf_free(buf); |
| 12743 | } |
| 12744 | |
| 12745 | return status; |
| 12746 | } |
| 12747 | #endif /* FEATURE_WLAN_LPHB */ |
| 12748 | #endif /* End of WLAN_PMO_ENABLE */ |
| 12749 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12750 | static QDF_STATUS send_enable_broadcast_filter_cmd_tlv(wmi_unified_t wmi_handle, |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 12751 | uint8_t vdev_id, bool enable) |
| 12752 | { |
| 12753 | int32_t res; |
| 12754 | wmi_hw_data_filter_cmd_fixed_param *cmd; |
| 12755 | A_UINT8 *buf_ptr; |
| 12756 | wmi_buf_t buf; |
| 12757 | int32_t len; |
| 12758 | |
| 12759 | /* |
| 12760 | * TLV place holder size for array of ARP tuples |
| 12761 | */ |
| 12762 | len = sizeof(wmi_hw_data_filter_cmd_fixed_param); |
| 12763 | |
| 12764 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12765 | if (!buf) { |
| 12766 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12767 | return QDF_STATUS_E_NOMEM; |
| 12768 | } |
| 12769 | |
| 12770 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 12771 | cmd = (wmi_hw_data_filter_cmd_fixed_param *) buf_ptr; |
| 12772 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12773 | WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param, |
| 12774 | WMITLV_GET_STRUCT_TLVLEN |
| 12775 | (wmi_hw_data_filter_cmd_fixed_param)); |
| 12776 | cmd->vdev_id = vdev_id; |
| 12777 | cmd->enable = enable; |
| 12778 | cmd->hw_filter_bitmap = WMI_HW_DATA_FILTER_DROP_NON_ARP_BC; |
| 12779 | |
| 12780 | WMI_LOGD("HW Broadcast Filter vdev_id: %d", cmd->vdev_id); |
| 12781 | |
| 12782 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12783 | WMI_HW_DATA_FILTER_CMDID); |
| 12784 | if (res) { |
| 12785 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
| 12786 | wmi_buf_free(buf); |
| 12787 | return QDF_STATUS_E_FAILURE; |
| 12788 | } |
| 12789 | |
| 12790 | return QDF_STATUS_SUCCESS; |
| 12791 | } |
| 12792 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12793 | /** |
| 12794 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 12795 | * @wmi_handle: wmi handle |
| 12796 | * @request: SSID hotlist set request |
| 12797 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12798 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12799 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12800 | static QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12801 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 12802 | struct ssid_hotlist_request_params *request) |
| 12803 | { |
| 12804 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 12805 | wmi_buf_t wmi_buf; |
| 12806 | uint32_t len; |
| 12807 | uint32_t array_size; |
| 12808 | uint8_t *buf_ptr; |
| 12809 | |
| 12810 | /* length of fixed portion */ |
| 12811 | len = sizeof(*cmd); |
| 12812 | |
| 12813 | /* length of variable portion */ |
| 12814 | array_size = |
| 12815 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 12816 | len += WMI_TLV_HDR_SIZE + array_size; |
| 12817 | |
| 12818 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 12819 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12820 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12821 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12822 | } |
| 12823 | |
| 12824 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 12825 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 12826 | buf_ptr; |
| 12827 | WMITLV_SET_HDR |
| 12828 | (&cmd->tlv_header, |
| 12829 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 12830 | WMITLV_GET_STRUCT_TLVLEN |
| 12831 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 12832 | |
| 12833 | cmd->request_id = request->request_id; |
| 12834 | cmd->requestor_id = 0; |
| 12835 | cmd->vdev_id = request->session_id; |
| 12836 | cmd->table_id = 0; |
| 12837 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 12838 | cmd->total_entries = request->ssid_count; |
| 12839 | cmd->num_entries_in_page = request->ssid_count; |
| 12840 | cmd->first_entry_index = 0; |
| 12841 | |
| 12842 | buf_ptr += sizeof(*cmd); |
| 12843 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 12844 | |
| 12845 | if (request->ssid_count) { |
| 12846 | wmi_extscan_hotlist_ssid_entry *entry; |
| 12847 | int i; |
| 12848 | |
| 12849 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12850 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 12851 | for (i = 0; i < request->ssid_count; i++) { |
| 12852 | WMITLV_SET_HDR |
| 12853 | (entry, |
| 12854 | WMITLV_TAG_ARRAY_STRUC, |
| 12855 | WMITLV_GET_STRUCT_TLVLEN |
| 12856 | (wmi_extscan_hotlist_ssid_entry)); |
| 12857 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12858 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12859 | request->ssids[i].ssid.mac_ssid, |
| 12860 | request->ssids[i].ssid.length); |
| 12861 | entry->band = request->ssids[i].band; |
| 12862 | entry->min_rssi = request->ssids[i].rssi_low; |
| 12863 | entry->max_rssi = request->ssids[i].rssi_high; |
| 12864 | entry++; |
| 12865 | } |
| 12866 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 12867 | } else { |
| 12868 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 12869 | } |
| 12870 | |
| 12871 | if (wmi_unified_cmd_send |
| 12872 | (wmi_handle, wmi_buf, len, |
| 12873 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12874 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12875 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12876 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12877 | } |
| 12878 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12879 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12880 | } |
| 12881 | |
| 12882 | /** |
| 12883 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 12884 | * @wmi_handle: wmi handle |
| 12885 | * @vdev_id: vdev id |
| 12886 | * |
| 12887 | * This function sends roam synch complete event to fw. |
| 12888 | * |
| 12889 | * Return: CDF STATUS |
| 12890 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12891 | static 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] | 12892 | uint8_t vdev_id) |
| 12893 | { |
| 12894 | wmi_roam_synch_complete_fixed_param *cmd; |
| 12895 | wmi_buf_t wmi_buf; |
| 12896 | uint8_t *buf_ptr; |
| 12897 | uint16_t len; |
| 12898 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 12899 | |
| 12900 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 12901 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12902 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12903 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12904 | } |
| 12905 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 12906 | buf_ptr = (uint8_t *) cmd; |
| 12907 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12908 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 12909 | WMITLV_GET_STRUCT_TLVLEN |
| 12910 | (wmi_roam_synch_complete_fixed_param)); |
| 12911 | cmd->vdev_id = vdev_id; |
| 12912 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 12913 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12914 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12915 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12916 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12917 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12918 | } |
| 12919 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12920 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12921 | } |
| 12922 | |
| 12923 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 12924 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 12925 | * @wmi_handle: wmi handle |
| 12926 | * @wmi_fwtest: fw test command |
| 12927 | * |
| 12928 | * This function sends fw test command to fw. |
| 12929 | * |
| 12930 | * Return: CDF STATUS |
| 12931 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 12932 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 12933 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 12934 | struct set_fwtest_params *wmi_fwtest) |
| 12935 | { |
| 12936 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 12937 | wmi_buf_t wmi_buf; |
| 12938 | uint16_t len; |
| 12939 | |
| 12940 | len = sizeof(*cmd); |
| 12941 | |
| 12942 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 12943 | if (!wmi_buf) { |
| 12944 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 12945 | return QDF_STATUS_E_NOMEM; |
| 12946 | } |
| 12947 | |
| 12948 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 12949 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12950 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 12951 | WMITLV_GET_STRUCT_TLVLEN( |
| 12952 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 12953 | cmd->param_id = wmi_fwtest->arg; |
| 12954 | cmd->param_value = wmi_fwtest->value; |
| 12955 | |
| 12956 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 12957 | WMI_FWTEST_CMDID)) { |
| 12958 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 12959 | qdf_nbuf_free(wmi_buf); |
| 12960 | return QDF_STATUS_E_FAILURE; |
| 12961 | } |
| 12962 | |
| 12963 | return QDF_STATUS_SUCCESS; |
| 12964 | } |
| 12965 | |
| 12966 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12967 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 12968 | * @wmi_handle: wmi handle |
| 12969 | * @wmi_utest: unit test command |
| 12970 | * |
| 12971 | * This function send unit test command to fw. |
| 12972 | * |
| 12973 | * Return: CDF STATUS |
| 12974 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12975 | static QDF_STATUS send_unit_test_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12976 | struct wmi_unit_test_cmd *wmi_utest) |
| 12977 | { |
| 12978 | wmi_unit_test_cmd_fixed_param *cmd; |
| 12979 | wmi_buf_t wmi_buf; |
| 12980 | uint8_t *buf_ptr; |
| 12981 | int i; |
| 12982 | uint16_t len, args_tlv_len; |
| 12983 | A_UINT32 *unit_test_cmd_args; |
| 12984 | |
| 12985 | args_tlv_len = |
| 12986 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 12987 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 12988 | |
| 12989 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 12990 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12991 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 12992 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12993 | } |
| 12994 | |
| 12995 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 12996 | buf_ptr = (uint8_t *) cmd; |
| 12997 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12998 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 12999 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 13000 | cmd->vdev_id = wmi_utest->vdev_id; |
| 13001 | cmd->module_id = wmi_utest->module_id; |
| 13002 | cmd->num_args = wmi_utest->num_args; |
| 13003 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 13004 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13005 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 13006 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13007 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13008 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 13009 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13010 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13011 | } |
| 13012 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13013 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13014 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13015 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13016 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13017 | } |
| 13018 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13019 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13020 | } |
| 13021 | |
| 13022 | /** |
| 13023 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 13024 | * @wmi_handle: wma handle |
| 13025 | * @roaminvoke: roam invoke command |
| 13026 | * |
| 13027 | * Send roam invoke command to fw for fastreassoc. |
| 13028 | * |
| 13029 | * Return: CDF STATUS |
| 13030 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13031 | static QDF_STATUS send_roam_invoke_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13032 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 13033 | uint32_t ch_hz) |
| 13034 | { |
| 13035 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 13036 | wmi_buf_t wmi_buf; |
| 13037 | u_int8_t *buf_ptr; |
| 13038 | u_int16_t len, args_tlv_len; |
| 13039 | A_UINT32 *channel_list; |
| 13040 | wmi_mac_addr *bssid_list; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13041 | wmi_tlv_buf_len_param *buf_len_tlv; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13042 | |
| 13043 | /* Host sends only one channel and one bssid */ |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13044 | args_tlv_len = (4 * WMI_TLV_HDR_SIZE) + sizeof(A_UINT32) + |
| 13045 | sizeof(wmi_mac_addr) + sizeof(wmi_tlv_buf_len_param) + |
| 13046 | roundup(roaminvoke->frame_len, sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13047 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 13048 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13049 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13050 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 13051 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13052 | } |
| 13053 | |
| 13054 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 13055 | buf_ptr = (u_int8_t *) cmd; |
| 13056 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13057 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 13058 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 13059 | cmd->vdev_id = roaminvoke->vdev_id; |
| 13060 | cmd->flags = 0; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13061 | |
| 13062 | if (roaminvoke->frame_len) |
| 13063 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_SKIP; |
| 13064 | else |
| 13065 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_FIXED_CH; |
| 13066 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13067 | cmd->roam_ap_sel_mode = 0; |
| 13068 | cmd->roam_delay = 0; |
| 13069 | cmd->num_chan = 1; |
| 13070 | cmd->num_bssid = 1; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13071 | /* packing 1 beacon/probe_rsp frame with WMI cmd */ |
| 13072 | cmd->num_buf = 1; |
| 13073 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13074 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 13075 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13076 | (sizeof(u_int32_t))); |
| 13077 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13078 | *channel_list = ch_hz; |
| 13079 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 13080 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 13081 | (sizeof(wmi_mac_addr))); |
| 13082 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13083 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13084 | |
| 13085 | /* move to next tlv i.e. bcn_prb_buf_list */ |
| 13086 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_mac_addr); |
| 13087 | |
| 13088 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 13089 | sizeof(wmi_tlv_buf_len_param)); |
| 13090 | |
| 13091 | buf_len_tlv = (wmi_tlv_buf_len_param *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13092 | buf_len_tlv->buf_len = roaminvoke->frame_len; |
| 13093 | |
| 13094 | /* move to next tlv i.e. bcn_prb_frm */ |
| 13095 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_tlv_buf_len_param); |
| 13096 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 13097 | roundup(roaminvoke->frame_len, sizeof(uint32_t))); |
| 13098 | |
| 13099 | /* copy frame after the header */ |
| 13100 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
| 13101 | roaminvoke->frame_buf, |
| 13102 | roaminvoke->frame_len); |
| 13103 | |
| 13104 | WMI_LOGD(FL("bcn/prb_rsp frame, length: %d"), roaminvoke->frame_len); |
| 13105 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 13106 | buf_ptr + WMI_TLV_HDR_SIZE, |
| 13107 | roaminvoke->frame_len); |
| 13108 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13109 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13110 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13111 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13112 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13113 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13114 | } |
| 13115 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13116 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13117 | } |
| 13118 | |
| 13119 | /** |
| 13120 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 13121 | * @wmi_handle: wmi handle |
| 13122 | * @command: command |
| 13123 | * @vdev_id: vdev id |
| 13124 | * |
| 13125 | * This function set roam offload command to fw. |
| 13126 | * |
| 13127 | * Return: CDF status |
| 13128 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13129 | static 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] | 13130 | uint32_t command, uint32_t vdev_id) |
| 13131 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13132 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13133 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 13134 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13135 | int len; |
| 13136 | uint8_t *buf_ptr; |
| 13137 | |
| 13138 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 13139 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13140 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13141 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13142 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13143 | } |
| 13144 | |
| 13145 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13146 | |
| 13147 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 13148 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 13149 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 13150 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 13151 | cmd_fp->vdev_id = vdev_id; |
| 13152 | cmd_fp->command_arg = command; |
| 13153 | |
| 13154 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13155 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13156 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13157 | 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] | 13158 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13159 | goto error; |
| 13160 | } |
| 13161 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13162 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 13163 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13164 | |
| 13165 | error: |
| 13166 | wmi_buf_free(buf); |
| 13167 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13168 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13169 | } |
| 13170 | |
| 13171 | /** |
| 13172 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 13173 | * @wmi_handle: wmi handle |
| 13174 | * @ap_profile_p: ap profile |
| 13175 | * @vdev_id: vdev id |
| 13176 | * |
| 13177 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 13178 | * |
| 13179 | * Return: CDF status |
| 13180 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13181 | static 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] | 13182 | wmi_ap_profile *ap_profile_p, |
| 13183 | uint32_t vdev_id) |
| 13184 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13185 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13186 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13187 | int len; |
| 13188 | uint8_t *buf_ptr; |
| 13189 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 13190 | |
| 13191 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 13192 | |
| 13193 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13194 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13195 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13196 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13197 | } |
| 13198 | |
| 13199 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13200 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 13201 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 13202 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 13203 | WMITLV_GET_STRUCT_TLVLEN |
| 13204 | (wmi_roam_ap_profile_fixed_param)); |
| 13205 | /* fill in threshold values */ |
| 13206 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 13207 | roam_ap_profile_fp->id = 0; |
| 13208 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 13209 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13210 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13211 | WMITLV_SET_HDR(buf_ptr, |
| 13212 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 13213 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 13214 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13215 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13216 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13217 | 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] | 13218 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13219 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13220 | } |
| 13221 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13222 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13223 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13224 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13225 | } |
| 13226 | |
| 13227 | /** |
| 13228 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 13229 | * @wmi_handle: wmi handle |
| 13230 | * @scan_period: scan period |
| 13231 | * @scan_age: scan age |
| 13232 | * @vdev_id: vdev id |
| 13233 | * |
| 13234 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 13235 | * |
| 13236 | * Return: CDF status |
| 13237 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13238 | static 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] | 13239 | uint32_t scan_period, |
| 13240 | uint32_t scan_age, |
| 13241 | uint32_t vdev_id) |
| 13242 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13243 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13244 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13245 | int len; |
| 13246 | uint8_t *buf_ptr; |
| 13247 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 13248 | |
| 13249 | /* Send scan period values */ |
| 13250 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 13251 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13252 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13253 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13254 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13255 | } |
| 13256 | |
| 13257 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13258 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 13259 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 13260 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 13261 | WMITLV_GET_STRUCT_TLVLEN |
| 13262 | (wmi_roam_scan_period_fixed_param)); |
| 13263 | /* fill in scan period values */ |
| 13264 | scan_period_fp->vdev_id = vdev_id; |
| 13265 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 13266 | scan_period_fp->roam_scan_age = scan_age; |
| 13267 | |
| 13268 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13269 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13270 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13271 | 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] | 13272 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13273 | goto error; |
| 13274 | } |
| 13275 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13276 | 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] | 13277 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13278 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13279 | error: |
| 13280 | wmi_buf_free(buf); |
| 13281 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13282 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13283 | } |
| 13284 | |
| 13285 | /** |
| 13286 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 13287 | * @wmi_handle: wmi handle |
| 13288 | * @chan_count: channel count |
| 13289 | * @chan_list: channel list |
| 13290 | * @list_type: list type |
| 13291 | * @vdev_id: vdev id |
| 13292 | * |
| 13293 | * Set roam offload channel list. |
| 13294 | * |
| 13295 | * Return: CDF status |
| 13296 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13297 | static 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] | 13298 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 13299 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13300 | uint8_t list_type, uint32_t vdev_id) |
| 13301 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13302 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13303 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13304 | int len, list_tlv_len; |
| 13305 | int i; |
| 13306 | uint8_t *buf_ptr; |
| 13307 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 13308 | A_UINT32 *roam_chan_list_array; |
| 13309 | |
| 13310 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13311 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13312 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13313 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13314 | } |
| 13315 | /* Channel list is a table of 2 TLV's */ |
| 13316 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 13317 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 13318 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13319 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13320 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13321 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13322 | } |
| 13323 | |
| 13324 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13325 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 13326 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 13327 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 13328 | WMITLV_GET_STRUCT_TLVLEN |
| 13329 | (wmi_roam_chan_list_fixed_param)); |
| 13330 | chan_list_fp->vdev_id = vdev_id; |
| 13331 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 13332 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13333 | /* external app is controlling channel list */ |
| 13334 | chan_list_fp->chan_list_type = |
| 13335 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 13336 | } else { |
| 13337 | /* umac supplied occupied channel list in LFR */ |
| 13338 | chan_list_fp->chan_list_type = |
| 13339 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 13340 | } |
| 13341 | |
| 13342 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 13343 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13344 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 13345 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13346 | WMI_LOGI("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13347 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 13348 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 13349 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13350 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13351 | } |
| 13352 | |
| 13353 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13354 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13355 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13356 | 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] | 13357 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13358 | goto error; |
| 13359 | } |
| 13360 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13361 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
| 13362 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13363 | error: |
| 13364 | wmi_buf_free(buf); |
| 13365 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13366 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13367 | } |
| 13368 | |
| 13369 | /** |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 13370 | * send_per_roam_config_cmd_tlv() - set per roaming config to FW |
| 13371 | * @wmi_handle: wmi handle |
| 13372 | * @req_buf: per roam config buffer |
| 13373 | * |
| 13374 | * Return: QDF status |
| 13375 | */ |
| 13376 | static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 13377 | struct wmi_per_roam_config_req *req_buf) |
| 13378 | { |
| 13379 | wmi_buf_t buf = NULL; |
| 13380 | QDF_STATUS status; |
| 13381 | int len; |
| 13382 | uint8_t *buf_ptr; |
| 13383 | wmi_roam_per_config_fixed_param *wmi_per_config; |
| 13384 | |
| 13385 | len = sizeof(wmi_roam_per_config_fixed_param); |
| 13386 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13387 | if (!buf) { |
| 13388 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13389 | return QDF_STATUS_E_NOMEM; |
| 13390 | } |
| 13391 | |
| 13392 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13393 | wmi_per_config = |
| 13394 | (wmi_roam_per_config_fixed_param *) buf_ptr; |
| 13395 | WMITLV_SET_HDR(&wmi_per_config->tlv_header, |
| 13396 | WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param, |
| 13397 | WMITLV_GET_STRUCT_TLVLEN |
| 13398 | (wmi_roam_per_config_fixed_param)); |
| 13399 | |
| 13400 | /* fill in per roam config values */ |
| 13401 | wmi_per_config->vdev_id = req_buf->vdev_id; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 13402 | |
| 13403 | wmi_per_config->enable = req_buf->per_config.enable; |
| 13404 | wmi_per_config->high_rate_thresh = |
| 13405 | (req_buf->per_config.tx_high_rate_thresh << 16) | |
| 13406 | (req_buf->per_config.rx_high_rate_thresh & 0x0000ffff); |
| 13407 | wmi_per_config->low_rate_thresh = |
| 13408 | (req_buf->per_config.tx_low_rate_thresh << 16) | |
| 13409 | (req_buf->per_config.rx_low_rate_thresh & 0x0000ffff); |
| 13410 | wmi_per_config->pkt_err_rate_thresh_pct = |
| 13411 | (req_buf->per_config.tx_rate_thresh_percnt << 16) | |
| 13412 | (req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff); |
| 13413 | wmi_per_config->per_rest_time = req_buf->per_config.per_rest_time; |
Kapil Gupta | 071b155 | 2017-02-13 15:51:52 +0530 | [diff] [blame] | 13414 | wmi_per_config->pkt_err_rate_mon_time = |
| 13415 | (req_buf->per_config.tx_per_mon_time << 16) | |
| 13416 | (req_buf->per_config.rx_per_mon_time & 0x0000ffff); |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 13417 | |
| 13418 | /* Send per roam config parameters */ |
| 13419 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13420 | len, WMI_ROAM_PER_CONFIG_CMDID); |
| 13421 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13422 | WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d", |
| 13423 | status); |
| 13424 | wmi_buf_free(buf); |
| 13425 | return status; |
| 13426 | } |
| 13427 | |
| 13428 | WMI_LOGI(FL("per roam enable=%d, vdev=%d"), |
| 13429 | req_buf->per_config.enable, req_buf->vdev_id); |
| 13430 | return QDF_STATUS_SUCCESS; |
| 13431 | } |
| 13432 | |
| 13433 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13434 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 13435 | * @wmi_handle: wmi handle |
| 13436 | * @rssi_change_thresh: RSSI Change threshold |
| 13437 | * @bcn_rssi_weight: beacon RSSI weight |
| 13438 | * @vdev_id: vdev id |
| 13439 | * |
| 13440 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 13441 | * |
| 13442 | * Return: CDF status |
| 13443 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13444 | static 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] | 13445 | uint32_t vdev_id, |
| 13446 | int32_t rssi_change_thresh, |
| 13447 | uint32_t bcn_rssi_weight, |
| 13448 | uint32_t hirssi_delay_btw_scans) |
| 13449 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13450 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13451 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13452 | int len; |
| 13453 | uint8_t *buf_ptr; |
| 13454 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 13455 | |
| 13456 | /* Send rssi change parameters */ |
| 13457 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 13458 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13459 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13460 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13461 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13462 | } |
| 13463 | |
| 13464 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13465 | rssi_change_fp = |
| 13466 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 13467 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 13468 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 13469 | WMITLV_GET_STRUCT_TLVLEN |
| 13470 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 13471 | /* fill in rssi change threshold (hysteresis) values */ |
| 13472 | rssi_change_fp->vdev_id = vdev_id; |
| 13473 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 13474 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 13475 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 13476 | |
| 13477 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13478 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13479 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13480 | 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] | 13481 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13482 | goto error; |
| 13483 | } |
| 13484 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13485 | 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] | 13486 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13487 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 13488 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13489 | error: |
| 13490 | wmi_buf_free(buf); |
| 13491 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13492 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13493 | } |
| 13494 | |
| 13495 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 13496 | * @wmi_handle: wmi handle. |
| 13497 | * @cmd: size of command structure. |
| 13498 | * @per_entry_size: per entry size. |
| 13499 | * |
| 13500 | * This utility function calculates how many hotlist entries can |
| 13501 | * fit in one page. |
| 13502 | * |
| 13503 | * Return: number of entries |
| 13504 | */ |
| 13505 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 13506 | size_t cmd_size, |
| 13507 | size_t per_entry_size) |
| 13508 | { |
| 13509 | uint32_t avail_space = 0; |
| 13510 | int num_entries = 0; |
| 13511 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 13512 | |
| 13513 | /* Calculate number of hotlist entries that can |
| 13514 | * be passed in wma message request. |
| 13515 | */ |
| 13516 | avail_space = max_msg_len - cmd_size; |
| 13517 | num_entries = avail_space / per_entry_size; |
| 13518 | return num_entries; |
| 13519 | } |
| 13520 | |
| 13521 | /** |
| 13522 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 13523 | * @wmi_handle: wmi handle |
| 13524 | * @photlist: hotlist command params |
| 13525 | * @buf_len: buffer length |
| 13526 | * |
| 13527 | * This function fills individual elements for hotlist request and |
| 13528 | * TLV for bssid entries |
| 13529 | * |
| 13530 | * Return: CDF Status. |
| 13531 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13532 | static 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] | 13533 | struct ext_scan_setbssi_hotlist_params * |
| 13534 | photlist, int *buf_len) |
| 13535 | { |
| 13536 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 13537 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 13538 | struct ap_threshold_params *src_ap = photlist->ap; |
| 13539 | wmi_buf_t buf; |
| 13540 | uint8_t *buf_ptr; |
| 13541 | |
| 13542 | int j, index = 0; |
| 13543 | int cmd_len = 0; |
| 13544 | int num_entries; |
| 13545 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 13546 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13547 | int len = sizeof(*cmd); |
| 13548 | |
| 13549 | len += WMI_TLV_HDR_SIZE; |
| 13550 | cmd_len = len; |
| 13551 | |
| 13552 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 13553 | cmd_len, |
| 13554 | sizeof(*dest_hotlist)); |
| 13555 | /* setbssid hotlist expects the bssid list |
| 13556 | * to be non zero value |
| 13557 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 13558 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 13559 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13560 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13561 | } |
| 13562 | |
| 13563 | /* Split the hot list entry pages and send multiple command |
| 13564 | * requests if the buffer reaches the maximum request size |
| 13565 | */ |
| 13566 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13567 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13568 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 13569 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13570 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13571 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 13572 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13573 | } |
| 13574 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13575 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 13576 | buf_ptr; |
| 13577 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13578 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 13579 | WMITLV_GET_STRUCT_TLVLEN |
| 13580 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 13581 | |
| 13582 | /* Multiple requests are sent until the num_entries_in_page |
| 13583 | * matches the total_entries |
| 13584 | */ |
| 13585 | cmd->request_id = photlist->requestId; |
| 13586 | cmd->vdev_id = photlist->sessionId; |
| 13587 | cmd->total_entries = numap; |
| 13588 | cmd->mode = 1; |
| 13589 | cmd->num_entries_in_page = min_entries; |
| 13590 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 13591 | cmd->first_entry_index = index; |
| 13592 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13593 | 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] | 13594 | __func__, cmd->vdev_id, cmd->total_entries, |
| 13595 | cmd->num_entries_in_page, |
| 13596 | cmd->lost_ap_scan_count); |
| 13597 | |
| 13598 | buf_ptr += sizeof(*cmd); |
| 13599 | WMITLV_SET_HDR(buf_ptr, |
| 13600 | WMITLV_TAG_ARRAY_STRUC, |
| 13601 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 13602 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 13603 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 13604 | |
| 13605 | /* Populate bssid, channel info and rssi |
| 13606 | * for the bssid's that are sent as hotlists. |
| 13607 | */ |
| 13608 | for (j = 0; j < min_entries; j++) { |
| 13609 | WMITLV_SET_HDR(dest_hotlist, |
| 13610 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 13611 | WMITLV_GET_STRUCT_TLVLEN |
| 13612 | (wmi_extscan_hotlist_entry)); |
| 13613 | |
| 13614 | dest_hotlist->min_rssi = src_ap->low; |
| 13615 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 13616 | &dest_hotlist->bssid); |
| 13617 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13618 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13619 | __func__, dest_hotlist->channel, |
| 13620 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13621 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13622 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 13623 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 13624 | dest_hotlist->bssid.mac_addr47to32); |
| 13625 | dest_hotlist++; |
| 13626 | src_ap++; |
| 13627 | } |
| 13628 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 13629 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 13630 | |
| 13631 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13632 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13633 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13634 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13635 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13636 | } |
| 13637 | index = index + min_entries; |
| 13638 | num_entries = numap - min_entries; |
| 13639 | len = cmd_len; |
| 13640 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13641 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13642 | } |
| 13643 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 13644 | /** |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 13645 | * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW |
| 13646 | * @wmi_handle: the WMI handle |
| 13647 | * @vdev_id: the Id of the vdev to apply the configuration to |
| 13648 | * @ucast_mode: the active BPF mode to configure for unicast packets |
| 13649 | * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast |
| 13650 | * packets |
| 13651 | * |
| 13652 | * Return: QDF status |
| 13653 | */ |
| 13654 | static QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 13655 | uint8_t vdev_id, |
| 13656 | enum wmi_host_active_bpf_mode ucast_mode, |
| 13657 | enum wmi_host_active_bpf_mode mcast_bcast_mode) |
| 13658 | { |
| 13659 | const WMITLV_TAG_ID tag_id = |
| 13660 | WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; |
| 13661 | const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( |
| 13662 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param); |
| 13663 | QDF_STATUS status; |
| 13664 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; |
| 13665 | wmi_buf_t buf; |
| 13666 | |
| 13667 | WMI_LOGI("Sending WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)", |
| 13668 | vdev_id, ucast_mode, mcast_bcast_mode); |
| 13669 | |
| 13670 | /* allocate command buffer */ |
| 13671 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13672 | if (!buf) { |
| 13673 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13674 | return QDF_STATUS_E_NOMEM; |
| 13675 | } |
| 13676 | |
| 13677 | /* set TLV header */ |
| 13678 | cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); |
| 13679 | WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); |
| 13680 | |
| 13681 | /* populate data */ |
| 13682 | cmd->vdev_id = vdev_id; |
| 13683 | cmd->uc_mode = ucast_mode; |
| 13684 | cmd->mcbc_mode = mcast_bcast_mode; |
| 13685 | |
| 13686 | /* send to FW */ |
| 13687 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 13688 | WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); |
| 13689 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13690 | WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", |
| 13691 | status); |
| 13692 | wmi_buf_free(buf); |
| 13693 | return status; |
| 13694 | } |
| 13695 | |
| 13696 | WMI_LOGI("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); |
| 13697 | |
| 13698 | return QDF_STATUS_SUCCESS; |
| 13699 | } |
| 13700 | |
| 13701 | /** |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 13702 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 13703 | * @wmi_handle: wmi handle |
| 13704 | * @param: wmi power debug parameter |
| 13705 | * |
| 13706 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 13707 | * |
| 13708 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 13709 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 13710 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 13711 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 13712 | { |
| 13713 | wmi_buf_t buf = NULL; |
| 13714 | QDF_STATUS status; |
| 13715 | int len, args_tlv_len; |
| 13716 | uint8_t *buf_ptr; |
| 13717 | uint8_t i; |
| 13718 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 13719 | uint32_t *cmd_args; |
| 13720 | |
| 13721 | /* Prepare and send power debug cmd parameters */ |
| 13722 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 13723 | len = sizeof(*cmd) + args_tlv_len; |
| 13724 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13725 | if (!buf) { |
| 13726 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13727 | return QDF_STATUS_E_NOMEM; |
| 13728 | } |
| 13729 | |
| 13730 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13731 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 13732 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13733 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 13734 | WMITLV_GET_STRUCT_TLVLEN |
| 13735 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 13736 | |
| 13737 | cmd->pdev_id = param->pdev_id; |
| 13738 | cmd->module_id = param->module_id; |
| 13739 | cmd->num_args = param->num_args; |
| 13740 | buf_ptr += sizeof(*cmd); |
| 13741 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13742 | (param->num_args * sizeof(uint32_t))); |
| 13743 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 13744 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 13745 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 13746 | cmd_args[i] = param->args[i]; |
| 13747 | WMI_LOGI("%d,", param->args[i]); |
| 13748 | } |
| 13749 | |
| 13750 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13751 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 13752 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13753 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 13754 | status); |
| 13755 | goto error; |
| 13756 | } |
| 13757 | |
| 13758 | return QDF_STATUS_SUCCESS; |
| 13759 | error: |
| 13760 | wmi_buf_free(buf); |
| 13761 | |
| 13762 | return status; |
| 13763 | } |
| 13764 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 13765 | /* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd |
| 13766 | * @buf_ptr: pointer to current position in init command buffer |
| 13767 | * @len: pointer to length. This will be updated with current lenght of cmd |
| 13768 | * @param: point host parameters for init command |
| 13769 | * |
| 13770 | * Return: Updated pointer of buf_ptr. |
| 13771 | */ |
| 13772 | static inline uint8_t *copy_hw_mode_in_init_cmd(uint8_t *buf_ptr, |
| 13773 | int *len, struct wmi_init_cmd_param *param) |
| 13774 | { |
| 13775 | uint16_t idx; |
| 13776 | |
| 13777 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { |
| 13778 | wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode; |
| 13779 | wmi_pdev_band_to_mac *band_to_mac; |
| 13780 | |
| 13781 | hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *) |
| 13782 | (buf_ptr + sizeof(wmi_init_cmd_fixed_param) + |
| 13783 | sizeof(wmi_resource_config) + |
| 13784 | WMI_TLV_HDR_SIZE + (param->num_mem_chunks * |
| 13785 | sizeof(wlan_host_memory_chunk))); |
| 13786 | |
| 13787 | WMITLV_SET_HDR(&hw_mode->tlv_header, |
| 13788 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 13789 | (WMITLV_GET_STRUCT_TLVLEN |
| 13790 | (wmi_pdev_set_hw_mode_cmd_fixed_param))); |
| 13791 | |
| 13792 | hw_mode->hw_mode_index = param->hw_mode_id; |
| 13793 | hw_mode->num_band_to_mac = param->num_band_to_mac; |
| 13794 | |
| 13795 | buf_ptr = (uint8_t *) (hw_mode + 1); |
| 13796 | band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr + |
| 13797 | WMI_TLV_HDR_SIZE); |
| 13798 | for (idx = 0; idx < param->num_band_to_mac; idx++) { |
| 13799 | WMITLV_SET_HDR(&band_to_mac[idx].tlv_header, |
| 13800 | WMITLV_TAG_STRUC_wmi_pdev_band_to_mac, |
| 13801 | WMITLV_GET_STRUCT_TLVLEN |
| 13802 | (wmi_pdev_band_to_mac)); |
| 13803 | band_to_mac[idx].pdev_id = |
| 13804 | param->band_to_mac[idx].pdev_id; |
| 13805 | band_to_mac[idx].start_freq = |
| 13806 | param->band_to_mac[idx].start_freq; |
| 13807 | band_to_mac[idx].end_freq = |
| 13808 | param->band_to_mac[idx].end_freq; |
| 13809 | } |
| 13810 | *len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 13811 | (param->num_band_to_mac * |
| 13812 | sizeof(wmi_pdev_band_to_mac)) + |
| 13813 | WMI_TLV_HDR_SIZE; |
| 13814 | |
| 13815 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13816 | (param->num_band_to_mac * |
| 13817 | sizeof(wmi_pdev_band_to_mac))); |
| 13818 | } |
| 13819 | |
| 13820 | return buf_ptr; |
| 13821 | } |
| 13822 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 13823 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 13824 | * send_multiple_vdev_restart_req_cmd_tlv() - send multiple vdev restart req |
| 13825 | * @wmi_handle: wmi handle |
| 13826 | * @param: wmi multiple vdev restart req param |
| 13827 | * |
| 13828 | * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw. |
| 13829 | * |
| 13830 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 13831 | */ |
| 13832 | static QDF_STATUS send_multiple_vdev_restart_req_cmd_tlv( |
| 13833 | wmi_unified_t wmi_handle, |
| 13834 | struct multiple_vdev_restart_params *param) |
| 13835 | { |
| 13836 | wmi_buf_t buf; |
| 13837 | QDF_STATUS qdf_status; |
| 13838 | wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *cmd; |
| 13839 | int i; |
| 13840 | uint8_t *buf_ptr; |
| 13841 | uint32_t *vdev_ids; |
| 13842 | wmi_channel *chan_info; |
| 13843 | struct channel_param *tchan_info; |
| 13844 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 13845 | |
| 13846 | len += sizeof(wmi_channel); |
| 13847 | if (param->num_vdevs) |
| 13848 | len += sizeof(uint32_t) * param->num_vdevs; |
| 13849 | |
| 13850 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13851 | if (!buf) { |
| 13852 | WMI_LOGE("Failed to allocate memory\n"); |
| 13853 | qdf_status = QDF_STATUS_E_NOMEM; |
| 13854 | goto end; |
| 13855 | } |
| 13856 | |
| 13857 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 13858 | cmd = (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *) |
| 13859 | buf_ptr; |
| 13860 | |
| 13861 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13862 | WMITLV_TAG_STRUC_wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param, |
| 13863 | WMITLV_GET_STRUCT_TLVLEN |
| 13864 | (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param)); |
| 13865 | cmd->pdev_id = param->pdev_id; |
| 13866 | cmd->requestor_id = param->requestor_id; |
| 13867 | cmd->disable_hw_ack = param->disable_hw_ack; |
| 13868 | cmd->cac_duration_ms = param->cac_duration_ms; |
| 13869 | cmd->num_vdevs = param->num_vdevs; |
| 13870 | |
| 13871 | buf_ptr += sizeof(*cmd); |
| 13872 | |
| 13873 | WMITLV_SET_HDR(buf_ptr, |
| 13874 | WMITLV_TAG_ARRAY_UINT32, |
| 13875 | sizeof(A_UINT32) * param->num_vdevs); |
| 13876 | vdev_ids = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13877 | for (i = 0; i < param->num_vdevs; i++) { |
| 13878 | vdev_ids[i] = param->vdev_ids[i]; |
| 13879 | } |
| 13880 | |
| 13881 | buf_ptr += (sizeof(A_UINT32) * param->num_vdevs) + WMI_TLV_HDR_SIZE; |
| 13882 | |
| 13883 | WMITLV_SET_HDR(buf_ptr, |
| 13884 | WMITLV_TAG_STRUC_wmi_channel, |
| 13885 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
Sathish Kumar | 3e28e00 | 2017-03-07 15:53:04 +0530 | [diff] [blame] | 13886 | chan_info = (wmi_channel *)buf_ptr; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 13887 | tchan_info = &(param->ch_param); |
| 13888 | chan_info->mhz = tchan_info->mhz; |
| 13889 | chan_info->band_center_freq1 = tchan_info->cfreq1; |
| 13890 | chan_info->band_center_freq2 = tchan_info->cfreq2; |
| 13891 | if (tchan_info->is_chan_passive) |
| 13892 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 13893 | WMI_CHAN_FLAG_PASSIVE); |
| 13894 | if (tchan_info->allow_vht) |
| 13895 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 13896 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 13897 | else if (tchan_info->allow_ht) |
| 13898 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 13899 | WMI_CHAN_FLAG_ALLOW_HT); |
| 13900 | WMI_SET_CHANNEL_MODE(chan_info, tchan_info->phy_mode); |
| 13901 | WMI_SET_CHANNEL_MIN_POWER(chan_info, tchan_info->minpower); |
| 13902 | WMI_SET_CHANNEL_MAX_POWER(chan_info, tchan_info->maxpower); |
| 13903 | WMI_SET_CHANNEL_REG_POWER(chan_info, tchan_info->maxregpower); |
| 13904 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, tchan_info->antennamax); |
| 13905 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, tchan_info->reg_class_id); |
| 13906 | |
| 13907 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13908 | WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID); |
| 13909 | |
| 13910 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 13911 | WMI_LOGE("%s: Failed to send\n", __func__); |
| 13912 | wmi_buf_free(buf); |
| 13913 | } |
| 13914 | |
| 13915 | end: |
| 13916 | return qdf_status; |
| 13917 | } |
| 13918 | |
| 13919 | /** |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 13920 | * send_dfs_phyerr_offload_en_cmd_tlv() - send dfs phyerr offload enable cmd |
| 13921 | * @wmi_handle: wmi handle |
| 13922 | * @pdev_id: pdev id |
| 13923 | * |
| 13924 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID command to firmware. |
| 13925 | * |
| 13926 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 13927 | */ |
| 13928 | static QDF_STATUS send_dfs_phyerr_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 13929 | uint32_t pdev_id) |
| 13930 | { |
| 13931 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *cmd; |
| 13932 | wmi_buf_t buf; |
| 13933 | uint16_t len; |
| 13934 | QDF_STATUS ret; |
| 13935 | |
| 13936 | len = sizeof(*cmd); |
| 13937 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13938 | |
| 13939 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 13940 | |
| 13941 | if (!buf) { |
| 13942 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13943 | return QDF_STATUS_E_NOMEM; |
| 13944 | } |
| 13945 | |
| 13946 | cmd = (wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *) |
| 13947 | wmi_buf_data(buf); |
| 13948 | |
| 13949 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13950 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param, |
| 13951 | WMITLV_GET_STRUCT_TLVLEN( |
| 13952 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param)); |
| 13953 | |
| 13954 | cmd->pdev_id = pdev_id; |
| 13955 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13956 | WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 13957 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 13958 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 13959 | __func__, ret, pdev_id); |
| 13960 | wmi_buf_free(buf); |
| 13961 | return QDF_STATUS_E_FAILURE; |
| 13962 | } |
| 13963 | |
| 13964 | return QDF_STATUS_SUCCESS; |
| 13965 | } |
| 13966 | |
| 13967 | /** |
| 13968 | * send_dfs_phyerr_offload_dis_cmd_tlv() - send dfs phyerr offload disable cmd |
| 13969 | * @wmi_handle: wmi handle |
| 13970 | * @pdev_id: pdev id |
| 13971 | * |
| 13972 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID command to firmware. |
| 13973 | * |
| 13974 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 13975 | */ |
| 13976 | static QDF_STATUS send_dfs_phyerr_offload_dis_cmd_tlv(wmi_unified_t wmi_handle, |
| 13977 | uint32_t pdev_id) |
| 13978 | { |
| 13979 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *cmd; |
| 13980 | wmi_buf_t buf; |
| 13981 | uint16_t len; |
| 13982 | QDF_STATUS ret; |
| 13983 | |
| 13984 | len = sizeof(*cmd); |
| 13985 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13986 | |
| 13987 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 13988 | |
| 13989 | if (!buf) { |
| 13990 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13991 | return QDF_STATUS_E_NOMEM; |
| 13992 | } |
| 13993 | |
| 13994 | cmd = (wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *) |
| 13995 | wmi_buf_data(buf); |
| 13996 | |
| 13997 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13998 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param, |
| 13999 | WMITLV_GET_STRUCT_TLVLEN( |
| 14000 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param)); |
| 14001 | |
| 14002 | cmd->pdev_id = pdev_id; |
| 14003 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14004 | WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 14005 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 14006 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 14007 | __func__, ret, pdev_id); |
| 14008 | wmi_buf_free(buf); |
| 14009 | return QDF_STATUS_E_FAILURE; |
| 14010 | } |
| 14011 | |
| 14012 | return QDF_STATUS_SUCCESS; |
| 14013 | } |
| 14014 | |
| 14015 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14016 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 14017 | * @wmi_handle: wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14018 | * @param param: pointer to wmi init param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14019 | * |
| 14020 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14021 | */ |
| 14022 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14023 | struct wmi_init_cmd_param *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14024 | { |
| 14025 | wmi_buf_t buf; |
| 14026 | wmi_init_cmd_fixed_param *cmd; |
| 14027 | wmi_abi_version my_vers; |
| 14028 | int num_whitelist; |
| 14029 | uint8_t *buf_ptr; |
| 14030 | wmi_resource_config *resource_cfg; |
| 14031 | wlan_host_memory_chunk *host_mem_chunks; |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14032 | uint32_t mem_chunk_len = 0, hw_mode_len = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14033 | uint16_t idx; |
| 14034 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14035 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14036 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14037 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + |
| 14038 | WMI_TLV_HDR_SIZE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14039 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14040 | |
| 14041 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) |
| 14042 | hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 14043 | WMI_TLV_HDR_SIZE + |
| 14044 | (param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac)); |
| 14045 | |
| 14046 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len + hw_mode_len); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14047 | if (!buf) { |
| 14048 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14049 | return QDF_STATUS_E_FAILURE; |
| 14050 | } |
| 14051 | |
| 14052 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14053 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 14054 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 14055 | |
| 14056 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 14057 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 14058 | + WMI_TLV_HDR_SIZE); |
| 14059 | |
| 14060 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14061 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 14062 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 14063 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14064 | wmi_copy_resource_config(resource_cfg, param->res_cfg); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14065 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 14066 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 14067 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 14068 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14069 | for (idx = 0; idx < param->num_mem_chunks; ++idx) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14070 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 14071 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 14072 | WMITLV_GET_STRUCT_TLVLEN |
| 14073 | (wlan_host_memory_chunk)); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14074 | host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr; |
| 14075 | host_mem_chunks[idx].size = param->mem_chunks[idx].len; |
| 14076 | host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14077 | qdf_print("chunk %d len %d requested ,ptr 0x%x ", |
| 14078 | idx, host_mem_chunks[idx].size, |
| 14079 | host_mem_chunks[idx].ptr); |
| 14080 | } |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14081 | cmd->num_host_mem_chunks = param->num_mem_chunks; |
| 14082 | len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 14083 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14084 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 14085 | WMITLV_TAG_ARRAY_STRUC, |
| 14086 | (sizeof(wlan_host_memory_chunk) * |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14087 | param->num_mem_chunks)); |
| 14088 | |
| 14089 | /* Fill hw mode id config */ |
| 14090 | buf_ptr = copy_hw_mode_in_init_cmd(buf_ptr, &len, param); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14091 | |
| 14092 | num_whitelist = sizeof(version_whitelist) / |
| 14093 | sizeof(wmi_whitelist_version_info); |
| 14094 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 14095 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 14096 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 14097 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 14098 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 14099 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 14100 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14101 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14102 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 14103 | &my_vers, |
| 14104 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 14105 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14106 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14107 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 14108 | __func__, |
| 14109 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 14110 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 14111 | cmd->host_abi_vers.abi_version_ns_0, |
| 14112 | cmd->host_abi_vers.abi_version_ns_1, |
| 14113 | cmd->host_abi_vers.abi_version_ns_2, |
| 14114 | cmd->host_abi_vers.abi_version_ns_3); |
| 14115 | |
| 14116 | /* Save version sent from host - |
| 14117 | * Will be used to check ready event |
| 14118 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14119 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14120 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 14121 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14122 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14123 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 14124 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 14125 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 14126 | ret); |
| 14127 | wmi_buf_free(buf); |
| 14128 | } |
| 14129 | return ret; |
| 14130 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14131 | } |
| 14132 | |
| 14133 | /** |
| 14134 | * save_service_bitmap_tlv() - save service bitmap |
| 14135 | * @wmi_handle: wmi handle |
| 14136 | * @param evt_buf: pointer to event buffer |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14137 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14138 | * |
| 14139 | * Return: None |
| 14140 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 14141 | #ifndef CONFIG_MCL |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14142 | static |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14143 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 14144 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14145 | { |
| 14146 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14147 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14148 | |
| 14149 | qdf_mem_copy(wmi_handle->wmi_service_bitmap, |
| 14150 | param_buf->wmi_service_bitmap, |
| 14151 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14152 | |
| 14153 | if (bitmap_buf) |
| 14154 | qdf_mem_copy(bitmap_buf, |
| 14155 | param_buf->wmi_service_bitmap, |
| 14156 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14157 | } |
| 14158 | #else |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14159 | static |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14160 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 14161 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14162 | { |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14163 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14164 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14165 | |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14166 | if (bitmap_buf) |
| 14167 | qdf_mem_copy(bitmap_buf, |
| 14168 | param_buf->wmi_service_bitmap, |
| 14169 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
| 14170 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14171 | #endif |
| 14172 | |
| 14173 | /** |
| 14174 | * is_service_enabled_tlv() - Check if service enabled |
| 14175 | * @param wmi_handle: wmi handle |
| 14176 | * @param service_id: service identifier |
| 14177 | * |
| 14178 | * Return: 1 enabled, 0 disabled |
| 14179 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 14180 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14181 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 14182 | uint32_t service_id) |
| 14183 | { |
| 14184 | return WMI_SERVICE_IS_ENABLED(wmi_handle->wmi_service_bitmap, |
| 14185 | service_id); |
| 14186 | } |
| 14187 | #else |
| 14188 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 14189 | uint32_t service_id) |
| 14190 | { |
| 14191 | return false; |
| 14192 | } |
| 14193 | #endif |
| 14194 | |
| 14195 | /** |
| 14196 | * extract_service_ready_tlv() - extract service ready event |
| 14197 | * @wmi_handle: wmi handle |
| 14198 | * @param evt_buf: pointer to received event buffer |
| 14199 | * @param cap: pointer to hold target capability information extracted from even |
| 14200 | * |
| 14201 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14202 | */ |
| 14203 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 14204 | void *evt_buf, struct wlan_psoc_target_capability_info *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14205 | { |
| 14206 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14207 | wmi_service_ready_event_fixed_param *ev; |
| 14208 | |
| 14209 | |
| 14210 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14211 | |
| 14212 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 14213 | if (!ev) { |
| 14214 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14215 | return QDF_STATUS_E_FAILURE; |
| 14216 | } |
| 14217 | |
| 14218 | cap->phy_capability = ev->phy_capability; |
| 14219 | cap->max_frag_entry = ev->max_frag_entry; |
| 14220 | cap->num_rf_chains = ev->num_rf_chains; |
| 14221 | cap->ht_cap_info = ev->ht_cap_info; |
| 14222 | cap->vht_cap_info = ev->vht_cap_info; |
| 14223 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 14224 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 14225 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 14226 | cap->sys_cap_info = ev->sys_cap_info; |
| 14227 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 14228 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 14229 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 14230 | cap->max_supported_macs = ev->max_supported_macs; |
| 14231 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 14232 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 14233 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 14234 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 14235 | |
| 14236 | return QDF_STATUS_SUCCESS; |
| 14237 | } |
| 14238 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 14239 | /* convert_wireless_modes_tlv() - Convert REGDMN_MODE values sent by target |
| 14240 | * to host internal WMI_HOST_REGDMN_MODE values. |
| 14241 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 14242 | * host currently. Add this in the future if required. |
| 14243 | * 11AX (Phase II) : 11ax related values are not currently |
| 14244 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 14245 | * finalize the advertisement mechanism. |
| 14246 | * @target_wireless_mode: target wireless mode received in message |
| 14247 | * |
| 14248 | * Return: returns the host internal wireless mode. |
| 14249 | */ |
| 14250 | static inline uint32_t convert_wireless_modes_tlv(uint32_t target_wireless_mode) |
| 14251 | { |
| 14252 | |
| 14253 | uint32_t wireless_modes = 0; |
| 14254 | |
| 14255 | if (target_wireless_mode & REGDMN_MODE_11A) |
| 14256 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 14257 | |
| 14258 | if (target_wireless_mode & REGDMN_MODE_TURBO) |
| 14259 | wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 14260 | |
| 14261 | if (target_wireless_mode & REGDMN_MODE_11B) |
| 14262 | wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 14263 | |
| 14264 | if (target_wireless_mode & REGDMN_MODE_PUREG) |
| 14265 | wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 14266 | |
| 14267 | if (target_wireless_mode & REGDMN_MODE_11G) |
| 14268 | wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 14269 | |
| 14270 | if (target_wireless_mode & REGDMN_MODE_108G) |
| 14271 | wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 14272 | |
| 14273 | if (target_wireless_mode & REGDMN_MODE_108A) |
| 14274 | wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 14275 | |
| 14276 | if (target_wireless_mode & REGDMN_MODE_XR) |
| 14277 | wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 14278 | |
| 14279 | if (target_wireless_mode & REGDMN_MODE_11A_HALF_RATE) |
| 14280 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 14281 | |
| 14282 | if (target_wireless_mode & REGDMN_MODE_11A_QUARTER_RATE) |
| 14283 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 14284 | |
| 14285 | if (target_wireless_mode & REGDMN_MODE_11NG_HT20) |
| 14286 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 14287 | |
| 14288 | if (target_wireless_mode & REGDMN_MODE_11NA_HT20) |
| 14289 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 14290 | |
| 14291 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40PLUS) |
| 14292 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 14293 | |
| 14294 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40MINUS) |
| 14295 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 14296 | |
| 14297 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40PLUS) |
| 14298 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 14299 | |
| 14300 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40MINUS) |
| 14301 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 14302 | |
| 14303 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT20) |
| 14304 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 14305 | |
| 14306 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40PLUS) |
| 14307 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 14308 | |
| 14309 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40MINUS) |
| 14310 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 14311 | |
| 14312 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80) |
| 14313 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 14314 | |
| 14315 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT160) |
| 14316 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 14317 | |
| 14318 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80_80) |
| 14319 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 14320 | |
| 14321 | return wireless_modes; |
| 14322 | } |
| 14323 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14324 | /** |
| 14325 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 14326 | * @wmi_handle: wmi handle |
| 14327 | * @param evt_buf: Pointer to event buffer |
| 14328 | * @param cap: pointer to hold HAL reg capabilities |
| 14329 | * |
| 14330 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14331 | */ |
| 14332 | static QDF_STATUS extract_hal_reg_cap_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 14333 | void *evt_buf, struct wlan_psoc_hal_reg_capability *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14334 | { |
| 14335 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14336 | |
| 14337 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14338 | |
| 14339 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 14340 | sizeof(uint32_t)), |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 14341 | sizeof(struct wlan_psoc_hal_reg_capability)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14342 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 14343 | cap->wireless_modes = convert_wireless_modes_tlv( |
| 14344 | param_buf->hal_reg_capabilities->wireless_modes); |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 14345 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14346 | return QDF_STATUS_SUCCESS; |
| 14347 | } |
| 14348 | |
| 14349 | /** |
| 14350 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 14351 | * @wmi_handle: wmi handle |
| 14352 | * @param evt_buf: pointer to event buffer |
| 14353 | * @param num_entries: pointer to hold number of entries requested |
| 14354 | * |
| 14355 | * Return: Number of entries requested |
| 14356 | */ |
| 14357 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 14358 | void *evt_buf, uint8_t *num_entries) |
| 14359 | { |
| 14360 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14361 | wmi_service_ready_event_fixed_param *ev; |
| 14362 | |
| 14363 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14364 | |
| 14365 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 14366 | if (!ev) { |
| 14367 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14368 | return NULL; |
| 14369 | } |
| 14370 | |
| 14371 | *num_entries = ev->num_mem_reqs; |
| 14372 | |
| 14373 | return (host_mem_req *)param_buf->mem_reqs; |
| 14374 | } |
| 14375 | |
| 14376 | /** |
| 14377 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 14378 | * ready function |
| 14379 | * @wmi_handle: wmi handle |
| 14380 | * @param evt_buf: pointer to event buffer |
| 14381 | * |
| 14382 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14383 | */ |
| 14384 | static QDF_STATUS |
| 14385 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 14386 | { |
| 14387 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 14388 | wmi_service_ready_event_fixed_param *ev; |
| 14389 | |
| 14390 | |
| 14391 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 14392 | |
| 14393 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 14394 | if (!ev) { |
| 14395 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14396 | return QDF_STATUS_E_FAILURE; |
| 14397 | } |
| 14398 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14399 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14400 | /*Save fw version from service ready message */ |
| 14401 | /*This will be used while sending INIT message */ |
| 14402 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 14403 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14404 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14405 | return QDF_STATUS_SUCCESS; |
| 14406 | } |
| 14407 | |
| 14408 | /** |
| 14409 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 14410 | * @wmi_handle: wmi handle |
| 14411 | * @param evt_buf: Pointer to event buffer |
| 14412 | * |
| 14413 | * Return: ready status |
| 14414 | */ |
| 14415 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 14416 | void *evt_buf) |
| 14417 | { |
| 14418 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 14419 | wmi_ready_event_fixed_param *ev = NULL; |
| 14420 | |
| 14421 | |
| 14422 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 14423 | ev = param_buf->fixed_param; |
| 14424 | |
| 14425 | qdf_print("%s:%d\n", __func__, ev->status); |
| 14426 | |
| 14427 | return ev->status; |
| 14428 | } |
| 14429 | |
| 14430 | /** |
| 14431 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 14432 | * @wmi_handle: wmi handle |
| 14433 | * @param evt_buf: pointer to event buffer |
| 14434 | * @param macaddr: Pointer to hold MAC address |
| 14435 | * |
| 14436 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14437 | */ |
| 14438 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 14439 | void *evt_buf, uint8_t *macaddr) |
| 14440 | { |
| 14441 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 14442 | wmi_ready_event_fixed_param *ev = NULL; |
| 14443 | |
| 14444 | |
| 14445 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 14446 | ev = param_buf->fixed_param; |
| 14447 | |
| 14448 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 14449 | |
| 14450 | return QDF_STATUS_SUCCESS; |
| 14451 | } |
| 14452 | |
| 14453 | /** |
| 14454 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 14455 | * @wmi_handle: wmi handle |
| 14456 | * @param evt_buf: pointer to event buffer |
| 14457 | * |
| 14458 | * Return: length |
| 14459 | */ |
| 14460 | static uint8_t *extract_dbglog_data_len_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 029b9ea | 2017-01-25 12:46:21 -0800 | [diff] [blame] | 14461 | void *evt_buf, uint32_t *len) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14462 | { |
| 14463 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 14464 | |
| 14465 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 14466 | |
| 14467 | *len = param_buf->num_bufp; |
| 14468 | |
| 14469 | return param_buf->bufp; |
| 14470 | } |
| 14471 | |
| 14472 | /** |
| 14473 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 14474 | * @wmi_handle: wmi handle |
| 14475 | * @param evt_buf: pointer to event buffer |
| 14476 | * @param vdev_rsp: Pointer to hold vdev response |
| 14477 | * |
| 14478 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14479 | */ |
| 14480 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 14481 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 14482 | { |
| 14483 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 14484 | wmi_vdev_start_response_event_fixed_param *ev; |
| 14485 | |
| 14486 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 14487 | if (!param_buf) { |
| 14488 | qdf_print("Invalid start response event buffer\n"); |
| 14489 | return QDF_STATUS_E_INVAL; |
| 14490 | } |
| 14491 | |
| 14492 | ev = param_buf->fixed_param; |
| 14493 | if (!ev) { |
| 14494 | qdf_print("Invalid start response event buffer\n"); |
| 14495 | return QDF_STATUS_E_INVAL; |
| 14496 | } |
| 14497 | |
| 14498 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 14499 | |
| 14500 | vdev_rsp->vdev_id = ev->vdev_id; |
| 14501 | vdev_rsp->requestor_id = ev->requestor_id; |
| 14502 | vdev_rsp->resp_type = ev->resp_type; |
| 14503 | vdev_rsp->status = ev->status; |
| 14504 | vdev_rsp->chain_mask = ev->chain_mask; |
| 14505 | vdev_rsp->smps_mode = ev->smps_mode; |
| 14506 | vdev_rsp->mac_id = ev->mac_id; |
| 14507 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 14508 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 14509 | |
| 14510 | return QDF_STATUS_SUCCESS; |
| 14511 | } |
| 14512 | |
| 14513 | /** |
| 14514 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset update param |
| 14515 | * @wmi_handle: wmi handle |
| 14516 | * @param evt_buf: pointer to event buffer |
| 14517 | * @param vdev_map: Pointer to hold vdev map |
| 14518 | * @param tbttoffset_list: Pointer to tbtt offset list |
| 14519 | * |
| 14520 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14521 | */ |
| 14522 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 14523 | void *evt_buf, uint32_t *vdev_map, uint32_t **tbttoffset_list) |
| 14524 | { |
| 14525 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 14526 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 14527 | |
| 14528 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 14529 | if (!param_buf) { |
| 14530 | qdf_print("Invalid tbtt update event buffer\n"); |
| 14531 | return QDF_STATUS_E_INVAL; |
| 14532 | } |
| 14533 | tbtt_offset_event = param_buf->fixed_param; |
| 14534 | |
| 14535 | *vdev_map = tbtt_offset_event->vdev_map; |
| 14536 | *tbttoffset_list = param_buf->tbttoffset_list; |
| 14537 | |
| 14538 | return QDF_STATUS_SUCCESS; |
| 14539 | } |
| 14540 | |
| 14541 | /** |
| 14542 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 14543 | * @wmi_handle: wmi handle |
| 14544 | * @param evt_buf: pointer to event buffer |
| 14545 | * @param hdr: Pointer to hold header |
| 14546 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 14547 | * |
| 14548 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14549 | */ |
| 14550 | static QDF_STATUS extract_mgmt_rx_params_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | b4992a4 | 2017-01-05 14:23:18 +0530 | [diff] [blame] | 14551 | void *evt_buf, struct mgmt_rx_event_params *hdr, |
| 14552 | uint8_t **bufp) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14553 | { |
| 14554 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 14555 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 14556 | |
| 14557 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 14558 | if (!param_tlvs) { |
| 14559 | WMI_LOGE("Get NULL point message from FW"); |
| 14560 | return QDF_STATUS_E_INVAL; |
| 14561 | } |
| 14562 | |
| 14563 | ev_hdr = param_tlvs->hdr; |
| 14564 | if (!hdr) { |
| 14565 | WMI_LOGE("Rx event is NULL"); |
| 14566 | return QDF_STATUS_E_INVAL; |
| 14567 | } |
| 14568 | |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 14569 | hdr->pdev_id = ev_hdr->pdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14570 | |
| 14571 | hdr->channel = ev_hdr->channel; |
| 14572 | hdr->snr = ev_hdr->snr; |
| 14573 | hdr->rate = ev_hdr->rate; |
| 14574 | hdr->phy_mode = ev_hdr->phy_mode; |
| 14575 | hdr->buf_len = ev_hdr->buf_len; |
| 14576 | hdr->status = ev_hdr->status; |
| 14577 | hdr->flags = ev_hdr->flags; |
| 14578 | hdr->rssi = ev_hdr->rssi; |
| 14579 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 14580 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 14581 | |
| 14582 | *bufp = param_tlvs->bufp; |
| 14583 | |
| 14584 | return QDF_STATUS_SUCCESS; |
| 14585 | } |
| 14586 | |
| 14587 | /** |
| 14588 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 14589 | * @wmi_handle: wmi handle |
| 14590 | * @param evt_buf: pointer to event buffer |
| 14591 | * @param vdev_id: Pointer to hold vdev identifier |
| 14592 | * |
| 14593 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14594 | */ |
| 14595 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 14596 | void *evt_buf, uint32_t *vdev_id) |
| 14597 | { |
| 14598 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 14599 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 14600 | |
| 14601 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 14602 | if (!param_buf) { |
| 14603 | WMI_LOGE("Invalid event buffer"); |
| 14604 | return QDF_STATUS_E_INVAL; |
| 14605 | } |
| 14606 | resp_event = param_buf->fixed_param; |
| 14607 | *vdev_id = resp_event->vdev_id; |
| 14608 | |
| 14609 | return QDF_STATUS_SUCCESS; |
| 14610 | } |
| 14611 | |
| 14612 | /** |
| 14613 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 14614 | * @wmi_handle: wmi handle |
| 14615 | * @param evt_buf: pointer to event buffer |
| 14616 | * @param param: Pointer to hold roam param |
| 14617 | * |
| 14618 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14619 | */ |
| 14620 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 14621 | void *evt_buf, wmi_host_roam_event *param) |
| 14622 | { |
| 14623 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 14624 | wmi_roam_event_fixed_param *evt; |
| 14625 | |
| 14626 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 14627 | if (!param_buf) { |
| 14628 | WMI_LOGE("Invalid roam event buffer"); |
| 14629 | return QDF_STATUS_E_INVAL; |
| 14630 | } |
| 14631 | |
| 14632 | evt = param_buf->fixed_param; |
| 14633 | qdf_mem_zero(param, sizeof(*param)); |
| 14634 | |
| 14635 | param->vdev_id = evt->vdev_id; |
| 14636 | param->reason = evt->reason; |
| 14637 | param->rssi = evt->rssi; |
| 14638 | |
| 14639 | return QDF_STATUS_SUCCESS; |
| 14640 | } |
| 14641 | |
| 14642 | /** |
| 14643 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 14644 | * @wmi_handle: wmi handle |
| 14645 | * @param evt_buf: pointer to event buffer |
| 14646 | * @param param: Pointer to hold vdev scan param |
| 14647 | * |
| 14648 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14649 | */ |
| 14650 | static QDF_STATUS extract_vdev_scan_ev_param_tlv(wmi_unified_t wmi_handle, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14651 | void *evt_buf, struct scan_event *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14652 | { |
| 14653 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 14654 | wmi_scan_event_fixed_param *evt = NULL; |
| 14655 | |
| 14656 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 14657 | evt = param_buf->fixed_param; |
| 14658 | |
| 14659 | qdf_mem_zero(param, sizeof(*param)); |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 14660 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14661 | switch (evt->event) { |
| 14662 | case WMI_SCAN_EVENT_STARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14663 | param->type = SCAN_EVENT_TYPE_STARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14664 | break; |
| 14665 | case WMI_SCAN_EVENT_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14666 | param->type = SCAN_EVENT_TYPE_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14667 | break; |
| 14668 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14669 | param->type = SCAN_EVENT_TYPE_BSS_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14670 | break; |
| 14671 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14672 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14673 | break; |
| 14674 | case WMI_SCAN_EVENT_DEQUEUED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14675 | param->type = SCAN_EVENT_TYPE_DEQUEUED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14676 | break; |
| 14677 | case WMI_SCAN_EVENT_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14678 | param->type = SCAN_EVENT_TYPE_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14679 | break; |
| 14680 | case WMI_SCAN_EVENT_START_FAILED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14681 | param->type = SCAN_EVENT_TYPE_START_FAILED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14682 | break; |
| 14683 | case WMI_SCAN_EVENT_RESTARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14684 | param->type = SCAN_EVENT_TYPE_RESTARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14685 | break; |
| 14686 | case WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14687 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14688 | break; |
| 14689 | case WMI_SCAN_EVENT_MAX: |
| 14690 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14691 | param->type = SCAN_EVENT_TYPE_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14692 | break; |
| 14693 | }; |
| 14694 | |
| 14695 | switch (evt->reason) { |
| 14696 | case WMI_SCAN_REASON_NONE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14697 | param->reason = SCAN_REASON_NONE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14698 | break; |
| 14699 | case WMI_SCAN_REASON_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14700 | param->reason = SCAN_REASON_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14701 | break; |
| 14702 | case WMI_SCAN_REASON_CANCELLED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14703 | param->reason = SCAN_REASON_CANCELLED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14704 | break; |
| 14705 | case WMI_SCAN_REASON_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14706 | param->reason = SCAN_REASON_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14707 | break; |
| 14708 | case WMI_SCAN_REASON_TIMEDOUT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14709 | param->reason = SCAN_REASON_TIMEDOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14710 | break; |
| 14711 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14712 | param->reason = SCAN_REASON_INTERNAL_FAILURE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14713 | break; |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 14714 | case WMI_SCAN_REASON_SUSPENDED: |
| 14715 | param->reason = SCAN_REASON_SUSPENDED; |
| 14716 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14717 | case WMI_SCAN_REASON_MAX: |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 14718 | param->reason = SCAN_REASON_MAX; |
| 14719 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14720 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14721 | param->reason = SCAN_REASON_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14722 | break; |
| 14723 | }; |
| 14724 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 14725 | param->chan_freq = evt->channel_freq; |
| 14726 | param->requester = evt->requestor; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14727 | param->scan_id = evt->scan_id; |
| 14728 | param->vdev_id = evt->vdev_id; |
| 14729 | |
| 14730 | return QDF_STATUS_SUCCESS; |
| 14731 | } |
| 14732 | |
| 14733 | /** |
| 14734 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 14735 | * @wmi_handle: wmi handle |
| 14736 | * @param evt_buf: pointer to event buffer |
| 14737 | * @param param: Pointer to hold MGMT TX completion params |
| 14738 | * |
| 14739 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14740 | */ |
| 14741 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 14742 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 14743 | { |
| 14744 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 14745 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 14746 | |
| 14747 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 14748 | evt_buf; |
| 14749 | if (!param_buf) { |
| 14750 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 14751 | return QDF_STATUS_E_INVAL; |
| 14752 | } |
| 14753 | cmpl_params = param_buf->fixed_param; |
| 14754 | |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 14755 | param->pdev_id = cmpl_params->pdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14756 | param->desc_id = cmpl_params->desc_id; |
| 14757 | param->status = cmpl_params->status; |
| 14758 | |
| 14759 | return QDF_STATUS_SUCCESS; |
| 14760 | } |
| 14761 | |
| 14762 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 14763 | * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count |
| 14764 | * status tlv |
| 14765 | * @wmi_handle: wmi handle |
| 14766 | * @param evt_buf: pointer to event buffer |
| 14767 | * @param param: Pointer to hold csa switch count status event param |
| 14768 | * |
| 14769 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14770 | */ |
| 14771 | static QDF_STATUS extract_pdev_csa_switch_count_status_tlv( |
| 14772 | wmi_unified_t wmi_handle, |
| 14773 | void *evt_buf, |
| 14774 | struct pdev_csa_switch_count_status *param) |
| 14775 | { |
| 14776 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *param_buf; |
| 14777 | wmi_pdev_csa_switch_count_status_event_fixed_param *csa_status; |
| 14778 | |
| 14779 | param_buf = (WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *) |
| 14780 | evt_buf; |
| 14781 | if (!param_buf) { |
| 14782 | WMI_LOGE("%s: Invalid CSA status event\n", __func__); |
| 14783 | return QDF_STATUS_E_INVAL; |
| 14784 | } |
| 14785 | |
| 14786 | csa_status = param_buf->fixed_param; |
| 14787 | |
| 14788 | param->pdev_id = csa_status->pdev_id; |
| 14789 | param->current_switch_count = csa_status->current_switch_count; |
| 14790 | param->num_vdevs = csa_status->num_vdevs; |
| 14791 | param->vdev_ids = param_buf->vdev_ids; |
| 14792 | |
| 14793 | return QDF_STATUS_SUCCESS; |
| 14794 | } |
| 14795 | |
| 14796 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14797 | * extract_swba_vdev_map_tlv() - extract swba vdev map from event |
| 14798 | * @wmi_handle: wmi handle |
| 14799 | * @param evt_buf: pointer to event buffer |
| 14800 | * @param vdev_map: Pointer to hold vdev map |
| 14801 | * |
| 14802 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14803 | */ |
| 14804 | static QDF_STATUS extract_swba_vdev_map_tlv(wmi_unified_t wmi_handle, |
| 14805 | void *evt_buf, uint32_t *vdev_map) |
| 14806 | { |
| 14807 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 14808 | wmi_host_swba_event_fixed_param *swba_event; |
| 14809 | |
| 14810 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 14811 | if (!param_buf) { |
| 14812 | WMI_LOGE("Invalid swba event buffer"); |
| 14813 | return QDF_STATUS_E_INVAL; |
| 14814 | } |
| 14815 | swba_event = param_buf->fixed_param; |
| 14816 | *vdev_map = swba_event->vdev_map; |
| 14817 | |
| 14818 | return QDF_STATUS_SUCCESS; |
| 14819 | } |
| 14820 | |
| 14821 | /** |
| 14822 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 14823 | * @wmi_handle: wmi handle |
| 14824 | * @param evt_buf: pointer to event buffer |
| 14825 | * @param idx: Index to bcn info |
| 14826 | * @param tim_info: Pointer to hold tim info |
| 14827 | * |
| 14828 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14829 | */ |
| 14830 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 14831 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 14832 | { |
| 14833 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 14834 | wmi_tim_info *tim_info_ev; |
| 14835 | |
| 14836 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 14837 | if (!param_buf) { |
| 14838 | WMI_LOGE("Invalid swba event buffer"); |
| 14839 | return QDF_STATUS_E_INVAL; |
| 14840 | } |
| 14841 | |
| 14842 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 14843 | |
| 14844 | tim_info->tim_len = tim_info_ev->tim_len; |
| 14845 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 14846 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 14847 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 14848 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 14849 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
| 14850 | |
| 14851 | return QDF_STATUS_SUCCESS; |
| 14852 | } |
| 14853 | |
| 14854 | /** |
| 14855 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 14856 | * @wmi_handle: wmi handle |
| 14857 | * @param evt_buf: pointer to event buffer |
| 14858 | * @param idx: Index to bcn info |
| 14859 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 14860 | * |
| 14861 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14862 | */ |
| 14863 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 14864 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 14865 | { |
| 14866 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 14867 | wmi_p2p_noa_info *p2p_noa_info; |
| 14868 | uint8_t i = 0; |
| 14869 | |
| 14870 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 14871 | if (!param_buf) { |
| 14872 | WMI_LOGE("Invalid swba event buffer"); |
| 14873 | return QDF_STATUS_E_INVAL; |
| 14874 | } |
| 14875 | |
| 14876 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 14877 | |
| 14878 | p2p_desc->modified = false; |
| 14879 | p2p_desc->num_descriptors = 0; |
| 14880 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 14881 | p2p_desc->modified = true; |
| 14882 | p2p_desc->index = |
| 14883 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 14884 | p2p_desc->oppPS = |
| 14885 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 14886 | p2p_desc->ctwindow = |
| 14887 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 14888 | p2p_desc->num_descriptors = |
| 14889 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 14890 | (p2p_noa_info); |
| 14891 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 14892 | p2p_desc->noa_descriptors[i].type_count = |
| 14893 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 14894 | type_count; |
| 14895 | p2p_desc->noa_descriptors[i].duration = |
| 14896 | p2p_noa_info->noa_descriptors[i].duration; |
| 14897 | p2p_desc->noa_descriptors[i].interval = |
| 14898 | p2p_noa_info->noa_descriptors[i].interval; |
| 14899 | p2p_desc->noa_descriptors[i].start_time = |
| 14900 | p2p_noa_info->noa_descriptors[i].start_time; |
| 14901 | } |
| 14902 | } |
| 14903 | |
| 14904 | return QDF_STATUS_SUCCESS; |
| 14905 | } |
| 14906 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 14907 | #ifdef CONVERGED_P2P_ENABLE |
| 14908 | /** |
| 14909 | * extract_p2p_noa_ev_param_tlv() - extract p2p noa information from event |
| 14910 | * @wmi_handle: wmi handle |
| 14911 | * @param evt_buf: pointer to event buffer |
| 14912 | * @param param: Pointer to hold p2p noa info |
| 14913 | * |
| 14914 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14915 | */ |
| 14916 | static QDF_STATUS extract_p2p_noa_ev_param_tlv( |
| 14917 | wmi_unified_t wmi_handle, void *evt_buf, |
| 14918 | struct p2p_noa_info *param) |
| 14919 | { |
| 14920 | WMI_P2P_NOA_EVENTID_param_tlvs *param_tlvs; |
| 14921 | wmi_p2p_noa_event_fixed_param *fixed_param; |
| 14922 | uint8_t i; |
| 14923 | wmi_p2p_noa_info *wmi_noa_info; |
| 14924 | uint8_t *buf_ptr; |
| 14925 | uint32_t descriptors; |
| 14926 | |
| 14927 | param_tlvs = (WMI_P2P_NOA_EVENTID_param_tlvs *) evt_buf; |
| 14928 | if (!param_tlvs) { |
| 14929 | WMI_LOGE("%s: Invalid P2P NoA event buffer", __func__); |
| 14930 | return QDF_STATUS_E_INVAL; |
| 14931 | } |
| 14932 | |
| 14933 | if (!param) { |
| 14934 | WMI_LOGE("noa information param is null"); |
| 14935 | return QDF_STATUS_E_INVAL; |
| 14936 | } |
| 14937 | |
| 14938 | fixed_param = param_tlvs->fixed_param; |
| 14939 | buf_ptr = (uint8_t *) fixed_param; |
| 14940 | buf_ptr += sizeof(wmi_p2p_noa_event_fixed_param); |
| 14941 | wmi_noa_info = (wmi_p2p_noa_info *) (buf_ptr); |
| 14942 | |
| 14943 | if (!WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(wmi_noa_info)) { |
| 14944 | WMI_LOGE("%s: noa attr is not modified", __func__); |
| 14945 | return QDF_STATUS_E_INVAL; |
| 14946 | } |
| 14947 | |
| 14948 | param->vdev_id = fixed_param->vdev_id; |
| 14949 | param->index = |
| 14950 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(wmi_noa_info); |
| 14951 | param->opps_ps = |
| 14952 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(wmi_noa_info); |
| 14953 | param->ct_window = |
| 14954 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(wmi_noa_info); |
| 14955 | descriptors = WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET(wmi_noa_info); |
| 14956 | param->num_desc = (uint8_t) descriptors; |
| 14957 | |
| 14958 | WMI_LOGD("%s:index %u, opps_ps %u, ct_window %u, num_descriptors = %u", __func__, |
| 14959 | param->index, param->opps_ps, param->ct_window, |
| 14960 | param->num_desc); |
| 14961 | for (i = 0; i < param->num_desc; i++) { |
| 14962 | param->noa_desc[i].type_count = |
| 14963 | (uint8_t) wmi_noa_info->noa_descriptors[i]. |
| 14964 | type_count; |
| 14965 | param->noa_desc[i].duration = |
| 14966 | wmi_noa_info->noa_descriptors[i].duration; |
| 14967 | param->noa_desc[i].interval = |
| 14968 | wmi_noa_info->noa_descriptors[i].interval; |
| 14969 | param->noa_desc[i].start_time = |
| 14970 | wmi_noa_info->noa_descriptors[i].start_time; |
| 14971 | WMI_LOGD("%s:NoA descriptor[%d] type_count %u, duration %u, interval %u, start_time = %u", |
| 14972 | __func__, i, param->noa_desc[i].type_count, |
| 14973 | param->noa_desc[i].duration, |
| 14974 | param->noa_desc[i].interval, |
| 14975 | param->noa_desc[i].start_time); |
| 14976 | } |
| 14977 | |
| 14978 | return QDF_STATUS_SUCCESS; |
| 14979 | } |
| 14980 | |
| 14981 | /** |
| 14982 | * extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop |
| 14983 | * information from event |
| 14984 | * @wmi_handle: wmi handle |
| 14985 | * @param evt_buf: pointer to event buffer |
| 14986 | * @param param: Pointer to hold p2p lo stop event information |
| 14987 | * |
| 14988 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14989 | */ |
| 14990 | static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv( |
| 14991 | wmi_unified_t wmi_handle, void *evt_buf, |
| 14992 | struct p2p_lo_event *param) |
| 14993 | { |
| 14994 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *param_tlvs; |
| 14995 | wmi_p2p_lo_stopped_event_fixed_param *lo_param; |
| 14996 | |
| 14997 | param_tlvs = (WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *) |
| 14998 | evt_buf; |
| 14999 | if (!param_tlvs) { |
| 15000 | WMI_LOGE("%s: Invalid P2P lo stop event buffer", __func__); |
| 15001 | return QDF_STATUS_E_INVAL; |
| 15002 | } |
| 15003 | |
| 15004 | if (!param) { |
| 15005 | WMI_LOGE("lo stop event param is null"); |
| 15006 | return QDF_STATUS_E_INVAL; |
| 15007 | } |
| 15008 | |
| 15009 | lo_param = param_tlvs->fixed_param; |
| 15010 | param->vdev_id = lo_param->vdev_id; |
| 15011 | param->reason_code = lo_param->reason; |
| 15012 | WMI_LOGD("%s: vdev_id:%d, reason:%d", __func__, |
| 15013 | param->vdev_id, param->reason_code); |
| 15014 | |
| 15015 | return QDF_STATUS_SUCCESS; |
| 15016 | } |
| 15017 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 15018 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15019 | /** |
| 15020 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 15021 | * @wmi_handle: wmi handle |
| 15022 | * @param evt_buf: pointer to event buffer |
| 15023 | * @param ev: Pointer to hold peer param |
| 15024 | * |
| 15025 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15026 | */ |
| 15027 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 15028 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 15029 | { |
| 15030 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 15031 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 15032 | |
| 15033 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 15034 | kickout_event = param_buf->fixed_param; |
| 15035 | |
| 15036 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 15037 | ev->peer_macaddr); |
| 15038 | |
| 15039 | ev->reason = kickout_event->reason; |
| 15040 | ev->rssi = kickout_event->rssi; |
| 15041 | |
| 15042 | return QDF_STATUS_SUCCESS; |
| 15043 | } |
| 15044 | |
| 15045 | /** |
| 15046 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 15047 | * @wmi_handle: wmi handle |
| 15048 | * @param evt_buf: pointer to event buffer |
| 15049 | * @param stats_param: Pointer to hold stats count |
| 15050 | * |
| 15051 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15052 | */ |
| 15053 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 15054 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 15055 | { |
| 15056 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 15057 | wmi_stats_event_fixed_param *ev; |
| 15058 | |
| 15059 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 15060 | |
| 15061 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 15062 | if (!ev) { |
| 15063 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 15064 | return QDF_STATUS_E_FAILURE; |
| 15065 | } |
| 15066 | |
| 15067 | switch (ev->stats_id) { |
| 15068 | case WMI_REQUEST_PEER_STAT: |
| 15069 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 15070 | break; |
| 15071 | |
| 15072 | case WMI_REQUEST_AP_STAT: |
| 15073 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 15074 | break; |
| 15075 | |
| 15076 | case WMI_REQUEST_PDEV_STAT: |
| 15077 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 15078 | break; |
| 15079 | |
| 15080 | case WMI_REQUEST_VDEV_STAT: |
| 15081 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 15082 | break; |
| 15083 | |
| 15084 | case WMI_REQUEST_BCNFLT_STAT: |
| 15085 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 15086 | break; |
| 15087 | |
| 15088 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 15089 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 15090 | break; |
| 15091 | |
| 15092 | default: |
| 15093 | stats_param->stats_id = 0; |
| 15094 | break; |
| 15095 | |
| 15096 | } |
| 15097 | |
| 15098 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 15099 | stats_param->num_pdev_ext_stats = 0; |
| 15100 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 15101 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 15102 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 15103 | stats_param->num_chan_stats = ev->num_chan_stats; |
| 15104 | |
| 15105 | return QDF_STATUS_SUCCESS; |
| 15106 | } |
| 15107 | |
| 15108 | /** |
| 15109 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 15110 | * @wmi_handle: wmi handle |
| 15111 | * @param evt_buf: pointer to event buffer |
| 15112 | * @param index: Index into pdev stats |
| 15113 | * @param pdev_stats: Pointer to hold pdev stats |
| 15114 | * |
| 15115 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15116 | */ |
| 15117 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 15118 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 15119 | { |
| 15120 | return QDF_STATUS_SUCCESS; |
| 15121 | } |
| 15122 | |
| 15123 | /** |
| 15124 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 15125 | * @wmi_handle: wmi handle |
| 15126 | * @param evt_buf: pointer to event buffer |
| 15127 | * @param index: Index into extended pdev stats |
| 15128 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 15129 | * |
| 15130 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15131 | */ |
| 15132 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 15133 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 15134 | { |
| 15135 | return QDF_STATUS_SUCCESS; |
| 15136 | } |
| 15137 | |
| 15138 | /** |
| 15139 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 15140 | * @wmi_handle: wmi handle |
| 15141 | * @param evt_buf: pointer to event buffer |
| 15142 | * @param index: Index into vdev stats |
| 15143 | * @param vdev_stats: Pointer to hold vdev stats |
| 15144 | * |
| 15145 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15146 | */ |
| 15147 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 15148 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 15149 | { |
| 15150 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 15151 | wmi_stats_event_fixed_param *ev_param; |
| 15152 | uint8_t *data; |
| 15153 | |
| 15154 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 15155 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 15156 | data = (uint8_t *) param_buf->data; |
| 15157 | |
| 15158 | if (index < ev_param->num_vdev_stats) { |
| 15159 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 15160 | ((ev_param->num_pdev_stats) * |
| 15161 | sizeof(wmi_pdev_stats)) + |
| 15162 | (index * sizeof(wmi_vdev_stats))); |
| 15163 | |
| 15164 | vdev_stats->vdev_id = ev->vdev_id; |
| 15165 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 15166 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 15167 | |
| 15168 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 15169 | sizeof(ev->tx_frm_cnt)); |
| 15170 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 15171 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 15172 | ev->multiple_retry_cnt, |
| 15173 | sizeof(ev->multiple_retry_cnt)); |
| 15174 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 15175 | sizeof(ev->fail_cnt)); |
| 15176 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 15177 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 15178 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 15179 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 15180 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 15181 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 15182 | sizeof(ev->tx_rate_history)); |
| 15183 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 15184 | sizeof(ev->bcn_rssi_history)); |
| 15185 | |
| 15186 | } |
| 15187 | |
| 15188 | return QDF_STATUS_SUCCESS; |
| 15189 | } |
| 15190 | |
| 15191 | /** |
| 15192 | * extract_peer_stats_tlv() - extract peer stats from event |
| 15193 | * @wmi_handle: wmi handle |
| 15194 | * @param evt_buf: pointer to event buffer |
| 15195 | * @param index: Index into peer stats |
| 15196 | * @param peer_stats: Pointer to hold peer stats |
| 15197 | * |
| 15198 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15199 | */ |
| 15200 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 15201 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 15202 | { |
| 15203 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 15204 | wmi_stats_event_fixed_param *ev_param; |
| 15205 | uint8_t *data; |
| 15206 | |
| 15207 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 15208 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 15209 | data = (uint8_t *) param_buf->data; |
| 15210 | |
| 15211 | if (index < ev_param->num_peer_stats) { |
| 15212 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 15213 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 15214 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 15215 | (index * sizeof(wmi_peer_stats))); |
| 15216 | |
| 15217 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 15218 | |
| 15219 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 15220 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 15221 | |
| 15222 | peer_stats->peer_rssi = ev->peer_rssi; |
| 15223 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 15224 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 15225 | } |
| 15226 | |
| 15227 | return QDF_STATUS_SUCCESS; |
| 15228 | } |
| 15229 | |
| 15230 | /** |
| 15231 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 15232 | * @wmi_handle: wmi handle |
| 15233 | * @param evt_buf: pointer to event buffer |
| 15234 | * @param index: Index into bcn fault stats |
| 15235 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 15236 | * |
| 15237 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15238 | */ |
| 15239 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 15240 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 15241 | { |
| 15242 | return QDF_STATUS_SUCCESS; |
| 15243 | } |
| 15244 | |
| 15245 | /** |
| 15246 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 15247 | * @wmi_handle: wmi handle |
| 15248 | * @param evt_buf: pointer to event buffer |
| 15249 | * @param index: Index into extended peer stats |
| 15250 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 15251 | * |
| 15252 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15253 | */ |
| 15254 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 15255 | void *evt_buf, uint32_t index, |
| 15256 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 15257 | { |
| 15258 | return QDF_STATUS_SUCCESS; |
| 15259 | } |
| 15260 | |
| 15261 | /** |
| 15262 | * extract_chan_stats_tlv() - extract chan stats from event |
| 15263 | * @wmi_handle: wmi handle |
| 15264 | * @param evt_buf: pointer to event buffer |
| 15265 | * @param index: Index into chan stats |
| 15266 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 15267 | * |
| 15268 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15269 | */ |
| 15270 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 15271 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 15272 | { |
| 15273 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 15274 | wmi_stats_event_fixed_param *ev_param; |
| 15275 | uint8_t *data; |
| 15276 | |
| 15277 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 15278 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 15279 | data = (uint8_t *) param_buf->data; |
| 15280 | |
| 15281 | if (index < ev_param->num_chan_stats) { |
| 15282 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 15283 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 15284 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 15285 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 15286 | (index * sizeof(wmi_chan_stats))); |
| 15287 | |
| 15288 | |
| 15289 | /* Non-TLV doesnt have num_chan_stats */ |
| 15290 | chan_stats->chan_mhz = ev->chan_mhz; |
| 15291 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 15292 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 15293 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 15294 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 15295 | } |
| 15296 | |
| 15297 | return QDF_STATUS_SUCCESS; |
| 15298 | } |
| 15299 | |
| 15300 | /** |
| 15301 | * extract_profile_ctx_tlv() - extract profile context from event |
| 15302 | * @wmi_handle: wmi handle |
| 15303 | * @param evt_buf: pointer to event buffer |
| 15304 | * @idx: profile stats index to extract |
| 15305 | * @param profile_ctx: Pointer to hold profile context |
| 15306 | * |
| 15307 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15308 | */ |
| 15309 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 15310 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 15311 | { |
| 15312 | return QDF_STATUS_SUCCESS; |
| 15313 | } |
| 15314 | |
| 15315 | /** |
| 15316 | * extract_profile_data_tlv() - extract profile data from event |
| 15317 | * @wmi_handle: wmi handle |
| 15318 | * @param evt_buf: pointer to event buffer |
| 15319 | * @param profile_data: Pointer to hold profile data |
| 15320 | * |
| 15321 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15322 | */ |
| 15323 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 15324 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 15325 | { |
| 15326 | |
| 15327 | return QDF_STATUS_SUCCESS; |
| 15328 | } |
| 15329 | |
| 15330 | /** |
| 15331 | * extract_chan_info_event_tlv() - extract chan information from event |
| 15332 | * @wmi_handle: wmi handle |
| 15333 | * @param evt_buf: pointer to event buffer |
| 15334 | * @param chan_info: Pointer to hold chan information |
| 15335 | * |
| 15336 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15337 | */ |
| 15338 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 15339 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 15340 | { |
| 15341 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 15342 | wmi_chan_info_event_fixed_param *ev; |
| 15343 | |
| 15344 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 15345 | |
| 15346 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 15347 | if (!ev) { |
| 15348 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 15349 | return QDF_STATUS_E_FAILURE; |
| 15350 | } |
| 15351 | |
| 15352 | chan_info->err_code = ev->err_code; |
| 15353 | chan_info->freq = ev->freq; |
| 15354 | chan_info->cmd_flags = ev->cmd_flags; |
| 15355 | chan_info->noise_floor = ev->noise_floor; |
| 15356 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 15357 | chan_info->cycle_count = ev->cycle_count; |
| 15358 | |
| 15359 | return QDF_STATUS_SUCCESS; |
| 15360 | } |
| 15361 | |
| 15362 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 15363 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 15364 | * @wmi_handle: WMI handle |
| 15365 | * @param evt_buf: Pointer to event buffer |
| 15366 | * @param param: Pointer to hold data |
| 15367 | * |
| 15368 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 15369 | */ |
| 15370 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 15371 | uint8_t *evt_buf, |
| 15372 | struct wmi_host_pdev_utf_event *event) |
| 15373 | { |
| 15374 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
| 15375 | |
| 15376 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 15377 | event->data = param_buf->data; |
| 15378 | event->datalen = param_buf->num_data; |
Kiran Venkatappa | 15978c6 | 2017-02-28 12:42:36 +0530 | [diff] [blame] | 15379 | /* Set pdev_id=1 until FW adds support to include pdev_id */ |
| 15380 | event->pdev_id = 1; |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 15381 | |
| 15382 | return QDF_STATUS_SUCCESS; |
| 15383 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15384 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15385 | /** |
| 15386 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 15387 | * from event |
| 15388 | * @wmi_handle: wmi handle |
| 15389 | * @param evt_buf: pointer to event buffer |
| 15390 | * @param param: Pointer to hold evt buf |
| 15391 | * |
| 15392 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15393 | */ |
| 15394 | static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15395 | uint8_t *event, struct wlan_psoc_host_service_ext_param *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15396 | { |
| 15397 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 15398 | wmi_service_ready_ext_event_fixed_param *ev; |
| 15399 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 15400 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 15401 | |
| 15402 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 15403 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15404 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15405 | |
| 15406 | ev = param_buf->fixed_param; |
| 15407 | if (!ev) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15408 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15409 | |
| 15410 | /* Move this to host based bitmap */ |
| 15411 | param->default_conc_scan_config_bits = |
| 15412 | ev->default_conc_scan_config_bits; |
| 15413 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 15414 | param->he_cap_info = ev->he_cap_info; |
| 15415 | param->mpdu_density = ev->mpdu_density; |
| 15416 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 15417 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 15418 | |
| 15419 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15420 | if (hw_caps) |
| 15421 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 15422 | else |
| 15423 | param->num_hw_modes = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15424 | |
| 15425 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15426 | if (reg_caps) |
| 15427 | param->num_phy = reg_caps->num_phy; |
| 15428 | else |
| 15429 | param->num_phy = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15430 | |
| 15431 | return QDF_STATUS_SUCCESS; |
| 15432 | } |
| 15433 | |
| 15434 | /** |
| 15435 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 15436 | * extract HW mode cap from service ready event |
| 15437 | * @wmi_handle: wmi handle |
| 15438 | * @param evt_buf: pointer to event buffer |
| 15439 | * @param param: Pointer to hold evt buf |
| 15440 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 15441 | * |
| 15442 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15443 | */ |
| 15444 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 15445 | wmi_unified_t wmi_handle, |
| 15446 | uint8_t *event, uint8_t hw_mode_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15447 | struct wlan_psoc_host_hw_mode_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15448 | { |
| 15449 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 15450 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 15451 | |
| 15452 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 15453 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15454 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15455 | |
| 15456 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15457 | if (!hw_caps) |
| 15458 | return QDF_STATUS_E_INVAL; |
| 15459 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15460 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15461 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15462 | |
| 15463 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 15464 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 15465 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15466 | param->hw_mode_config_type = |
| 15467 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 15468 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15469 | return QDF_STATUS_SUCCESS; |
| 15470 | } |
| 15471 | |
| 15472 | /** |
| 15473 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 15474 | * extract MAC phy cap from service ready event |
| 15475 | * @wmi_handle: wmi handle |
| 15476 | * @param evt_buf: pointer to event buffer |
| 15477 | * @param param: Pointer to hold evt buf |
| 15478 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15479 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15480 | * |
| 15481 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15482 | */ |
| 15483 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 15484 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15485 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15486 | struct wlan_psoc_host_mac_phy_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15487 | { |
| 15488 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15489 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15490 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 15491 | uint32_t phy_map; |
| 15492 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15493 | |
| 15494 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 15495 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15496 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15497 | |
| 15498 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15499 | if (!hw_caps) |
| 15500 | return QDF_STATUS_E_INVAL; |
| 15501 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15502 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 15503 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 15504 | break; |
| 15505 | |
| 15506 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 15507 | while (phy_map) { |
| 15508 | phy_map >>= 1; |
| 15509 | phy_idx++; |
| 15510 | } |
| 15511 | } |
| 15512 | |
| 15513 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15514 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15515 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15516 | phy_idx += phy_id; |
| 15517 | if (phy_idx >= param_buf->num_mac_phy_caps) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15518 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15519 | |
| 15520 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15521 | |
| 15522 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
| 15523 | param->pdev_id = mac_phy_caps->pdev_id; |
| 15524 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 15525 | param->supports_11b = |
| 15526 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 15527 | param->supports_11g = |
| 15528 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 15529 | param->supports_11a = |
| 15530 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 15531 | param->supports_11n = |
| 15532 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 15533 | param->supports_11ac = |
| 15534 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 15535 | param->supports_11ax = |
| 15536 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15537 | |
| 15538 | param->supported_bands = mac_phy_caps->supported_bands; |
| 15539 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 15540 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 15541 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 15542 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 15543 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 15544 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 15545 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 15546 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 15547 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 15548 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 15549 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 15550 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 15551 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 15552 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 15553 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 15554 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 15555 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
Kris Muthusamy | 61fe369 | 2017-02-20 02:35:47 -0800 | [diff] [blame] | 15556 | qdf_mem_copy(¶m->he_cap_phy_info_2G, |
| 15557 | &mac_phy_caps->he_cap_phy_info_2G, |
| 15558 | sizeof(param->he_cap_phy_info_2G)); |
| 15559 | qdf_mem_copy(¶m->he_cap_phy_info_5G, |
| 15560 | &mac_phy_caps->he_cap_phy_info_5G, |
| 15561 | sizeof(param->he_cap_phy_info_5G)); |
| 15562 | qdf_mem_copy(¶m->he_ppet2G, &mac_phy_caps->he_ppet2G, |
| 15563 | sizeof(param->he_ppet2G)); |
| 15564 | qdf_mem_copy(¶m->he_ppet5G, &mac_phy_caps->he_ppet5G, |
| 15565 | sizeof(param->he_ppet5G)); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15566 | |
| 15567 | return QDF_STATUS_SUCCESS; |
| 15568 | } |
| 15569 | |
| 15570 | /** |
| 15571 | * extract_reg_cap_service_ready_ext_tlv() - |
| 15572 | * extract REG cap from service ready event |
| 15573 | * @wmi_handle: wmi handle |
| 15574 | * @param evt_buf: pointer to event buffer |
| 15575 | * @param param: Pointer to hold evt buf |
| 15576 | * @param phy_idx: phy idx should be less than num_mode |
| 15577 | * |
| 15578 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15579 | */ |
| 15580 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 15581 | wmi_unified_t wmi_handle, |
| 15582 | uint8_t *event, uint8_t phy_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15583 | struct wlan_psoc_host_hal_reg_capabilities_ext *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15584 | { |
| 15585 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 15586 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 15587 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 15588 | |
| 15589 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 15590 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15591 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15592 | |
| 15593 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15594 | if (!reg_caps) |
| 15595 | return QDF_STATUS_E_INVAL; |
| 15596 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15597 | if (phy_idx >= reg_caps->num_phy) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15598 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15599 | |
| 15600 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 15601 | |
| 15602 | param->phy_id = ext_reg_cap->phy_id; |
| 15603 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 15604 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 15605 | param->regcap1 = ext_reg_cap->regcap1; |
| 15606 | param->regcap2 = ext_reg_cap->regcap2; |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 15607 | param->wireless_modes = convert_wireless_modes_tlv( |
| 15608 | ext_reg_cap->wireless_modes); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 15609 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 15610 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 15611 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 15612 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 15613 | |
| 15614 | return QDF_STATUS_SUCCESS; |
| 15615 | } |
| 15616 | |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 15617 | /** |
| 15618 | * extract_dcs_interference_type_tlv() - extract dcs interference type |
| 15619 | * from event |
| 15620 | * @wmi_handle: wmi handle |
| 15621 | * @param evt_buf: pointer to event buffer |
| 15622 | * @param param: Pointer to hold dcs interference param |
| 15623 | * |
| 15624 | * Return: 0 for success or error code |
| 15625 | */ |
| 15626 | static QDF_STATUS extract_dcs_interference_type_tlv( |
| 15627 | wmi_unified_t wmi_handle, |
| 15628 | void *evt_buf, struct wmi_host_dcs_interference_param *param) |
| 15629 | { |
| 15630 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 15631 | |
| 15632 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 15633 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15634 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 15635 | |
| 15636 | param->interference_type = param_buf->fixed_param->interference_type; |
| 15637 | param->pdev_id = param_buf->fixed_param->pdev_id; |
| 15638 | |
| 15639 | return QDF_STATUS_SUCCESS; |
| 15640 | } |
| 15641 | |
| 15642 | /* |
| 15643 | * extract_dcs_cw_int_tlv() - extract dcs cw interference from event |
| 15644 | * @wmi_handle: wmi handle |
| 15645 | * @param evt_buf: pointer to event buffer |
| 15646 | * @param cw_int: Pointer to hold cw interference |
| 15647 | * |
| 15648 | * Return: 0 for success or error code |
| 15649 | */ |
| 15650 | static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle, |
| 15651 | void *evt_buf, |
| 15652 | wmi_host_ath_dcs_cw_int *cw_int) |
| 15653 | { |
| 15654 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 15655 | wlan_dcs_cw_int *ev; |
| 15656 | |
| 15657 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 15658 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15659 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 15660 | |
| 15661 | ev = param_buf->cw_int; |
| 15662 | |
| 15663 | cw_int->channel = ev->channel; |
| 15664 | |
| 15665 | return QDF_STATUS_SUCCESS; |
| 15666 | } |
| 15667 | |
| 15668 | /** |
| 15669 | * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event |
| 15670 | * @wmi_handle: wmi handle |
| 15671 | * @param evt_buf: pointer to event buffer |
| 15672 | * @param wlan_stat: Pointer to hold wlan stats |
| 15673 | * |
| 15674 | * Return: 0 for success or error code |
| 15675 | */ |
| 15676 | static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle, |
| 15677 | void *evt_buf, |
| 15678 | wmi_host_dcs_im_tgt_stats_t *wlan_stat) |
| 15679 | { |
| 15680 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 15681 | wlan_dcs_im_tgt_stats_t *ev; |
| 15682 | |
| 15683 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 15684 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 15685 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 15686 | |
| 15687 | ev = param_buf->wlan_stat; |
| 15688 | wlan_stat->reg_tsf32 = ev->reg_tsf32; |
| 15689 | wlan_stat->last_ack_rssi = ev->last_ack_rssi; |
| 15690 | wlan_stat->tx_waste_time = ev->tx_waste_time; |
| 15691 | wlan_stat->rx_time = ev->rx_time; |
| 15692 | wlan_stat->phyerr_cnt = ev->phyerr_cnt; |
| 15693 | wlan_stat->mib_stats.listen_time = ev->listen_time; |
| 15694 | wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt; |
| 15695 | wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt; |
| 15696 | wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt; |
| 15697 | wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt; |
| 15698 | wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt; |
| 15699 | wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt; |
| 15700 | wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt; |
| 15701 | wlan_stat->chan_nf = ev->chan_nf; |
| 15702 | wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 15703 | |
| 15704 | return QDF_STATUS_SUCCESS; |
| 15705 | } |
| 15706 | |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 15707 | #ifdef BIG_ENDIAN_HOST |
| 15708 | /** |
| 15709 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 15710 | * @param data_len - data length |
| 15711 | * @param data - pointer to data |
| 15712 | * |
| 15713 | * Return: QDF_STATUS - success or error status |
| 15714 | */ |
| 15715 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 15716 | { |
| 15717 | uint8_t *data_aligned = NULL; |
| 15718 | int c; |
| 15719 | unsigned char *data_unaligned; |
| 15720 | |
| 15721 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 15722 | FIPS_ALIGN)); |
| 15723 | /* Assigning unaligned space to copy the data */ |
| 15724 | /* Checking if kmalloc does succesful allocation */ |
| 15725 | if (data_unaligned == NULL) |
| 15726 | return QDF_STATUS_E_FAILURE; |
| 15727 | |
| 15728 | /* Checking if space is alligned */ |
| 15729 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 15730 | /* align the data space */ |
| 15731 | data_aligned = |
| 15732 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 15733 | } else { |
| 15734 | data_aligned = (u_int8_t *)data_unaligned; |
| 15735 | } |
| 15736 | |
| 15737 | /* memset and copy content from data to data aligned */ |
| 15738 | OS_MEMSET(data_aligned, 0, data_len); |
| 15739 | OS_MEMCPY(data_aligned, data, data_len); |
| 15740 | /* Endianness to LE */ |
| 15741 | for (c = 0; c < data_len/4; c++) { |
| 15742 | *((u_int32_t *)data_aligned + c) = |
| 15743 | qdf_os_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
| 15744 | } |
| 15745 | |
| 15746 | /* Copy content to event->data */ |
| 15747 | OS_MEMCPY(data, data_aligned, data_len); |
| 15748 | |
| 15749 | /* clean up allocated space */ |
| 15750 | qdf_mem_free(data_unaligned); |
| 15751 | data_aligned = NULL; |
| 15752 | data_unaligned = NULL; |
| 15753 | |
| 15754 | /*************************************************************/ |
| 15755 | |
| 15756 | return QDF_STATUS_SUCCESS; |
| 15757 | } |
| 15758 | #else |
| 15759 | /** |
| 15760 | * fips_conv_data_be() - DUMMY for LE platform |
| 15761 | * |
| 15762 | * Return: QDF_STATUS - success |
| 15763 | */ |
| 15764 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 15765 | { |
| 15766 | return QDF_STATUS_SUCCESS; |
| 15767 | } |
| 15768 | #endif |
| 15769 | |
| 15770 | /** |
| 15771 | * extract_fips_event_data_tlv() - extract fips event data |
| 15772 | * @wmi_handle: wmi handle |
| 15773 | * @param evt_buf: pointer to event buffer |
| 15774 | * @param param: pointer FIPS event params |
| 15775 | * |
| 15776 | * Return: 0 for success or error code |
| 15777 | */ |
| 15778 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 15779 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 15780 | { |
| 15781 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 15782 | wmi_pdev_fips_event_fixed_param *event; |
| 15783 | |
| 15784 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 15785 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 15786 | |
| 15787 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 15788 | QDF_STATUS_SUCCESS) |
| 15789 | return QDF_STATUS_E_FAILURE; |
| 15790 | |
| 15791 | param->data = (uint32_t *)param_buf->data; |
| 15792 | param->data_len = event->data_len; |
| 15793 | param->error_status = event->error_status; |
Kiran Venkatappa | aa07514 | 2017-03-30 15:22:50 +0530 | [diff] [blame] | 15794 | param->pdev_id = event->pdev_id; |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 15795 | |
| 15796 | return QDF_STATUS_SUCCESS; |
| 15797 | } |
| 15798 | |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 15799 | /* |
| 15800 | * extract_peer_delete_response_event_tlv() - extract peer delete response event |
| 15801 | * @wmi_handle: wmi handle |
| 15802 | * @param evt_buf: pointer to event buffer |
| 15803 | * @param vdev_id: Pointer to hold vdev_id |
| 15804 | * @param mac_addr: Pointer to hold peer mac address |
| 15805 | * |
| 15806 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15807 | */ |
| 15808 | static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl, |
| 15809 | void *evt_buf, struct wmi_host_peer_delete_response_event *param) |
| 15810 | { |
| 15811 | WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 15812 | wmi_peer_delete_resp_event_fixed_param *ev; |
| 15813 | |
| 15814 | param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf; |
| 15815 | |
| 15816 | ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param; |
| 15817 | if (!ev) { |
| 15818 | WMI_LOGE("%s: Invalid peer_delete response\n", __func__); |
| 15819 | return QDF_STATUS_E_FAILURE; |
| 15820 | } |
| 15821 | |
| 15822 | param->vdev_id = ev->vdev_id; |
| 15823 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr, |
| 15824 | ¶m->mac_address.bytes[0]); |
| 15825 | |
| 15826 | return QDF_STATUS_SUCCESS; |
| 15827 | } |
| 15828 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 15829 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 15830 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 15831 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 15832 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15833 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 15834 | return false; |
| 15835 | } |
| 15836 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 15837 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 15838 | { |
| 15839 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 15840 | |
| 15841 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 15842 | |
| 15843 | switch (set_cmd->param_id) { |
| 15844 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 15845 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 15846 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 15847 | default: |
| 15848 | break; |
| 15849 | } |
| 15850 | |
| 15851 | return 0; |
| 15852 | } |
| 15853 | |
| 15854 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 15855 | { |
| 15856 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 15857 | |
| 15858 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 15859 | |
| 15860 | switch (ps_cmd->param) { |
| 15861 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 15862 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 15863 | case WMI_STA_PS_ENABLE_QPOWER: |
| 15864 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 15865 | default: |
| 15866 | break; |
| 15867 | } |
| 15868 | |
| 15869 | return 0; |
| 15870 | } |
| 15871 | |
| 15872 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 15873 | uint32_t cmd_id) |
| 15874 | { |
| 15875 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 15876 | return 0; |
| 15877 | |
| 15878 | switch (cmd_id) { |
| 15879 | case WMI_VDEV_SET_PARAM_CMDID: |
| 15880 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 15881 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 15882 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 15883 | default: |
| 15884 | break; |
| 15885 | } |
| 15886 | |
| 15887 | return 0; |
| 15888 | } |
| 15889 | |
| 15890 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 15891 | { |
| 15892 | uint16_t tag = 0; |
| 15893 | |
| 15894 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
| 15895 | pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", |
| 15896 | __func__); |
| 15897 | return tag; |
| 15898 | } |
| 15899 | |
| 15900 | if (wmi_handle->tag_crash_inject) |
| 15901 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 15902 | |
| 15903 | wmi_handle->tag_crash_inject = false; |
| 15904 | return tag; |
| 15905 | } |
| 15906 | |
| 15907 | /** |
| 15908 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 15909 | * @wmi_handle: WMI handle |
| 15910 | * @buf: WMI buffer |
| 15911 | * @cmd_id: WMI command Id |
| 15912 | * |
| 15913 | * Return htc_tx_tag |
| 15914 | */ |
| 15915 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 15916 | wmi_buf_t buf, |
| 15917 | uint32_t cmd_id) |
| 15918 | { |
| 15919 | uint16_t htc_tx_tag = 0; |
| 15920 | |
| 15921 | switch (cmd_id) { |
| 15922 | case WMI_WOW_ENABLE_CMDID: |
| 15923 | case WMI_PDEV_SUSPEND_CMDID: |
| 15924 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 15925 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 15926 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 15927 | case WMI_PDEV_RESUME_CMDID: |
| 15928 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 15929 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 15930 | #ifdef FEATURE_WLAN_D0WOW |
| 15931 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 15932 | #endif |
| 15933 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 15934 | break; |
| 15935 | case WMI_FORCE_FW_HANG_CMDID: |
| 15936 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 15937 | break; |
| 15938 | case WMI_VDEV_SET_PARAM_CMDID: |
| 15939 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 15940 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 15941 | default: |
| 15942 | break; |
| 15943 | } |
| 15944 | |
| 15945 | return htc_tx_tag; |
| 15946 | } |
| 15947 | |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 15948 | /** |
| 15949 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 15950 | * from event |
| 15951 | * @wmi_handle: wmi handle |
| 15952 | * @param evt_buf: pointer to event buffer |
| 15953 | * @param ch_hopping: Pointer to hold channel hopping param |
| 15954 | * |
| 15955 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 15956 | */ |
| 15957 | static QDF_STATUS extract_channel_hopping_event_tlv( |
| 15958 | wmi_unified_t wmi_handle, void *evt_buf, |
| 15959 | wmi_host_pdev_channel_hopping_event *ch_hopping) |
| 15960 | { |
| 15961 | WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *param_buf; |
| 15962 | wmi_pdev_channel_hopping_event_fixed_param *event; |
| 15963 | |
| 15964 | param_buf = (WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *)evt_buf; |
| 15965 | event = (wmi_pdev_channel_hopping_event_fixed_param *) |
| 15966 | param_buf->fixed_param; |
| 15967 | |
| 15968 | ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter; |
| 15969 | ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter; |
Kiran Venkatappa | aa07514 | 2017-03-30 15:22:50 +0530 | [diff] [blame] | 15970 | ch_hopping->pdev_id = event->pdev_id; |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 15971 | |
| 15972 | return QDF_STATUS_SUCCESS; |
| 15973 | } |
| 15974 | |
| 15975 | /** |
| 15976 | * extract_pdev_tpc_ev_param_tlv() - extract tpc param from event |
| 15977 | * @wmi_handle: wmi handle |
| 15978 | * @param evt_buf: pointer to event buffer |
| 15979 | * @param param: Pointer to hold tpc param |
| 15980 | * |
| 15981 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 15982 | */ |
| 15983 | static QDF_STATUS extract_pdev_tpc_ev_param_tlv(wmi_unified_t wmi_handle, |
| 15984 | void *evt_buf, |
| 15985 | wmi_host_pdev_tpc_event *param) |
| 15986 | { |
| 15987 | WMI_PDEV_TPC_EVENTID_param_tlvs *param_buf; |
| 15988 | wmi_pdev_tpc_event_fixed_param *event; |
| 15989 | |
| 15990 | param_buf = (WMI_PDEV_TPC_EVENTID_param_tlvs *)evt_buf; |
| 15991 | event = (wmi_pdev_tpc_event_fixed_param *)param_buf->fixed_param; |
| 15992 | |
Kiran Venkatappa | aa07514 | 2017-03-30 15:22:50 +0530 | [diff] [blame] | 15993 | param->pdev_id = event->pdev_id; |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 15994 | qdf_mem_copy(param->tpc, param_buf->tpc, sizeof(param->tpc)); |
| 15995 | |
| 15996 | return QDF_STATUS_SUCCESS; |
| 15997 | } |
| 15998 | |
| 15999 | |
| 16000 | #ifdef BIG_ENDIAN_HOST |
| 16001 | /** |
| 16002 | * wds_addr_ev_conv_data_be() - LE to BE conversion of wds addr event |
| 16003 | * @param data_len - data length |
| 16004 | * @param data - pointer to data |
| 16005 | * |
| 16006 | * Return: QDF_STATUS - success or error status |
| 16007 | */ |
| 16008 | static QDF_STATUS wds_addr_ev_conv_data_be(uint16_t data_len, uint8_t *ev) |
| 16009 | { |
| 16010 | uint8_t *datap = (uint8_t *)ev; |
| 16011 | /* Skip swapping the first word */ |
| 16012 | datap += sizeof(uint32_t); |
| 16013 | for (i = 0; i < ((data_len / sizeof(uint32_t))-1); |
| 16014 | i++, datap += sizeof(uint32_t)) { |
| 16015 | *(uint32_t *)datap = qdf_le32_to_cpu(*(uint32_t *)datap); |
| 16016 | } |
| 16017 | |
| 16018 | return QDF_STATUS_SUCCESS; |
| 16019 | } |
| 16020 | #else |
| 16021 | /** |
| 16022 | * wds_addr_ev_conv_data_be() - Dummy operation for LE platforms |
| 16023 | * @param data_len - data length |
| 16024 | * @param data - pointer to data |
| 16025 | * |
| 16026 | * Return: QDF_STATUS - success or error status |
| 16027 | */ |
| 16028 | static QDF_STATUS wds_addr_ev_conv_data_be(uint32_t data_len, uint8_t *ev) |
| 16029 | { |
| 16030 | return QDF_STATUS_SUCCESS; |
| 16031 | } |
| 16032 | #endif |
| 16033 | |
| 16034 | /** |
| 16035 | * extract_wds_addr_event_tlv() - extract wds address from event |
| 16036 | * @wmi_handle: wmi handle |
| 16037 | * @param evt_buf: pointer to event buffer |
| 16038 | * @param wds_ev: Pointer to hold wds address |
| 16039 | * |
| 16040 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 16041 | */ |
| 16042 | static QDF_STATUS extract_wds_addr_event_tlv(wmi_unified_t wmi_handle, |
| 16043 | void *evt_buf, |
| 16044 | uint16_t len, wds_addr_event_t *wds_ev) |
| 16045 | { |
| 16046 | WMI_WDS_PEER_EVENTID_param_tlvs *param_buf; |
| 16047 | wmi_wds_addr_event_fixed_param *ev; |
| 16048 | int i; |
| 16049 | |
| 16050 | param_buf = (WMI_WDS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 16051 | ev = (wmi_wds_addr_event_fixed_param *)param_buf->fixed_param; |
| 16052 | |
| 16053 | if (wds_addr_ev_conv_data_be(len, (uint8_t *)ev) != QDF_STATUS_SUCCESS) |
| 16054 | return QDF_STATUS_E_FAILURE; |
| 16055 | |
| 16056 | qdf_mem_copy(wds_ev->event_type, ev->event_type, |
| 16057 | sizeof(wds_ev->event_type)); |
| 16058 | for (i = 0; i < 4; i++) { |
| 16059 | wds_ev->peer_mac[i] = |
| 16060 | ((u_int8_t *)&(ev->peer_mac.mac_addr31to0))[i]; |
| 16061 | wds_ev->dest_mac[i] = |
| 16062 | ((u_int8_t *)&(ev->dest_mac.mac_addr31to0))[i]; |
| 16063 | } |
| 16064 | for (i = 0; i < 2; i++) { |
| 16065 | wds_ev->peer_mac[4+i] = |
| 16066 | ((u_int8_t *)&(ev->peer_mac.mac_addr47to32))[i]; |
| 16067 | wds_ev->dest_mac[4+i] = |
| 16068 | ((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i]; |
| 16069 | } |
| 16070 | return QDF_STATUS_SUCCESS; |
| 16071 | } |
| 16072 | |
| 16073 | /** |
| 16074 | * extract_peer_sta_ps_statechange_ev_tlv() - extract peer sta ps state |
| 16075 | * from event |
| 16076 | * @wmi_handle: wmi handle |
| 16077 | * @param evt_buf: pointer to event buffer |
| 16078 | * @param ev: Pointer to hold peer param and ps state |
| 16079 | * |
| 16080 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 16081 | */ |
| 16082 | static QDF_STATUS extract_peer_sta_ps_statechange_ev_tlv(wmi_unified_t wmi_handle, |
| 16083 | void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev) |
| 16084 | { |
| 16085 | WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf; |
| 16086 | wmi_peer_sta_ps_statechange_event_fixed_param *event; |
| 16087 | |
| 16088 | param_buf = (WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *)evt_buf; |
| 16089 | event = (wmi_peer_sta_ps_statechange_event_fixed_param *) |
| 16090 | param_buf->fixed_param; |
| 16091 | |
| 16092 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, ev->peer_macaddr); |
| 16093 | ev->peer_ps_state = event->peer_ps_state; |
| 16094 | |
| 16095 | return QDF_STATUS_SUCCESS; |
| 16096 | } |
| 16097 | |
| 16098 | /** |
| 16099 | * extract_inst_rssi_stats_event_tlv() - extract inst rssi stats from event |
| 16100 | * @wmi_handle: wmi handle |
| 16101 | * @param evt_buf: pointer to event buffer |
| 16102 | * @param inst_rssi_resp: Pointer to hold inst rssi response |
| 16103 | * |
| 16104 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 16105 | */ |
| 16106 | static QDF_STATUS extract_inst_rssi_stats_event_tlv( |
| 16107 | wmi_unified_t wmi_handle, void *evt_buf, |
| 16108 | wmi_host_inst_stats_resp *inst_rssi_resp) |
| 16109 | { |
| 16110 | WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf; |
| 16111 | wmi_inst_rssi_stats_resp_fixed_param *event; |
| 16112 | |
| 16113 | param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf; |
| 16114 | event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param; |
| 16115 | |
| 16116 | qdf_mem_copy(&(inst_rssi_resp->peer_macaddr), |
| 16117 | &(event->peer_macaddr), sizeof(wmi_mac_addr)); |
| 16118 | inst_rssi_resp->iRSSI = event->iRSSI; |
| 16119 | |
| 16120 | return QDF_STATUS_SUCCESS; |
| 16121 | } |
| 16122 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16123 | static struct cur_reg_rule |
| 16124 | *create_reg_rules_from_wmi(uint32_t num_reg_rules, |
| 16125 | wmi_regulatory_rule_struct *wmi_reg_rule) |
| 16126 | { |
| 16127 | struct cur_reg_rule *reg_rule_ptr; |
| 16128 | uint32_t count; |
| 16129 | |
| 16130 | reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); |
| 16131 | |
| 16132 | if (NULL == reg_rule_ptr) { |
| 16133 | WMI_LOGE("memory allocation failure"); |
| 16134 | return NULL; |
| 16135 | } |
| 16136 | |
| 16137 | for (count = 0; count < num_reg_rules; count++) { |
| 16138 | reg_rule_ptr[count].start_freq = |
| 16139 | WMI_REG_RULE_START_FREQ_GET( |
| 16140 | wmi_reg_rule[count].freq_info); |
| 16141 | reg_rule_ptr[count].end_freq = |
| 16142 | WMI_REG_RULE_END_FREQ_GET( |
| 16143 | wmi_reg_rule[count].freq_info); |
| 16144 | reg_rule_ptr[count].max_bw = |
| 16145 | WMI_REG_RULE_MAX_BW_GET( |
| 16146 | wmi_reg_rule[count].bw_info); |
| 16147 | reg_rule_ptr[count].reg_power = |
| 16148 | WMI_REG_RULE_REG_POWER_GET( |
| 16149 | wmi_reg_rule[count].bw_info); |
| 16150 | reg_rule_ptr[count].flags = |
| 16151 | WMI_REG_RULE_FLAGS_GET( |
| 16152 | wmi_reg_rule[count].power_flag_info); |
| 16153 | } |
| 16154 | |
| 16155 | return reg_rule_ptr; |
| 16156 | } |
| 16157 | |
| 16158 | static QDF_STATUS extract_reg_chan_list_update_event_tlv( |
| 16159 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 16160 | struct cur_regulatory_info *reg_info, uint32_t len) |
| 16161 | { |
| 16162 | WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *param_buf; |
| 16163 | wmi_reg_chan_list_cc_event_fixed_param *chan_list_event_hdr; |
| 16164 | wmi_regulatory_rule_struct *wmi_reg_rule; |
| 16165 | uint32_t num_2g_reg_rules, num_5g_reg_rules; |
| 16166 | |
| 16167 | WMI_LOGD("processing regulatory channel list"); |
| 16168 | |
| 16169 | param_buf = (WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *)evt_buf; |
| 16170 | if (!param_buf) { |
| 16171 | WMI_LOGE("invalid channel list event buf"); |
| 16172 | return QDF_STATUS_E_FAILURE; |
| 16173 | } |
| 16174 | |
| 16175 | chan_list_event_hdr = param_buf->fixed_param; |
| 16176 | |
| 16177 | reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; |
| 16178 | reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; |
| 16179 | qdf_mem_copy(reg_info->alpha2, &(chan_list_event_hdr->alpha2), |
| 16180 | REG_ALPHA2_LEN); |
| 16181 | reg_info->dfs_region = chan_list_event_hdr->dfs_region; |
| 16182 | reg_info->phybitmap = chan_list_event_hdr->phybitmap; |
| 16183 | reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; |
| 16184 | reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; |
| 16185 | reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; |
| 16186 | reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; |
| 16187 | |
| 16188 | num_2g_reg_rules = reg_info->num_2g_reg_rules; |
| 16189 | num_5g_reg_rules = reg_info->num_5g_reg_rules; |
| 16190 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16191 | |
Kiran Kumar Lokere | dd64e04 | 2017-03-31 15:50:26 -0700 | [diff] [blame] | 16192 | wmi_reg_rule = |
| 16193 | (wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr |
| 16194 | + sizeof(wmi_reg_chan_list_cc_event_fixed_param) |
| 16195 | + WMI_TLV_HDR_SIZE); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16196 | reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, |
| 16197 | wmi_reg_rule); |
| 16198 | wmi_reg_rule += num_2g_reg_rules; |
| 16199 | |
| 16200 | reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, |
| 16201 | wmi_reg_rule); |
| 16202 | |
| 16203 | WMI_LOGD("processed regulatory channel list"); |
| 16204 | |
| 16205 | return QDF_STATUS_SUCCESS; |
| 16206 | } |
| 16207 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16208 | struct wmi_ops tlv_ops = { |
| 16209 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 16210 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 16211 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 16212 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 16213 | .send_hidden_ssid_vdev_restart_cmd = |
| 16214 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16215 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 16216 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 16217 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16218 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16219 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16220 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 16221 | .send_peer_rx_reorder_queue_setup_cmd = |
| 16222 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 16223 | .send_peer_rx_reorder_queue_remove_cmd = |
| 16224 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 16225 | .send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv, |
| 16226 | .send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv, |
| 16227 | .send_peer_update_wds_entry_cmd = send_peer_update_wds_entry_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16228 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 16229 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 16230 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 16231 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 16232 | .send_resume_cmd = send_resume_cmd_tlv, |
| 16233 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 16234 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 16235 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 16236 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 16237 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 16238 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 16239 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 16240 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
| 16241 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16242 | #ifndef CONFIG_MCL |
| 16243 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
| 16244 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16245 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 16246 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 16247 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 16248 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16249 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
| 16250 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 16251 | .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] | 16252 | .send_set_sta_uapsd_auto_trig_cmd = |
| 16253 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16254 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 16255 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 16256 | .send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 16257 | #ifdef CONVERGED_P2P_ENABLE |
| 16258 | .send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv, |
| 16259 | .send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv, |
| 16260 | #endif |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 16261 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 16262 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 16263 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 16264 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 16265 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 16266 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 16267 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 16268 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 16269 | .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] | 16270 | .send_ocb_start_timing_advert_cmd = |
| 16271 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 16272 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 16273 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 16274 | .send_set_mcc_channel_time_latency_cmd = |
| 16275 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 16276 | .send_set_mcc_channel_time_quota_cmd = |
| 16277 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 16278 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 16279 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 16280 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16281 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 16282 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 16283 | .send_vdev_set_gtx_cfg_cmd = send_vdev_set_gtx_cfg_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16284 | .send_probe_rsp_tmpl_send_cmd = |
| 16285 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 16286 | .send_p2p_go_set_beacon_ie_cmd = |
| 16287 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 16288 | .send_setup_install_key_cmd = |
| 16289 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16290 | .send_set_gateway_params_cmd = |
| 16291 | send_set_gateway_params_cmd_tlv, |
| 16292 | .send_set_rssi_monitoring_cmd = |
| 16293 | send_set_rssi_monitoring_cmd_tlv, |
| 16294 | .send_scan_probe_setoui_cmd = |
| 16295 | send_scan_probe_setoui_cmd_tlv, |
| 16296 | .send_reset_passpoint_network_list_cmd = |
| 16297 | send_reset_passpoint_network_list_cmd_tlv, |
| 16298 | .send_set_passpoint_network_list_cmd = |
| 16299 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 16300 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 16301 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
| 16302 | .send_roam_scan_filter_cmd = |
| 16303 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16304 | .send_set_epno_network_list_cmd = |
| 16305 | send_set_epno_network_list_cmd_tlv, |
| 16306 | .send_ipa_offload_control_cmd = |
| 16307 | send_ipa_offload_control_cmd_tlv, |
| 16308 | .send_extscan_get_capabilities_cmd = |
| 16309 | send_extscan_get_capabilities_cmd_tlv, |
| 16310 | .send_extscan_get_cached_results_cmd = |
| 16311 | send_extscan_get_cached_results_cmd_tlv, |
| 16312 | .send_extscan_stop_change_monitor_cmd = |
| 16313 | send_extscan_stop_change_monitor_cmd_tlv, |
| 16314 | .send_extscan_start_change_monitor_cmd = |
| 16315 | send_extscan_start_change_monitor_cmd_tlv, |
| 16316 | .send_extscan_stop_hotlist_monitor_cmd = |
| 16317 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 16318 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 16319 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 16320 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 16321 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 16322 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16323 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16324 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16325 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 16326 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 16327 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 16328 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 16329 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 16330 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16331 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 16332 | .send_snr_cmd = send_snr_cmd_tlv, |
| 16333 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 16334 | #ifdef WLAN_PMO_ENABLE |
| 16335 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 16336 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 16337 | .send_enable_arp_ns_offload_cmd = send_enable_arp_ns_offload_cmd_tlv, |
| 16338 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
| 16339 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 16340 | .send_process_gtk_offload_getinfo_cmd = |
| 16341 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 16342 | .send_enable_enhance_multicast_offload_cmd = |
| 16343 | send_enable_enhance_multicast_offload_tlv, |
| 16344 | .extract_gtk_rsp_event = extract_gtk_rsp_event_tlv, |
| 16345 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 16346 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
| 16347 | #endif |
| 16348 | .send_action_frame_patterns_cmd = send_action_frame_patterns_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16349 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 16350 | .send_lphb_config_tcp_params_cmd = send_lphb_config_tcp_params_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 16351 | .send_lphb_config_tcp_pkt_filter_cmd = |
| 16352 | send_lphb_config_tcp_pkt_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16353 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 16354 | .send_lphb_config_udp_pkt_filter_cmd = |
| 16355 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 16356 | #endif /* End of WLAN_PMO_ENABLE */ |
| 16357 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16358 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 16359 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 16360 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16361 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
| 16362 | .send_process_update_edca_param_cmd = |
| 16363 | send_process_update_edca_param_cmd_tlv, |
| 16364 | .send_roam_scan_offload_mode_cmd = |
| 16365 | send_roam_scan_offload_mode_cmd_tlv, |
| 16366 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 16367 | .send_roam_scan_offload_ap_profile_cmd = |
| 16368 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 16369 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16370 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 16371 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16372 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 16373 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
| 16374 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 16375 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16376 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 16377 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 16378 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 16379 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 16380 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
| 16381 | .send_enable_disable_packet_filter_cmd = |
| 16382 | send_enable_disable_packet_filter_cmd_tlv, |
| 16383 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16384 | .send_process_add_periodic_tx_ptrn_cmd = |
| 16385 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 16386 | .send_process_del_periodic_tx_ptrn_cmd = |
| 16387 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 16388 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 16389 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 16390 | .send_set_app_type2_params_in_fw_cmd = |
| 16391 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 16392 | .send_set_auto_shutdown_timer_cmd = |
| 16393 | send_set_auto_shutdown_timer_cmd_tlv, |
| 16394 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 16395 | .send_process_dhcpserver_offload_cmd = |
| 16396 | send_process_dhcpserver_offload_cmd_tlv, |
| 16397 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 16398 | .send_process_ch_avoid_update_cmd = |
| 16399 | send_process_ch_avoid_update_cmd_tlv, |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 16400 | .send_pdev_set_regdomain_cmd = |
| 16401 | send_pdev_set_regdomain_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 16402 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 16403 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 16404 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 16405 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 16406 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 16407 | .send_process_set_ie_info_cmd = send_process_set_ie_info_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 16408 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 16409 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 16410 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 16411 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16412 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16413 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 16414 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16415 | .send_set_base_macaddr_indicate_cmd = |
| 16416 | send_set_base_macaddr_indicate_cmd_tlv, |
| 16417 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 16418 | .send_enable_specific_fw_logs_cmd = |
| 16419 | send_enable_specific_fw_logs_cmd_tlv, |
| 16420 | .send_flush_logs_to_fw_cmd = send_flush_logs_to_fw_cmd_tlv, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 16421 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 16422 | .send_pdev_set_hw_mode_cmd = send_pdev_set_hw_mode_cmd_tlv, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 16423 | .send_pdev_set_dual_mac_config_cmd = |
| 16424 | send_pdev_set_dual_mac_config_cmd_tlv, |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 16425 | .send_enable_broadcast_filter_cmd = |
| 16426 | send_enable_broadcast_filter_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16427 | .send_app_type1_params_in_fw_cmd = |
| 16428 | send_app_type1_params_in_fw_cmd_tlv, |
| 16429 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 16430 | .send_process_roam_synch_complete_cmd = |
| 16431 | send_process_roam_synch_complete_cmd_tlv, |
| 16432 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 16433 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 16434 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 16435 | .send_roam_scan_offload_scan_period_cmd = |
| 16436 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 16437 | .send_roam_scan_offload_chan_list_cmd = |
| 16438 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 16439 | .send_roam_scan_offload_rssi_change_cmd = |
| 16440 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 16441 | .send_get_buf_extscan_hotlist_cmd = |
| 16442 | send_get_buf_extscan_hotlist_cmd_tlv, |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 16443 | .send_set_active_bpf_mode_cmd = send_set_active_bpf_mode_cmd_tlv, |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 16444 | .send_adapt_dwelltime_params_cmd = |
| 16445 | send_adapt_dwelltime_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16446 | .init_cmd_send = init_cmd_send_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 16447 | .send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv, |
| 16448 | .send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv, |
| 16449 | .send_set_ctl_table_cmd = send_set_ctl_table_cmd_tlv, |
| 16450 | .send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv, |
| 16451 | .send_packet_power_info_get_cmd = send_packet_power_info_get_cmd_tlv, |
| 16452 | .send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv, |
| 16453 | .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, |
| 16454 | .send_vdev_set_neighbour_rx_cmd = send_vdev_set_neighbour_rx_cmd_tlv, |
| 16455 | .send_smart_ant_set_tx_ant_cmd = send_smart_ant_set_tx_ant_cmd_tlv, |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 16456 | .send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv, |
| 16457 | .send_smart_ant_set_training_info_cmd = |
| 16458 | send_smart_ant_set_training_info_cmd_tlv, |
| 16459 | .send_smart_ant_set_node_config_cmd = |
| 16460 | send_smart_ant_set_node_config_cmd_tlv, |
| 16461 | .send_set_atf_cmd = send_set_atf_cmd_tlv, |
| 16462 | .send_vdev_set_fwtest_param_cmd = send_vdev_set_fwtest_param_cmd_tlv, |
| 16463 | .send_set_qboost_param_cmd = send_set_qboost_param_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 16464 | .send_gpio_config_cmd = send_gpio_config_cmd_tlv, |
| 16465 | .send_gpio_output_cmd = send_gpio_output_cmd_tlv, |
| 16466 | .send_phyerr_disable_cmd = send_phyerr_disable_cmd_tlv, |
| 16467 | .send_phyerr_enable_cmd = send_phyerr_enable_cmd_tlv, |
| 16468 | .send_nf_dbr_dbm_info_get_cmd = send_nf_dbr_dbm_info_get_cmd_tlv, |
| 16469 | .send_set_ht_ie_cmd = send_set_ht_ie_cmd_tlv, |
| 16470 | .send_set_vht_ie_cmd = send_set_vht_ie_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16471 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 16472 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 16473 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 16474 | .save_service_bitmap = save_service_bitmap_tlv, |
| 16475 | .is_service_enabled = is_service_enabled_tlv, |
| 16476 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 16477 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 16478 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
| 16479 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 16480 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 16481 | .extract_tbttoffset_update_params = |
| 16482 | extract_tbttoffset_update_params_tlv, |
| 16483 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 16484 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 16485 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 16486 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
| 16487 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
| 16488 | .extract_swba_vdev_map = extract_swba_vdev_map_tlv, |
| 16489 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 16490 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 16491 | #ifdef CONVERGED_P2P_ENABLE |
| 16492 | .extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv, |
| 16493 | .extract_p2p_lo_stop_ev_param = |
| 16494 | extract_p2p_lo_stop_ev_param_tlv, |
| 16495 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16496 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 16497 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 16498 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 16499 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 16500 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 16501 | .extract_peer_stats = extract_peer_stats_tlv, |
| 16502 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 16503 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 16504 | .extract_chan_stats = extract_chan_stats_tlv, |
| 16505 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 16506 | .extract_profile_data = extract_profile_data_tlv, |
| 16507 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 16508 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 16509 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 16510 | .send_encrypt_decrypt_send_cmd = |
| 16511 | send_encrypt_decrypt_send_cmd_tlv, |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 16512 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 16513 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16514 | .send_multiple_vdev_restart_req_cmd = |
| 16515 | send_multiple_vdev_restart_req_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16516 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 16517 | .extract_hw_mode_cap_service_ready_ext = |
| 16518 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 16519 | .extract_mac_phy_cap_service_ready_ext = |
| 16520 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 16521 | .extract_reg_cap_service_ready_ext = |
| 16522 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 16523 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 16524 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16525 | .extract_dcs_interference_type = extract_dcs_interference_type_tlv, |
| 16526 | .extract_dcs_cw_int = extract_dcs_cw_int_tlv, |
| 16527 | .extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 16528 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 16529 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 16530 | .extract_peer_delete_response_event = |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16531 | extract_peer_delete_response_event_tlv, |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 16532 | .is_management_record = is_management_record_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16533 | .extract_pdev_csa_switch_count_status = |
| 16534 | extract_pdev_csa_switch_count_status_tlv, |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 16535 | .extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv, |
| 16536 | .extract_wds_addr_event = extract_wds_addr_event_tlv, |
| 16537 | .extract_peer_sta_ps_statechange_ev = |
| 16538 | extract_peer_sta_ps_statechange_ev_tlv, |
| 16539 | .extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv, |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 16540 | .send_per_roam_config_cmd = send_per_roam_config_cmd_tlv, |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 16541 | .send_dfs_phyerr_offload_en_cmd = send_dfs_phyerr_offload_en_cmd_tlv, |
| 16542 | .send_dfs_phyerr_offload_dis_cmd = send_dfs_phyerr_offload_dis_cmd_tlv, |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16543 | .extract_reg_chan_list_update_event = |
| 16544 | extract_reg_chan_list_update_event_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 16545 | }; |
| 16546 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16547 | /** |
| 16548 | * populate_tlv_event_id() - populates wmi event ids |
| 16549 | * |
| 16550 | * @param event_ids: Pointer to hold event ids |
| 16551 | * Return: None |
| 16552 | */ |
| 16553 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 16554 | { |
| 16555 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 16556 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 16557 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 16558 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 16559 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 16560 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 16561 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 16562 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 16563 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 16564 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 16565 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 16566 | event_ids[wmi_service_ready_ext_event_id] = |
| 16567 | WMI_SERVICE_READY_EXT_EVENTID; |
| 16568 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 16569 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 16570 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 16571 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 16572 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 16573 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 16574 | |
| 16575 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 16576 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 16577 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 16578 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 16579 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 16580 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 16581 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 16582 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 16583 | event_ids[wmi_peer_delete_response_event_id] = |
| 16584 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16585 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 16586 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 16587 | event_ids[wmi_tbttoffset_update_event_id] = |
| 16588 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
| 16589 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 16590 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 16591 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 16592 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 16593 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 16594 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 16595 | |
| 16596 | event_ids[wmi_tx_delba_complete_event_id] = |
| 16597 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 16598 | event_ids[wmi_tx_addba_complete_event_id] = |
| 16599 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 16600 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 16601 | |
| 16602 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 16603 | |
| 16604 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 16605 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 16606 | |
| 16607 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 16608 | |
| 16609 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 16610 | |
| 16611 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
Wu Gao | 84ed340 | 2017-03-15 19:12:20 +0800 | [diff] [blame] | 16612 | event_ids[wmi_p2p_lo_stop_event_id] = |
| 16613 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16614 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 16615 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 16616 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 16617 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 16618 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 16619 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 16620 | |
| 16621 | event_ids[wmi_rtt_meas_report_event_id] = |
| 16622 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 16623 | event_ids[wmi_tsf_meas_report_event_id] = |
| 16624 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 16625 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 16626 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 16627 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 16628 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 16629 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 16630 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 16631 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 16632 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 16633 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 16634 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 16635 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 16636 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 16637 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 16638 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 16639 | |
| 16640 | event_ids[wmi_gtk_offload_status_event_id] = |
| 16641 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 16642 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 16643 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 16644 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 16645 | |
| 16646 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 16647 | |
| 16648 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 16649 | |
| 16650 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 16651 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 16652 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 16653 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 16654 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 16655 | event_ids[wmi_wlan_profile_data_event_id] = |
| 16656 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 16657 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 16658 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 16659 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 16660 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 16661 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 16662 | |
| 16663 | event_ids[wmi_diag_container_event_id] = |
| 16664 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 16665 | |
| 16666 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 16667 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 16668 | |
| 16669 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 16670 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 16671 | |
| 16672 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 16673 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 16674 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 16675 | |
| 16676 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 16677 | |
| 16678 | /** Set OCB Sched Response, deprecated */ |
| 16679 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 16680 | |
| 16681 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 16682 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 16683 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 16684 | |
| 16685 | /* GPIO Event */ |
| 16686 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 16687 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 16688 | |
| 16689 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 16690 | event_ids[wmi_rfkill_state_change_event_id] = |
| 16691 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 16692 | |
| 16693 | /* TDLS Event */ |
| 16694 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 16695 | |
| 16696 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 16697 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 16698 | event_ids[wmi_batch_scan_result_event_id] = |
| 16699 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 16700 | /* OEM Event */ |
| 16701 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 16702 | event_ids[wmi_oem_meas_report_event_id] = |
| 16703 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 16704 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 16705 | |
| 16706 | /* NAN Event */ |
| 16707 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 16708 | |
| 16709 | /* LPI Event */ |
| 16710 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 16711 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 16712 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 16713 | |
| 16714 | /* ExtScan events */ |
| 16715 | event_ids[wmi_extscan_start_stop_event_id] = |
| 16716 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 16717 | event_ids[wmi_extscan_operation_event_id] = |
| 16718 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 16719 | event_ids[wmi_extscan_table_usage_event_id] = |
| 16720 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 16721 | event_ids[wmi_extscan_cached_results_event_id] = |
| 16722 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 16723 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 16724 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 16725 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 16726 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 16727 | event_ids[wmi_extscan_capabilities_event_id] = |
| 16728 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 16729 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 16730 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 16731 | |
| 16732 | /* mDNS offload events */ |
| 16733 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 16734 | |
| 16735 | /* SAP Authentication offload events */ |
| 16736 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 16737 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 16738 | |
| 16739 | /** Out-of-context-of-bss (OCB) events */ |
| 16740 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 16741 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 16742 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 16743 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 16744 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 16745 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 16746 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 16747 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 16748 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 16749 | /* System-On-Chip events */ |
| 16750 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 16751 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 16752 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 16753 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 16754 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 16755 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 16756 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 16757 | event_ids[wmi_pdev_csa_switch_count_status_event_id] = |
| 16758 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID; |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 16759 | event_ids[wmi_reg_chan_list_cc_event_id] = WMI_REG_CHAN_LIST_CC_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16760 | } |
| 16761 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 16762 | #ifndef CONFIG_MCL |
| 16763 | /** |
| 16764 | * populate_tlv_service() - populates wmi services |
| 16765 | * |
| 16766 | * @param wmi_service: Pointer to hold wmi_service |
| 16767 | * Return: None |
| 16768 | */ |
| 16769 | static void populate_tlv_service(uint32_t *wmi_service) |
| 16770 | { |
| 16771 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
| 16772 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 16773 | wmi_service[wmi_service_roam_scan_offload] = |
| 16774 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 16775 | wmi_service[wmi_service_bcn_miss_offload] = |
| 16776 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 16777 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 16778 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 16779 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 16780 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 16781 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 16782 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 16783 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 16784 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 16785 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 16786 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 16787 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 16788 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 16789 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 16790 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 16791 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 16792 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 16793 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 16794 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 16795 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 16796 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 16797 | wmi_service[wmi_service_packet_power_save] = |
| 16798 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 16799 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 16800 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 16801 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 16802 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 16803 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 16804 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 16805 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 16806 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 16807 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 16808 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 16809 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 16810 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 16811 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 16812 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 16813 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 16814 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 16815 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 16816 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 16817 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 16818 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 16819 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 16820 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 16821 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 16822 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 16823 | wmi_service[wmi_service_lte_ant_share_support] = |
| 16824 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 16825 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 16826 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 16827 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 16828 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 16829 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 16830 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 16831 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 16832 | wmi_service[wmi_service_bcn_txrate_override] = |
| 16833 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 16834 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 16835 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 16836 | wmi_service[wmi_service_estimate_linkspeed] = |
| 16837 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 16838 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 16839 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 16840 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 16841 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 16842 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 16843 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 16844 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 16845 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 16846 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 16847 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 16848 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 16849 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 16850 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 16851 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 16852 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 16853 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 16854 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 16855 | wmi_service[wmi_service_sap_auth_offload] = |
| 16856 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 16857 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 16858 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 16859 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 16860 | wmi_service[wmi_service_ap_arpns_offload] = |
| 16861 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 16862 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 16863 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 16864 | wmi_service[wmi_service_packet_filter_offload] = |
| 16865 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 16866 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 16867 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 16868 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 16869 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 16870 | wmi_service[wmi_service_multiple_vdev_restart] = |
| 16871 | WMI_SERVICE_MULTIPLE_VDEV_RESTART; |
| 16872 | |
| 16873 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 16874 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 16875 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 16876 | WMI_SERVICE_UNAVAILABLE; |
| 16877 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 16878 | WMI_SERVICE_UNAVAILABLE; |
| 16879 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 16880 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
| 16881 | wmi_service[wmi_service_atf] = WMI_SERVICE_UNAVAILABLE; |
| 16882 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 16883 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 16884 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 16885 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 16886 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 16887 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 16888 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 16889 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
| 16890 | |
| 16891 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 16892 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 16893 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 16894 | WMI_SERVICE_UNAVAILABLE; |
| 16895 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 16896 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 16897 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 16898 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
| 16899 | wmi_service[wmi_service_4_wire_coex_support] = WMI_SERVICE_UNAVAILABLE; |
| 16900 | wmi_service[wmi_service_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
| 16901 | } |
| 16902 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16903 | /** |
| 16904 | * populate_pdev_param_tlv() - populates pdev params |
| 16905 | * |
| 16906 | * @param pdev_param: Pointer to hold pdev params |
| 16907 | * Return: None |
| 16908 | */ |
| 16909 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 16910 | { |
| 16911 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 16912 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 16913 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 16914 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 16915 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 16916 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 16917 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 16918 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 16919 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 16920 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 16921 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 16922 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 16923 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 16924 | pdev_param[wmi_pdev_param_protection_mode] = |
| 16925 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 16926 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 16927 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 16928 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 16929 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 16930 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 16931 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 16932 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 16933 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 16934 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 16935 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 16936 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 16937 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 16938 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 16939 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 16940 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 16941 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 16942 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 16943 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 16944 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 16945 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 16946 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 16947 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 16948 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 16949 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 16950 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 16951 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 16952 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 16953 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 16954 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 16955 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 16956 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 16957 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 16958 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 16959 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 16960 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 16961 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 16962 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 16963 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 16964 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 16965 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 16966 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 16967 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 16968 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 16969 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 16970 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 16971 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 16972 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 16973 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 16974 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 16975 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 16976 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 16977 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 16978 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 16979 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 16980 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 16981 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 16982 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 16983 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 16984 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 16985 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 16986 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 16987 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 16988 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 16989 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 16990 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 16991 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 16992 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 16993 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 16994 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 16995 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 16996 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 16997 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 16998 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 16999 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 17000 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 17001 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 17002 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 17003 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 17004 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 17005 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 17006 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 17007 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 17008 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 17009 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 17010 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 17011 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 17012 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 17013 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 17014 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 17015 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 17016 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 17017 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 17018 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 17019 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 17020 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 17021 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 17022 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 17023 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 17024 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 17025 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 17026 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 17027 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 17028 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 17029 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 17030 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 17031 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 17032 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 17033 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 17034 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 17035 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 17036 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 17037 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 17038 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 17039 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 17040 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 17041 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 17042 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
| 17043 | pdev_param[wmi_pdev_param_rx_filter] = WMI_UNAVAILABLE_PARAM; |
| 17044 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = WMI_UNAVAILABLE_PARAM; |
| 17045 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = WMI_UNAVAILABLE_PARAM; |
| 17046 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_UNAVAILABLE_PARAM; |
| 17047 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
| 17048 | WMI_UNAVAILABLE_PARAM; |
| 17049 | pdev_param[wmi_pdev_param_proxy_sta_mode] = WMI_UNAVAILABLE_PARAM; |
| 17050 | pdev_param[wmi_pdev_param_mu_group_policy] = WMI_UNAVAILABLE_PARAM; |
| 17051 | pdev_param[wmi_pdev_param_noise_detection] = WMI_UNAVAILABLE_PARAM; |
| 17052 | pdev_param[wmi_pdev_param_noise_threshold] = WMI_UNAVAILABLE_PARAM; |
| 17053 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_UNAVAILABLE_PARAM; |
| 17054 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = WMI_UNAVAILABLE_PARAM; |
| 17055 | pdev_param[wmi_pdev_param_atf_strict_sch] = WMI_UNAVAILABLE_PARAM; |
| 17056 | pdev_param[wmi_pdev_param_atf_sched_duration] = WMI_UNAVAILABLE_PARAM; |
| 17057 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_UNAVAILABLE_PARAM; |
| 17058 | pdev_param[wmi_pdev_param_sensitivity_level] = WMI_UNAVAILABLE_PARAM; |
| 17059 | pdev_param[wmi_pdev_param_signed_txpower_2g] = WMI_UNAVAILABLE_PARAM; |
| 17060 | pdev_param[wmi_pdev_param_signed_txpower_5g] = WMI_UNAVAILABLE_PARAM; |
| 17061 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = WMI_UNAVAILABLE_PARAM; |
| 17062 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = WMI_UNAVAILABLE_PARAM; |
| 17063 | pdev_param[wmi_pdev_param_cca_threshold] = WMI_UNAVAILABLE_PARAM; |
| 17064 | pdev_param[wmi_pdev_param_rts_fixed_rate] = WMI_UNAVAILABLE_PARAM; |
| 17065 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
| 17066 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_UNAVAILABLE_PARAM; |
| 17067 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = WMI_UNAVAILABLE_PARAM; |
| 17068 | pdev_param[wmi_pdev_param_arp_srcaddr] = WMI_UNAVAILABLE_PARAM; |
| 17069 | pdev_param[wmi_pdev_param_arp_dstaddr] = WMI_UNAVAILABLE_PARAM; |
| 17070 | pdev_param[wmi_pdev_param_txpower_decr_db] = WMI_UNAVAILABLE_PARAM; |
| 17071 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 17072 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
| 17073 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = WMI_UNAVAILABLE_PARAM; |
| 17074 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
| 17075 | WMI_UNAVAILABLE_PARAM; |
| 17076 | pdev_param[wmi_pdev_param_cust_txpower_scale] = WMI_UNAVAILABLE_PARAM; |
| 17077 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = WMI_UNAVAILABLE_PARAM; |
| 17078 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 17079 | WMI_UNAVAILABLE_PARAM; |
| 17080 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 17081 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
| 17082 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_UNAVAILABLE_PARAM; |
| 17083 | pdev_param[wmi_pdev_param_block_interbss] = WMI_UNAVAILABLE_PARAM; |
| 17084 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
| 17085 | WMI_UNAVAILABLE_PARAM; |
| 17086 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 17087 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
| 17088 | WMI_UNAVAILABLE_PARAM; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 17089 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 17090 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17091 | pdev_param[wmi_pdev_param_en_stats] = WMI_UNAVAILABLE_PARAM; |
Venkateswara Swamy Bandaru | 21cc1ca | 2017-02-24 17:09:46 +0530 | [diff] [blame] | 17092 | pdev_param[wmi_pdev_param_mesh_mcast_enable] = |
| 17093 | WMI_PDEV_PARAM_MESH_MCAST_ENABLE; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 17094 | pdev_param[wmi_pdev_param_set_promisc_mode_cmdid] = |
| 17095 | WMI_PDEV_PARAM_SET_PROMISC_MODE_CMDID; |
| 17096 | pdev_param[wmi_pdev_param_set_ppdu_duration_cmdid] = |
| 17097 | WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID; |
| 17098 | pdev_param[wmi_pdev_param_igmpmld_ac_override] = |
| 17099 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
| 17100 | pdev_param[wmi_pdev_param_remove_mcast2ucast_buffer] = |
| 17101 | WMI_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER; |
| 17102 | pdev_param[wmi_pdev_param_set_mcast2ucast_buffer] = |
| 17103 | WMI_PDEV_PARAM_SET_MCAST2UCAST_BUFFER; |
| 17104 | pdev_param[wmi_pdev_param_set_mcast2ucast_mode] = |
| 17105 | WMI_PDEV_PARAM_SET_MCAST2UCAST_MODE; |
| 17106 | pdev_param[wmi_pdev_param_smart_antenna_default_antenna] = |
| 17107 | WMI_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA; |
| 17108 | pdev_param[wmi_pdev_param_fast_channel_reset] = |
| 17109 | WMI_PDEV_PARAM_FAST_CHANNEL_RESET; |
| 17110 | pdev_param[wmi_pdev_param_rx_decap_mode] = WMI_PDEV_PARAM_RX_DECAP_MODE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17111 | } |
| 17112 | |
| 17113 | /** |
| 17114 | * populate_vdev_param_tlv() - populates vdev params |
| 17115 | * |
| 17116 | * @param vdev_param: Pointer to hold vdev params |
| 17117 | * Return: None |
| 17118 | */ |
| 17119 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 17120 | { |
| 17121 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 17122 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 17123 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 17124 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 17125 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 17126 | vdev_param[wmi_vdev_param_listen_interval] = |
| 17127 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 17128 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 17129 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 17130 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 17131 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 17132 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 17133 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 17134 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 17135 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 17136 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 17137 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 17138 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 17139 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 17140 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 17141 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 17142 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 17143 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 17144 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 17145 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 17146 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 17147 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 17148 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 17149 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 17150 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 17151 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 17152 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 17153 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 17154 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 17155 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 17156 | vdev_param[wmi_vdev_param_protection_mode] = |
| 17157 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 17158 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 17159 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 17160 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 17161 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 17162 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 17163 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 17164 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 17165 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 17166 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 17167 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 17168 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 17169 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 17170 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 17171 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 17172 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 17173 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 17174 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 17175 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 17176 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 17177 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 17178 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 17179 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 17180 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 17181 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 17182 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 17183 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 17184 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 17185 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 17186 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 17187 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 17188 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 17189 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 17190 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 17191 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 17192 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 17193 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 17194 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 17195 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 17196 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 17197 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 17198 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 17199 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 17200 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 17201 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 17202 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 17203 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 17204 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 17205 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 17206 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 17207 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 17208 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 17209 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 17210 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 17211 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 17212 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 17213 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 17214 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 17215 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 17216 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 17217 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 17218 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 17219 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 17220 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 17221 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 17222 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 17223 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 17224 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 17225 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 17226 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 17227 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 17228 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 17229 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 17230 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 17231 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 17232 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 17233 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 17234 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 17235 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 17236 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 17237 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 17238 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 17239 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 17240 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 17241 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 17242 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 17243 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 17244 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 17245 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 17246 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 17247 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Kalyan Tallapragada | d9a6abd | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 17248 | vdev_param[wmi_vdev_param_rx_decap_type] = WMI_VDEV_PARAM_RX_DECAP_TYPE; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 17249 | vdev_param[wmi_vdev_param_he_dcm_enable] = WMI_VDEV_PARAM_HE_DCM; |
| 17250 | vdev_param[wmi_vdev_param_he_range_ext_enable] = |
| 17251 | WMI_VDEV_PARAM_HE_RANGE_EXT; |
| 17252 | vdev_param[wmi_vdev_param_he_bss_color] = WMI_VDEV_PARAM_BSS_COLOR; |
| 17253 | vdev_param[wmi_vdev_param_set_hemu_mode] = WMI_VDEV_PARAM_SET_HEMU_MODE; |
Kiran Venkatappa | 1f9d67d | 2017-03-13 15:11:44 +0530 | [diff] [blame] | 17254 | vdev_param[wmi_vdev_param_sensor_ap] = WMI_VDEV_PARAM_SENSOR_AP; |
| 17255 | vdev_param[wmi_vdev_param_dtim_enable_cts] = |
| 17256 | WMI_VDEV_PARAM_DTIM_ENABLE_CTS; |
| 17257 | vdev_param[wmi_vdev_param_atf_ssid_sched_policy] = |
| 17258 | WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY; |
| 17259 | vdev_param[wmi_vdev_param_disable_dyn_bw_rts] = |
| 17260 | WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS; |
Sathish Kumar | 2ac4070 | 2017-03-22 19:18:45 +0530 | [diff] [blame^] | 17261 | vdev_param[wmi_vdev_param_mcast2ucast_set] = |
| 17262 | WMI_VDEV_PARAM_MCAST2UCAST_SET; |
| 17263 | vdev_param[wmi_vdev_param_rc_num_retries] = |
| 17264 | WMI_VDEV_PARAM_RC_NUM_RETRIES; |
| 17265 | vdev_param[wmi_vdev_param_cabq_maxdur] = WMI_VDEV_PARAM_CABQ_MAXDUR; |
| 17266 | vdev_param[wmi_vdev_param_mfptest_set] = WMI_VDEV_PARAM_MFPTEST_SET; |
| 17267 | vdev_param[wmi_vdev_param_rts_fixed_rate] = |
| 17268 | WMI_VDEV_PARAM_RTS_FIXED_RATE; |
| 17269 | vdev_param[wmi_vdev_param_vht_sgimask] = WMI_VDEV_PARAM_VHT_SGIMASK; |
| 17270 | vdev_param[wmi_vdev_param_vht80_ratemask] = |
| 17271 | WMI_VDEV_PARAM_VHT80_RATEMASK; |
| 17272 | vdev_param[wmi_vdev_param_proxy_sta] = WMI_VDEV_PARAM_PROXY_STA; |
| 17273 | vdev_param[wmi_vdev_param_bw_nss_ratemask] = |
| 17274 | WMI_VDEV_PARAM_BW_NSS_RATEMASK; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17275 | } |
| 17276 | #endif |
| 17277 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17278 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17279 | * populate_target_defines_tlv() - Populate target defines and params |
| 17280 | * @wmi_handle: pointer to wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17281 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 17282 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17283 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 17284 | #ifndef CONFIG_MCL |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17285 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17286 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17287 | populate_tlv_service(wmi_handle->services); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17288 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 17289 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 17290 | } |
| 17291 | #else |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17292 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
| 17293 | { } |
| 17294 | #endif |
| 17295 | |
| 17296 | /** |
| 17297 | * wmi_tlv_attach() - Attach TLV APIs |
| 17298 | * |
| 17299 | * Return: None |
| 17300 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 17301 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17302 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 17303 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 17304 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 17305 | wmi_handle->log_info.buf_offset_command = 2; |
| 17306 | wmi_handle->log_info.buf_offset_event = 4; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 17307 | #endif |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 17308 | populate_tlv_events_id(wmi_handle->wmi_events); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17309 | populate_target_defines_tlv(wmi_handle); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17310 | } |