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" |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 33 | #ifdef CONVERGED_P2P_ENABLE |
| 34 | #include "wlan_p2p_public_struct.h" |
| 35 | #endif |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 36 | #include <wlan_utility.h> |
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. |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 40 | * @wmi_handle: pointer to wmi_handle |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 41 | * @cmd: pointer target vdev create command buffer |
| 42 | * @param: pointer host params for vdev create |
| 43 | * |
| 44 | * Return: None |
| 45 | */ |
| 46 | #ifdef CONFIG_MCL |
| 47 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 48 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 49 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 50 | struct vdev_create_params *param) |
| 51 | { |
| 52 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 53 | } |
| 54 | #else |
| 55 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 56 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 57 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 58 | struct vdev_create_params *param) |
| 59 | { |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 60 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 61 | param->pdev_id); |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 62 | } |
| 63 | #endif |
| 64 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 65 | /** |
| 66 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 67 | * @wmi_handle: wmi handle |
| 68 | * @param: pointer to hold vdev create parameter |
| 69 | * @macaddr: vdev mac address |
| 70 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 71 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 72 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 73 | 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] | 74 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 75 | struct vdev_create_params *param) |
| 76 | { |
| 77 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 78 | wmi_buf_t buf; |
| 79 | int32_t len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 80 | QDF_STATUS ret; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 81 | int num_bands = 2; |
| 82 | uint8_t *buf_ptr; |
| 83 | wmi_vdev_txrx_streams *txrx_streams; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 84 | |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 85 | len += (num_bands * sizeof(*txrx_streams) + WMI_TLV_HDR_SIZE); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 86 | buf = wmi_buf_alloc(wmi_handle, len); |
| 87 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 88 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 89 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 90 | } |
| 91 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 92 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 93 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 94 | WMITLV_GET_STRUCT_TLVLEN |
| 95 | (wmi_vdev_create_cmd_fixed_param)); |
| 96 | cmd->vdev_id = param->if_id; |
| 97 | cmd->vdev_type = param->type; |
| 98 | cmd->vdev_subtype = param->subtype; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 99 | cmd->num_cfg_txrx_streams = num_bands; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 100 | copy_vdev_create_pdev_id(wmi_handle, cmd, param); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 101 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 102 | 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] | 103 | __func__, param->if_id, |
| 104 | macaddr[0], macaddr[1], macaddr[2], |
| 105 | macaddr[3], macaddr[4], macaddr[5]); |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 106 | buf_ptr = (uint8_t *)cmd + sizeof(*cmd); |
| 107 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 108 | (num_bands * sizeof(wmi_vdev_txrx_streams))); |
| 109 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 110 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 111 | 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] | 112 | param->type, param->subtype, |
| 113 | param->nss_2g, param->nss_5g); |
| 114 | txrx_streams = (wmi_vdev_txrx_streams *)buf_ptr; |
| 115 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_2G; |
| 116 | txrx_streams->supported_tx_streams = param->nss_2g; |
| 117 | txrx_streams->supported_rx_streams = param->nss_2g; |
| 118 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 119 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 120 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
| 121 | |
| 122 | txrx_streams++; |
| 123 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_5G; |
| 124 | txrx_streams->supported_tx_streams = param->nss_5g; |
| 125 | txrx_streams->supported_rx_streams = param->nss_5g; |
| 126 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 127 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 128 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 129 | 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] | 130 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 131 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 132 | wmi_buf_free(buf); |
| 133 | } |
| 134 | |
| 135 | return ret; |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 140 | * @wmi_handle: wmi handle |
| 141 | * @if_id: vdev id |
| 142 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 143 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 144 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 145 | 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] | 146 | uint8_t if_id) |
| 147 | { |
| 148 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 149 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 150 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 151 | |
| 152 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 153 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 154 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 155 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 159 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 160 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 161 | WMITLV_GET_STRUCT_TLVLEN |
| 162 | (wmi_vdev_delete_cmd_fixed_param)); |
| 163 | cmd->vdev_id = if_id; |
| 164 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 165 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 166 | WMI_VDEV_DELETE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 167 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 168 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 169 | wmi_buf_free(buf); |
| 170 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 171 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 172 | |
| 173 | return ret; |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 178 | * @wmi: wmi handle |
| 179 | * @vdev_id: vdev id |
| 180 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 181 | * Return: QDF_STATUS_SUCCESS for success or erro code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 182 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 183 | static QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 184 | uint8_t vdev_id) |
| 185 | { |
| 186 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 187 | wmi_buf_t buf; |
| 188 | int32_t len = sizeof(*cmd); |
| 189 | |
| 190 | buf = wmi_buf_alloc(wmi, len); |
| 191 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 192 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 193 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 194 | } |
| 195 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 196 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 197 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 198 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 199 | cmd->vdev_id = vdev_id; |
| 200 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 201 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 202 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 203 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 204 | } |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 205 | WMI_LOGD("%s:vdev id = %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 206 | |
| 207 | return 0; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 212 | * @wmi: wmi handle |
| 213 | * @vdev_id: vdev id |
| 214 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 215 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 216 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 217 | 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] | 218 | { |
| 219 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 220 | wmi_buf_t buf; |
| 221 | int32_t len = sizeof(*cmd); |
| 222 | |
| 223 | buf = wmi_buf_alloc(wmi, len); |
| 224 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 225 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 226 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 227 | } |
| 228 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 229 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 230 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 231 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 232 | cmd->vdev_id = vdev_id; |
| 233 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 234 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 235 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 236 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 237 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 238 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 239 | |
| 240 | return 0; |
| 241 | } |
| 242 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 243 | #ifdef CONFIG_MCL |
| 244 | static inline void copy_channel_info( |
| 245 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 246 | wmi_channel *chan, |
| 247 | struct vdev_start_params *req) |
| 248 | { |
| 249 | chan->mhz = req->chan_freq; |
| 250 | |
| 251 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 252 | |
| 253 | chan->band_center_freq1 = req->band_center_freq1; |
| 254 | chan->band_center_freq2 = req->band_center_freq2; |
| 255 | |
| 256 | if (req->is_half_rate) |
| 257 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 258 | else if (req->is_quarter_rate) |
| 259 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 260 | |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 261 | if (req->is_dfs && req->flag_dfs) { |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 262 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 263 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 264 | } |
| 265 | |
| 266 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 267 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 268 | |
| 269 | } |
| 270 | #else |
| 271 | static inline void copy_channel_info( |
| 272 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 273 | wmi_channel *chan, |
| 274 | struct vdev_start_params *req) |
| 275 | { |
| 276 | chan->mhz = req->channel.mhz; |
| 277 | |
| 278 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 279 | |
| 280 | chan->band_center_freq1 = req->channel.cfreq1; |
| 281 | chan->band_center_freq2 = req->channel.cfreq2; |
| 282 | |
| 283 | if (req->channel.half_rate) |
| 284 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 285 | else if (req->channel.quarter_rate) |
| 286 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 287 | |
| 288 | if (req->channel.dfs_set) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 289 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 290 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 291 | } |
| 292 | |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 293 | if (req->channel.dfs_set_cfreq2) |
| 294 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS_CFREQ2); |
| 295 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 296 | /* FIXME: Find out min, max and regulatory power levels */ |
| 297 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
| 298 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxpower); |
| 299 | |
| 300 | } |
| 301 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 302 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 303 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 304 | * @wmi_handle: wmi handle |
| 305 | * @req: vdev start params |
| 306 | * |
| 307 | * Return: QDF status |
| 308 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 309 | 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] | 310 | struct vdev_start_params *req) |
| 311 | { |
| 312 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 313 | wmi_buf_t buf; |
| 314 | wmi_channel *chan; |
| 315 | int32_t len, ret; |
| 316 | uint8_t *buf_ptr; |
| 317 | |
| 318 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 319 | buf = wmi_buf_alloc(wmi_handle, len); |
| 320 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 321 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 322 | return QDF_STATUS_E_NOMEM; |
| 323 | } |
| 324 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 325 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 326 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 327 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 328 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 329 | WMITLV_GET_STRUCT_TLVLEN |
| 330 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 331 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 332 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 333 | cmd->vdev_id = req->vdev_id; |
| 334 | |
| 335 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 336 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 337 | |
| 338 | cmd->beacon_interval = req->beacon_intval; |
| 339 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 340 | |
| 341 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 342 | cmd->beacon_interval = req->beacon_intval; |
| 343 | cmd->dtim_period = req->dtim_period; |
| 344 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 345 | /* Copy the SSID */ |
| 346 | if (req->ssid.length) { |
| 347 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 348 | cmd->ssid.ssid_len = req->ssid.length; |
| 349 | else |
| 350 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 351 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 352 | cmd->ssid.ssid_len); |
| 353 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 354 | |
| 355 | if (req->hidden_ssid) |
| 356 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 357 | |
| 358 | if (req->pmf_enabled) |
| 359 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 360 | } |
| 361 | |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 362 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 363 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 364 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 365 | cmd->cac_duration_ms = req->cac_duration_ms; |
| 366 | cmd->regdomain = req->regdomain; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 367 | cmd->he_ops = req->he_ops; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 368 | |
| 369 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 370 | sizeof(wmi_channel)); |
| 371 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 372 | cmd->num_noa_descriptors * |
| 373 | sizeof(wmi_p2p_noa_descriptor)); |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 374 | 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] | 375 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 376 | "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] | 377 | "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] | 378 | __func__, req->vdev_id, chan->mhz, req->chan_mode, chan->info, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 379 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 380 | chan->band_center_freq1, chan->band_center_freq2, |
| 381 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 382 | req->preferred_tx_streams, req->preferred_rx_streams, |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 383 | req->cac_duration_ms, req->regdomain, req->he_ops); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 384 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 385 | if (req->is_restart) |
| 386 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 387 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 388 | else |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 389 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 390 | WMI_VDEV_START_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 391 | if (ret) { |
| 392 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 393 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 394 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 395 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 396 | |
| 397 | return QDF_STATUS_SUCCESS; |
| 398 | } |
| 399 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 400 | /** |
| 401 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 402 | * @wmi_handle: wmi handle |
| 403 | * @restart_params: vdev restart params |
| 404 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 405 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 406 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 407 | 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] | 408 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 409 | { |
| 410 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 411 | wmi_buf_t buf; |
| 412 | wmi_channel *chan; |
| 413 | int32_t len; |
| 414 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 415 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 416 | |
| 417 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 418 | buf = wmi_buf_alloc(wmi_handle, len); |
| 419 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 420 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 421 | return QDF_STATUS_E_NOMEM; |
| 422 | } |
| 423 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 424 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 425 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 426 | |
| 427 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 428 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 429 | WMITLV_GET_STRUCT_TLVLEN |
| 430 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 431 | |
| 432 | WMITLV_SET_HDR(&chan->tlv_header, |
| 433 | WMITLV_TAG_STRUC_wmi_channel, |
| 434 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 435 | |
| 436 | cmd->vdev_id = restart_params->session_id; |
| 437 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 438 | qdf_mem_copy(cmd->ssid.ssid, |
| 439 | restart_params->ssid, |
| 440 | cmd->ssid.ssid_len); |
| 441 | cmd->flags = restart_params->flags; |
| 442 | cmd->requestor_id = restart_params->requestor_id; |
| 443 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 444 | |
| 445 | chan->mhz = restart_params->mhz; |
| 446 | chan->band_center_freq1 = |
| 447 | restart_params->band_center_freq1; |
| 448 | chan->band_center_freq2 = |
| 449 | restart_params->band_center_freq2; |
| 450 | chan->info = restart_params->info; |
| 451 | chan->reg_info_1 = restart_params->reg_info_1; |
| 452 | chan->reg_info_2 = restart_params->reg_info_2; |
| 453 | |
| 454 | cmd->num_noa_descriptors = 0; |
| 455 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 456 | sizeof(wmi_channel)); |
| 457 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 458 | cmd->num_noa_descriptors * |
| 459 | sizeof(wmi_p2p_noa_descriptor)); |
| 460 | |
| 461 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 462 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 463 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 464 | wmi_buf_free(buf); |
| 465 | return QDF_STATUS_E_FAILURE; |
| 466 | } |
| 467 | return QDF_STATUS_SUCCESS; |
| 468 | } |
| 469 | |
| 470 | |
| 471 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 472 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 473 | * @wmi: wmi handle |
| 474 | * @peer_addr: peer mac address |
| 475 | * @param: pointer to hold peer flush tid parameter |
| 476 | * |
| 477 | * Return: 0 for sucess or error code |
| 478 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 479 | 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] | 480 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 481 | struct peer_flush_params *param) |
| 482 | { |
| 483 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 484 | wmi_buf_t buf; |
| 485 | int32_t len = sizeof(*cmd); |
| 486 | |
| 487 | buf = wmi_buf_alloc(wmi, len); |
| 488 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 489 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 490 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 491 | } |
| 492 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 493 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 494 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 495 | WMITLV_GET_STRUCT_TLVLEN |
| 496 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 497 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 498 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 499 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 500 | 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] | 501 | peer_addr, param->vdev_id, |
| 502 | param->peer_tid_bitmap); |
| 503 | 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] | 504 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 505 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 506 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | return 0; |
| 510 | } |
| 511 | |
| 512 | /** |
| 513 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 514 | * @wmi: wmi handle |
| 515 | * @peer_addr: peer mac addr |
| 516 | * @vdev_id: vdev id |
| 517 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 518 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 519 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 520 | static QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 521 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 522 | uint8_t vdev_id) |
| 523 | { |
| 524 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 525 | wmi_buf_t buf; |
| 526 | int32_t len = sizeof(*cmd); |
| 527 | buf = wmi_buf_alloc(wmi, len); |
| 528 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 529 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 530 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 531 | } |
| 532 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 533 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 534 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 535 | WMITLV_GET_STRUCT_TLVLEN |
| 536 | (wmi_peer_delete_cmd_fixed_param)); |
| 537 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 538 | cmd->vdev_id = vdev_id; |
| 539 | |
Orhan K AKYILDIZ | c8d1c4b | 2017-01-10 14:32:18 -0800 | [diff] [blame] | 540 | 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] | 541 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 542 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 543 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 544 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 545 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 546 | |
| 547 | return 0; |
| 548 | } |
| 549 | |
| 550 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 551 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 552 | * to target id. |
| 553 | * @targ_paramid: Target parameter id to hold the result. |
| 554 | * @peer_param_id: host param id. |
| 555 | * |
| 556 | * Return: QDF_STATUS_SUCCESS for success |
| 557 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
| 558 | */ |
| 559 | #ifdef CONFIG_MCL |
| 560 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 561 | uint32_t *targ_paramid, |
| 562 | uint32_t peer_param_id) |
| 563 | { |
| 564 | *targ_paramid = peer_param_id; |
| 565 | return QDF_STATUS_SUCCESS; |
| 566 | } |
| 567 | #else |
| 568 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 569 | uint32_t *targ_paramid, |
| 570 | uint32_t peer_param_id) |
| 571 | { |
| 572 | switch (peer_param_id) { |
| 573 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 574 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 575 | break; |
| 576 | case WMI_HOST_PEER_AMPDU: |
| 577 | *targ_paramid = WMI_PEER_AMPDU; |
| 578 | break; |
| 579 | case WMI_HOST_PEER_AUTHORIZE: |
| 580 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 581 | break; |
| 582 | case WMI_HOST_PEER_CHWIDTH: |
| 583 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 584 | break; |
| 585 | case WMI_HOST_PEER_NSS: |
| 586 | *targ_paramid = WMI_PEER_NSS; |
| 587 | break; |
| 588 | case WMI_HOST_PEER_USE_4ADDR: |
| 589 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 590 | break; |
| 591 | case WMI_HOST_PEER_MEMBERSHIP: |
| 592 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 593 | break; |
| 594 | case WMI_HOST_PEER_USERPOS: |
| 595 | *targ_paramid = WMI_PEER_USERPOS; |
| 596 | break; |
| 597 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 598 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 599 | break; |
| 600 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 601 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 602 | break; |
| 603 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 604 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 605 | break; |
| 606 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 607 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 608 | break; |
| 609 | case WMI_HOST_PEER_PHYMODE: |
| 610 | *targ_paramid = WMI_PEER_PHYMODE; |
| 611 | break; |
| 612 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 613 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 614 | break; |
| 615 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 616 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 617 | break; |
| 618 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 619 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 620 | break; |
| 621 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 622 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 623 | break; |
| 624 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 625 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 626 | break; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 627 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 628 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 629 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 630 | default: |
| 631 | return QDF_STATUS_E_NOSUPPORT; |
| 632 | } |
| 633 | |
| 634 | return QDF_STATUS_SUCCESS; |
| 635 | } |
| 636 | #endif |
| 637 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 638 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 639 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 640 | * @peer_addr: peer mac address |
| 641 | * @param : pointer to hold peer set parameter |
| 642 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 643 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 644 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 645 | static QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 646 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 647 | struct peer_set_params *param) |
| 648 | { |
| 649 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 650 | wmi_buf_t buf; |
| 651 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 652 | uint32_t param_id; |
| 653 | |
| 654 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 655 | param->param_id) != QDF_STATUS_SUCCESS) |
| 656 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 657 | |
| 658 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 659 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 660 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 661 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 662 | } |
| 663 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 664 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 665 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 666 | WMITLV_GET_STRUCT_TLVLEN |
| 667 | (wmi_peer_set_param_cmd_fixed_param)); |
| 668 | cmd->vdev_id = param->vdev_id; |
| 669 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 670 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 671 | cmd->param_value = param->param_value; |
| 672 | err = wmi_unified_cmd_send(wmi, buf, |
| 673 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 674 | WMI_PEER_SET_PARAM_CMDID); |
| 675 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 676 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 677 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 678 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | return 0; |
| 682 | } |
| 683 | |
| 684 | /** |
| 685 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 686 | * @wmi: wmi handle |
| 687 | * @bssid: bssid |
| 688 | * @vdev_up_params: pointer to hold vdev up parameter |
| 689 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 690 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 691 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 692 | static QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 693 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 694 | struct vdev_up_params *params) |
| 695 | { |
| 696 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 697 | wmi_buf_t buf; |
| 698 | int32_t len = sizeof(*cmd); |
| 699 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 700 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 701 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 702 | params->vdev_id, params->assoc_id, bssid); |
| 703 | buf = wmi_buf_alloc(wmi, len); |
| 704 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 705 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 706 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 707 | } |
| 708 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 709 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 710 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 711 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 712 | cmd->vdev_id = params->vdev_id; |
| 713 | cmd->vdev_assoc_id = params->assoc_id; |
| 714 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 715 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 716 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 717 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 718 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 719 | } |
| 720 | |
| 721 | return 0; |
| 722 | } |
| 723 | |
| 724 | /** |
| 725 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 726 | * @wmi: wmi handle |
| 727 | * @peer_addr: peer mac address |
| 728 | * @peer_type: peer type |
| 729 | * @vdev_id: vdev id |
| 730 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 731 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 732 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 733 | static QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 734 | struct peer_create_params *param) |
| 735 | { |
| 736 | wmi_peer_create_cmd_fixed_param *cmd; |
| 737 | wmi_buf_t buf; |
| 738 | int32_t len = sizeof(*cmd); |
| 739 | |
| 740 | buf = wmi_buf_alloc(wmi, len); |
| 741 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 742 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 743 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 744 | } |
| 745 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 746 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 747 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 748 | WMITLV_GET_STRUCT_TLVLEN |
| 749 | (wmi_peer_create_cmd_fixed_param)); |
| 750 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 751 | cmd->peer_type = param->peer_type; |
| 752 | cmd->vdev_id = param->vdev_id; |
| 753 | |
| 754 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 755 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 756 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 757 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 758 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 759 | 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] | 760 | param->vdev_id); |
| 761 | |
| 762 | return 0; |
| 763 | } |
| 764 | |
| 765 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 766 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 767 | * command to fw |
| 768 | * @wmi: wmi handle |
| 769 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 770 | * |
| 771 | * Return: 0 for success or error code |
| 772 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 773 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 774 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 775 | struct rx_reorder_queue_setup_params *param) |
| 776 | { |
| 777 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 778 | wmi_buf_t buf; |
| 779 | int32_t len = sizeof(*cmd); |
| 780 | |
| 781 | buf = wmi_buf_alloc(wmi, len); |
| 782 | if (!buf) { |
| 783 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 784 | return QDF_STATUS_E_NOMEM; |
| 785 | } |
| 786 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 787 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 788 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 789 | WMITLV_GET_STRUCT_TLVLEN |
| 790 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 791 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 792 | cmd->vdev_id = param->vdev_id; |
| 793 | cmd->tid = param->tid; |
| 794 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 795 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 796 | cmd->queue_no = param->queue_no; |
| 797 | |
| 798 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 799 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 800 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 801 | __func__); |
| 802 | qdf_nbuf_free(buf); |
| 803 | return QDF_STATUS_E_FAILURE; |
| 804 | } |
| 805 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 806 | param->peer_macaddr, param->vdev_id, param->tid); |
| 807 | |
| 808 | return QDF_STATUS_SUCCESS; |
| 809 | } |
| 810 | |
| 811 | /** |
| 812 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 813 | * command to fw |
| 814 | * @wmi: wmi handle |
| 815 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 816 | * |
| 817 | * Return: 0 for success or error code |
| 818 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 819 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 820 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 821 | struct rx_reorder_queue_remove_params *param) |
| 822 | { |
| 823 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 824 | wmi_buf_t buf; |
| 825 | int32_t len = sizeof(*cmd); |
| 826 | |
| 827 | buf = wmi_buf_alloc(wmi, len); |
| 828 | if (!buf) { |
| 829 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 830 | return QDF_STATUS_E_NOMEM; |
| 831 | } |
| 832 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 833 | wmi_buf_data(buf); |
| 834 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 835 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 836 | WMITLV_GET_STRUCT_TLVLEN |
| 837 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 838 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 839 | cmd->vdev_id = param->vdev_id; |
| 840 | cmd->tid_mask = param->peer_tid_bitmap; |
| 841 | |
| 842 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 843 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 844 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 845 | __func__); |
| 846 | qdf_nbuf_free(buf); |
| 847 | return QDF_STATUS_E_FAILURE; |
| 848 | } |
| 849 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 850 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 851 | |
| 852 | return QDF_STATUS_SUCCESS; |
| 853 | } |
| 854 | |
| 855 | /** |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 856 | * send_peer_add_wds_entry_cmd_tlv() - send peer add command to fw |
| 857 | * @wmi_handle: wmi handle |
| 858 | * @param: pointer holding peer details |
| 859 | * |
| 860 | * Return: 0 for success or error code |
| 861 | */ |
| 862 | static QDF_STATUS send_peer_add_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 863 | struct peer_add_wds_entry_params *param) |
| 864 | { |
| 865 | wmi_peer_add_wds_entry_cmd_fixed_param *cmd; |
| 866 | wmi_buf_t buf; |
| 867 | int len = sizeof(*cmd); |
| 868 | |
| 869 | buf = wmi_buf_alloc(wmi_handle, len); |
| 870 | if (!buf) { |
| 871 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 872 | return QDF_STATUS_E_FAILURE; |
| 873 | } |
| 874 | cmd = (wmi_peer_add_wds_entry_cmd_fixed_param *) wmi_buf_data(buf); |
| 875 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 876 | WMITLV_TAG_STRUC_wmi_peer_add_wds_entry_cmd_fixed_param, |
| 877 | WMITLV_GET_STRUCT_TLVLEN |
| 878 | (wmi_peer_add_wds_entry_cmd_fixed_param)); |
| 879 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 880 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 881 | cmd->flags = param->flags; |
| 882 | |
| 883 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 884 | WMI_PEER_ADD_WDS_ENTRY_CMDID); |
| 885 | } |
| 886 | |
| 887 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 888 | * 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] | 889 | * @wmi_handle: wmi handle |
| 890 | * @param: pointer holding peer details |
| 891 | * |
| 892 | * Return: 0 for success or error code |
| 893 | */ |
| 894 | static QDF_STATUS send_peer_del_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 895 | struct peer_del_wds_entry_params *param) |
| 896 | { |
| 897 | wmi_peer_remove_wds_entry_cmd_fixed_param *cmd; |
| 898 | wmi_buf_t buf; |
| 899 | int len = sizeof(*cmd); |
| 900 | |
| 901 | buf = wmi_buf_alloc(wmi_handle, len); |
| 902 | if (!buf) { |
| 903 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 904 | return QDF_STATUS_E_NOMEM; |
| 905 | } |
| 906 | cmd = (wmi_peer_remove_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 907 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 908 | WMITLV_TAG_STRUC_wmi_peer_remove_wds_entry_cmd_fixed_param, |
| 909 | WMITLV_GET_STRUCT_TLVLEN |
| 910 | (wmi_peer_remove_wds_entry_cmd_fixed_param)); |
| 911 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 912 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 913 | WMI_PEER_REMOVE_WDS_ENTRY_CMDID); |
| 914 | } |
| 915 | |
| 916 | /** |
| 917 | * send_peer_update_wds_entry_cmd_non_tlv() - send peer update command to fw |
| 918 | * @wmi_handle: wmi handle |
| 919 | * @param: pointer holding peer details |
| 920 | * |
| 921 | * Return: 0 for success or error code |
| 922 | */ |
| 923 | static QDF_STATUS send_peer_update_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 924 | struct peer_update_wds_entry_params *param) |
| 925 | { |
| 926 | wmi_peer_update_wds_entry_cmd_fixed_param *cmd; |
| 927 | wmi_buf_t buf; |
| 928 | int len = sizeof(*cmd); |
| 929 | |
| 930 | buf = wmi_buf_alloc(wmi_handle, len); |
| 931 | if (!buf) { |
| 932 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 933 | return QDF_STATUS_E_NOMEM; |
| 934 | } |
| 935 | |
| 936 | /* wmi_buf_alloc returns zeroed command buffer */ |
| 937 | cmd = (wmi_peer_update_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 938 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 939 | WMITLV_TAG_STRUC_wmi_peer_update_wds_entry_cmd_fixed_param, |
| 940 | WMITLV_GET_STRUCT_TLVLEN |
| 941 | (wmi_peer_update_wds_entry_cmd_fixed_param)); |
| 942 | cmd->flags = (param->flags) ? WMI_WDS_FLAG_STATIC : 0; |
| 943 | if (param->wds_macaddr) |
| 944 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->wds_macaddr, |
| 945 | &cmd->wds_macaddr); |
| 946 | if (param->peer_macaddr) |
| 947 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, |
| 948 | &cmd->peer_macaddr); |
| 949 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 950 | WMI_PEER_UPDATE_WDS_ENTRY_CMDID); |
| 951 | } |
| 952 | |
| 953 | |
| 954 | |
| 955 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 956 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 957 | * @wmi_handle: wmi handle |
| 958 | * @value: value |
| 959 | * @mac_id: mac id to have radio context |
| 960 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 961 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 962 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 963 | 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] | 964 | uint32_t value, uint8_t mac_id) |
| 965 | { |
| 966 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 967 | wmi_buf_t buf; |
| 968 | int32_t len = sizeof(*cmd); |
| 969 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 970 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 971 | |
| 972 | buf = wmi_buf_alloc(wmi_handle, len); |
| 973 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 974 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 975 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 976 | } |
| 977 | |
| 978 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 979 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 980 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 981 | WMITLV_GET_STRUCT_TLVLEN |
| 982 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 983 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 984 | cmd->enable = value; |
| 985 | |
| 986 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 987 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 988 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 989 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 990 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 991 | } |
| 992 | |
| 993 | return 0; |
| 994 | } |
| 995 | |
| 996 | /** |
| 997 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 998 | * @wmi_handle: wmi handle |
| 999 | * @param: pointer to pdev_utf_params |
| 1000 | * @mac_id: mac id to have radio context |
| 1001 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1002 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1003 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1004 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1005 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 1006 | struct pdev_utf_params *param, |
| 1007 | uint8_t mac_id) |
| 1008 | { |
| 1009 | wmi_buf_t buf; |
| 1010 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 1011 | /* if param->len is 0 no data is sent, return error */ |
| 1012 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1013 | static uint8_t msgref = 1; |
| 1014 | uint8_t segNumber = 0, segInfo, numSegments; |
| 1015 | uint16_t chunk_len, total_bytes; |
| 1016 | uint8_t *bufpos; |
| 1017 | struct seg_hdr_info segHdrInfo; |
| 1018 | |
| 1019 | bufpos = param->utf_payload; |
| 1020 | total_bytes = param->len; |
| 1021 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 1022 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 1023 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 1024 | |
| 1025 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 1026 | numSegments++; |
| 1027 | |
| 1028 | while (param->len) { |
| 1029 | if (param->len > MAX_WMI_UTF_LEN) |
| 1030 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 1031 | else |
| 1032 | chunk_len = param->len; |
| 1033 | |
| 1034 | buf = wmi_buf_alloc(wmi_handle, |
| 1035 | (chunk_len + sizeof(segHdrInfo) + |
| 1036 | WMI_TLV_HDR_SIZE)); |
| 1037 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1038 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1039 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1040 | } |
| 1041 | |
| 1042 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 1043 | |
| 1044 | segHdrInfo.len = total_bytes; |
| 1045 | segHdrInfo.msgref = msgref; |
| 1046 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 1047 | segHdrInfo.segmentInfo = segInfo; |
| 1048 | segHdrInfo.pad = 0; |
| 1049 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1050 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1051 | " segHdrInfo.segmentInfo = %d", |
| 1052 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 1053 | segHdrInfo.segmentInfo); |
| 1054 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1055 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1056 | "chunk len %d", __func__, total_bytes, segNumber, |
| 1057 | numSegments, chunk_len); |
| 1058 | |
| 1059 | segNumber++; |
| 1060 | |
| 1061 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 1062 | (chunk_len + sizeof(segHdrInfo))); |
| 1063 | cmd += WMI_TLV_HDR_SIZE; |
| 1064 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 1065 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 1066 | |
| 1067 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 1068 | (chunk_len + sizeof(segHdrInfo) + |
| 1069 | WMI_TLV_HDR_SIZE), |
| 1070 | WMI_PDEV_UTF_CMDID); |
| 1071 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1072 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1073 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1074 | wmi_buf_free(buf); |
| 1075 | break; |
| 1076 | } |
| 1077 | |
| 1078 | param->len -= chunk_len; |
| 1079 | bufpos += chunk_len; |
| 1080 | } |
| 1081 | |
| 1082 | msgref++; |
| 1083 | |
| 1084 | return ret; |
| 1085 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1086 | #ifdef CONFIG_MCL |
| 1087 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1088 | uint32_t host_param) |
| 1089 | { |
| 1090 | return host_param; |
| 1091 | } |
| 1092 | #else |
| 1093 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1094 | uint32_t host_param) |
| 1095 | { |
| 1096 | if (host_param < wmi_pdev_param_max) |
| 1097 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1098 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1099 | return WMI_UNAVAILABLE_PARAM; |
| 1100 | } |
| 1101 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1102 | /** |
| 1103 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 1104 | * @wmi_handle: wmi handle |
| 1105 | * @param: pointer to pdev parameter |
| 1106 | * @mac_id: radio context |
| 1107 | * |
| 1108 | * Return: 0 on success, errno on failure |
| 1109 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1110 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1111 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 1112 | struct pdev_params *param, |
| 1113 | uint8_t mac_id) |
| 1114 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1115 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1116 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 1117 | wmi_buf_t buf; |
| 1118 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1119 | uint32_t pdev_param; |
| 1120 | |
| 1121 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 1122 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1123 | WMI_LOGW("%s: Unavailable param %d\n", |
| 1124 | __func__, param->param_id); |
| 1125 | return QDF_STATUS_E_INVAL; |
| 1126 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1127 | |
| 1128 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1129 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1130 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1131 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1132 | } |
| 1133 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1134 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1135 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 1136 | WMITLV_GET_STRUCT_TLVLEN |
| 1137 | (wmi_pdev_set_param_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1138 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1139 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1140 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1141 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1142 | param->param_value); |
| 1143 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1144 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1145 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1146 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1147 | wmi_buf_free(buf); |
| 1148 | } |
| 1149 | return ret; |
| 1150 | } |
| 1151 | |
| 1152 | /** |
| 1153 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1154 | * @param wmi_handle : handle to WMI. |
| 1155 | * @param param : pointer to hold suspend parameter |
| 1156 | * @mac_id: radio context |
| 1157 | * |
| 1158 | * Return 0 on success and -ve on failure. |
| 1159 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1160 | static QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1161 | struct suspend_params *param, |
| 1162 | uint8_t mac_id) |
| 1163 | { |
| 1164 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1165 | wmi_buf_t wmibuf; |
| 1166 | uint32_t len = sizeof(*cmd); |
| 1167 | int32_t ret; |
| 1168 | |
| 1169 | /* |
| 1170 | * send the comand to Target to ignore the |
| 1171 | * PCIE reset so as to ensure that Host and target |
| 1172 | * states are in sync |
| 1173 | */ |
| 1174 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1175 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1176 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1177 | |
| 1178 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1179 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1180 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1181 | WMITLV_GET_STRUCT_TLVLEN |
| 1182 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1183 | if (param->disable_target_intr) |
| 1184 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1185 | else |
| 1186 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
| 1187 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1188 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1189 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1190 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1191 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1192 | } |
| 1193 | |
| 1194 | return ret; |
| 1195 | } |
| 1196 | |
| 1197 | /** |
| 1198 | * send_resume_cmd_tlv() - WMI resume function |
| 1199 | * @param wmi_handle : handle to WMI. |
| 1200 | * @mac_id: radio context |
| 1201 | * |
| 1202 | * Return: 0 on success and -ve on failure. |
| 1203 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1204 | static QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1205 | uint8_t mac_id) |
| 1206 | { |
| 1207 | wmi_buf_t wmibuf; |
| 1208 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1209 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1210 | |
| 1211 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1212 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1213 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1214 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1215 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1216 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1217 | WMITLV_GET_STRUCT_TLVLEN |
| 1218 | (wmi_pdev_resume_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1219 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1220 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1221 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1222 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1223 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1224 | wmi_buf_free(wmibuf); |
| 1225 | } |
| 1226 | |
| 1227 | return ret; |
| 1228 | } |
| 1229 | |
| 1230 | /** |
| 1231 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1232 | * @param wmi_handle : handle to WMI. |
| 1233 | * @param param : pointer to hold wow enable parameter |
| 1234 | * @mac_id: radio context |
| 1235 | * |
| 1236 | * Return: 0 on success and -ve on failure. |
| 1237 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1238 | 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] | 1239 | struct wow_cmd_params *param, |
| 1240 | uint8_t mac_id) |
| 1241 | { |
| 1242 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1243 | wmi_buf_t buf; |
| 1244 | int32_t len; |
| 1245 | int32_t ret; |
| 1246 | |
| 1247 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1248 | |
| 1249 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1250 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1251 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1252 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1253 | } |
| 1254 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1255 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1256 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1257 | WMITLV_GET_STRUCT_TLVLEN |
| 1258 | (wmi_wow_enable_cmd_fixed_param)); |
| 1259 | cmd->enable = param->enable; |
| 1260 | if (param->can_suspend_link) |
| 1261 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1262 | else |
| 1263 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1264 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1265 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1266 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1267 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1268 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1269 | |
| 1270 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1271 | WMI_WOW_ENABLE_CMDID); |
| 1272 | if (ret) |
| 1273 | wmi_buf_free(buf); |
| 1274 | |
| 1275 | return ret; |
| 1276 | } |
| 1277 | |
| 1278 | /** |
| 1279 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1280 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1281 | * @peer_addr: peer mac address |
| 1282 | * @param: pointer to ap_ps parameter structure |
| 1283 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1284 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1285 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1286 | 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] | 1287 | uint8_t *peer_addr, |
| 1288 | struct ap_ps_params *param) |
| 1289 | { |
| 1290 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1291 | wmi_buf_t buf; |
| 1292 | int32_t err; |
| 1293 | |
| 1294 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1295 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1296 | 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] | 1297 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1298 | } |
| 1299 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1300 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1301 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1302 | WMITLV_GET_STRUCT_TLVLEN |
| 1303 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1304 | cmd->vdev_id = param->vdev_id; |
| 1305 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1306 | cmd->param = param->param; |
| 1307 | cmd->value = param->value; |
| 1308 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1309 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1310 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1311 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1312 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1313 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1314 | } |
| 1315 | |
| 1316 | return 0; |
| 1317 | } |
| 1318 | |
| 1319 | /** |
| 1320 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1321 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1322 | * @peer_addr: peer mac address |
| 1323 | * @param: pointer to sta_ps parameter structure |
| 1324 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1325 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1326 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1327 | 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] | 1328 | struct sta_ps_params *param) |
| 1329 | { |
| 1330 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1331 | wmi_buf_t buf; |
| 1332 | int32_t len = sizeof(*cmd); |
| 1333 | |
| 1334 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1335 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1336 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1337 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1338 | } |
| 1339 | |
| 1340 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1341 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1342 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1343 | WMITLV_GET_STRUCT_TLVLEN |
| 1344 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1345 | cmd->vdev_id = param->vdev_id; |
| 1346 | cmd->param = param->param; |
| 1347 | cmd->value = param->value; |
| 1348 | |
| 1349 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1350 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1351 | 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] | 1352 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1353 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1354 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1355 | } |
| 1356 | |
| 1357 | return 0; |
| 1358 | } |
| 1359 | |
| 1360 | /** |
| 1361 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1362 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1363 | * @param: ponirt to crash inject paramter structure |
| 1364 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1365 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1366 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1367 | 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] | 1368 | struct crash_inject *param) |
| 1369 | { |
| 1370 | int32_t ret = 0; |
| 1371 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1372 | uint16_t len = sizeof(*cmd); |
| 1373 | wmi_buf_t buf; |
| 1374 | |
| 1375 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1376 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1377 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1378 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1379 | } |
| 1380 | |
| 1381 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1382 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1383 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1384 | WMITLV_GET_STRUCT_TLVLEN |
| 1385 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1386 | cmd->type = param->type; |
| 1387 | cmd->delay_time_ms = param->delay_time_ms; |
| 1388 | |
| 1389 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1390 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1391 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1392 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1393 | __func__, ret); |
| 1394 | wmi_buf_free(buf); |
| 1395 | } |
| 1396 | |
| 1397 | return ret; |
| 1398 | } |
| 1399 | |
| 1400 | /** |
| 1401 | * send_dbglog_cmd_tlv() - set debug log level |
| 1402 | * @param wmi_handle : handle to WMI. |
| 1403 | * @param param : pointer to hold dbglog level parameter |
| 1404 | * |
| 1405 | * Return: 0 on success and -ve on failure. |
| 1406 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1407 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1408 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1409 | struct dbglog_params *dbglog_param) |
| 1410 | { |
| 1411 | wmi_buf_t buf; |
| 1412 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
| 1413 | A_STATUS status = A_OK; |
| 1414 | int32_t i; |
| 1415 | int32_t len; |
| 1416 | int8_t *buf_ptr; |
| 1417 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1418 | |
| 1419 | ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
| 1420 | |
| 1421 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1422 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1423 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1424 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1425 | if (buf == NULL) |
| 1426 | return A_NO_MEMORY; |
| 1427 | |
| 1428 | configmsg = |
| 1429 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1430 | buf_ptr = (int8_t *) configmsg; |
| 1431 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1432 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1433 | WMITLV_GET_STRUCT_TLVLEN |
| 1434 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1435 | configmsg->dbg_log_param = dbglog_param->param; |
| 1436 | configmsg->value = dbglog_param->val; |
| 1437 | /* Filling in the data part of second tlv -- should |
| 1438 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1439 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1440 | sizeof |
| 1441 | (wmi_debug_log_config_cmd_fixed_param) |
| 1442 | + WMI_TLV_HDR_SIZE); |
| 1443 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1444 | WMITLV_TAG_ARRAY_UINT32, |
| 1445 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1446 | if (dbglog_param->module_id_bitmap) { |
| 1447 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1448 | module_id_bitmap_array[i] = |
| 1449 | dbglog_param->module_id_bitmap[i]; |
| 1450 | } |
| 1451 | } |
| 1452 | |
| 1453 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1454 | len, WMI_DBGLOG_CFG_CMDID); |
| 1455 | |
| 1456 | if (status != A_OK) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1457 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1458 | |
| 1459 | return status; |
| 1460 | } |
| 1461 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1462 | #ifdef CONFIG_MCL |
| 1463 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1464 | uint32_t host_param) |
| 1465 | { |
| 1466 | return host_param; |
| 1467 | } |
| 1468 | #else |
| 1469 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1470 | uint32_t host_param) |
| 1471 | { |
| 1472 | if (host_param < wmi_vdev_param_max) |
| 1473 | return wmi_handle->vdev_param[host_param]; |
| 1474 | |
| 1475 | return WMI_UNAVAILABLE_PARAM; |
| 1476 | } |
| 1477 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1478 | /** |
| 1479 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1480 | * @param wmi_handle : handle to WMI. |
| 1481 | * @param macaddr : MAC address |
| 1482 | * @param param : pointer to hold vdev set parameter |
| 1483 | * |
| 1484 | * Return: 0 on success and -ve on failure. |
| 1485 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1486 | 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] | 1487 | struct vdev_set_params *param) |
| 1488 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1489 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1490 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1491 | wmi_buf_t buf; |
| 1492 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1493 | uint32_t vdev_param; |
| 1494 | |
| 1495 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1496 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1497 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1498 | param->param_id); |
| 1499 | return QDF_STATUS_E_INVAL; |
| 1500 | |
| 1501 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1502 | |
| 1503 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1504 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1505 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1506 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1507 | } |
| 1508 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1509 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1510 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1511 | WMITLV_GET_STRUCT_TLVLEN |
| 1512 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1513 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1514 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1515 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1516 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1517 | param->if_id, param->param_id, param->param_value); |
| 1518 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1519 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1520 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1521 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1522 | wmi_buf_free(buf); |
| 1523 | } |
| 1524 | |
| 1525 | return ret; |
| 1526 | } |
| 1527 | |
| 1528 | /** |
| 1529 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1530 | * @param wmi_handle : handle to WMI. |
| 1531 | * @param macaddr : MAC address |
| 1532 | * @param param : pointer to hold stats request parameter |
| 1533 | * |
| 1534 | * Return: 0 on success and -ve on failure. |
| 1535 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1536 | 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] | 1537 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1538 | struct stats_request_params *param) |
| 1539 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1540 | int32_t ret; |
| 1541 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1542 | wmi_buf_t buf; |
| 1543 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1544 | |
| 1545 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1546 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1547 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1548 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1549 | } |
| 1550 | |
| 1551 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1552 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1553 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1554 | WMITLV_GET_STRUCT_TLVLEN |
| 1555 | (wmi_request_stats_cmd_fixed_param)); |
| 1556 | cmd->stats_id = param->stats_id; |
| 1557 | cmd->vdev_id = param->vdev_id; |
| 1558 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1559 | WMI_REQUEST_STATS_CMDID); |
| 1560 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1561 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1562 | wmi_buf_free(buf); |
| 1563 | } |
| 1564 | |
| 1565 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1566 | } |
| 1567 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1568 | #ifdef CONFIG_WIN |
| 1569 | /** |
| 1570 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1571 | * @param wmi_handle : handle to WMI. |
| 1572 | * @param macaddr : MAC address |
| 1573 | * @param param : pointer to hold stats request parameter |
| 1574 | * |
| 1575 | * Return: 0 on success and -ve on failure. |
| 1576 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1577 | 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] | 1578 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT) |
| 1579 | { |
| 1580 | return 0; |
| 1581 | } |
| 1582 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1583 | /** |
| 1584 | * send_packet_log_enable_cmd_tlv() - WMI request stats function |
| 1585 | * @param wmi_handle : handle to WMI. |
| 1586 | * @param macaddr : MAC address |
| 1587 | * @param param : pointer to hold stats request parameter |
| 1588 | * |
| 1589 | * Return: 0 on success and -ve on failure. |
| 1590 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1591 | 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] | 1592 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1593 | struct packet_enable_params *param) |
| 1594 | { |
| 1595 | return 0; |
| 1596 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1597 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1598 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1599 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1600 | /** |
| 1601 | * send_beacon_send_cmd_tlv() - WMI beacon send function |
| 1602 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1603 | * @param param : pointer to hold beacon send cmd parameter |
| 1604 | * |
| 1605 | * Return: 0 on success and -ve on failure. |
| 1606 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1607 | 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] | 1608 | struct beacon_params *param) |
| 1609 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1610 | int32_t ret; |
| 1611 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1612 | wmi_bcn_prb_info *bcn_prb_info; |
| 1613 | wmi_buf_t wmi_buf; |
| 1614 | uint8_t *buf_ptr; |
| 1615 | uint32_t wmi_buf_len; |
| 1616 | |
| 1617 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1618 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1619 | param->tmpl_len_aligned; |
| 1620 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1621 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1622 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1623 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1624 | } |
| 1625 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1626 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1627 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1628 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1629 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1630 | cmd->vdev_id = param->vdev_id; |
| 1631 | cmd->tim_ie_offset = param->tim_ie_offset; |
| 1632 | cmd->buf_len = param->tmpl_len; |
| 1633 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1634 | |
| 1635 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1636 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1637 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1638 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1639 | bcn_prb_info->caps = 0; |
| 1640 | bcn_prb_info->erp = 0; |
| 1641 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1642 | |
| 1643 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1644 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1645 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1646 | |
| 1647 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1648 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1649 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1650 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1651 | wmi_buf_free(wmi_buf); |
| 1652 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1653 | return 0; |
| 1654 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1655 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1656 | 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] | 1657 | struct beacon_params *param) |
| 1658 | { |
Kiran Venkatappa | 9d59bd6 | 2017-04-21 14:42:32 +0530 | [diff] [blame] | 1659 | QDF_STATUS ret; |
| 1660 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 1661 | wmi_buf_t wmi_buf; |
| 1662 | qdf_dma_addr_t dma_addr; |
| 1663 | uint32_t dtim_flag = 0; |
| 1664 | |
| 1665 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1666 | if (!wmi_buf) { |
| 1667 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1668 | return QDF_STATUS_E_NOMEM; |
| 1669 | } |
| 1670 | if (param->is_dtim_count_zero) { |
| 1671 | dtim_flag |= WMI_BCN_SEND_DTIM_ZERO; |
| 1672 | if (param->is_bitctl_reqd) { |
| 1673 | /* deliver CAB traffic in next DTIM beacon */ |
| 1674 | dtim_flag |= WMI_BCN_SEND_DTIM_BITCTL_SET; |
| 1675 | } |
| 1676 | } |
| 1677 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 1678 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1679 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 1680 | WMITLV_GET_STRUCT_TLVLEN |
| 1681 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 1682 | cmd->vdev_id = param->vdev_id; |
| 1683 | cmd->data_len = qdf_nbuf_len(param->wbuf); |
| 1684 | cmd->frame_ctrl = param->frame_ctrl; |
| 1685 | cmd->dtim_flag = dtim_flag; |
| 1686 | dma_addr = qdf_nbuf_get_frag_paddr(param->wbuf, 0); |
| 1687 | cmd->frag_ptr_lo = qdf_get_lower_32_bits(dma_addr); |
| 1688 | #if defined(HTT_PADDR64) |
| 1689 | cmd->frag_ptr_hi = qdf_get_upper_32_bits(dma_addr) & 0x1F; |
| 1690 | #endif |
| 1691 | cmd->bcn_antenna = param->bcn_txant; |
| 1692 | |
| 1693 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1694 | wmi_buf, sizeof(*cmd), WMI_PDEV_SEND_BCN_CMDID); |
| 1695 | if (ret != QDF_STATUS_SUCCESS) { |
| 1696 | WMI_LOGE("%s: Failed to send bcn: %d", __func__, ret); |
| 1697 | wmi_buf_free(wmi_buf); |
| 1698 | } |
| 1699 | |
| 1700 | return ret; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1701 | } |
| 1702 | |
| 1703 | /** |
| 1704 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1705 | * @param wmi_handle : handle to WMI. |
| 1706 | * @param param : pointer to hold beacon send cmd parameter |
| 1707 | * |
| 1708 | * Return: 0 on success and -ve on failure. |
| 1709 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1710 | 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] | 1711 | struct beacon_tmpl_params *param) |
| 1712 | { |
| 1713 | int32_t ret; |
| 1714 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1715 | wmi_bcn_prb_info *bcn_prb_info; |
| 1716 | wmi_buf_t wmi_buf; |
| 1717 | uint8_t *buf_ptr; |
| 1718 | uint32_t wmi_buf_len; |
| 1719 | |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1720 | WMI_LOGI("%s\n", __func__); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1721 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1722 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1723 | param->tmpl_len_aligned; |
| 1724 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1725 | if (!wmi_buf) { |
| 1726 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1727 | return QDF_STATUS_E_NOMEM; |
| 1728 | } |
| 1729 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1730 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1731 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1732 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1733 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1734 | cmd->vdev_id = param->vdev_id; |
| 1735 | cmd->tim_ie_offset = param->tim_ie_offset; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1736 | cmd->csa_switch_count_offset = param->csa_switch_count_offset; |
| 1737 | cmd->ext_csa_switch_count_offset = param->ext_csa_switch_count_offset; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1738 | cmd->buf_len = param->tmpl_len; |
| 1739 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1740 | |
| 1741 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1742 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1743 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1744 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1745 | bcn_prb_info->caps = 0; |
| 1746 | bcn_prb_info->erp = 0; |
| 1747 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1748 | |
| 1749 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1750 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1751 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1752 | |
| 1753 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1754 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1755 | if (ret) { |
| 1756 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1757 | wmi_buf_free(wmi_buf); |
| 1758 | } |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1759 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1760 | return 0; |
| 1761 | } |
| 1762 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1763 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1764 | #ifdef CONFIG_MCL |
| 1765 | static inline void copy_peer_flags_tlv( |
| 1766 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1767 | struct peer_assoc_params *param) |
| 1768 | { |
| 1769 | cmd->peer_flags = param->peer_flags; |
| 1770 | } |
| 1771 | #else |
| 1772 | static inline void copy_peer_flags_tlv( |
| 1773 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1774 | struct peer_assoc_params *param) |
| 1775 | { |
| 1776 | /* |
| 1777 | * The target only needs a subset of the flags maintained in the host. |
| 1778 | * Just populate those flags and send it down |
| 1779 | */ |
| 1780 | cmd->peer_flags = 0; |
| 1781 | |
| 1782 | /* |
| 1783 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1784 | */ |
| 1785 | if (param->is_wme_set) { |
| 1786 | |
| 1787 | if (param->qos_flag) |
| 1788 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1789 | if (param->apsd_flag) |
| 1790 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1791 | if (param->ht_flag) |
| 1792 | cmd->peer_flags |= WMI_PEER_HT; |
| 1793 | if (param->bw_40) |
| 1794 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1795 | if (param->bw_80) |
| 1796 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1797 | if (param->bw_160) |
| 1798 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1799 | |
| 1800 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1801 | * for HT as well |
| 1802 | **/ |
| 1803 | if (param->stbc_flag) |
| 1804 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1805 | |
| 1806 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1807 | * for HT as well |
| 1808 | **/ |
| 1809 | if (param->ldpc_flag) |
| 1810 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1811 | |
| 1812 | if (param->static_mimops_flag) |
| 1813 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1814 | if (param->dynamic_mimops_flag) |
| 1815 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1816 | if (param->spatial_mux_flag) |
| 1817 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1818 | if (param->vht_flag) |
| 1819 | cmd->peer_flags |= WMI_PEER_VHT; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1820 | if (param->he_flag) |
| 1821 | cmd->peer_flags |= WMI_PEER_HE; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1822 | } |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1823 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1824 | /* |
| 1825 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1826 | * (during re-association). |
| 1827 | * Authorization will be done for these modes on key installation. |
| 1828 | */ |
| 1829 | if (param->auth_flag) |
| 1830 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1831 | if (param->need_ptk_4_way) |
| 1832 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1833 | else |
| 1834 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1835 | if (param->need_gtk_2_way) |
| 1836 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1837 | /* safe mode bypass the 4-way handshake */ |
| 1838 | if (param->safe_mode_enabled) |
| 1839 | cmd->peer_flags &= |
| 1840 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1841 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1842 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1843 | * it |
| 1844 | * if (param->amsdu_disable) Add after FW support |
| 1845 | **/ |
| 1846 | |
| 1847 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1848 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1849 | * iwpriv |
| 1850 | **/ |
| 1851 | if (param->peer_ht_rates.num_rates == 0) |
| 1852 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1853 | } |
| 1854 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1855 | |
| 1856 | #ifdef CONFIG_MCL |
| 1857 | static inline void copy_peer_mac_addr_tlv( |
| 1858 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1859 | struct peer_assoc_params *param) |
| 1860 | { |
| 1861 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1862 | sizeof(param->peer_macaddr)); |
| 1863 | } |
| 1864 | #else |
| 1865 | static inline void copy_peer_mac_addr_tlv( |
| 1866 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1867 | struct peer_assoc_params *param) |
| 1868 | { |
| 1869 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 1870 | } |
| 1871 | #endif |
| 1872 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1873 | /** |
| 1874 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1875 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1876 | * @param param : pointer to peer assoc parameter |
| 1877 | * |
| 1878 | * Return: 0 on success and -ve on failure. |
| 1879 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1880 | 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] | 1881 | struct peer_assoc_params *param) |
| 1882 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1883 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1884 | wmi_vht_rate_set *mcs; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1885 | wmi_he_rate_set *he_mcs; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1886 | wmi_buf_t buf; |
| 1887 | int32_t len; |
| 1888 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1889 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1890 | uint32_t peer_legacy_rates_align; |
| 1891 | uint32_t peer_ht_rates_align; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1892 | int32_t i; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1893 | |
| 1894 | |
| 1895 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1896 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1897 | |
| 1898 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1899 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
| 1900 | WMI_TLV_HDR_SIZE + |
| 1901 | (peer_ht_rates_align * sizeof(uint8_t)) + |
| 1902 | sizeof(wmi_vht_rate_set) + |
| 1903 | (sizeof(wmi_he_rate_set) * param->peer_he_mcs_count |
| 1904 | + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1905 | |
| 1906 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1907 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1908 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1909 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1910 | } |
| 1911 | |
| 1912 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1913 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1914 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1915 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1916 | WMITLV_GET_STRUCT_TLVLEN |
| 1917 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1918 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1919 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1920 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1921 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1922 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1923 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1924 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1925 | copy_peer_mac_addr_tlv(cmd, param); |
| 1926 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1927 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1928 | cmd->peer_caps = param->peer_caps; |
| 1929 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1930 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1931 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1932 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1933 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1934 | cmd->peer_phymode = param->peer_phymode; |
| 1935 | |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1936 | /* Update 11ax capabilities */ |
| 1937 | cmd->peer_he_cap_info = param->peer_he_cap_macinfo; |
| 1938 | cmd->peer_he_ops = param->peer_he_ops; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1939 | qdf_mem_copy(&cmd->peer_he_cap_phy, ¶m->peer_he_cap_phyinfo, |
| 1940 | sizeof(param->peer_he_cap_phyinfo)); |
| 1941 | qdf_mem_copy(&cmd->peer_ppet, ¶m->peer_ppet, |
| 1942 | sizeof(param->peer_ppet)); |
| 1943 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1944 | /* Update peer legacy rate information */ |
| 1945 | buf_ptr += sizeof(*cmd); |
| 1946 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1947 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1948 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1949 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1950 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1951 | param->peer_legacy_rates.num_rates); |
| 1952 | |
| 1953 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1954 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1955 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1956 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1957 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1958 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1959 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1960 | param->peer_ht_rates.num_rates); |
| 1961 | |
| 1962 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1963 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1964 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 1965 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 1966 | |
| 1967 | cmd->peer_nss = param->peer_nss; |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 1968 | |
| 1969 | /* Update bandwidth-NSS mapping */ |
| 1970 | cmd->peer_bw_rxnss_override = 0; |
| 1971 | cmd->peer_bw_rxnss_override |= param->peer_bw_rxnss_override; |
| 1972 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1973 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 1974 | if (param->vht_capable) { |
| 1975 | mcs->rx_max_rate = param->rx_max_rate; |
| 1976 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 1977 | mcs->tx_max_rate = param->tx_max_rate; |
| 1978 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 1979 | } |
| 1980 | |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1981 | /* HE Rates */ |
| 1982 | cmd->peer_he_mcs = param->peer_he_mcs_count; |
| 1983 | buf_ptr += sizeof(wmi_vht_rate_set); |
| 1984 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 1985 | (param->peer_he_mcs_count * sizeof(wmi_he_rate_set))); |
| 1986 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1987 | |
| 1988 | /* Loop through the HE rate set */ |
| 1989 | for (i = 0; i < param->peer_he_mcs_count; i++) { |
| 1990 | he_mcs = (wmi_he_rate_set *) buf_ptr; |
| 1991 | WMITLV_SET_HDR(he_mcs, WMITLV_TAG_STRUC_wmi_he_rate_set, |
| 1992 | WMITLV_GET_STRUCT_TLVLEN(wmi_he_rate_set)); |
| 1993 | |
| 1994 | he_mcs->rx_mcs_set = param->peer_he_rx_mcs_set[i]; |
| 1995 | he_mcs->tx_mcs_set = param->peer_he_tx_mcs_set[i]; |
| 1996 | WMI_LOGD("%s:HE idx %d RxMCSmap %x TxMCSmap %x ", __func__, |
| 1997 | i, he_mcs->rx_mcs_set, he_mcs->tx_mcs_set); |
| 1998 | buf_ptr += sizeof(wmi_he_rate_set); |
| 1999 | } |
| 2000 | |
| 2001 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2002 | 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] | 2003 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 2004 | "nss %d phymode %d peer_mpdu_density %d " |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2005 | "cmd->peer_vht_caps %x " |
| 2006 | "HE cap_info %x ops %x " |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2007 | "HE phy %x %x %x " |
| 2008 | "peer_bw_rxnss_override %x", __func__, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2009 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 2010 | cmd->peer_rate_caps, cmd->peer_caps, |
| 2011 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 2012 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 2013 | cmd->peer_mpdu_density, |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2014 | cmd->peer_vht_caps, cmd->peer_he_cap_info, |
| 2015 | cmd->peer_he_ops, cmd->peer_he_cap_phy[0], |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2016 | cmd->peer_he_cap_phy[1], cmd->peer_he_cap_phy[2], |
| 2017 | cmd->peer_bw_rxnss_override); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2018 | |
| 2019 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2020 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2021 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2022 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2023 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2024 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2025 | } |
| 2026 | |
| 2027 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2028 | } |
| 2029 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2030 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 2031 | */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2032 | static inline void copy_scan_event_cntrl_flags( |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2033 | wmi_start_scan_cmd_fixed_param * cmd, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2034 | struct scan_req_params *param) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2035 | { |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2036 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2037 | /* Scan events subscription */ |
| 2038 | if (param->scan_ev_started) |
| 2039 | cmd->notify_scan_events |= WMI_SCAN_EVENT_STARTED; |
| 2040 | if (param->scan_ev_completed) |
| 2041 | cmd->notify_scan_events |= WMI_SCAN_EVENT_COMPLETED; |
| 2042 | if (param->scan_ev_bss_chan) |
| 2043 | cmd->notify_scan_events |= WMI_SCAN_EVENT_BSS_CHANNEL; |
| 2044 | if (param->scan_ev_foreign_chan) |
| 2045 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL; |
| 2046 | if (param->scan_ev_dequeued) |
| 2047 | cmd->notify_scan_events |= WMI_SCAN_EVENT_DEQUEUED; |
| 2048 | if (param->scan_ev_preempted) |
| 2049 | cmd->notify_scan_events |= WMI_SCAN_EVENT_PREEMPTED; |
| 2050 | if (param->scan_ev_start_failed) |
| 2051 | cmd->notify_scan_events |= WMI_SCAN_EVENT_START_FAILED; |
| 2052 | if (param->scan_ev_restarted) |
| 2053 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESTARTED; |
| 2054 | if (param->scan_ev_foreign_chn_exit) |
| 2055 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 2056 | if (param->scan_ev_suspended) |
| 2057 | cmd->notify_scan_events |= WMI_SCAN_EVENT_SUSPENDED; |
| 2058 | if (param->scan_ev_resumed) |
| 2059 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESUMED; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2060 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2061 | /** Set scan control flags */ |
| 2062 | cmd->scan_ctrl_flags = 0; |
| 2063 | if (param->scan_f_passive) |
| 2064 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; |
| 2065 | if (param->scan_f_strict_passive_pch) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2066 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2067 | if (param->scan_f_promisc_mode) |
| 2068 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROMISCOUS; |
| 2069 | if (param->scan_f_capture_phy_err) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2070 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2071 | if (param->scan_f_half_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2072 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2073 | if (param->scan_f_quarter_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2074 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2075 | if (param->scan_f_cck_rates) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2076 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2077 | if (param->scan_f_ofdm_rates) |
| 2078 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 2079 | if (param->scan_f_chan_stat_evnt) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2080 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2081 | if (param->scan_f_filter_prb_req) |
| 2082 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; |
| 2083 | if (param->scan_f_bcast_probe) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2084 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2085 | if (param->scan_f_offchan_mgmt_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2086 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2087 | if (param->scan_f_offchan_data_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2088 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2089 | if (param->scan_f_force_active_dfs_chn) |
| 2090 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_FORCE_ACTIVE_ON_DFS; |
| 2091 | if (param->scan_f_add_tpc_ie_in_probe) |
| 2092 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_TPC_IE_IN_PROBE_REQ; |
| 2093 | if (param->scan_f_add_ds_ie_in_probe) |
| 2094 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
| 2095 | if (param->scan_f_add_spoofed_mac_in_probe) |
| 2096 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; |
| 2097 | if (param->scan_f_add_rand_seq_in_probe) |
| 2098 | cmd->scan_ctrl_flags |= WMI_SCAN_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 2099 | if (param->scan_f_en_ie_whitelist_in_probe) |
| 2100 | cmd->scan_ctrl_flags |= |
| 2101 | WMI_SCAN_ENABLE_IE_WHTELIST_IN_PROBE_REQ; |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2102 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2103 | /* for adaptive scan mode using 3 bits (21 - 23 bits) */ |
| 2104 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 2105 | param->adaptive_dwell_time_mode); |
| 2106 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2107 | |
| 2108 | /* scan_copy_ie_buffer() - Copy scan ie_data */ |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2109 | static inline void scan_copy_ie_buffer(uint8_t *buf_ptr, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2110 | struct scan_req_params *params) |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2111 | { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2112 | qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len); |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2113 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2114 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2115 | /* |
| 2116 | * get_pdev_wmi_handle() - Helper func to derive pdev wmi handle from vdev_id |
| 2117 | * @param wmi_handle : Handle to WMI |
| 2118 | * @param vdev_id : vdev identifier |
| 2119 | * |
| 2120 | * Return : void * |
| 2121 | */ |
| 2122 | static inline void *get_pdev_wmi_handle(wmi_unified_t wmi_handle, uint8_t vdev_id) |
| 2123 | { |
| 2124 | struct wlan_objmgr_vdev *vdev = NULL; |
| 2125 | struct wlan_objmgr_pdev *pdev = NULL; |
| 2126 | uint8_t pdev_id = 0; |
| 2127 | |
| 2128 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc( |
| 2129 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 2130 | vdev_id, WLAN_SCAN_ID); |
| 2131 | if (vdev) { |
| 2132 | wlan_objmgr_vdev_release_ref(vdev, WLAN_SCAN_ID); |
| 2133 | pdev = wlan_vdev_get_pdev(vdev); |
| 2134 | if (pdev) |
| 2135 | pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); |
| 2136 | else { |
| 2137 | qdf_print("%s : Invalid PDEV, forcing pdev_id to 0\n", __func__); |
| 2138 | } |
| 2139 | } else { |
| 2140 | qdf_print("%s : Invalid VDEV, forcing pdev_id to 0\n", __func__); |
| 2141 | } |
| 2142 | |
| 2143 | return wmi_unified_get_pdev_handle(wmi_handle->soc, pdev_id); |
| 2144 | } |
| 2145 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2146 | /** |
| 2147 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 2148 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2149 | * @param param : pointer to hold scan start cmd parameter |
| 2150 | * |
| 2151 | * Return: 0 on success and -ve on failure. |
| 2152 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2153 | 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] | 2154 | struct scan_req_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2155 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2156 | int32_t ret = 0; |
| 2157 | int32_t i; |
| 2158 | wmi_buf_t wmi_buf; |
| 2159 | wmi_start_scan_cmd_fixed_param *cmd; |
| 2160 | uint8_t *buf_ptr; |
| 2161 | uint32_t *tmp_ptr; |
| 2162 | wmi_ssid *ssid = NULL; |
| 2163 | wmi_mac_addr *bssid; |
| 2164 | int len = sizeof(*cmd); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2165 | uint8_t extraie_len_with_pad = 0; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2166 | |
| 2167 | /* Length TLV placeholder for array of uint32_t */ |
| 2168 | len += WMI_TLV_HDR_SIZE; |
| 2169 | /* calculate the length of buffer required */ |
| 2170 | if (params->num_chan) |
| 2171 | len += params->num_chan * sizeof(uint32_t); |
| 2172 | |
| 2173 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 2174 | len += WMI_TLV_HDR_SIZE; |
| 2175 | if (params->num_ssids) |
| 2176 | len += params->num_ssids * sizeof(wmi_ssid); |
| 2177 | |
| 2178 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 2179 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2180 | if (params->num_bssid) |
| 2181 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2182 | |
| 2183 | /* Length TLV placeholder for array of bytes */ |
| 2184 | len += WMI_TLV_HDR_SIZE; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2185 | if (params->extraie.len) |
| 2186 | extraie_len_with_pad = |
| 2187 | roundup(params->extraie.len, sizeof(uint32_t)); |
| 2188 | len += extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2189 | |
| 2190 | /* Allocate the memory */ |
| 2191 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2192 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2193 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2194 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2195 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2196 | } |
| 2197 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2198 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 2199 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2200 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 2201 | WMITLV_GET_STRUCT_TLVLEN |
| 2202 | (wmi_start_scan_cmd_fixed_param)); |
| 2203 | |
| 2204 | cmd->scan_id = params->scan_id; |
| 2205 | cmd->scan_req_id = params->scan_req_id; |
| 2206 | cmd->vdev_id = params->vdev_id; |
| 2207 | cmd->scan_priority = params->scan_priority; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2208 | |
| 2209 | copy_scan_event_cntrl_flags(cmd, params); |
| 2210 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2211 | cmd->dwell_time_active = params->dwell_time_active; |
| 2212 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 2213 | cmd->min_rest_time = params->min_rest_time; |
| 2214 | cmd->max_rest_time = params->max_rest_time; |
| 2215 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 2216 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 2217 | cmd->idle_time = params->idle_time; |
| 2218 | cmd->max_scan_time = params->max_scan_time; |
| 2219 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2220 | cmd->burst_duration = params->burst_duration; |
| 2221 | cmd->num_chan = params->num_chan; |
| 2222 | cmd->num_bssid = params->num_bssid; |
| 2223 | cmd->num_ssids = params->num_ssids; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2224 | cmd->ie_len = params->extraie.len; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2225 | cmd->n_probes = params->n_probes; |
| 2226 | buf_ptr += sizeof(*cmd); |
| 2227 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2228 | for (i = 0; i < params->num_chan; ++i) |
| 2229 | tmp_ptr[i] = params->chan_list[i]; |
| 2230 | |
| 2231 | WMITLV_SET_HDR(buf_ptr, |
| 2232 | WMITLV_TAG_ARRAY_UINT32, |
| 2233 | (params->num_chan * sizeof(uint32_t))); |
| 2234 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2235 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2236 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2237 | goto error; |
| 2238 | } |
| 2239 | |
| 2240 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2241 | (params->num_ssids * sizeof(wmi_ssid))); |
| 2242 | |
| 2243 | if (params->num_ssids) { |
| 2244 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2245 | for (i = 0; i < params->num_ssids; ++i) { |
| 2246 | ssid->ssid_len = params->ssid[i].length; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2247 | qdf_mem_copy(ssid->ssid, params->ssid[i].ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2248 | params->ssid[i].length); |
| 2249 | ssid++; |
| 2250 | } |
| 2251 | } |
| 2252 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 2253 | |
| 2254 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2255 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 2256 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2257 | |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2258 | if (params->num_bssid) { |
| 2259 | for (i = 0; i < params->num_bssid; ++i) { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2260 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 2261 | ¶ms->bssid_list[i].bytes[0], bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2262 | bssid++; |
| 2263 | } |
| 2264 | } |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2265 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2266 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2267 | (params->num_bssid * sizeof(wmi_mac_addr)); |
| 2268 | |
| 2269 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, extraie_len_with_pad); |
| 2270 | if (params->extraie.len) |
| 2271 | scan_copy_ie_buffer(buf_ptr + WMI_TLV_HDR_SIZE, |
| 2272 | params); |
| 2273 | |
| 2274 | buf_ptr += WMI_TLV_HDR_SIZE + extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2275 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2276 | ret = wmi_unified_cmd_send( |
| 2277 | get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2278 | len, WMI_START_SCAN_CMDID); |
| 2279 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2280 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2281 | wmi_buf_free(wmi_buf); |
| 2282 | } |
| 2283 | return ret; |
| 2284 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2285 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2286 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2287 | } |
| 2288 | |
| 2289 | /** |
| 2290 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 2291 | * @param wmi_handle : handle to WMI. |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2292 | * @param param : pointer to hold scan cancel cmd parameter |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2293 | * |
| 2294 | * Return: 0 on success and -ve on failure. |
| 2295 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2296 | 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] | 2297 | struct scan_cancel_param *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2298 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2299 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2300 | int ret; |
| 2301 | int len = sizeof(*cmd); |
| 2302 | wmi_buf_t wmi_buf; |
| 2303 | |
| 2304 | /* Allocate the memory */ |
| 2305 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2306 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2307 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2308 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2309 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2310 | goto error; |
| 2311 | } |
| 2312 | |
| 2313 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2314 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2315 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2316 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2317 | cmd->vdev_id = param->vdev_id; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2318 | cmd->requestor = param->requester; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2319 | cmd->scan_id = param->scan_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2320 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2321 | param->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2322 | /* stop the scan with the corresponding scan_id */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2323 | if (param->req_type == WLAN_SCAN_CANCEL_PDEV_ALL) { |
| 2324 | /* Cancelling all scans */ |
| 2325 | cmd->req_type = WMI_SCAN_STOP_ALL; |
| 2326 | } else if (param->req_type == WLAN_SCAN_CANCEL_VDEV_ALL) { |
| 2327 | /* Cancelling VAP scans */ |
| 2328 | cmd->req_type = WMI_SCN_STOP_VAP_ALL; |
| 2329 | } else if (param->req_type == WLAN_SCAN_CANCEL_SINGLE) { |
| 2330 | /* Cancelling specific scan */ |
| 2331 | cmd->req_type = WMI_SCAN_STOP_ONE; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2332 | } else { |
| 2333 | WMI_LOGE("%s: Invalid Command : ", __func__); |
| 2334 | wmi_buf_free(wmi_buf); |
| 2335 | return QDF_STATUS_E_INVAL; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2336 | } |
| 2337 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2338 | 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] | 2339 | len, WMI_STOP_SCAN_CMDID); |
| 2340 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2341 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2342 | wmi_buf_free(wmi_buf); |
| 2343 | } |
| 2344 | |
| 2345 | error: |
| 2346 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2347 | } |
| 2348 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2349 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2350 | /** |
| 2351 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2352 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2353 | * @param param : pointer to hold scan channel list parameter |
| 2354 | * |
| 2355 | * Return: 0 on success and -ve on failure. |
| 2356 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2357 | 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] | 2358 | struct scan_chan_list_params *chan_list) |
| 2359 | { |
| 2360 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2361 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2362 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2363 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2364 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2365 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2366 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2367 | |
| 2368 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2369 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2370 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2371 | WMI_LOGE("Failed to allocate memory"); |
| 2372 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2373 | goto end; |
| 2374 | } |
| 2375 | |
| 2376 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2377 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2378 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2379 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2380 | WMITLV_GET_STRUCT_TLVLEN |
| 2381 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2382 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2383 | 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] | 2384 | |
| 2385 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2386 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2387 | WMITLV_TAG_ARRAY_STRUC, |
| 2388 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2389 | chan_info = (wmi_channel_param *) |
| 2390 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2391 | tchan_info = chan_list->chan_info; |
| 2392 | |
| 2393 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2394 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2395 | WMITLV_TAG_STRUC_wmi_channel, |
| 2396 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2397 | chan_info->mhz = tchan_info->mhz; |
| 2398 | chan_info->band_center_freq1 = |
| 2399 | tchan_info->band_center_freq1; |
| 2400 | chan_info->band_center_freq2 = |
| 2401 | tchan_info->band_center_freq2; |
| 2402 | chan_info->info = tchan_info->info; |
| 2403 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2404 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2405 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2406 | |
| 2407 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2408 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2409 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2410 | tchan_info++; |
| 2411 | chan_info++; |
| 2412 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2413 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2414 | chan_list->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2415 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2416 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 2417 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2418 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2419 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2420 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2421 | wmi_buf_free(buf); |
| 2422 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2423 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2424 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2425 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2426 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2427 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2428 | 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] | 2429 | struct scan_chan_list_params *chan_list) |
| 2430 | { |
| 2431 | wmi_buf_t buf; |
| 2432 | QDF_STATUS qdf_status; |
| 2433 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2434 | int i; |
| 2435 | uint8_t *buf_ptr; |
| 2436 | wmi_channel *chan_info; |
| 2437 | struct channel_param *tchan_info; |
| 2438 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2439 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2440 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2441 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2442 | if (!buf) { |
| 2443 | WMI_LOGE("Failed to allocate memory"); |
| 2444 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2445 | goto end; |
| 2446 | } |
| 2447 | |
| 2448 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2449 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2450 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2451 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2452 | WMITLV_GET_STRUCT_TLVLEN |
| 2453 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2454 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2455 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2456 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2457 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2458 | chan_list->pdev_id); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2459 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2460 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2461 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2462 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2463 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2464 | tchan_info = &(chan_list->ch_param[0]); |
| 2465 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2466 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2467 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2468 | WMITLV_TAG_STRUC_wmi_channel, |
| 2469 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2470 | chan_info->mhz = tchan_info->mhz; |
| 2471 | chan_info->band_center_freq1 = |
| 2472 | tchan_info->cfreq1; |
| 2473 | chan_info->band_center_freq2 = |
| 2474 | tchan_info->cfreq2; |
| 2475 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2476 | if (tchan_info->is_chan_passive) |
| 2477 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2478 | WMI_CHAN_FLAG_PASSIVE); |
| 2479 | |
| 2480 | if (tchan_info->allow_vht) |
| 2481 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2482 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2483 | else if (tchan_info->allow_ht) |
| 2484 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2485 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2486 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2487 | tchan_info->phy_mode); |
| 2488 | |
| 2489 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2490 | * after FW support |
| 2491 | */ |
| 2492 | |
| 2493 | /* also fill in power information */ |
| 2494 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2495 | tchan_info->minpower); |
| 2496 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2497 | tchan_info->maxpower); |
| 2498 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2499 | tchan_info->maxregpower); |
| 2500 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2501 | tchan_info->antennamax); |
| 2502 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2503 | tchan_info->reg_class_id); |
| 2504 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2505 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2506 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2507 | tchan_info++; |
| 2508 | chan_info++; |
| 2509 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2510 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2511 | chan_list->pdev_id); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2512 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2513 | qdf_status = wmi_unified_cmd_send( |
| 2514 | wmi_handle, |
| 2515 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2516 | |
| 2517 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2518 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2519 | wmi_buf_free(buf); |
| 2520 | } |
| 2521 | |
| 2522 | end: |
| 2523 | return qdf_status; |
| 2524 | } |
| 2525 | #endif |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2526 | /** |
| 2527 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2528 | * @wmi_handle : handle to WMI. |
| 2529 | * @param : pointer to hold mgmt cmd parameter |
| 2530 | * |
| 2531 | * Return: 0 on success and -ve on failure. |
| 2532 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2533 | static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2534 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2535 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2536 | wmi_buf_t buf; |
| 2537 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2538 | int32_t cmd_len; |
| 2539 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2540 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2541 | uint8_t *bufp; |
Himanshu Agarwal | e3d1374 | 2017-04-04 12:36:33 +0530 | [diff] [blame] | 2542 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2543 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2544 | mgmt_tx_dl_frm_len; |
| 2545 | |
| 2546 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
| 2547 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 2548 | |
| 2549 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2550 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2551 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2552 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2553 | } |
| 2554 | |
| 2555 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2556 | bufp = (uint8_t *) cmd; |
| 2557 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2558 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2559 | WMITLV_GET_STRUCT_TLVLEN |
| 2560 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2561 | |
| 2562 | cmd->vdev_id = param->vdev_id; |
| 2563 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2564 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2565 | cmd->chanfreq = param->chanfreq; |
| 2566 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2567 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2568 | sizeof(uint32_t))); |
| 2569 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2570 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
Himanshu Agarwal | e3d1374 | 2017-04-04 12:36:33 +0530 | [diff] [blame] | 2571 | |
| 2572 | status = qdf_nbuf_map_single(qdf_ctx, param->tx_frame, |
| 2573 | QDF_DMA_TO_DEVICE); |
| 2574 | if (status != QDF_STATUS_SUCCESS) { |
| 2575 | WMI_LOGE("%s: wmi buf map failed", __func__); |
| 2576 | goto err1; |
| 2577 | } |
| 2578 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2579 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2580 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
Orhan K AKYILDIZ | 271641f | 2017-01-29 15:17:12 -0800 | [diff] [blame] | 2581 | #if defined(HTT_PADDR64) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2582 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2583 | #endif |
| 2584 | cmd->frame_len = param->frm_len; |
| 2585 | cmd->buf_len = bufp_len; |
| 2586 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2587 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2588 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2589 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2590 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2591 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2592 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2593 | goto err1; |
| 2594 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2595 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2596 | |
| 2597 | err1: |
| 2598 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2599 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2600 | } |
| 2601 | |
| 2602 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2603 | * send_offchan_data_tx_send_cmd_tlv() - Send off-chan tx data |
| 2604 | * @wmi_handle : handle to WMI. |
| 2605 | * @param : pointer to offchan data tx cmd parameter |
| 2606 | * |
| 2607 | * Return: QDF_STATUS_SUCCESS on success and error on failure. |
| 2608 | */ |
| 2609 | static QDF_STATUS send_offchan_data_tx_cmd_tlv(wmi_unified_t wmi_handle, |
| 2610 | struct wmi_offchan_data_tx_params *param) |
| 2611 | { |
| 2612 | wmi_buf_t buf; |
| 2613 | wmi_offchan_data_tx_send_cmd_fixed_param *cmd; |
| 2614 | int32_t cmd_len; |
| 2615 | uint64_t dma_addr; |
| 2616 | void *qdf_ctx = param->qdf_ctx; |
| 2617 | uint8_t *bufp; |
| 2618 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? |
| 2619 | param->frm_len : mgmt_tx_dl_frm_len; |
| 2620 | |
| 2621 | cmd_len = sizeof(wmi_offchan_data_tx_send_cmd_fixed_param) + |
| 2622 | WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t)); |
| 2623 | |
| 2624 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 2625 | if (!buf) { |
| 2626 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2627 | return QDF_STATUS_E_NOMEM; |
| 2628 | } |
| 2629 | |
| 2630 | cmd = (wmi_offchan_data_tx_send_cmd_fixed_param *) wmi_buf_data(buf); |
| 2631 | bufp = (uint8_t *) cmd; |
| 2632 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2633 | WMITLV_TAG_STRUC_wmi_offchan_data_tx_send_cmd_fixed_param, |
| 2634 | WMITLV_GET_STRUCT_TLVLEN |
| 2635 | (wmi_offchan_data_tx_send_cmd_fixed_param)); |
| 2636 | |
| 2637 | cmd->vdev_id = param->vdev_id; |
| 2638 | |
| 2639 | cmd->desc_id = param->desc_id; |
| 2640 | cmd->chanfreq = param->chanfreq; |
| 2641 | bufp += sizeof(wmi_offchan_data_tx_send_cmd_fixed_param); |
| 2642 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2643 | sizeof(uint32_t))); |
| 2644 | bufp += WMI_TLV_HDR_SIZE; |
| 2645 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2646 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2647 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
| 2648 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 2649 | #if defined(HTT_PADDR64) |
| 2650 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2651 | #endif |
| 2652 | cmd->frame_len = param->frm_len; |
| 2653 | cmd->buf_len = bufp_len; |
| 2654 | |
| 2655 | wmi_mgmt_cmd_record(wmi_handle, WMI_OFFCHAN_DATA_TX_SEND_CMDID, |
| 2656 | bufp, cmd->vdev_id, cmd->chanfreq); |
| 2657 | |
| 2658 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2659 | WMI_OFFCHAN_DATA_TX_SEND_CMDID)) { |
| 2660 | WMI_LOGE("%s: Failed to offchan data Tx", __func__); |
| 2661 | wmi_buf_free(buf); |
| 2662 | return QDF_STATUS_E_FAILURE; |
| 2663 | } |
| 2664 | |
| 2665 | return QDF_STATUS_SUCCESS; |
| 2666 | } |
| 2667 | |
| 2668 | /** |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2669 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2670 | * @wmi_handle: wmi handle |
| 2671 | * @param_value: parameter value |
| 2672 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2673 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2674 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2675 | 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] | 2676 | uint32_t param_value) |
| 2677 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2678 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2679 | wmi_modem_power_state_cmd_param *cmd; |
| 2680 | wmi_buf_t buf; |
| 2681 | uint16_t len = sizeof(*cmd); |
| 2682 | |
| 2683 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2684 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2685 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2686 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2687 | } |
| 2688 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2689 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2690 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2691 | WMITLV_GET_STRUCT_TLVLEN |
| 2692 | (wmi_modem_power_state_cmd_param)); |
| 2693 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2694 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2695 | param_value); |
| 2696 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2697 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2698 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2699 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2700 | wmi_buf_free(buf); |
| 2701 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2702 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2703 | return ret; |
| 2704 | } |
| 2705 | |
| 2706 | /** |
| 2707 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2708 | * @wmi_handle: wmi handle |
| 2709 | * @vdev_id: vdev id |
| 2710 | * @val: value |
| 2711 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2712 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2713 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2714 | 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] | 2715 | uint32_t vdev_id, uint8_t val) |
| 2716 | { |
| 2717 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2718 | wmi_buf_t buf; |
| 2719 | int32_t len = sizeof(*cmd); |
| 2720 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2721 | 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] | 2722 | |
| 2723 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2724 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2725 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2726 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2727 | } |
| 2728 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2729 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2730 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2731 | WMITLV_GET_STRUCT_TLVLEN |
| 2732 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2733 | cmd->vdev_id = vdev_id; |
| 2734 | if (val) |
| 2735 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2736 | else |
| 2737 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2738 | |
| 2739 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2740 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2741 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2742 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2743 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2744 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2745 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2746 | return 0; |
| 2747 | } |
| 2748 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2749 | /** |
| 2750 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2751 | * @wmi_handle: wmi handle |
| 2752 | * @vdev_id: vdev id |
| 2753 | * @value: value |
| 2754 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2755 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2756 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2757 | 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] | 2758 | uint8_t vdev_id, int value) |
| 2759 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2760 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2761 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2762 | wmi_buf_t buf; |
| 2763 | uint16_t len = sizeof(*cmd); |
| 2764 | |
| 2765 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2766 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2767 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2768 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2769 | } |
| 2770 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2771 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2772 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2773 | WMITLV_GET_STRUCT_TLVLEN |
| 2774 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2775 | |
| 2776 | cmd->vdev_id = vdev_id; |
| 2777 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2778 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2779 | * to SM power save values defined in the specification. |
| 2780 | * Make sure to send the right mapping. |
| 2781 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2782 | switch (value) { |
| 2783 | case 0: |
| 2784 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 2785 | break; |
| 2786 | case 1: |
| 2787 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 2788 | break; |
| 2789 | case 2: |
| 2790 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 2791 | break; |
| 2792 | case 3: |
| 2793 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 2794 | break; |
| 2795 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2796 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 2797 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2798 | } |
| 2799 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2800 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2801 | |
| 2802 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2803 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2804 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2805 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2806 | wmi_buf_free(buf); |
| 2807 | } |
| 2808 | |
| 2809 | return ret; |
| 2810 | } |
| 2811 | |
| 2812 | /** |
| 2813 | * send_set_smps_params_cmd_tlv() - set smps params |
| 2814 | * @wmi_handle: wmi handle |
| 2815 | * @vdev_id: vdev id |
| 2816 | * @value: value |
| 2817 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2818 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2819 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2820 | 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] | 2821 | int value) |
| 2822 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2823 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2824 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 2825 | wmi_buf_t buf; |
| 2826 | uint16_t len = sizeof(*cmd); |
| 2827 | |
| 2828 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2829 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2830 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2831 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2832 | } |
| 2833 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 2834 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2835 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 2836 | WMITLV_GET_STRUCT_TLVLEN |
| 2837 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 2838 | |
| 2839 | cmd->vdev_id = vdev_id; |
| 2840 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 2841 | cmd->param = |
| 2842 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 2843 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2844 | 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] | 2845 | cmd->param); |
| 2846 | |
| 2847 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2848 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2849 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2850 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2851 | wmi_buf_free(buf); |
| 2852 | } |
| 2853 | |
| 2854 | return ret; |
| 2855 | } |
| 2856 | |
| 2857 | /** |
| 2858 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 2859 | * @wmi_handle: wmi handle |
| 2860 | * @noa: p2p power save parameters |
| 2861 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2862 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2863 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2864 | 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] | 2865 | struct p2p_ps_params *noa) |
| 2866 | { |
| 2867 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 2868 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 2869 | wmi_buf_t buf; |
| 2870 | uint8_t *buf_ptr; |
| 2871 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2872 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2873 | uint32_t duration; |
| 2874 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2875 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2876 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 2877 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2878 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2879 | WMI_LOGE("Failed to allocate memory"); |
| 2880 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2881 | goto end; |
| 2882 | } |
| 2883 | |
| 2884 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2885 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 2886 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2887 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 2888 | WMITLV_GET_STRUCT_TLVLEN |
| 2889 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 2890 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 2891 | cmd->vdev_id = noa->session_id; |
| 2892 | cmd->enable = (duration) ? true : false; |
| 2893 | cmd->num_noa = 1; |
| 2894 | |
| 2895 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 2896 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 2897 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 2898 | sizeof |
| 2899 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 2900 | + WMI_TLV_HDR_SIZE); |
| 2901 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 2902 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 2903 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 2904 | noa_discriptor->type_count = noa->count; |
| 2905 | noa_discriptor->duration = duration; |
| 2906 | noa_discriptor->interval = noa->interval; |
| 2907 | noa_discriptor->start_time = 0; |
| 2908 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2909 | 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] | 2910 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 2911 | noa->interval); |
| 2912 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2913 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2914 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2915 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2916 | wmi_buf_free(buf); |
| 2917 | } |
| 2918 | |
| 2919 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2920 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2921 | return status; |
| 2922 | } |
| 2923 | |
| 2924 | |
| 2925 | /** |
| 2926 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 2927 | * @wmi_handle: wmi handle |
| 2928 | * @noa: p2p opp power save parameters |
| 2929 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 2930 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2931 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2932 | 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] | 2933 | struct p2p_ps_params *oppps) |
| 2934 | { |
| 2935 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 2936 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2937 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2938 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2939 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2940 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 2941 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2942 | WMI_LOGE("Failed to allocate memory"); |
| 2943 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2944 | goto end; |
| 2945 | } |
| 2946 | |
| 2947 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 2948 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2949 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 2950 | WMITLV_GET_STRUCT_TLVLEN |
| 2951 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 2952 | cmd->vdev_id = oppps->session_id; |
| 2953 | if (oppps->ctwindow) |
| 2954 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 2955 | |
| 2956 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2957 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2958 | cmd->vdev_id, oppps->ctwindow); |
| 2959 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 2960 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2961 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2962 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2963 | wmi_buf_free(buf); |
| 2964 | } |
| 2965 | |
| 2966 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2967 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2968 | return status; |
| 2969 | } |
| 2970 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 2971 | #ifdef CONVERGED_P2P_ENABLE |
| 2972 | /** |
| 2973 | * send_p2p_lo_start_cmd_tlv() - send p2p lo start request to fw |
| 2974 | * @wmi_handle: wmi handle |
| 2975 | * @param: p2p listen offload start parameters |
| 2976 | * |
| 2977 | * Return: QDF status |
| 2978 | */ |
| 2979 | static QDF_STATUS send_p2p_lo_start_cmd_tlv(wmi_unified_t wmi_handle, |
| 2980 | struct p2p_lo_start *param) |
| 2981 | { |
| 2982 | wmi_buf_t buf; |
| 2983 | wmi_p2p_lo_start_cmd_fixed_param *cmd; |
| 2984 | int32_t len = sizeof(*cmd); |
| 2985 | uint8_t *buf_ptr; |
| 2986 | QDF_STATUS status; |
| 2987 | int device_types_len_aligned; |
| 2988 | int probe_resp_len_aligned; |
| 2989 | |
| 2990 | if (!param) { |
| 2991 | WMI_LOGE("lo start param is null"); |
| 2992 | return QDF_STATUS_E_INVAL; |
| 2993 | } |
| 2994 | |
| 2995 | WMI_LOGD("%s: vdev_id:%d", __func__, param->vdev_id); |
| 2996 | |
| 2997 | device_types_len_aligned = |
| 2998 | qdf_roundup(param->dev_types_len, |
| 2999 | sizeof(A_UINT32)); |
| 3000 | probe_resp_len_aligned = |
| 3001 | qdf_roundup(param->probe_resp_len, |
| 3002 | sizeof(A_UINT32)); |
| 3003 | |
| 3004 | len += 2 * WMI_TLV_HDR_SIZE + device_types_len_aligned + |
| 3005 | probe_resp_len_aligned; |
| 3006 | |
| 3007 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3008 | if (!buf) { |
| 3009 | WMI_LOGE("%s: Failed to allocate memory for p2p lo start", |
| 3010 | __func__); |
| 3011 | return QDF_STATUS_E_NOMEM; |
| 3012 | } |
| 3013 | |
| 3014 | cmd = (wmi_p2p_lo_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 3015 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3016 | |
| 3017 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3018 | WMITLV_TAG_STRUC_wmi_p2p_lo_start_cmd_fixed_param, |
| 3019 | WMITLV_GET_STRUCT_TLVLEN( |
| 3020 | wmi_p2p_lo_start_cmd_fixed_param)); |
| 3021 | |
| 3022 | cmd->vdev_id = param->vdev_id; |
| 3023 | cmd->ctl_flags = param->ctl_flags; |
| 3024 | cmd->channel = param->freq; |
| 3025 | cmd->period = param->period; |
| 3026 | cmd->interval = param->interval; |
| 3027 | cmd->count = param->count; |
| 3028 | cmd->device_types_len = param->dev_types_len; |
| 3029 | cmd->prob_resp_len = param->probe_resp_len; |
| 3030 | |
| 3031 | buf_ptr += sizeof(wmi_p2p_lo_start_cmd_fixed_param); |
| 3032 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3033 | device_types_len_aligned); |
| 3034 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3035 | qdf_mem_copy(buf_ptr, param->device_types, |
| 3036 | param->dev_types_len); |
| 3037 | |
| 3038 | buf_ptr += device_types_len_aligned; |
| 3039 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3040 | probe_resp_len_aligned); |
| 3041 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3042 | qdf_mem_copy(buf_ptr, param->probe_resp_tmplt, |
| 3043 | param->probe_resp_len); |
| 3044 | |
| 3045 | WMI_LOGD("%s: Sending WMI_P2P_LO_START command, channel=%d, period=%d, interval=%d, count=%d", __func__, |
| 3046 | cmd->channel, cmd->period, cmd->interval, cmd->count); |
| 3047 | |
| 3048 | status = wmi_unified_cmd_send(wmi_handle, |
| 3049 | buf, len, |
| 3050 | WMI_P2P_LISTEN_OFFLOAD_START_CMDID); |
| 3051 | if (status != QDF_STATUS_SUCCESS) { |
| 3052 | WMI_LOGE("%s: Failed to send p2p lo start: %d", |
| 3053 | __func__, status); |
| 3054 | wmi_buf_free(buf); |
| 3055 | return status; |
| 3056 | } |
| 3057 | |
| 3058 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_START", __func__); |
| 3059 | |
| 3060 | return QDF_STATUS_SUCCESS; |
| 3061 | } |
| 3062 | |
| 3063 | /** |
| 3064 | * send_p2p_lo_stop_cmd_tlv() - send p2p lo stop request to fw |
| 3065 | * @wmi_handle: wmi handle |
| 3066 | * @param: p2p listen offload stop parameters |
| 3067 | * |
| 3068 | * Return: QDF status |
| 3069 | */ |
| 3070 | static QDF_STATUS send_p2p_lo_stop_cmd_tlv(wmi_unified_t wmi_handle, |
| 3071 | uint8_t vdev_id) |
| 3072 | { |
| 3073 | wmi_buf_t buf; |
| 3074 | wmi_p2p_lo_stop_cmd_fixed_param *cmd; |
| 3075 | int32_t len; |
| 3076 | QDF_STATUS status; |
| 3077 | |
| 3078 | WMI_LOGD("%s: vdev_id:%d", __func__, vdev_id); |
| 3079 | |
| 3080 | len = sizeof(*cmd); |
| 3081 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3082 | if (!buf) { |
| 3083 | qdf_print("%s: Failed to allocate memory for p2p lo stop", |
| 3084 | __func__); |
| 3085 | return QDF_STATUS_E_NOMEM; |
| 3086 | } |
| 3087 | cmd = (wmi_p2p_lo_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 3088 | |
| 3089 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3090 | WMITLV_TAG_STRUC_wmi_p2p_lo_stop_cmd_fixed_param, |
| 3091 | WMITLV_GET_STRUCT_TLVLEN( |
| 3092 | wmi_p2p_lo_stop_cmd_fixed_param)); |
| 3093 | |
| 3094 | cmd->vdev_id = vdev_id; |
| 3095 | |
| 3096 | WMI_LOGD("%s: Sending WMI_P2P_LO_STOP command", __func__); |
| 3097 | |
| 3098 | status = wmi_unified_cmd_send(wmi_handle, |
| 3099 | buf, len, |
| 3100 | WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID); |
| 3101 | if (status != QDF_STATUS_SUCCESS) { |
| 3102 | WMI_LOGE("%s: Failed to send p2p lo stop: %d", |
| 3103 | __func__, status); |
| 3104 | wmi_buf_free(buf); |
| 3105 | return status; |
| 3106 | } |
| 3107 | |
| 3108 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_STOP", __func__); |
| 3109 | |
| 3110 | return QDF_STATUS_SUCCESS; |
| 3111 | } |
| 3112 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 3113 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3114 | /** |
| 3115 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 3116 | * @wmi_handle: wmi handle |
| 3117 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3118 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3119 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3120 | 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] | 3121 | { |
| 3122 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 3123 | wmi_buf_t wmi_buf; |
| 3124 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 3125 | uint8_t *buf_ptr; |
| 3126 | |
| 3127 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3128 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 3129 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3130 | } |
| 3131 | |
| 3132 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 3133 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3134 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3135 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3136 | } |
| 3137 | |
| 3138 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3139 | |
| 3140 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 3141 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3142 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 3143 | WMITLV_GET_STRUCT_TLVLEN |
| 3144 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 3145 | |
| 3146 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 3147 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3148 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3149 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3150 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3151 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3152 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3153 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3154 | } |
| 3155 | |
| 3156 | /** |
| 3157 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 3158 | * @wmi_handle: wmi handle |
| 3159 | * @vdevid: vdev id |
| 3160 | * @peer_addr: peer mac address |
| 3161 | * @auto_triggerparam: auto trigger parameters |
| 3162 | * @num_ac: number of access category |
| 3163 | * |
| 3164 | * This function sets the trigger |
| 3165 | * uapsd params such as service interval, delay interval |
| 3166 | * and suspend interval which will be used by the firmware |
| 3167 | * to send trigger frames periodically when there is no |
| 3168 | * traffic on the transmit side. |
| 3169 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3170 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3171 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3172 | 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] | 3173 | struct sta_uapsd_trig_params *param) |
| 3174 | { |
| 3175 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3176 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3177 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 3178 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 3179 | uint32_t i; |
| 3180 | wmi_buf_t buf; |
| 3181 | uint8_t *buf_ptr; |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3182 | struct sta_uapsd_params *uapsd_param; |
| 3183 | wmi_sta_uapsd_auto_trig_param *trig_param; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3184 | |
| 3185 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 3186 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3187 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3188 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3189 | } |
| 3190 | |
| 3191 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3192 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 3193 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3194 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 3195 | WMITLV_GET_STRUCT_TLVLEN |
| 3196 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 3197 | cmd->vdev_id = param->vdevid; |
| 3198 | cmd->num_ac = param->num_ac; |
| 3199 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 3200 | |
| 3201 | /* TLV indicating array of structures to follow */ |
| 3202 | buf_ptr += sizeof(*cmd); |
| 3203 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 3204 | |
| 3205 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3206 | |
| 3207 | /* |
| 3208 | * Update tag and length for uapsd auto trigger params (this will take |
| 3209 | * care of updating tag and length if it is not pre-filled by caller). |
| 3210 | */ |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3211 | uapsd_param = (struct sta_uapsd_params *)param->auto_triggerparam; |
| 3212 | trig_param = (wmi_sta_uapsd_auto_trig_param *)buf_ptr; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3213 | for (i = 0; i < param->num_ac; i++) { |
| 3214 | WMITLV_SET_HDR((buf_ptr + |
| 3215 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 3216 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 3217 | WMITLV_GET_STRUCT_TLVLEN |
| 3218 | (wmi_sta_uapsd_auto_trig_param)); |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3219 | trig_param->wmm_ac = uapsd_param->wmm_ac; |
| 3220 | trig_param->user_priority = uapsd_param->user_priority; |
| 3221 | trig_param->service_interval = uapsd_param->service_interval; |
| 3222 | trig_param->suspend_interval = uapsd_param->suspend_interval; |
| 3223 | trig_param->delay_interval = uapsd_param->delay_interval; |
| 3224 | trig_param++; |
| 3225 | uapsd_param++; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3226 | } |
| 3227 | |
| 3228 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3229 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3230 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3231 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3232 | wmi_buf_free(buf); |
| 3233 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3234 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3235 | return ret; |
| 3236 | } |
| 3237 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3238 | /** |
| 3239 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 3240 | * @wmi_handle: pointer to the wmi handle |
| 3241 | * @utc: pointer to the UTC time struct |
| 3242 | * |
| 3243 | * Return: 0 on succes |
| 3244 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3245 | 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] | 3246 | struct ocb_utc_param *utc) |
| 3247 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3248 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3249 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 3250 | uint8_t *buf_ptr; |
| 3251 | uint32_t len, i; |
| 3252 | wmi_buf_t buf; |
| 3253 | |
| 3254 | len = sizeof(*cmd); |
| 3255 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3256 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3257 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3258 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3259 | } |
| 3260 | |
| 3261 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3262 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 3263 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3264 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 3265 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 3266 | cmd->vdev_id = utc->vdev_id; |
| 3267 | |
| 3268 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 3269 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 3270 | |
| 3271 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 3272 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 3273 | |
| 3274 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3275 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3276 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3277 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3278 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3279 | } |
| 3280 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3281 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3282 | } |
| 3283 | |
| 3284 | /** |
| 3285 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 3286 | * frames on a channel |
| 3287 | * @wmi_handle: pointer to the wmi handle |
| 3288 | * @timing_advert: pointer to the timing advertisement struct |
| 3289 | * |
| 3290 | * Return: 0 on succes |
| 3291 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3292 | 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] | 3293 | struct ocb_timing_advert_param *timing_advert) |
| 3294 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3295 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3296 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 3297 | uint8_t *buf_ptr; |
| 3298 | uint32_t len, len_template; |
| 3299 | wmi_buf_t buf; |
| 3300 | |
| 3301 | len = sizeof(*cmd) + |
| 3302 | WMI_TLV_HDR_SIZE; |
| 3303 | |
| 3304 | len_template = timing_advert->template_length; |
| 3305 | /* Add padding to the template if needed */ |
| 3306 | if (len_template % 4 != 0) |
| 3307 | len_template += 4 - (len_template % 4); |
| 3308 | len += len_template; |
| 3309 | |
| 3310 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3311 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3312 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3313 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3314 | } |
| 3315 | |
| 3316 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3317 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3318 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3319 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 3320 | WMITLV_GET_STRUCT_TLVLEN( |
| 3321 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 3322 | cmd->vdev_id = timing_advert->vdev_id; |
| 3323 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 3324 | cmd->channel_freq = timing_advert->chan_freq; |
| 3325 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 3326 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 3327 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 3328 | buf_ptr += sizeof(*cmd); |
| 3329 | |
| 3330 | /* Add the timing advert template */ |
| 3331 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3332 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3333 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3334 | (uint8_t *)timing_advert->template_value, |
| 3335 | timing_advert->template_length); |
| 3336 | |
| 3337 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3338 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3339 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3340 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3341 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3342 | } |
| 3343 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3344 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3345 | } |
| 3346 | |
| 3347 | /** |
| 3348 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 3349 | * on a channel |
| 3350 | * @wmi_handle: pointer to the wmi handle |
| 3351 | * @timing_advert: pointer to the timing advertisement struct |
| 3352 | * |
| 3353 | * Return: 0 on succes |
| 3354 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3355 | 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] | 3356 | struct ocb_timing_advert_param *timing_advert) |
| 3357 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3358 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3359 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 3360 | uint8_t *buf_ptr; |
| 3361 | uint32_t len; |
| 3362 | wmi_buf_t buf; |
| 3363 | |
| 3364 | len = sizeof(*cmd); |
| 3365 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3366 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3367 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3368 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3369 | } |
| 3370 | |
| 3371 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3372 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3373 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3374 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 3375 | WMITLV_GET_STRUCT_TLVLEN( |
| 3376 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 3377 | cmd->vdev_id = timing_advert->vdev_id; |
| 3378 | cmd->channel_freq = timing_advert->chan_freq; |
| 3379 | |
| 3380 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3381 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3382 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3383 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3384 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3385 | } |
| 3386 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3387 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3388 | } |
| 3389 | |
| 3390 | /** |
| 3391 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 3392 | * @wmi_handle: pointer to the wmi handle |
| 3393 | * @request: pointer to the request |
| 3394 | * |
| 3395 | * Return: 0 on succes |
| 3396 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3397 | 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] | 3398 | uint8_t vdev_id) |
| 3399 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3400 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3401 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 3402 | uint8_t *buf_ptr; |
| 3403 | wmi_buf_t buf; |
| 3404 | int32_t len; |
| 3405 | |
| 3406 | len = sizeof(*cmd); |
| 3407 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3408 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3409 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3410 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3411 | } |
| 3412 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3413 | |
| 3414 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3415 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3416 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3417 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 3418 | WMITLV_GET_STRUCT_TLVLEN( |
| 3419 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 3420 | cmd->vdev_id = vdev_id; |
| 3421 | |
| 3422 | /* Send the WMI command */ |
| 3423 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3424 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 3425 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3426 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3427 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3428 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3429 | } |
| 3430 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3431 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3432 | } |
| 3433 | |
| 3434 | /** |
| 3435 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 3436 | * @wmi_handle: pointer to the wmi handle |
| 3437 | * @get_stats_param: pointer to the dcc stats |
| 3438 | * |
| 3439 | * Return: 0 on succes |
| 3440 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3441 | 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] | 3442 | struct dcc_get_stats_param *get_stats_param) |
| 3443 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3444 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3445 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 3446 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 3447 | wmi_buf_t buf; |
| 3448 | uint8_t *buf_ptr; |
| 3449 | uint32_t len; |
| 3450 | uint32_t i; |
| 3451 | |
| 3452 | /* Validate the input */ |
| 3453 | if (get_stats_param->request_array_len != |
| 3454 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3455 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3456 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3457 | } |
| 3458 | |
| 3459 | /* Allocate memory for the WMI command */ |
| 3460 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 3461 | get_stats_param->request_array_len; |
| 3462 | |
| 3463 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3464 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3465 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3466 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3467 | } |
| 3468 | |
| 3469 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3470 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3471 | |
| 3472 | /* Populate the WMI command */ |
| 3473 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 3474 | buf_ptr += sizeof(*cmd); |
| 3475 | |
| 3476 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3477 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 3478 | WMITLV_GET_STRUCT_TLVLEN( |
| 3479 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 3480 | cmd->vdev_id = get_stats_param->vdev_id; |
| 3481 | cmd->num_channels = get_stats_param->channel_count; |
| 3482 | |
| 3483 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3484 | get_stats_param->request_array_len); |
| 3485 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3486 | |
| 3487 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3488 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3489 | get_stats_param->request_array_len); |
| 3490 | for (i = 0; i < cmd->num_channels; i++) |
| 3491 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 3492 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 3493 | WMITLV_GET_STRUCT_TLVLEN( |
| 3494 | wmi_dcc_channel_stats_request)); |
| 3495 | |
| 3496 | /* Send the WMI command */ |
| 3497 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3498 | WMI_DCC_GET_STATS_CMDID); |
| 3499 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3500 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3501 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3502 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3503 | } |
| 3504 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3505 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3506 | } |
| 3507 | |
| 3508 | /** |
| 3509 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 3510 | * @wmi_handle: pointer to the wmi handle |
| 3511 | * @vdev_id: vdev id |
| 3512 | * @dcc_stats_bitmap: dcc status bitmap |
| 3513 | * |
| 3514 | * Return: 0 on succes |
| 3515 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3516 | 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] | 3517 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 3518 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3519 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3520 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 3521 | wmi_buf_t buf; |
| 3522 | uint8_t *buf_ptr; |
| 3523 | uint32_t len; |
| 3524 | |
| 3525 | /* Allocate memory for the WMI command */ |
| 3526 | len = sizeof(*cmd); |
| 3527 | |
| 3528 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3529 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3530 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3531 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3532 | } |
| 3533 | |
| 3534 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3535 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3536 | |
| 3537 | /* Populate the WMI command */ |
| 3538 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 3539 | |
| 3540 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3541 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 3542 | WMITLV_GET_STRUCT_TLVLEN( |
| 3543 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 3544 | cmd->vdev_id = vdev_id; |
| 3545 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 3546 | |
| 3547 | /* Send the WMI command */ |
| 3548 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3549 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3550 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3551 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3552 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3553 | } |
| 3554 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3555 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3556 | } |
| 3557 | |
| 3558 | /** |
| 3559 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 3560 | * @wmi_handle: pointer to the wmi handle |
| 3561 | * @update_ndl_param: pointer to the request parameters |
| 3562 | * |
| 3563 | * Return: 0 on success |
| 3564 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3565 | 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] | 3566 | struct dcc_update_ndl_param *update_ndl_param) |
| 3567 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3568 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3569 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 3570 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 3571 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 3572 | uint32_t active_state_count; |
| 3573 | wmi_buf_t buf; |
| 3574 | uint8_t *buf_ptr; |
| 3575 | uint32_t len; |
| 3576 | uint32_t i; |
| 3577 | |
| 3578 | /* validate the input */ |
| 3579 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 3580 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3581 | WMI_LOGE(FL("Invalid parameter")); |
| 3582 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3583 | } |
| 3584 | active_state_count = 0; |
| 3585 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 3586 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 3587 | active_state_count += |
| 3588 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 3589 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 3590 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3591 | WMI_LOGE(FL("Invalid parameter")); |
| 3592 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3593 | } |
| 3594 | |
| 3595 | /* Allocate memory for the WMI command */ |
| 3596 | len = sizeof(*cmd) + |
| 3597 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 3598 | WMI_TLV_HDR_SIZE + |
| 3599 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 3600 | |
| 3601 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3602 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3603 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3604 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3605 | } |
| 3606 | |
| 3607 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3608 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3609 | |
| 3610 | /* Populate the WMI command */ |
| 3611 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3612 | buf_ptr += sizeof(*cmd); |
| 3613 | |
| 3614 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3615 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3616 | WMITLV_GET_STRUCT_TLVLEN( |
| 3617 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3618 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3619 | cmd->num_channel = update_ndl_param->channel_count; |
| 3620 | |
| 3621 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3622 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3623 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3624 | |
| 3625 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3626 | 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] | 3627 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3628 | for (i = 0; i < cmd->num_channel; i++) |
| 3629 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3630 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3631 | WMITLV_GET_STRUCT_TLVLEN( |
| 3632 | wmi_dcc_ndl_chan)); |
| 3633 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3634 | |
| 3635 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3636 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3637 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3638 | |
| 3639 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3640 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3641 | update_ndl_param->dcc_ndl_active_state_list, |
| 3642 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3643 | for (i = 0; i < active_state_count; i++) { |
| 3644 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3645 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3646 | WMITLV_GET_STRUCT_TLVLEN( |
| 3647 | wmi_dcc_ndl_active_state_config)); |
| 3648 | } |
| 3649 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3650 | |
| 3651 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3652 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3653 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3654 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3655 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3656 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3657 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3658 | } |
| 3659 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3660 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3661 | } |
| 3662 | |
| 3663 | /** |
| 3664 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3665 | * @wmi_handle: pointer to the wmi handle |
| 3666 | * @config: the OCB configuration |
| 3667 | * |
| 3668 | * Return: 0 on success |
| 3669 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3670 | 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] | 3671 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3672 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3673 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3674 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3675 | wmi_channel *chan; |
| 3676 | wmi_ocb_channel *ocb_chan; |
| 3677 | wmi_qos_parameter *qos_param; |
| 3678 | wmi_dcc_ndl_chan *ndl_chan; |
| 3679 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3680 | wmi_ocb_schedule_element *sched_elem; |
| 3681 | uint8_t *buf_ptr; |
| 3682 | wmi_buf_t buf; |
| 3683 | int32_t len; |
| 3684 | int32_t i, j, active_state_count; |
| 3685 | |
| 3686 | /* |
| 3687 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3688 | * states. Validate dcc_ndl_active_state_list_len. |
| 3689 | */ |
| 3690 | active_state_count = 0; |
| 3691 | if (config->dcc_ndl_chan_list_len) { |
| 3692 | if (!config->dcc_ndl_chan_list || |
| 3693 | config->dcc_ndl_chan_list_len != |
| 3694 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3695 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3696 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3697 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3698 | } |
| 3699 | |
| 3700 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3701 | i < config->channel_count; ++i, ++ndl_chan) |
| 3702 | active_state_count += |
| 3703 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3704 | |
| 3705 | if (active_state_count) { |
| 3706 | if (!config->dcc_ndl_active_state_list || |
| 3707 | config->dcc_ndl_active_state_list_len != |
| 3708 | active_state_count * |
| 3709 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3710 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3711 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3712 | } |
| 3713 | } |
| 3714 | } |
| 3715 | |
| 3716 | len = sizeof(*cmd) + |
| 3717 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3718 | sizeof(wmi_channel) + |
| 3719 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3720 | sizeof(wmi_ocb_channel) + |
| 3721 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3722 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3723 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3724 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3725 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3726 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3727 | sizeof(wmi_ocb_schedule_element); |
| 3728 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3729 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3730 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3731 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3732 | } |
| 3733 | |
| 3734 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3735 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3736 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3737 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3738 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3739 | cmd->vdev_id = config->session_id; |
| 3740 | cmd->channel_count = config->channel_count; |
| 3741 | cmd->schedule_size = config->schedule_size; |
| 3742 | cmd->flags = config->flags; |
| 3743 | buf_ptr += sizeof(*cmd); |
| 3744 | |
| 3745 | /* Add the wmi_channel info */ |
| 3746 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3747 | config->channel_count*sizeof(wmi_channel)); |
| 3748 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3749 | for (i = 0; i < config->channel_count; i++) { |
| 3750 | chan = (wmi_channel *)buf_ptr; |
| 3751 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3752 | WMITLV_TAG_STRUC_wmi_channel, |
| 3753 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3754 | chan->mhz = config->channels[i].chan_freq; |
| 3755 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3756 | chan->band_center_freq2 = 0; |
| 3757 | chan->info = 0; |
| 3758 | |
| 3759 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3760 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3761 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3762 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3763 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3764 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3765 | config->channels[i].antenna_max); |
| 3766 | |
| 3767 | if (config->channels[i].bandwidth < 10) |
| 3768 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3769 | else if (config->channels[i].bandwidth < 20) |
| 3770 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3771 | buf_ptr += sizeof(*chan); |
| 3772 | } |
| 3773 | |
| 3774 | /* Add the wmi_ocb_channel info */ |
| 3775 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3776 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3777 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3778 | for (i = 0; i < config->channel_count; i++) { |
| 3779 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3780 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3781 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 3782 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 3783 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 3784 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 3785 | config->channels[i].mac_address.bytes, |
| 3786 | &ocb_chan->mac_address); |
| 3787 | buf_ptr += sizeof(*ocb_chan); |
| 3788 | } |
| 3789 | |
| 3790 | /* Add the wmi_qos_parameter info */ |
| 3791 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3792 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 3793 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3794 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 3795 | for (i = 0; i < config->channel_count; i++) { |
| 3796 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 3797 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 3798 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 3799 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 3800 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 3801 | qos_param->aifsn = |
| 3802 | config->channels[i].qos_params[j].aifsn; |
| 3803 | qos_param->cwmin = |
| 3804 | config->channels[i].qos_params[j].cwmin; |
| 3805 | qos_param->cwmax = |
| 3806 | config->channels[i].qos_params[j].cwmax; |
| 3807 | buf_ptr += sizeof(*qos_param); |
| 3808 | } |
| 3809 | } |
| 3810 | |
| 3811 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 3812 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3813 | config->dcc_ndl_chan_list_len); |
| 3814 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3815 | if (config->dcc_ndl_chan_list_len) { |
| 3816 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3817 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3818 | config->dcc_ndl_chan_list_len); |
| 3819 | for (i = 0; i < config->channel_count; i++) |
| 3820 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 3821 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3822 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 3823 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 3824 | } |
| 3825 | |
| 3826 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 3827 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 3828 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 3829 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3830 | if (active_state_count) { |
| 3831 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3832 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3833 | config->dcc_ndl_active_state_list, |
| 3834 | active_state_count * sizeof(*ndl_active_config)); |
| 3835 | for (i = 0; i < active_state_count; ++i) |
| 3836 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 3837 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3838 | WMITLV_GET_STRUCT_TLVLEN( |
| 3839 | wmi_dcc_ndl_active_state_config)); |
| 3840 | buf_ptr += active_state_count * |
| 3841 | sizeof(*ndl_active_config); |
| 3842 | } |
| 3843 | |
| 3844 | /* Add the wmi_ocb_schedule_element info */ |
| 3845 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3846 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 3847 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3848 | for (i = 0; i < config->schedule_size; i++) { |
| 3849 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 3850 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 3851 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 3852 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 3853 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 3854 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 3855 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 3856 | buf_ptr += sizeof(*sched_elem); |
| 3857 | } |
| 3858 | |
| 3859 | |
| 3860 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3861 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3862 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3863 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3864 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3865 | } |
| 3866 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3867 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3868 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3869 | |
| 3870 | /** |
| 3871 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 3872 | * @wmi_handle: wmi handle |
| 3873 | * @mcc_adaptive_scheduler: enable/disable |
| 3874 | * |
| 3875 | * This function enable/disable mcc adaptive scheduler in fw. |
| 3876 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3877 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3878 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3879 | static QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 3880 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 3881 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3882 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3883 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3884 | wmi_buf_t buf = 0; |
| 3885 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 3886 | uint16_t len = |
| 3887 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 3888 | |
| 3889 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3890 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3891 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 3892 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3893 | } |
| 3894 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 3895 | wmi_buf_data(buf); |
| 3896 | |
| 3897 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3898 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 3899 | WMITLV_GET_STRUCT_TLVLEN |
| 3900 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 3901 | cmd->enable = mcc_adaptive_scheduler; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 3902 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3903 | |
| 3904 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3905 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3906 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3907 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3908 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3909 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3910 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3911 | |
| 3912 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3913 | } |
| 3914 | |
| 3915 | /** |
| 3916 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 3917 | * @wmi: wmi handle |
| 3918 | * @mcc_channel: mcc channel |
| 3919 | * @mcc_channel_time_latency: MCC channel time latency. |
| 3920 | * |
| 3921 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 3922 | * channel of it and channel number. The info is provided run time using |
| 3923 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 3924 | * |
| 3925 | * Return: CDF status |
| 3926 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3927 | 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] | 3928 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 3929 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3930 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3931 | wmi_buf_t buf = 0; |
| 3932 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 3933 | uint16_t len = 0; |
| 3934 | uint8_t *buf_ptr = NULL; |
| 3935 | wmi_resmgr_chan_latency chan_latency; |
| 3936 | /* Note: we only support MCC time latency for a single channel */ |
| 3937 | uint32_t num_channels = 1; |
| 3938 | uint32_t chan1_freq = mcc_channel_freq; |
| 3939 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 3940 | |
| 3941 | |
| 3942 | /* If 0ms latency is provided, then FW will set to a default. |
| 3943 | * Otherwise, latency must be at least 30ms. |
| 3944 | */ |
| 3945 | if ((latency_chan1 > 0) && |
| 3946 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3947 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3948 | "Minimum is 30ms (or 0 to use default value by " |
| 3949 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3950 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3951 | } |
| 3952 | |
| 3953 | /* Set WMI CMD for channel time latency here */ |
| 3954 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 3955 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 3956 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 3957 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3958 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3959 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 3960 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3961 | } |
| 3962 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3963 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 3964 | wmi_buf_data(buf); |
| 3965 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 3966 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 3967 | WMITLV_GET_STRUCT_TLVLEN |
| 3968 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 3969 | cmdTL->num_chans = num_channels; |
| 3970 | /* Update channel time latency information for home channel(s) */ |
| 3971 | buf_ptr += sizeof(*cmdTL); |
| 3972 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3973 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 3974 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3975 | chan_latency.chan_mhz = chan1_freq; |
| 3976 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3977 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3978 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3979 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3980 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3981 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3982 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 3983 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3984 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3985 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3986 | |
| 3987 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3988 | } |
| 3989 | |
| 3990 | /** |
| 3991 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 3992 | * @wmi: wmi handle |
| 3993 | * @adapter_1_chan_number: adapter 1 channel number |
| 3994 | * @adapter_1_quota: adapter 1 quota |
| 3995 | * @adapter_2_chan_number: adapter 2 channel number |
| 3996 | * |
| 3997 | * Return: CDF status |
| 3998 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3999 | 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] | 4000 | uint32_t adapter_1_chan_freq, |
| 4001 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 4002 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4003 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4004 | wmi_buf_t buf = 0; |
| 4005 | uint16_t len = 0; |
| 4006 | uint8_t *buf_ptr = NULL; |
| 4007 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 4008 | wmi_resmgr_chan_time_quota chan_quota; |
| 4009 | uint32_t quota_chan1 = adapter_1_quota; |
| 4010 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 4011 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 4012 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 4013 | uint32_t num_channels = 2; |
| 4014 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 4015 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 4016 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4017 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4018 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 4019 | chan1_freq, quota_chan1, chan2_freq, |
| 4020 | quota_chan2); |
| 4021 | |
| 4022 | /* |
| 4023 | * Perform sanity check on time quota values provided. |
| 4024 | */ |
| 4025 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 4026 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4027 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4028 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4029 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4030 | } |
| 4031 | /* Set WMI CMD for channel time quota here */ |
| 4032 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 4033 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 4034 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 4035 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4036 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4037 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 4038 | QDF_ASSERT(0); |
| 4039 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4040 | } |
| 4041 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4042 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 4043 | wmi_buf_data(buf); |
| 4044 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 4045 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 4046 | WMITLV_GET_STRUCT_TLVLEN |
| 4047 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 4048 | cmdTQ->num_chans = num_channels; |
| 4049 | |
| 4050 | /* Update channel time quota information for home channel(s) */ |
| 4051 | buf_ptr += sizeof(*cmdTQ); |
| 4052 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4053 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 4054 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4055 | chan_quota.chan_mhz = chan1_freq; |
| 4056 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4057 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4058 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 4059 | buf_ptr += sizeof(chan_quota); |
| 4060 | chan_quota.chan_mhz = chan2_freq; |
| 4061 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4062 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4063 | |
| 4064 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4065 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4066 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4067 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4068 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4069 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4070 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4071 | |
| 4072 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4073 | } |
| 4074 | |
| 4075 | /** |
| 4076 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 4077 | * @wmi_handle: Pointer to wmi handle |
| 4078 | * @thermal_info: Thermal command information |
| 4079 | * |
| 4080 | * This function sends the thermal management command |
| 4081 | * to the firmware |
| 4082 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4083 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4084 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4085 | 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] | 4086 | struct thermal_cmd_params *thermal_info) |
| 4087 | { |
| 4088 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 4089 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4090 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4091 | uint32_t len = 0; |
| 4092 | |
| 4093 | len = sizeof(*cmd); |
| 4094 | |
| 4095 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4096 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4097 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4098 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4099 | } |
| 4100 | |
| 4101 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 4102 | |
| 4103 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4104 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 4105 | WMITLV_GET_STRUCT_TLVLEN |
| 4106 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 4107 | |
| 4108 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 4109 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 4110 | cmd->enable = thermal_info->thermal_enable; |
| 4111 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4112 | 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] | 4113 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 4114 | |
| 4115 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4116 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4117 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4118 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4119 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4120 | } |
| 4121 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4122 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4123 | } |
| 4124 | |
| 4125 | |
| 4126 | /** |
| 4127 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4128 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4129 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 4130 | * |
| 4131 | * This function sends down the LRO configuration parameters to |
| 4132 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 4133 | * seed values for the toeplitz hash generation |
| 4134 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4135 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4136 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4137 | 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] | 4138 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 4139 | { |
| 4140 | wmi_lro_info_cmd_fixed_param *cmd; |
| 4141 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4142 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4143 | |
| 4144 | |
| 4145 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4146 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4147 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4148 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4149 | } |
| 4150 | |
| 4151 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 4152 | |
| 4153 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4154 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 4155 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 4156 | |
| 4157 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 4158 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 4159 | wmi_lro_cmd->tcp_flag); |
| 4160 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 4161 | wmi_lro_cmd->tcp_flag_mask); |
| 4162 | cmd->toeplitz_hash_ipv4_0_3 = |
| 4163 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 4164 | cmd->toeplitz_hash_ipv4_4_7 = |
| 4165 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 4166 | cmd->toeplitz_hash_ipv4_8_11 = |
| 4167 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 4168 | cmd->toeplitz_hash_ipv4_12_15 = |
| 4169 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 4170 | cmd->toeplitz_hash_ipv4_16 = |
| 4171 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 4172 | |
| 4173 | cmd->toeplitz_hash_ipv6_0_3 = |
| 4174 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 4175 | cmd->toeplitz_hash_ipv6_4_7 = |
| 4176 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 4177 | cmd->toeplitz_hash_ipv6_8_11 = |
| 4178 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 4179 | cmd->toeplitz_hash_ipv6_12_15 = |
| 4180 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 4181 | cmd->toeplitz_hash_ipv6_16_19 = |
| 4182 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 4183 | cmd->toeplitz_hash_ipv6_20_23 = |
| 4184 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 4185 | cmd->toeplitz_hash_ipv6_24_27 = |
| 4186 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 4187 | cmd->toeplitz_hash_ipv6_28_31 = |
| 4188 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 4189 | cmd->toeplitz_hash_ipv6_32_35 = |
| 4190 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 4191 | cmd->toeplitz_hash_ipv6_36_39 = |
| 4192 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 4193 | cmd->toeplitz_hash_ipv6_40 = |
| 4194 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 4195 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4196 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4197 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 4198 | |
| 4199 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4200 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4201 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4202 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4203 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4204 | } |
| 4205 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4206 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4207 | } |
| 4208 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4209 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4210 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 4211 | * @wmi_handle: Pointer to wmi handle |
| 4212 | * @rate_report_params: Pointer to peer rate report parameters |
| 4213 | * |
| 4214 | * |
| 4215 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 4216 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4217 | 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] | 4218 | struct wmi_peer_rate_report_params *rate_report_params) |
| 4219 | { |
| 4220 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 4221 | wmi_buf_t buf = NULL; |
| 4222 | QDF_STATUS status = 0; |
| 4223 | uint32_t len = 0; |
| 4224 | uint32_t i, j; |
| 4225 | |
| 4226 | len = sizeof(*cmd); |
| 4227 | |
| 4228 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4229 | if (!buf) { |
| 4230 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 4231 | return QDF_STATUS_E_FAILURE; |
| 4232 | } |
| 4233 | |
| 4234 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 4235 | wmi_buf_data(buf); |
| 4236 | |
| 4237 | WMITLV_SET_HDR( |
| 4238 | &cmd->tlv_header, |
| 4239 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 4240 | WMITLV_GET_STRUCT_TLVLEN( |
| 4241 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 4242 | |
| 4243 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 4244 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 4245 | cmd->report_timer_period = rate_report_params->timer_period; |
| 4246 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 4247 | cmd->cond_per_phy[i].val_cond_flags = |
| 4248 | rate_report_params->report_per_phy[i].cond_flags; |
| 4249 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 4250 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 4251 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 4252 | rate_report_params->report_per_phy[i].delta.percent; |
| 4253 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 4254 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 4255 | rate_report_params->report_per_phy[i]. |
| 4256 | report_rate_threshold[j]; |
| 4257 | } |
| 4258 | } |
| 4259 | |
| 4260 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 4261 | cmd->enable_rate_report, |
| 4262 | cmd->report_backoff_time, cmd->report_timer_period); |
| 4263 | |
| 4264 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4265 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 4266 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4267 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4268 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 4269 | __func__); |
| 4270 | } |
| 4271 | return status; |
| 4272 | } |
| 4273 | |
| 4274 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4275 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 4276 | * @wmi_handle: wmi handle |
| 4277 | * @param: bcn ll cmd parameter |
| 4278 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4279 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4280 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4281 | 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] | 4282 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 4283 | { |
| 4284 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 4285 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4286 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4287 | |
| 4288 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4289 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4290 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4291 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4292 | } |
| 4293 | |
| 4294 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 4295 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4296 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 4297 | WMITLV_GET_STRUCT_TLVLEN |
| 4298 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 4299 | cmd->vdev_id = param->vdev_id; |
| 4300 | cmd->data_len = param->data_len; |
| 4301 | cmd->frame_ctrl = param->frame_ctrl; |
| 4302 | cmd->frag_ptr = param->frag_ptr; |
| 4303 | cmd->dtim_flag = param->dtim_flag; |
| 4304 | |
| 4305 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 4306 | WMI_PDEV_SEND_BCN_CMDID); |
| 4307 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4308 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4309 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4310 | wmi_buf_free(wmi_buf); |
| 4311 | } |
| 4312 | |
| 4313 | return ret; |
| 4314 | } |
| 4315 | |
| 4316 | /** |
| 4317 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 4318 | * @wmi_handle: wmi handle |
| 4319 | * @vdev_id: vdev id |
| 4320 | * @max_retries: max retries |
| 4321 | * @retry_interval: retry interval |
| 4322 | * This function sets sta query related parameters in fw. |
| 4323 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4324 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4325 | */ |
| 4326 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4327 | 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] | 4328 | uint8_t vdev_id, uint32_t max_retries, |
| 4329 | uint32_t retry_interval) |
| 4330 | { |
| 4331 | wmi_buf_t buf; |
| 4332 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 4333 | int len; |
| 4334 | |
| 4335 | len = sizeof(*cmd); |
| 4336 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4337 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4338 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 4339 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4340 | } |
| 4341 | |
| 4342 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 4343 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4344 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 4345 | WMITLV_GET_STRUCT_TLVLEN |
| 4346 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 4347 | |
| 4348 | |
| 4349 | cmd->vdev_id = vdev_id; |
| 4350 | cmd->sa_query_max_retry_count = max_retries; |
| 4351 | cmd->sa_query_retry_interval = retry_interval; |
| 4352 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4353 | 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] | 4354 | vdev_id, retry_interval, max_retries); |
| 4355 | |
| 4356 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4357 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4358 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4359 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4360 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4361 | } |
| 4362 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4363 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4364 | return 0; |
| 4365 | } |
| 4366 | |
| 4367 | /** |
| 4368 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 4369 | * @wmi_handle: wmi handle |
| 4370 | * @params: sta keep alive parameter |
| 4371 | * |
| 4372 | * This function sets keep alive related parameters in fw. |
| 4373 | * |
| 4374 | * Return: CDF status |
| 4375 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4376 | 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] | 4377 | struct sta_params *params) |
| 4378 | { |
| 4379 | wmi_buf_t buf; |
| 4380 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 4381 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 4382 | uint8_t *buf_ptr; |
| 4383 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4384 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4385 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4386 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4387 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4388 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 4389 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4390 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4391 | WMI_LOGE("wmi_buf_alloc failed"); |
| 4392 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4393 | } |
| 4394 | |
| 4395 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 4396 | buf_ptr = (uint8_t *) cmd; |
| 4397 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4398 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 4399 | WMITLV_GET_STRUCT_TLVLEN |
| 4400 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 4401 | cmd->interval = params->timeperiod; |
| 4402 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 4403 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4404 | 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] | 4405 | params->timeperiod, params->method); |
| 4406 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 4407 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 4408 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 4409 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 4410 | |
| 4411 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 4412 | if ((NULL == params->hostv4addr) || |
| 4413 | (NULL == params->destv4addr) || |
| 4414 | (NULL == params->destmac)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4415 | WMI_LOGE("%s: received null pointer, hostv4addr:%p " |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4416 | "destv4addr:%p destmac:%p ", __func__, |
| 4417 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4418 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4419 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4420 | } |
| 4421 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4422 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4423 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4424 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4425 | WMI_IPV4_ADDR_LEN); |
| 4426 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 4427 | } else { |
| 4428 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 4429 | } |
| 4430 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4431 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4432 | WMI_STA_KEEPALIVE_CMDID); |
| 4433 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4434 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4435 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4436 | } |
| 4437 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4438 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4439 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4440 | } |
| 4441 | |
| 4442 | /** |
| 4443 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 4444 | * @wmi_handle: wmi handle |
| 4445 | * @if_id: vdev id |
| 4446 | * @gtx_info: GTX config params |
| 4447 | * |
| 4448 | * This function set GTX related params in firmware. |
| 4449 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4450 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4451 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4452 | 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] | 4453 | struct wmi_gtx_config *gtx_info) |
| 4454 | { |
| 4455 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 4456 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4457 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4458 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4459 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4460 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4461 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4462 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4463 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4464 | } |
| 4465 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 4466 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4467 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 4468 | WMITLV_GET_STRUCT_TLVLEN |
| 4469 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 4470 | cmd->vdev_id = if_id; |
| 4471 | |
| 4472 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 4473 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 4474 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 4475 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 4476 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 4477 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 4478 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 4479 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 4480 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4481 | 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] | 4482 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 4483 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 4484 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 4485 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 4486 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4487 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4488 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4489 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4490 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 4491 | wmi_buf_free(buf); |
| 4492 | } |
| 4493 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4494 | } |
| 4495 | |
| 4496 | /** |
| 4497 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 4498 | * @wmi_handle: wmi handle |
| 4499 | * @edca_params: edca parameters |
| 4500 | * |
| 4501 | * This function updates EDCA parameters to the target |
| 4502 | * |
| 4503 | * Return: CDF Status |
| 4504 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4505 | 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] | 4506 | uint8_t vdev_id, |
| 4507 | wmi_wmm_vparams gwmm_param[WMI_MAX_NUM_AC]) |
| 4508 | { |
| 4509 | uint8_t *buf_ptr; |
| 4510 | wmi_buf_t buf; |
| 4511 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
| 4512 | wmi_wmm_vparams *wmm_param, *twmm_param; |
| 4513 | int len = sizeof(*cmd); |
| 4514 | int ac; |
| 4515 | |
| 4516 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4517 | |
| 4518 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4519 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4520 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4521 | } |
| 4522 | |
| 4523 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4524 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 4525 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4526 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4527 | WMITLV_GET_STRUCT_TLVLEN |
| 4528 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 4529 | cmd->vdev_id = vdev_id; |
| 4530 | |
| 4531 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 4532 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
| 4533 | twmm_param = (wmi_wmm_vparams *) (&gwmm_param[ac]); |
| 4534 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 4535 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4536 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 4537 | wmm_param->cwmin = twmm_param->cwmin; |
| 4538 | wmm_param->cwmax = twmm_param->cwmax; |
| 4539 | wmm_param->aifs = twmm_param->aifs; |
| 4540 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 4541 | wmm_param->acm = twmm_param->acm; |
| 4542 | wmm_param->no_ack = twmm_param->no_ack; |
| 4543 | } |
| 4544 | |
| 4545 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4546 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 4547 | goto fail; |
| 4548 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4549 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4550 | |
| 4551 | fail: |
| 4552 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4553 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 4554 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4555 | } |
| 4556 | |
| 4557 | /** |
| 4558 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 4559 | * @wmi_handle: wmi handle |
| 4560 | * @vdev_id: vdev id |
| 4561 | * @probe_rsp_info: probe response info |
| 4562 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4563 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4564 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4565 | 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] | 4566 | uint8_t vdev_id, |
| 4567 | struct wmi_probe_resp_params *probe_rsp_info, |
| 4568 | uint8_t *frm) |
| 4569 | { |
| 4570 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 4571 | wmi_bcn_prb_info *bcn_prb_info; |
| 4572 | wmi_buf_t wmi_buf; |
| 4573 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 4574 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4575 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4576 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4577 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4578 | |
| 4579 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 4580 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 4581 | |
| 4582 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 4583 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 4584 | tmpl_len_aligned; |
| 4585 | |
| 4586 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4587 | 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] | 4588 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4589 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4590 | } |
| 4591 | |
| 4592 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4593 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4594 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4595 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4596 | } |
| 4597 | |
| 4598 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4599 | |
| 4600 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 4601 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4602 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 4603 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 4604 | cmd->vdev_id = vdev_id; |
| 4605 | cmd->buf_len = tmpl_len; |
| 4606 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 4607 | |
| 4608 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4609 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4610 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4611 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4612 | bcn_prb_info->caps = 0; |
| 4613 | bcn_prb_info->erp = 0; |
| 4614 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4615 | |
| 4616 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4617 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4618 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4619 | |
| 4620 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4621 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4622 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4623 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4624 | wmi_buf_free(wmi_buf); |
| 4625 | } |
| 4626 | |
| 4627 | return ret; |
| 4628 | } |
| 4629 | |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4630 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4631 | #define WPI_IV_LEN 16 |
| 4632 | |
| 4633 | /** |
| 4634 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4635 | * |
| 4636 | * @dest_tx: destination address of tsc key counter |
| 4637 | * @src_tx: source address of tsc key counter |
| 4638 | * @dest_rx: destination address of rsc key counter |
| 4639 | * @src_rx: source address of rsc key counter |
| 4640 | * |
| 4641 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4642 | * |
| 4643 | * Return: None |
| 4644 | * |
| 4645 | */ |
| 4646 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4647 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4648 | { |
| 4649 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4650 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4651 | } |
| 4652 | #else |
| 4653 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4654 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4655 | { |
| 4656 | return; |
| 4657 | } |
| 4658 | #endif |
| 4659 | |
| 4660 | /** |
| 4661 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4662 | * @wmi_handle: wmi handle |
| 4663 | * @key_params: key parameters |
| 4664 | * |
| 4665 | * This function fills structure from information |
| 4666 | * passed in key_params. |
| 4667 | * |
| 4668 | * Return: QDF_STATUS_SUCCESS - success |
| 4669 | * QDF_STATUS_E_FAILURE - failure |
| 4670 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4671 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4672 | 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] | 4673 | struct set_key_params *key_params) |
| 4674 | { |
| 4675 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4676 | wmi_buf_t buf; |
| 4677 | uint8_t *buf_ptr; |
| 4678 | uint32_t len; |
| 4679 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4680 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4681 | |
| 4682 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4683 | WMI_TLV_HDR_SIZE; |
| 4684 | |
| 4685 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4686 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4687 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4688 | return QDF_STATUS_E_NOMEM; |
| 4689 | } |
| 4690 | |
| 4691 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4692 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4693 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4694 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4695 | WMITLV_GET_STRUCT_TLVLEN |
| 4696 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4697 | cmd->vdev_id = key_params->vdev_id; |
| 4698 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4699 | |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4700 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4701 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4702 | cmd->key_flags |= key_params->key_flags; |
| 4703 | cmd->key_cipher = key_params->key_cipher; |
| 4704 | if ((key_params->key_txmic_len) && |
| 4705 | (key_params->key_rxmic_len)) { |
| 4706 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4707 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4708 | } |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4709 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4710 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4711 | key_params->tx_iv, |
| 4712 | cmd->wpi_key_rsc_counter, |
| 4713 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4714 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4715 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4716 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4717 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4718 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4719 | qdf_mem_copy((void *)key_data, |
| 4720 | (const void *)key_params->key_data, key_params->key_len); |
| 4721 | cmd->key_len = key_params->key_len; |
| 4722 | |
| 4723 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4724 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4725 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4726 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4727 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4728 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4729 | } |
| 4730 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4731 | /** |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 4732 | * send_sar_limit_cmd_tlv() - send sar limit cmd to fw |
| 4733 | * @wmi_handle: wmi handle |
| 4734 | * @params: sar limit params |
| 4735 | * |
| 4736 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4737 | */ |
| 4738 | static QDF_STATUS send_sar_limit_cmd_tlv(wmi_unified_t wmi_handle, |
| 4739 | struct sar_limit_cmd_params *sar_limit_params) |
| 4740 | { |
| 4741 | wmi_buf_t buf; |
| 4742 | QDF_STATUS qdf_status; |
| 4743 | wmi_sar_limits_cmd_fixed_param *cmd; |
| 4744 | int i; |
| 4745 | uint8_t *buf_ptr; |
| 4746 | wmi_sar_limit_cmd_row *wmi_sar_rows_list; |
| 4747 | struct sar_limit_cmd_row *sar_rows_list; |
| 4748 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4749 | |
| 4750 | len += sizeof(wmi_sar_limit_cmd_row) * sar_limit_params->num_limit_rows; |
| 4751 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4752 | if (!buf) { |
| 4753 | WMI_LOGE("Failed to allocate memory"); |
| 4754 | qdf_status = QDF_STATUS_E_NOMEM; |
| 4755 | goto end; |
| 4756 | } |
| 4757 | |
| 4758 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4759 | cmd = (wmi_sar_limits_cmd_fixed_param *) buf_ptr; |
| 4760 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4761 | WMITLV_TAG_STRUC_wmi_sar_limits_cmd_fixed_param, |
| 4762 | WMITLV_GET_STRUCT_TLVLEN |
| 4763 | (wmi_sar_limits_cmd_fixed_param)); |
| 4764 | cmd->sar_enable = sar_limit_params->sar_enable; |
| 4765 | cmd->commit_limits = sar_limit_params->commit_limits; |
| 4766 | cmd->num_limit_rows = sar_limit_params->num_limit_rows; |
| 4767 | |
| 4768 | WMI_LOGD("no of sar rows = %d, len = %d", |
| 4769 | sar_limit_params->num_limit_rows, len); |
| 4770 | buf_ptr += sizeof(*cmd); |
| 4771 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4772 | sizeof(wmi_sar_limit_cmd_row) * |
| 4773 | sar_limit_params->num_limit_rows); |
| 4774 | if (cmd->num_limit_rows == 0) |
| 4775 | goto send_sar_limits; |
| 4776 | |
| 4777 | wmi_sar_rows_list = (wmi_sar_limit_cmd_row *) |
| 4778 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4779 | sar_rows_list = sar_limit_params->sar_limit_row_list; |
| 4780 | |
| 4781 | for (i = 0; i < sar_limit_params->num_limit_rows; i++) { |
| 4782 | WMITLV_SET_HDR(&wmi_sar_rows_list->tlv_header, |
| 4783 | WMITLV_TAG_STRUC_wmi_sar_limit_cmd_row, |
| 4784 | WMITLV_GET_STRUCT_TLVLEN(wmi_sar_limit_cmd_row)); |
| 4785 | wmi_sar_rows_list->band_id = sar_rows_list->band_id; |
| 4786 | wmi_sar_rows_list->chain_id = sar_rows_list->chain_id; |
| 4787 | wmi_sar_rows_list->mod_id = sar_rows_list->mod_id; |
| 4788 | wmi_sar_rows_list->limit_value = sar_rows_list->limit_value; |
| 4789 | wmi_sar_rows_list->validity_bitmap = |
| 4790 | sar_rows_list->validity_bitmap; |
| 4791 | WMI_LOGD("row %d, band_id = %d, chain_id = %d, mod_id = %d, limit_value = %d, validity_bitmap = %d", |
| 4792 | i, wmi_sar_rows_list->band_id, |
| 4793 | wmi_sar_rows_list->chain_id, |
| 4794 | wmi_sar_rows_list->mod_id, |
| 4795 | wmi_sar_rows_list->limit_value, |
| 4796 | wmi_sar_rows_list->validity_bitmap); |
| 4797 | sar_rows_list++; |
| 4798 | wmi_sar_rows_list++; |
| 4799 | } |
| 4800 | send_sar_limits: |
| 4801 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4802 | WMI_SAR_LIMITS_CMDID); |
| 4803 | |
| 4804 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 4805 | WMI_LOGE("Failed to send WMI_SAR_LIMITS_CMDID"); |
| 4806 | wmi_buf_free(buf); |
| 4807 | } |
| 4808 | |
| 4809 | end: |
| 4810 | return qdf_status; |
| 4811 | } |
| 4812 | |
| 4813 | /** |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4814 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 4815 | * @wmi_handle: wmi handle |
| 4816 | * @params: encrypt/decrypt params |
| 4817 | * |
| 4818 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4819 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 4820 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4821 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 4822 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 4823 | { |
| 4824 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 4825 | wmi_buf_t wmi_buf; |
| 4826 | uint8_t *buf_ptr; |
| 4827 | QDF_STATUS ret; |
| 4828 | uint32_t len; |
| 4829 | |
| 4830 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 4831 | |
| 4832 | len = sizeof(*cmd) + |
| 4833 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 4834 | WMI_TLV_HDR_SIZE; |
| 4835 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 4836 | if (!wmi_buf) { |
| 4837 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 4838 | __func__); |
| 4839 | return QDF_STATUS_E_NOMEM; |
| 4840 | } |
| 4841 | |
| 4842 | buf_ptr = wmi_buf_data(wmi_buf); |
| 4843 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 4844 | |
| 4845 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4846 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 4847 | WMITLV_GET_STRUCT_TLVLEN( |
| 4848 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 4849 | |
| 4850 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 4851 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 4852 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 4853 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 4854 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 4855 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 4856 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 4857 | |
| 4858 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 4859 | encrypt_decrypt_params->key_len); |
| 4860 | |
| 4861 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 4862 | MAX_MAC_HEADER_LEN); |
| 4863 | |
| 4864 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 4865 | |
| 4866 | if (cmd->data_len) { |
| 4867 | buf_ptr += sizeof(*cmd); |
| 4868 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4869 | roundup(encrypt_decrypt_params->data_len, |
| 4870 | sizeof(A_UINT32))); |
| 4871 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4872 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 4873 | encrypt_decrypt_params->data_len); |
| 4874 | } |
| 4875 | |
| 4876 | /* This conversion is to facilitate data to FW in little endian */ |
| 4877 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 4878 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 4879 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 4880 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 4881 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 4882 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 4883 | |
| 4884 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4885 | wmi_buf, len, |
| 4886 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 4887 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4888 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 4889 | wmi_buf_free(wmi_buf); |
| 4890 | } |
| 4891 | |
| 4892 | return ret; |
| 4893 | } |
| 4894 | |
| 4895 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4896 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4897 | /** |
| 4898 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 4899 | * @wmi_handle: wmi handle |
| 4900 | * @vdev_id: vdev id |
| 4901 | * @p2p_ie: p2p IE |
| 4902 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4903 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4904 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4905 | 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] | 4906 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 4907 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4908 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4909 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 4910 | wmi_buf_t wmi_buf; |
| 4911 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 4912 | uint8_t *buf_ptr; |
| 4913 | |
| 4914 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 4915 | |
| 4916 | /* More than one P2P IE may be included in a single frame. |
| 4917 | If multiple P2P IEs are present, the complete P2P attribute |
| 4918 | data consists of the concatenation of the P2P Attribute |
| 4919 | fields of the P2P IEs. The P2P Attributes field of each |
| 4920 | P2P IE may be any length up to the maximum (251 octets). |
| 4921 | In this case host sends one P2P IE to firmware so the length |
| 4922 | should not exceed more than 251 bytes |
| 4923 | */ |
| 4924 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4925 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4926 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4927 | } |
| 4928 | |
| 4929 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 4930 | |
| 4931 | wmi_buf_len = |
| 4932 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 4933 | WMI_TLV_HDR_SIZE; |
| 4934 | |
| 4935 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4936 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4937 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4938 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4939 | } |
| 4940 | |
| 4941 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4942 | |
| 4943 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 4944 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4945 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 4946 | WMITLV_GET_STRUCT_TLVLEN |
| 4947 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 4948 | cmd->vdev_id = vdev_id; |
| 4949 | cmd->ie_buf_len = ie_len; |
| 4950 | |
| 4951 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 4952 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 4953 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4954 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4955 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4956 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4957 | |
| 4958 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4959 | wmi_buf, wmi_buf_len, |
| 4960 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4961 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4962 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4963 | wmi_buf_free(wmi_buf); |
| 4964 | } |
| 4965 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4966 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4967 | return ret; |
| 4968 | } |
| 4969 | |
| 4970 | /** |
| 4971 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 4972 | * @wmi_handle: wmi handle |
| 4973 | * @req: gateway parameter update request structure |
| 4974 | * |
| 4975 | * This function reads the incoming @req and fill in the destination |
| 4976 | * WMI structure and sends down the gateway configs down to the firmware |
| 4977 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4978 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4979 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4980 | 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] | 4981 | struct gateway_update_req_param *req) |
| 4982 | { |
| 4983 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 4984 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4985 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4986 | int len = sizeof(*cmd); |
| 4987 | |
| 4988 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4989 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4990 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 4991 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4992 | } |
| 4993 | |
| 4994 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 4995 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4996 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 4997 | WMITLV_GET_STRUCT_TLVLEN( |
| 4998 | wmi_roam_subnet_change_config_fixed_param)); |
| 4999 | |
| 5000 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5001 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 5002 | QDF_IPV4_ADDR_SIZE); |
| 5003 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 5004 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5005 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 5006 | &cmd->inet_gw_mac_addr); |
| 5007 | cmd->max_retries = req->max_retries; |
| 5008 | cmd->timeout = req->timeout; |
| 5009 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 5010 | cmd->flag = 0; |
| 5011 | if (req->ipv4_addr_type) |
| 5012 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 5013 | |
| 5014 | if (req->ipv6_addr_type) |
| 5015 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 5016 | |
| 5017 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5018 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5019 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5020 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5021 | ret); |
| 5022 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5023 | } |
| 5024 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5025 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5026 | } |
| 5027 | |
| 5028 | /** |
| 5029 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 5030 | * @wmi_handle: wmi handle |
| 5031 | * @req: rssi monitoring request structure |
| 5032 | * |
| 5033 | * This function reads the incoming @req and fill in the destination |
| 5034 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 5035 | * |
| 5036 | * Return: 0 on success; error number otherwise |
| 5037 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5038 | 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] | 5039 | struct rssi_monitor_param *req) |
| 5040 | { |
| 5041 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 5042 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5043 | QDF_STATUS ret; |
| 5044 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5045 | |
| 5046 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5047 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5048 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5049 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5050 | } |
| 5051 | |
| 5052 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 5053 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5054 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 5055 | WMITLV_GET_STRUCT_TLVLEN( |
| 5056 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 5057 | |
| 5058 | cmd->vdev_id = req->session_id; |
| 5059 | cmd->request_id = req->request_id; |
| 5060 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 5061 | cmd->hi_rssi_reenable_histeresis = 0; |
| 5062 | cmd->min_report_interval = 0; |
| 5063 | cmd->max_num_report = 1; |
| 5064 | if (req->control) { |
| 5065 | /* enable one threshold for each min/max */ |
| 5066 | cmd->enabled_bitmap = 0x09; |
| 5067 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 5068 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 5069 | } else { |
| 5070 | cmd->enabled_bitmap = 0; |
| 5071 | cmd->low_rssi_breach_threshold[0] = 0; |
| 5072 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 5073 | } |
| 5074 | |
| 5075 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5076 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5077 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5078 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5079 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5080 | } |
| 5081 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5082 | WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5083 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5084 | } |
| 5085 | |
| 5086 | /** |
| 5087 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 5088 | * @wmi_handle: wmi handle |
| 5089 | * @psetoui: OUI parameters |
| 5090 | * |
| 5091 | * set scan probe OUI parameters in firmware |
| 5092 | * |
| 5093 | * Return: CDF status |
| 5094 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5095 | 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] | 5096 | struct scan_mac_oui *psetoui) |
| 5097 | { |
| 5098 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 5099 | wmi_buf_t wmi_buf; |
| 5100 | uint32_t len; |
| 5101 | uint8_t *buf_ptr; |
| 5102 | uint32_t *oui_buf; |
| 5103 | |
| 5104 | len = sizeof(*cmd); |
| 5105 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5106 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5107 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5108 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5109 | } |
| 5110 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5111 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 5112 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5113 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 5114 | WMITLV_GET_STRUCT_TLVLEN |
| 5115 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 5116 | |
| 5117 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5118 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5119 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 5120 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5121 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5122 | cmd->prob_req_oui); |
| 5123 | |
| 5124 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5125 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5126 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5127 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5128 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5129 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5130 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5131 | } |
| 5132 | |
| 5133 | /** |
| 5134 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 5135 | * @wmi_handle: wmi handle |
| 5136 | * @req: passpoint network request structure |
| 5137 | * |
| 5138 | * This function sends down WMI command with network id set to wildcard id. |
| 5139 | * firmware shall clear all the config entries |
| 5140 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5141 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5142 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5143 | 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] | 5144 | struct wifi_passpoint_req_param *req) |
| 5145 | { |
| 5146 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5147 | wmi_buf_t buf; |
| 5148 | uint32_t len; |
| 5149 | int ret; |
| 5150 | |
| 5151 | len = sizeof(*cmd); |
| 5152 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5153 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5154 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5155 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5156 | } |
| 5157 | |
| 5158 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5159 | |
| 5160 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5161 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5162 | WMITLV_GET_STRUCT_TLVLEN( |
| 5163 | wmi_passpoint_config_cmd_fixed_param)); |
| 5164 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 5165 | |
| 5166 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5167 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5168 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5169 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5170 | __func__); |
| 5171 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5172 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5173 | } |
| 5174 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5175 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5176 | } |
| 5177 | |
| 5178 | /** |
| 5179 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 5180 | * @wmi_handle: wmi handle |
| 5181 | * @req: passpoint network request structure |
| 5182 | * |
| 5183 | * This function reads the incoming @req and fill in the destination |
| 5184 | * WMI structure and send down the passpoint configs down to the firmware |
| 5185 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5186 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5187 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5188 | 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] | 5189 | struct wifi_passpoint_req_param *req) |
| 5190 | { |
| 5191 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5192 | u_int8_t i, j, *bytes; |
| 5193 | wmi_buf_t buf; |
| 5194 | uint32_t len; |
| 5195 | int ret; |
| 5196 | |
| 5197 | len = sizeof(*cmd); |
| 5198 | for (i = 0; i < req->num_networks; i++) { |
| 5199 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5200 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5201 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5202 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5203 | } |
| 5204 | |
| 5205 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 5206 | wmi_buf_data(buf); |
| 5207 | |
| 5208 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5209 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5210 | WMITLV_GET_STRUCT_TLVLEN( |
| 5211 | wmi_passpoint_config_cmd_fixed_param)); |
| 5212 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5213 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 5214 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5215 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5216 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5217 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 5218 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5219 | 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] | 5220 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 5221 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 5222 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5223 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5224 | &req->networks[i].roaming_consortium_ids[j], |
| 5225 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 5226 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5227 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5228 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5229 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5230 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 5231 | |
| 5232 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5233 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5234 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5235 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5236 | __func__); |
| 5237 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5238 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5239 | } |
| 5240 | } |
| 5241 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5242 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5243 | } |
| 5244 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5245 | /** |
| 5246 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 5247 | * @wmi_handle: wmi handle |
| 5248 | * @scan_cmd_fp: start scan command ptr |
| 5249 | * @roam_req: roam request param |
| 5250 | * |
| 5251 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 5252 | * of WMI_ROAM_SCAN_MODE. |
| 5253 | * |
| 5254 | * Return: QDF status |
| 5255 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5256 | 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] | 5257 | wmi_start_scan_cmd_fixed_param * |
| 5258 | scan_cmd_fp, |
| 5259 | struct roam_offload_scan_params *roam_req) |
| 5260 | { |
| 5261 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5262 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5263 | int len; |
| 5264 | uint8_t *buf_ptr; |
| 5265 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5266 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5267 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5268 | int auth_mode = roam_req->auth_mode; |
| 5269 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 5270 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 5271 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 5272 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5273 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5274 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5275 | /* Need to create a buf with roam_scan command at |
| 5276 | * front and piggyback with scan command */ |
| 5277 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 5278 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5279 | (2 * WMI_TLV_HDR_SIZE) + |
| 5280 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5281 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 5282 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5283 | if (roam_req->is_roam_req_valid && |
| 5284 | roam_req->roam_offload_enabled) { |
| 5285 | len += sizeof(wmi_roam_offload_tlv_param); |
| 5286 | len += WMI_TLV_HDR_SIZE; |
| 5287 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5288 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5289 | (auth_mode == WMI_AUTH_OPEN && |
| 5290 | roam_req->mdid.mdie_present) || |
| 5291 | roam_req->is_ese_assoc)) { |
| 5292 | len += WMI_TLV_HDR_SIZE; |
| 5293 | if (roam_req->is_ese_assoc) |
| 5294 | len += |
| 5295 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5296 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 5297 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 5298 | (auth_mode == WMI_AUTH_OPEN && |
| 5299 | roam_req->mdid.mdie_present)) |
| 5300 | len += |
| 5301 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5302 | else |
| 5303 | len += |
| 5304 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5305 | } else { |
| 5306 | len += WMI_TLV_HDR_SIZE; |
| 5307 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5308 | |
| 5309 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 5310 | + roundup(roam_req->assoc_ie_length, |
| 5311 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5312 | } else { |
| 5313 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5314 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5315 | __func__, roam_req->roam_offload_enabled); |
| 5316 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5317 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5318 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5319 | } |
| 5320 | if (roam_req->is_roam_req_valid && |
| 5321 | roam_req->roam_offload_enabled) { |
| 5322 | roam_req->mode = roam_req->mode | |
| 5323 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 5324 | } |
| 5325 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5326 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5327 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 5328 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 5329 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 5330 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5331 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5332 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5333 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5334 | return QDF_STATUS_E_NOMEM; |
| 5335 | } |
| 5336 | |
| 5337 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5338 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5339 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 5340 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 5341 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 5342 | WMITLV_GET_STRUCT_TLVLEN |
| 5343 | (wmi_roam_scan_mode_fixed_param)); |
| 5344 | |
| 5345 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 5346 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 5347 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE | |
| 5348 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) { |
| 5349 | roam_scan_mode_fp->flags |= |
| 5350 | WMI_ROAM_SCAN_MODE_FLAG_REPORT_STATUS; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5351 | goto send_roam_scan_mode_cmd; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 5352 | } |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5353 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5354 | /* Fill in scan parameters suitable for roaming scan */ |
| 5355 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5356 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5357 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 5358 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 5359 | /* Ensure there is no additional IEs */ |
| 5360 | scan_cmd_fp->ie_len = 0; |
| 5361 | WMITLV_SET_HDR(buf_ptr, |
| 5362 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 5363 | WMITLV_GET_STRUCT_TLVLEN |
| 5364 | (wmi_start_scan_cmd_fixed_param)); |
| 5365 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5366 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 5367 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 5368 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5369 | sizeof(wmi_roam_offload_tlv_param)); |
| 5370 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5371 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 5372 | WMITLV_SET_HDR(buf_ptr, |
| 5373 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 5374 | WMITLV_GET_STRUCT_TLVLEN |
| 5375 | (wmi_roam_offload_tlv_param)); |
| 5376 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 5377 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 5378 | roam_offload_params->select_5g_margin = |
| 5379 | roam_req->select_5ghz_margin; |
| 5380 | roam_offload_params->reassoc_failure_timeout = |
| 5381 | roam_req->reassoc_failure_timeout; |
| 5382 | |
| 5383 | /* Fill the capabilities */ |
| 5384 | roam_offload_params->capability = |
| 5385 | roam_req->roam_offload_params.capability; |
| 5386 | roam_offload_params->ht_caps_info = |
| 5387 | roam_req->roam_offload_params.ht_caps_info; |
| 5388 | roam_offload_params->ampdu_param = |
| 5389 | roam_req->roam_offload_params.ampdu_param; |
| 5390 | roam_offload_params->ht_ext_cap = |
| 5391 | roam_req->roam_offload_params.ht_ext_cap; |
| 5392 | roam_offload_params->ht_txbf = |
| 5393 | roam_req->roam_offload_params.ht_txbf; |
| 5394 | roam_offload_params->asel_cap = |
| 5395 | roam_req->roam_offload_params.asel_cap; |
| 5396 | roam_offload_params->qos_caps = |
| 5397 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 5398 | roam_offload_params->qos_enabled = |
| 5399 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5400 | roam_offload_params->wmm_caps = |
| 5401 | roam_req->roam_offload_params.wmm_caps; |
| 5402 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 5403 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 5404 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 5405 | |
| 5406 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 5407 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 5408 | * they are filled in the same order.Depending on the |
| 5409 | * authentication type, the other mode TLV's are nullified |
| 5410 | * and only headers are filled.*/ |
| 5411 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5412 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5413 | (auth_mode == WMI_AUTH_OPEN |
| 5414 | && roam_req->mdid.mdie_present) || |
| 5415 | roam_req->is_ese_assoc)) { |
| 5416 | if (roam_req->is_ese_assoc) { |
| 5417 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5418 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5419 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5420 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5421 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5422 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5423 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5424 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 5425 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5426 | roam_offload_ese = |
| 5427 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 5428 | qdf_mem_copy(roam_offload_ese->krk, |
| 5429 | roam_req->krk, |
| 5430 | sizeof(roam_req->krk)); |
| 5431 | qdf_mem_copy(roam_offload_ese->btk, |
| 5432 | roam_req->btk, |
| 5433 | sizeof(roam_req->btk)); |
| 5434 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 5435 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 5436 | WMITLV_GET_STRUCT_TLVLEN |
| 5437 | (wmi_roam_ese_offload_tlv_param)); |
| 5438 | buf_ptr += |
| 5439 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5440 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 5441 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 5442 | || (auth_mode == WMI_AUTH_OPEN |
| 5443 | && roam_req->mdid.mdie_present)) { |
| 5444 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5445 | 0); |
| 5446 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5447 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5448 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 5449 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5450 | roam_offload_11r = |
| 5451 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 5452 | roam_offload_11r->r0kh_id_len = |
| 5453 | roam_req->rokh_id_length; |
| 5454 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 5455 | roam_req->rokh_id, |
| 5456 | roam_offload_11r->r0kh_id_len); |
| 5457 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 5458 | roam_req->psk_pmk, |
| 5459 | sizeof(roam_req->psk_pmk)); |
| 5460 | roam_offload_11r->psk_msk_len = |
| 5461 | roam_req->pmk_len; |
| 5462 | roam_offload_11r->mdie_present = |
| 5463 | roam_req->mdid.mdie_present; |
| 5464 | roam_offload_11r->mdid = |
| 5465 | roam_req->mdid.mobility_domain; |
| 5466 | if (auth_mode == WMI_AUTH_OPEN) { |
| 5467 | /* If FT-Open ensure pmk length |
| 5468 | and r0khid len are zero */ |
| 5469 | roam_offload_11r->r0kh_id_len = 0; |
| 5470 | roam_offload_11r->psk_msk_len = 0; |
| 5471 | } |
| 5472 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 5473 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 5474 | WMITLV_GET_STRUCT_TLVLEN |
| 5475 | (wmi_roam_11r_offload_tlv_param)); |
| 5476 | buf_ptr += |
| 5477 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5478 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5479 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5480 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5481 | } else { |
| 5482 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5483 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 5484 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5485 | roam_offload_11i = |
| 5486 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 5487 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 5488 | roam_req->okc_enabled) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5489 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 5490 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5491 | WMI_LOGE("LFR3:OKC Enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5492 | } else { |
| 5493 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 5494 | (roam_offload_11i->flags); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5495 | WMI_LOGE("LFR3:OKC Disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5496 | } |
| 5497 | |
| 5498 | qdf_mem_copy(roam_offload_11i->pmk, |
| 5499 | roam_req->psk_pmk, |
| 5500 | sizeof(roam_req->psk_pmk)); |
| 5501 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 5502 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 5503 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 5504 | WMITLV_GET_STRUCT_TLVLEN |
| 5505 | (wmi_roam_11i_offload_tlv_param)); |
| 5506 | buf_ptr += |
| 5507 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5508 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5509 | 0); |
| 5510 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5511 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5512 | 0); |
| 5513 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5514 | } |
| 5515 | } else { |
| 5516 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5517 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5518 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5519 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5520 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5521 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5522 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5523 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5524 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5525 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5526 | |
| 5527 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5528 | sizeof(*assoc_ies)); |
| 5529 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5530 | |
| 5531 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 5532 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 5533 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 5534 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 5535 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 5536 | |
| 5537 | buf_ptr += sizeof(*assoc_ies); |
| 5538 | |
| 5539 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5540 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 5541 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5542 | |
| 5543 | if (assoc_ies->buf_len != 0) { |
| 5544 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 5545 | assoc_ies->buf_len); |
| 5546 | } |
| 5547 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5548 | } else { |
| 5549 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5550 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5551 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5552 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5553 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5554 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5555 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5556 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5557 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5558 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5559 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5560 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5561 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5562 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5563 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5564 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5565 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5566 | } |
| 5567 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5568 | |
| 5569 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5570 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5571 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5572 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5573 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5574 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 5575 | status); |
| 5576 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5577 | } |
| 5578 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5579 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5580 | } |
| 5581 | |
| 5582 | |
| 5583 | /** |
| 5584 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 5585 | * rssi threashold |
| 5586 | * @wmi_handle: wmi handle |
| 5587 | * @roam_req: Roaming request buffer |
| 5588 | * |
| 5589 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 5590 | * |
| 5591 | * Return: QDF status |
| 5592 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5593 | 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] | 5594 | struct roam_offload_scan_rssi_params *roam_req) |
| 5595 | { |
| 5596 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5597 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5598 | int len; |
| 5599 | uint8_t *buf_ptr; |
| 5600 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 5601 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 5602 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5603 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5604 | |
| 5605 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5606 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5607 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5608 | len += WMI_TLV_HDR_SIZE; |
| 5609 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5610 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 5611 | len += sizeof(wmi_roam_dense_thres_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5612 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5613 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5614 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5615 | return QDF_STATUS_E_NOMEM; |
| 5616 | } |
| 5617 | |
| 5618 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5619 | rssi_threshold_fp = |
| 5620 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 5621 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 5622 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 5623 | WMITLV_GET_STRUCT_TLVLEN |
| 5624 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 5625 | /* fill in threshold values */ |
| 5626 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 5627 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 5628 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 5629 | rssi_threshold_fp->hirssi_scan_max_count = |
| 5630 | roam_req->hi_rssi_scan_max_count; |
| 5631 | rssi_threshold_fp->hirssi_scan_delta = |
| 5632 | roam_req->hi_rssi_scan_rssi_delta; |
| 5633 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
| 5634 | |
| 5635 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5636 | WMITLV_SET_HDR(buf_ptr, |
| 5637 | WMITLV_TAG_ARRAY_STRUC, |
| 5638 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 5639 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5640 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 5641 | |
| 5642 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 5643 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 5644 | ext_thresholds->boost_threshold_5g = |
| 5645 | roam_req->boost_threshold_5g; |
| 5646 | |
| 5647 | ext_thresholds->boost_algorithm_5g = |
| 5648 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5649 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 5650 | ext_thresholds->penalty_algorithm_5g = |
| 5651 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5652 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 5653 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 5654 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 5655 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 5656 | |
| 5657 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 5658 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 5659 | WMITLV_GET_STRUCT_TLVLEN |
| 5660 | (wmi_roam_scan_extended_threshold_param)); |
| 5661 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5662 | WMITLV_SET_HDR(buf_ptr, |
| 5663 | WMITLV_TAG_ARRAY_STRUC, |
| 5664 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 5665 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5666 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 5667 | early_stop_thresholds->roam_earlystop_thres_min = |
| 5668 | roam_req->roam_earlystop_thres_min; |
| 5669 | early_stop_thresholds->roam_earlystop_thres_max = |
| 5670 | roam_req->roam_earlystop_thres_max; |
| 5671 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 5672 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 5673 | WMITLV_GET_STRUCT_TLVLEN |
| 5674 | (wmi_roam_earlystop_rssi_thres_param)); |
| 5675 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5676 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 5677 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5678 | sizeof(wmi_roam_dense_thres_param)); |
| 5679 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5680 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 5681 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 5682 | roam_req->dense_rssi_thresh_offset; |
| 5683 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 5684 | dense_thresholds->roam_dense_traffic_thres = |
| 5685 | roam_req->traffic_threshold; |
| 5686 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 5687 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 5688 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 5689 | WMITLV_GET_STRUCT_TLVLEN |
| 5690 | (wmi_roam_dense_thres_param)); |
| 5691 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5692 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5693 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5694 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5695 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5696 | status); |
| 5697 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5698 | } |
| 5699 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5700 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5701 | } |
| 5702 | |
| 5703 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5704 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 5705 | * configuration params |
| 5706 | * @wma_handle: wma handler |
| 5707 | * @dwelltime_params: pointer to dwelltime_params |
| 5708 | * |
| 5709 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 5710 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5711 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 5712 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5713 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 5714 | { |
| 5715 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 5716 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 5717 | wmi_buf_t buf; |
| 5718 | uint8_t *buf_ptr; |
| 5719 | int32_t err; |
| 5720 | int len; |
| 5721 | |
| 5722 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5723 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5724 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 5725 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5726 | if (!buf) { |
| 5727 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 5728 | __func__); |
| 5729 | return QDF_STATUS_E_NOMEM; |
| 5730 | } |
| 5731 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5732 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 5733 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 5734 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 5735 | WMITLV_GET_STRUCT_TLVLEN |
| 5736 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 5737 | |
| 5738 | dwell_param->enable = dwelltime_params->is_enabled; |
| 5739 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 5740 | WMITLV_SET_HDR(buf_ptr, |
| 5741 | WMITLV_TAG_ARRAY_STRUC, |
| 5742 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5743 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5744 | |
| 5745 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 5746 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5747 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 5748 | WMITLV_GET_STRUCT_TLVLEN( |
| 5749 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 5750 | |
| 5751 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 5752 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 5753 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 5754 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 5755 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 5756 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 5757 | if (err) { |
| 5758 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 5759 | wmi_buf_free(buf); |
| 5760 | return QDF_STATUS_E_FAILURE; |
| 5761 | } |
| 5762 | |
| 5763 | return QDF_STATUS_SUCCESS; |
| 5764 | } |
| 5765 | |
| 5766 | |
| 5767 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5768 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 5769 | * @wmi_handle: wmi handle |
| 5770 | * @roam_req: Request which contains the filters |
| 5771 | * |
| 5772 | * There are filters such as whitelist, blacklist and preferred |
| 5773 | * list that need to be applied to the scan results to form the |
| 5774 | * probable candidates for roaming. |
| 5775 | * |
| 5776 | * Return: Return success upon succesfully passing the |
| 5777 | * parameters to the firmware, otherwise failure. |
| 5778 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5779 | 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] | 5780 | struct roam_scan_filter_params *roam_req) |
| 5781 | { |
| 5782 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5783 | QDF_STATUS status; |
| 5784 | uint32_t i; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5785 | uint32_t len; |
| 5786 | uint8_t *buf_ptr; |
| 5787 | wmi_roam_filter_fixed_param *roam_filter; |
| 5788 | uint8_t *bssid_src_ptr = NULL; |
| 5789 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 5790 | wmi_ssid *ssid_ptr = NULL; |
| 5791 | uint32_t *bssid_preferred_factor_ptr = NULL; |
| 5792 | |
| 5793 | len = sizeof(wmi_roam_filter_fixed_param); |
| 5794 | len += WMI_TLV_HDR_SIZE; |
| 5795 | len += roam_req->len; |
| 5796 | |
| 5797 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5798 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5799 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5800 | return QDF_STATUS_E_NOMEM; |
| 5801 | } |
| 5802 | |
| 5803 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 5804 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 5805 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 5806 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 5807 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 5808 | /* fill in fixed values */ |
| 5809 | roam_filter->vdev_id = roam_req->session_id; |
| 5810 | roam_filter->flags = 0; |
| 5811 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 5812 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 5813 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 5814 | roam_filter->num_bssid_preferred_list = |
| 5815 | roam_req->num_bssid_preferred_list; |
| 5816 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 5817 | |
| 5818 | WMITLV_SET_HDR((buf_ptr), |
| 5819 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5820 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 5821 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 5822 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5823 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 5824 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 5825 | bssid_src_ptr += ATH_MAC_LEN; |
| 5826 | bssid_dst_ptr++; |
| 5827 | } |
| 5828 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5829 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 5830 | WMITLV_SET_HDR((buf_ptr), |
| 5831 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5832 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 5833 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5834 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 5835 | qdf_mem_copy(&ssid_ptr->ssid, |
| 5836 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 5837 | roam_req->ssid_allowed_list[i].length); |
| 5838 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 5839 | ssid_ptr++; |
| 5840 | } |
| 5841 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 5842 | sizeof(wmi_ssid)); |
| 5843 | WMITLV_SET_HDR((buf_ptr), |
| 5844 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 5845 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 5846 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 5847 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5848 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5849 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 5850 | (wmi_mac_addr *)bssid_dst_ptr); |
| 5851 | bssid_src_ptr += ATH_MAC_LEN; |
| 5852 | bssid_dst_ptr++; |
| 5853 | } |
| 5854 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5855 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 5856 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 5857 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 5858 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 5859 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 5860 | *bssid_preferred_factor_ptr = |
| 5861 | roam_req->bssid_favored_factor[i]; |
| 5862 | bssid_preferred_factor_ptr++; |
| 5863 | } |
| 5864 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 5865 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 5866 | |
| 5867 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5868 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5869 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5870 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5871 | status); |
| 5872 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5873 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5874 | |
| 5875 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5876 | } |
| 5877 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5878 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 5879 | * @wmi_handle: wmi handle |
| 5880 | * @req: epno config params request structure |
| 5881 | * |
| 5882 | * This function reads the incoming epno config request structure |
| 5883 | * and constructs the WMI message to the firmware. |
| 5884 | * |
| 5885 | * Returns: 0 on success, error number otherwise |
| 5886 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5887 | 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] | 5888 | struct wifi_enhanched_pno_params *req) |
| 5889 | { |
| 5890 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 5891 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5892 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5893 | u_int8_t i, *buf_ptr; |
| 5894 | wmi_buf_t buf; |
| 5895 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5896 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5897 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5898 | /* Fixed Params */ |
| 5899 | len = sizeof(*cmd); |
| 5900 | if (req->num_networks) { |
| 5901 | /* TLV place holder for array of structures |
| 5902 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 5903 | */ |
| 5904 | len += WMI_TLV_HDR_SIZE; |
| 5905 | len += (sizeof(nlo_configured_parameters) |
| 5906 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 5907 | /* TLV for array of uint32 channel_list */ |
| 5908 | len += WMI_TLV_HDR_SIZE; |
| 5909 | /* TLV for nlo_channel_prediction_cfg */ |
| 5910 | len += WMI_TLV_HDR_SIZE; |
| 5911 | /* TLV for candidate score params */ |
| 5912 | len += sizeof(enlo_candidate_score_params); |
| 5913 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5914 | |
| 5915 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5916 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5917 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5918 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5919 | } |
| 5920 | |
| 5921 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5922 | |
| 5923 | buf_ptr = (u_int8_t *) cmd; |
| 5924 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5925 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 5926 | WMITLV_GET_STRUCT_TLVLEN( |
| 5927 | wmi_nlo_config_cmd_fixed_param)); |
| 5928 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5929 | |
| 5930 | /* set flag to reset if num of networks are 0 */ |
| 5931 | cmd->flags = (req->num_networks == 0 ? |
| 5932 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5933 | |
| 5934 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 5935 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5936 | 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] | 5937 | WMI_LOGD("SSID count: %d flags: %d", |
| 5938 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5939 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5940 | /* Fill nlo_config only when num_networks are non zero */ |
| 5941 | if (cmd->no_of_ssids) { |
| 5942 | /* Fill networks */ |
| 5943 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5944 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 5945 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5946 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5947 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 5948 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 5949 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 5950 | WMITLV_TAG_ARRAY_BYTE, |
| 5951 | WMITLV_GET_STRUCT_TLVLEN( |
| 5952 | nlo_configured_parameters)); |
| 5953 | /* Copy ssid and it's length */ |
| 5954 | nlo_list[i].ssid.valid = true; |
| 5955 | nlo_list[i].ssid.ssid.ssid_len = |
| 5956 | req->networks[i].ssid.length; |
| 5957 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 5958 | req->networks[i].ssid.mac_ssid, |
| 5959 | nlo_list[i].ssid.ssid.ssid_len); |
| 5960 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 5961 | nlo_list[i].ssid.ssid.ssid_len, |
| 5962 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 5963 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5964 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5965 | /* Copy pno flags */ |
| 5966 | nlo_list[i].bcast_nw_type.valid = true; |
| 5967 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 5968 | req->networks[i].flags; |
| 5969 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5970 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 5971 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 5972 | /* Copy auth bit field */ |
| 5973 | nlo_list[i].auth_type.valid = true; |
| 5974 | nlo_list[i].auth_type.auth_type = |
| 5975 | req->networks[i].auth_bit_field; |
| 5976 | WMI_LOGD("Auth bit field (%u)", |
| 5977 | nlo_list[i].auth_type.auth_type); |
| 5978 | } |
| 5979 | |
| 5980 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 5981 | /* Fill the channel list */ |
| 5982 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 5983 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5984 | |
| 5985 | /* Fill prediction_param */ |
| 5986 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 5987 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5988 | |
| 5989 | /* Fill epno candidate score params */ |
| 5990 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 5991 | WMITLV_SET_HDR(buf_ptr, |
| 5992 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 5993 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 5994 | cand_score_params->min5GHz_rssi = |
| 5995 | req->min_5ghz_rssi; |
| 5996 | cand_score_params->min24GHz_rssi = |
| 5997 | req->min_24ghz_rssi; |
| 5998 | cand_score_params->initial_score_max = |
| 5999 | req->initial_score_max; |
| 6000 | cand_score_params->current_connection_bonus = |
| 6001 | req->current_connection_bonus; |
| 6002 | cand_score_params->same_network_bonus = |
| 6003 | req->same_network_bonus; |
| 6004 | cand_score_params->secure_bonus = |
| 6005 | req->secure_bonus; |
| 6006 | cand_score_params->band5GHz_bonus = |
| 6007 | req->band_5ghz_bonus; |
| 6008 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6009 | } |
| 6010 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6011 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6012 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6013 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6014 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6015 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6016 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6017 | } |
| 6018 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6019 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6020 | req->session_id); |
| 6021 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6022 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6023 | } |
| 6024 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6025 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6026 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 6027 | * @wmi_handle: wmi handle |
| 6028 | * @ipa_offload: ipa offload control parameter |
| 6029 | * |
| 6030 | * Returns: 0 on success, error number otherwise |
| 6031 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6032 | 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] | 6033 | struct ipa_offload_control_params *ipa_offload) |
| 6034 | { |
| 6035 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 6036 | wmi_buf_t wmi_buf; |
| 6037 | uint32_t len; |
| 6038 | u_int8_t *buf_ptr; |
| 6039 | |
| 6040 | len = sizeof(*cmd); |
| 6041 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6042 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6043 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 6044 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6045 | } |
| 6046 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6047 | WMI_LOGE("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6048 | ipa_offload->offload_type, ipa_offload->enable); |
| 6049 | |
| 6050 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 6051 | |
| 6052 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 6053 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6054 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 6055 | WMITLV_GET_STRUCT_TLVLEN( |
| 6056 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 6057 | |
| 6058 | cmd->offload_type = ipa_offload->offload_type; |
| 6059 | cmd->vdev_id = ipa_offload->vdev_id; |
| 6060 | cmd->enable = ipa_offload->enable; |
| 6061 | |
| 6062 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6063 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6064 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +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 | } |
| 6068 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6069 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6070 | } |
| 6071 | |
| 6072 | /** |
| 6073 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 6074 | * @wmi_handle: wmi handle |
| 6075 | * @pgetcapab: get capabilities params |
| 6076 | * |
| 6077 | * This function send request to fw to get extscan capabilities. |
| 6078 | * |
| 6079 | * Return: CDF status |
| 6080 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6081 | 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] | 6082 | struct extscan_capabilities_params *pgetcapab) |
| 6083 | { |
| 6084 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 6085 | wmi_buf_t wmi_buf; |
| 6086 | uint32_t len; |
| 6087 | uint8_t *buf_ptr; |
| 6088 | |
| 6089 | len = sizeof(*cmd); |
| 6090 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6091 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6092 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6093 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6094 | } |
| 6095 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6096 | |
| 6097 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 6098 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6099 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 6100 | WMITLV_GET_STRUCT_TLVLEN |
| 6101 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 6102 | |
| 6103 | cmd->request_id = pgetcapab->request_id; |
| 6104 | |
| 6105 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6106 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6107 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6108 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6109 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6110 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6111 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6112 | } |
| 6113 | |
| 6114 | /** |
| 6115 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 6116 | * @wmi_handle: wmi handle |
| 6117 | * @pcached_results: cached results parameters |
| 6118 | * |
| 6119 | * This function send request to fw to get cached results. |
| 6120 | * |
| 6121 | * Return: CDF status |
| 6122 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6123 | 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] | 6124 | struct extscan_cached_result_params *pcached_results) |
| 6125 | { |
| 6126 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 6127 | wmi_buf_t wmi_buf; |
| 6128 | uint32_t len; |
| 6129 | uint8_t *buf_ptr; |
| 6130 | |
| 6131 | len = sizeof(*cmd); |
| 6132 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6133 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6134 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6135 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6136 | } |
| 6137 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6138 | |
| 6139 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 6140 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6141 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 6142 | WMITLV_GET_STRUCT_TLVLEN |
| 6143 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 6144 | |
| 6145 | cmd->request_id = pcached_results->request_id; |
| 6146 | cmd->vdev_id = pcached_results->session_id; |
| 6147 | cmd->control_flags = pcached_results->flush; |
| 6148 | |
| 6149 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6150 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6151 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6152 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6153 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6154 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6155 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6156 | } |
| 6157 | |
| 6158 | /** |
| 6159 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 6160 | * @wmi_handle: wmi handle |
| 6161 | * @reset_req: Reset change request params |
| 6162 | * |
| 6163 | * This function sends stop change monitor request to fw. |
| 6164 | * |
| 6165 | * Return: CDF status |
| 6166 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6167 | 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] | 6168 | struct extscan_capabilities_reset_params *reset_req) |
| 6169 | { |
| 6170 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6171 | wmi_buf_t wmi_buf; |
| 6172 | uint32_t len; |
| 6173 | uint8_t *buf_ptr; |
| 6174 | int change_list = 0; |
| 6175 | |
| 6176 | len = sizeof(*cmd); |
| 6177 | |
| 6178 | /* reset significant change tlv is set to 0 */ |
| 6179 | len += WMI_TLV_HDR_SIZE; |
| 6180 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6181 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6182 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6183 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6184 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6185 | } |
| 6186 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6187 | |
| 6188 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6189 | buf_ptr; |
| 6190 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6191 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6192 | WMITLV_GET_STRUCT_TLVLEN |
| 6193 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6194 | |
| 6195 | cmd->request_id = reset_req->request_id; |
| 6196 | cmd->vdev_id = reset_req->session_id; |
| 6197 | cmd->mode = 0; |
| 6198 | |
| 6199 | buf_ptr += sizeof(*cmd); |
| 6200 | WMITLV_SET_HDR(buf_ptr, |
| 6201 | WMITLV_TAG_ARRAY_STRUC, |
| 6202 | change_list * |
| 6203 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6204 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 6205 | sizeof |
| 6206 | (wmi_extscan_wlan_change_bssid_param)); |
| 6207 | |
| 6208 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6209 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6210 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6211 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6212 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6213 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6214 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6215 | } |
| 6216 | |
| 6217 | /** |
| 6218 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 6219 | * @wmi_handle: wmi handle |
| 6220 | * @psigchange: change monitor request params |
| 6221 | * @buf: wmi buffer |
| 6222 | * @buf_len: buffer length |
| 6223 | * |
| 6224 | * This function fills elements of change monitor request buffer. |
| 6225 | * |
| 6226 | * Return: CDF status |
| 6227 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6228 | 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] | 6229 | struct extscan_set_sig_changereq_params |
| 6230 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 6231 | { |
| 6232 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6233 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 6234 | uint8_t *buf_ptr; |
| 6235 | int j; |
| 6236 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6237 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6238 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 6239 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6240 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6241 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 6242 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6243 | } |
| 6244 | len += WMI_TLV_HDR_SIZE; |
| 6245 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6246 | |
| 6247 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6248 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6249 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6250 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6251 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6252 | } |
| 6253 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6254 | cmd = |
| 6255 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6256 | buf_ptr; |
| 6257 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6258 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6259 | WMITLV_GET_STRUCT_TLVLEN |
| 6260 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6261 | |
| 6262 | cmd->request_id = psigchange->request_id; |
| 6263 | cmd->vdev_id = psigchange->session_id; |
| 6264 | cmd->total_entries = numap; |
| 6265 | cmd->mode = 1; |
| 6266 | cmd->num_entries_in_page = numap; |
| 6267 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 6268 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 6269 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 6270 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 6271 | |
| 6272 | buf_ptr += sizeof(*cmd); |
| 6273 | WMITLV_SET_HDR(buf_ptr, |
| 6274 | WMITLV_TAG_ARRAY_STRUC, |
| 6275 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6276 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 6277 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6278 | |
| 6279 | for (j = 0; j < numap; j++) { |
| 6280 | WMITLV_SET_HDR(dest_chglist, |
| 6281 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6282 | WMITLV_GET_STRUCT_TLVLEN |
| 6283 | (wmi_extscan_wlan_change_bssid_param)); |
| 6284 | |
| 6285 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 6286 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 6287 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 6288 | &dest_chglist->bssid); |
| 6289 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6290 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6291 | dest_chglist->lower_rssi_limit); |
| 6292 | dest_chglist++; |
| 6293 | src_ap++; |
| 6294 | } |
| 6295 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6296 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6297 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6298 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6299 | } |
| 6300 | |
| 6301 | /** |
| 6302 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 6303 | * @wmi_handle: wmi handle |
| 6304 | * @psigchange: change monitor request params |
| 6305 | * |
| 6306 | * This function sends start change monitor request to fw. |
| 6307 | * |
| 6308 | * Return: CDF status |
| 6309 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6310 | 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] | 6311 | struct extscan_set_sig_changereq_params * |
| 6312 | psigchange) |
| 6313 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6314 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6315 | wmi_buf_t buf; |
| 6316 | int len; |
| 6317 | |
| 6318 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6319 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6320 | psigchange, &buf, |
| 6321 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6322 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6323 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6324 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6325 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6326 | } |
| 6327 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6328 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 6329 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6330 | } |
| 6331 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6332 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6333 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6334 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6335 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6336 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6337 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6338 | } |
| 6339 | |
| 6340 | /** |
| 6341 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 6342 | * @wmi_handle: wmi handle |
| 6343 | * @photlist_reset: hotlist reset params |
| 6344 | * |
| 6345 | * This function configures hotlist monitor to stop in fw. |
| 6346 | * |
| 6347 | * Return: CDF status |
| 6348 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6349 | 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] | 6350 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 6351 | { |
| 6352 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 6353 | wmi_buf_t wmi_buf; |
| 6354 | uint32_t len; |
| 6355 | uint8_t *buf_ptr; |
| 6356 | int hotlist_entries = 0; |
| 6357 | |
| 6358 | len = sizeof(*cmd); |
| 6359 | |
| 6360 | /* reset bssid hotlist with tlv set to 0 */ |
| 6361 | len += WMI_TLV_HDR_SIZE; |
| 6362 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 6363 | |
| 6364 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6365 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6366 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6367 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6368 | } |
| 6369 | |
| 6370 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6371 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 6372 | buf_ptr; |
| 6373 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6374 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 6375 | WMITLV_GET_STRUCT_TLVLEN |
| 6376 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 6377 | |
| 6378 | cmd->request_id = photlist_reset->request_id; |
| 6379 | cmd->vdev_id = photlist_reset->session_id; |
| 6380 | cmd->mode = 0; |
| 6381 | |
| 6382 | buf_ptr += sizeof(*cmd); |
| 6383 | WMITLV_SET_HDR(buf_ptr, |
| 6384 | WMITLV_TAG_ARRAY_STRUC, |
| 6385 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6386 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6387 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6388 | |
| 6389 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6390 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6391 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6392 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6393 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6394 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6395 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6396 | } |
| 6397 | |
| 6398 | /** |
| 6399 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 6400 | * @wmi_handle: wmi handle |
| 6401 | * @pstopcmd: stop scan command request params |
| 6402 | * |
| 6403 | * This function sends stop extscan request to fw. |
| 6404 | * |
| 6405 | * Return: CDF Status. |
| 6406 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6407 | 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] | 6408 | struct extscan_stop_req_params *pstopcmd) |
| 6409 | { |
| 6410 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 6411 | wmi_buf_t wmi_buf; |
| 6412 | uint32_t len; |
| 6413 | uint8_t *buf_ptr; |
| 6414 | |
| 6415 | len = sizeof(*cmd); |
| 6416 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6417 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6418 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6419 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6420 | } |
| 6421 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6422 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 6423 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6424 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 6425 | WMITLV_GET_STRUCT_TLVLEN |
| 6426 | (wmi_extscan_stop_cmd_fixed_param)); |
| 6427 | |
| 6428 | cmd->request_id = pstopcmd->request_id; |
| 6429 | cmd->vdev_id = pstopcmd->session_id; |
| 6430 | |
| 6431 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6432 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6433 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6434 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6435 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6436 | } |
| 6437 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6438 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6439 | } |
| 6440 | |
| 6441 | /** |
| 6442 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 6443 | * @wmi_handle: wmi handle |
| 6444 | * @pstart: scan command request params |
| 6445 | * @buf: event buffer |
| 6446 | * @buf_len: length of buffer |
| 6447 | * |
| 6448 | * This function fills individual elements of extscan request and |
| 6449 | * TLV for buckets, channel list. |
| 6450 | * |
| 6451 | * Return: CDF Status. |
| 6452 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6453 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6454 | 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] | 6455 | struct wifi_scan_cmd_req_params *pstart, |
| 6456 | wmi_buf_t *buf, int *buf_len) |
| 6457 | { |
| 6458 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 6459 | wmi_extscan_bucket *dest_blist; |
| 6460 | wmi_extscan_bucket_channel *dest_clist; |
| 6461 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 6462 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 6463 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 6464 | |
| 6465 | uint8_t *buf_ptr; |
| 6466 | int i, k, count = 0; |
| 6467 | int len = sizeof(*cmd); |
| 6468 | int nbuckets = pstart->numBuckets; |
| 6469 | int nchannels = 0; |
| 6470 | |
| 6471 | /* These TLV's are are NULL by default */ |
| 6472 | uint32_t ie_len_with_pad = 0; |
| 6473 | int num_ssid = 0; |
| 6474 | int num_bssid = 0; |
| 6475 | int ie_len = 0; |
| 6476 | |
| 6477 | uint32_t base_period = pstart->basePeriod; |
| 6478 | |
| 6479 | /* TLV placeholder for ssid_list (NULL) */ |
| 6480 | len += WMI_TLV_HDR_SIZE; |
| 6481 | len += num_ssid * sizeof(wmi_ssid); |
| 6482 | |
| 6483 | /* TLV placeholder for bssid_list (NULL) */ |
| 6484 | len += WMI_TLV_HDR_SIZE; |
| 6485 | len += num_bssid * sizeof(wmi_mac_addr); |
| 6486 | |
| 6487 | /* TLV placeholder for ie_data (NULL) */ |
| 6488 | len += WMI_TLV_HDR_SIZE; |
| 6489 | len += ie_len * sizeof(uint32_t); |
| 6490 | |
| 6491 | /* TLV placeholder for bucket */ |
| 6492 | len += WMI_TLV_HDR_SIZE; |
| 6493 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 6494 | |
| 6495 | /* TLV channel placeholder */ |
| 6496 | len += WMI_TLV_HDR_SIZE; |
| 6497 | for (i = 0; i < nbuckets; i++) { |
| 6498 | nchannels += src_bucket->numChannels; |
| 6499 | src_bucket++; |
| 6500 | } |
| 6501 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6502 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6503 | __func__, nbuckets, nchannels); |
| 6504 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 6505 | /* Allocate the memory */ |
| 6506 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6507 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6508 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6509 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6510 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6511 | } |
| 6512 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6513 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 6514 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6515 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 6516 | WMITLV_GET_STRUCT_TLVLEN |
| 6517 | (wmi_extscan_start_cmd_fixed_param)); |
| 6518 | |
| 6519 | cmd->request_id = pstart->requestId; |
| 6520 | cmd->vdev_id = pstart->sessionId; |
| 6521 | cmd->base_period = pstart->basePeriod; |
| 6522 | cmd->num_buckets = nbuckets; |
| 6523 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 6524 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6525 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6526 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6527 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6528 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6529 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 6530 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6531 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 6532 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 6533 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6534 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 6535 | |
| 6536 | /* The max dwell time is retrieved from the first channel |
| 6537 | * of the first bucket and kept common for all channels. |
| 6538 | */ |
| 6539 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 6540 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 6541 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 6542 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 6543 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 6544 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 6545 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 6546 | |
| 6547 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6548 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6549 | cmd->probe_delay = 0; |
| 6550 | cmd->probe_spacing_time = 0; |
| 6551 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6552 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 6553 | WMI_SCAN_ADD_CCK_RATES | |
| 6554 | WMI_SCAN_ADD_OFDM_RATES | |
| 6555 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 6556 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6557 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 6558 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 6559 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6560 | cmd->num_ssids = 0; |
| 6561 | cmd->num_bssid = 0; |
| 6562 | cmd->ie_len = 0; |
| 6563 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 6564 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 6565 | |
| 6566 | buf_ptr += sizeof(*cmd); |
| 6567 | WMITLV_SET_HDR(buf_ptr, |
| 6568 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6569 | num_ssid * sizeof(wmi_ssid)); |
| 6570 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 6571 | |
| 6572 | WMITLV_SET_HDR(buf_ptr, |
| 6573 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6574 | num_bssid * sizeof(wmi_mac_addr)); |
| 6575 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 6576 | |
| 6577 | ie_len_with_pad = 0; |
| 6578 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 6579 | ie_len_with_pad); |
| 6580 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 6581 | |
| 6582 | WMITLV_SET_HDR(buf_ptr, |
| 6583 | WMITLV_TAG_ARRAY_STRUC, |
| 6584 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 6585 | dest_blist = (wmi_extscan_bucket *) |
| 6586 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6587 | src_bucket = pstart->buckets; |
| 6588 | |
| 6589 | /* Retrieve scanning information from each bucket and |
| 6590 | * channels and send it to the target |
| 6591 | */ |
| 6592 | for (i = 0; i < nbuckets; i++) { |
| 6593 | WMITLV_SET_HDR(dest_blist, |
| 6594 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6595 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 6596 | |
| 6597 | dest_blist->bucket_id = src_bucket->bucket; |
| 6598 | dest_blist->base_period_multiplier = |
| 6599 | src_bucket->period / base_period; |
| 6600 | dest_blist->min_period = src_bucket->period; |
| 6601 | dest_blist->max_period = src_bucket->max_period; |
| 6602 | dest_blist->exp_backoff = src_bucket->exponent; |
| 6603 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 6604 | dest_blist->channel_band = src_bucket->band; |
| 6605 | dest_blist->num_channels = src_bucket->numChannels; |
| 6606 | dest_blist->notify_extscan_events = 0; |
| 6607 | |
| 6608 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 6609 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 6610 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 6611 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6612 | |
| 6613 | if (src_bucket->reportEvents & |
| 6614 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 6615 | dest_blist->forwarding_flags = |
| 6616 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 6617 | dest_blist->notify_extscan_events |= |
| 6618 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 6619 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 6620 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 6621 | } else { |
| 6622 | dest_blist->forwarding_flags = |
| 6623 | WMI_EXTSCAN_NO_FORWARDING; |
| 6624 | } |
| 6625 | |
| 6626 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 6627 | dest_blist->configuration_flags = 0; |
| 6628 | else |
| 6629 | dest_blist->configuration_flags = |
| 6630 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 6631 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6632 | 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] | 6633 | __func__, dest_blist->notify_extscan_events, |
| 6634 | dest_blist->configuration_flags, |
| 6635 | dest_blist->forwarding_flags); |
| 6636 | |
| 6637 | dest_blist->min_dwell_time_active = |
| 6638 | src_bucket->min_dwell_time_active; |
| 6639 | dest_blist->max_dwell_time_active = |
| 6640 | src_bucket->max_dwell_time_active; |
| 6641 | dest_blist->min_dwell_time_passive = |
| 6642 | src_bucket->min_dwell_time_passive; |
| 6643 | dest_blist->max_dwell_time_passive = |
| 6644 | src_bucket->max_dwell_time_passive; |
| 6645 | src_channel = src_bucket->channels; |
| 6646 | |
| 6647 | /* save the channel info to later populate |
| 6648 | * the channel TLV |
| 6649 | */ |
| 6650 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 6651 | save_channel[count++].channel = src_channel->channel; |
| 6652 | src_channel++; |
| 6653 | } |
| 6654 | dest_blist++; |
| 6655 | src_bucket++; |
| 6656 | } |
| 6657 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 6658 | WMITLV_SET_HDR(buf_ptr, |
| 6659 | WMITLV_TAG_ARRAY_STRUC, |
| 6660 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6661 | dest_clist = (wmi_extscan_bucket_channel *) |
| 6662 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6663 | |
| 6664 | /* Active or passive scan is based on the bucket dwell time |
| 6665 | * and channel specific active,passive scans are not |
| 6666 | * supported yet |
| 6667 | */ |
| 6668 | for (i = 0; i < nchannels; i++) { |
| 6669 | WMITLV_SET_HDR(dest_clist, |
| 6670 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 6671 | WMITLV_GET_STRUCT_TLVLEN |
| 6672 | (wmi_extscan_bucket_channel)); |
| 6673 | dest_clist->channel = save_channel[i].channel; |
| 6674 | dest_clist++; |
| 6675 | } |
| 6676 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6677 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 6678 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6679 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6680 | } |
| 6681 | |
| 6682 | /** |
| 6683 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 6684 | * @wmi_handle: wmi handle |
| 6685 | * @pstart: scan command request params |
| 6686 | * |
| 6687 | * This function sends start extscan request to fw. |
| 6688 | * |
| 6689 | * Return: CDF Status. |
| 6690 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6691 | 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] | 6692 | struct wifi_scan_cmd_req_params *pstart) |
| 6693 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6694 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6695 | wmi_buf_t buf; |
| 6696 | int len; |
| 6697 | |
| 6698 | /* Fill individual elements of extscan request and |
| 6699 | * TLV for buckets, channel list. |
| 6700 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6701 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6702 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6703 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6704 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 6705 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6706 | } |
| 6707 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6708 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6709 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6710 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6711 | } |
| 6712 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 6713 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6714 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6715 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6716 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6717 | } |
| 6718 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6719 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6720 | } |
| 6721 | |
| 6722 | /** |
| 6723 | * send_plm_stop_cmd_tlv() - plm stop request |
| 6724 | * @wmi_handle: wmi handle |
| 6725 | * @plm: plm request parameters |
| 6726 | * |
| 6727 | * This function request FW to stop PLM. |
| 6728 | * |
| 6729 | * Return: CDF status |
| 6730 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6731 | 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] | 6732 | const struct plm_req_params *plm) |
| 6733 | { |
| 6734 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 6735 | int32_t len; |
| 6736 | wmi_buf_t buf; |
| 6737 | uint8_t *buf_ptr; |
| 6738 | int ret; |
| 6739 | |
| 6740 | len = sizeof(*cmd); |
| 6741 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6742 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6743 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6744 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6745 | } |
| 6746 | |
| 6747 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 6748 | |
| 6749 | buf_ptr = (uint8_t *) cmd; |
| 6750 | |
| 6751 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6752 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 6753 | WMITLV_GET_STRUCT_TLVLEN |
| 6754 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 6755 | |
| 6756 | cmd->vdev_id = plm->session_id; |
| 6757 | |
| 6758 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6759 | 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] | 6760 | |
| 6761 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6762 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 6763 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6764 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6765 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6766 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6767 | } |
| 6768 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6769 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6770 | } |
| 6771 | |
| 6772 | /** |
| 6773 | * send_plm_start_cmd_tlv() - plm start request |
| 6774 | * @wmi_handle: wmi handle |
| 6775 | * @plm: plm request parameters |
| 6776 | * |
| 6777 | * This function request FW to start PLM. |
| 6778 | * |
| 6779 | * Return: CDF status |
| 6780 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6781 | 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] | 6782 | const struct plm_req_params *plm, |
| 6783 | uint32_t *gchannel_list) |
| 6784 | { |
| 6785 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 6786 | uint32_t *channel_list; |
| 6787 | int32_t len; |
| 6788 | wmi_buf_t buf; |
| 6789 | uint8_t *buf_ptr; |
| 6790 | uint8_t count; |
| 6791 | int ret; |
| 6792 | |
| 6793 | /* TLV place holder for channel_list */ |
| 6794 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 6795 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 6796 | |
| 6797 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6798 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6799 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6800 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6801 | } |
| 6802 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 6803 | |
| 6804 | buf_ptr = (uint8_t *) cmd; |
| 6805 | |
| 6806 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6807 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 6808 | WMITLV_GET_STRUCT_TLVLEN |
| 6809 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 6810 | |
| 6811 | cmd->vdev_id = plm->session_id; |
| 6812 | |
| 6813 | cmd->meas_token = plm->meas_token; |
| 6814 | cmd->dialog_token = plm->diag_token; |
| 6815 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6816 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6817 | cmd->off_duration = plm->meas_duration; |
| 6818 | cmd->burst_cycle = plm->burst_len; |
| 6819 | cmd->tx_power = plm->desired_tx_pwr; |
| 6820 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 6821 | cmd->num_chans = plm->plm_num_ch; |
| 6822 | |
| 6823 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 6824 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6825 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 6826 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 6827 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 6828 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 6829 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 6830 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 6831 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 6832 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6833 | |
| 6834 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6835 | (cmd->num_chans * sizeof(uint32_t))); |
| 6836 | |
| 6837 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6838 | if (cmd->num_chans) { |
| 6839 | channel_list = (uint32_t *) buf_ptr; |
| 6840 | for (count = 0; count < cmd->num_chans; count++) { |
| 6841 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6842 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6843 | channel_list[count] = |
| 6844 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6845 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6846 | } |
| 6847 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 6848 | } |
| 6849 | |
| 6850 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6851 | WMI_VDEV_PLMREQ_START_CMDID); |
| 6852 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6853 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6854 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6855 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6856 | } |
| 6857 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6858 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6859 | } |
| 6860 | |
| 6861 | /** |
| 6862 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 6863 | * @wmi_handle: wmi handle |
| 6864 | * @vdev_id: vdev id |
| 6865 | * |
| 6866 | * This function request FW to stop ongoing PNO operation. |
| 6867 | * |
| 6868 | * Return: CDF status |
| 6869 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6870 | 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] | 6871 | { |
| 6872 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6873 | int32_t len = sizeof(*cmd); |
| 6874 | wmi_buf_t buf; |
| 6875 | uint8_t *buf_ptr; |
| 6876 | int ret; |
| 6877 | |
| 6878 | /* |
| 6879 | * TLV place holder for array of structures nlo_configured_parameters |
| 6880 | * TLV place holder for array of uint32_t channel_list |
| 6881 | * TLV place holder for chnl prediction cfg |
| 6882 | */ |
| 6883 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6884 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6885 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6886 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6887 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6888 | } |
| 6889 | |
| 6890 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6891 | buf_ptr = (uint8_t *) cmd; |
| 6892 | |
| 6893 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6894 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6895 | WMITLV_GET_STRUCT_TLVLEN |
| 6896 | (wmi_nlo_config_cmd_fixed_param)); |
| 6897 | |
| 6898 | cmd->vdev_id = vdev_id; |
| 6899 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 6900 | buf_ptr += sizeof(*cmd); |
| 6901 | |
| 6902 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6903 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6904 | |
| 6905 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6906 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6907 | |
| 6908 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6909 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6910 | |
| 6911 | |
| 6912 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6913 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 6914 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6915 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6916 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6917 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6918 | } |
| 6919 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6920 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6921 | } |
| 6922 | |
| 6923 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6924 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 6925 | * @buf_ptr: Buffer passed by upper layers |
| 6926 | * @pno: Buffer to be sent to the firmware |
| 6927 | * |
| 6928 | * Copy the PNO Channel prediction configuration parameters |
| 6929 | * passed by the upper layers to a WMI format TLV and send it |
| 6930 | * down to the firmware. |
| 6931 | * |
| 6932 | * Return: None |
| 6933 | */ |
| 6934 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 6935 | struct pno_scan_req_params *pno) |
| 6936 | { |
| 6937 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 6938 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 6939 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 6940 | WMITLV_TAG_ARRAY_BYTE, |
| 6941 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6942 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6943 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 6944 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 6945 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 6946 | channel_prediction_cfg->full_scan_period_ms = |
| 6947 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 6948 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 6949 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 6950 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 6951 | channel_prediction_cfg->enable, |
| 6952 | channel_prediction_cfg->top_k_num, |
| 6953 | channel_prediction_cfg->stationary_threshold, |
| 6954 | channel_prediction_cfg->full_scan_period_ms); |
| 6955 | } |
| 6956 | |
| 6957 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6958 | * send_pno_start_cmd_tlv() - PNO start request |
| 6959 | * @wmi_handle: wmi handle |
| 6960 | * @pno: PNO request |
| 6961 | * |
| 6962 | * This function request FW to start PNO request. |
| 6963 | * Request: CDF status |
| 6964 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6965 | static QDF_STATUS send_pno_start_cmd_tlv(wmi_unified_t wmi_handle, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 6966 | struct pno_scan_req_params *pno) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6967 | { |
| 6968 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6969 | nlo_configured_parameters *nlo_list; |
| 6970 | uint32_t *channel_list; |
| 6971 | int32_t len; |
| 6972 | wmi_buf_t buf; |
| 6973 | uint8_t *buf_ptr; |
| 6974 | uint8_t i; |
| 6975 | int ret; |
| 6976 | |
| 6977 | /* |
| 6978 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 6979 | * TLV place holder for array of uint32_t channel_list |
| 6980 | * TLV place holder for chnnl prediction cfg |
| 6981 | */ |
| 6982 | len = sizeof(*cmd) + |
| 6983 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 6984 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 6985 | len += sizeof(uint32_t) * QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6986 | WMI_NLO_MAX_CHAN); |
| 6987 | len += sizeof(nlo_configured_parameters) * |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 6988 | QDF_MIN(pno->networks_cnt, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6989 | len += sizeof(nlo_channel_prediction_cfg); |
| 6990 | |
| 6991 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6992 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6993 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6994 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6995 | } |
| 6996 | |
| 6997 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6998 | |
| 6999 | buf_ptr = (uint8_t *) cmd; |
| 7000 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7001 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 7002 | WMITLV_GET_STRUCT_TLVLEN |
| 7003 | (wmi_nlo_config_cmd_fixed_param)); |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7004 | cmd->vdev_id = pno->vdev_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7005 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 7006 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7007 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 7008 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7009 | pno->adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7010 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7011 | /* Current FW does not support min-max range for dwell time */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7012 | cmd->active_dwell_time = pno->active_dwell_time; |
| 7013 | cmd->passive_dwell_time = pno->passive_dwell_time; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7014 | |
| 7015 | /* Copy scan interval */ |
| 7016 | cmd->fast_scan_period = pno->fast_scan_period; |
| 7017 | cmd->slow_scan_period = pno->slow_scan_period; |
Arif Hussain | 17ff203 | 2017-03-02 11:56:04 -0800 | [diff] [blame] | 7018 | cmd->delay_start_time = WMI_SEC_TO_MSEC(pno->delay_start_time); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7019 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7020 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7021 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7022 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7023 | |
| 7024 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 7025 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7026 | cmd->no_of_ssids = QDF_MIN(pno->networks_cnt, WMI_NLO_MAX_SSIDS); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7027 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7028 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7029 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 7030 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7031 | |
| 7032 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 7033 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 7034 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 7035 | WMITLV_TAG_ARRAY_BYTE, |
| 7036 | WMITLV_GET_STRUCT_TLVLEN |
| 7037 | (nlo_configured_parameters)); |
| 7038 | /* Copy ssid and it's length */ |
| 7039 | nlo_list[i].ssid.valid = true; |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7040 | nlo_list[i].ssid.ssid.ssid_len = |
| 7041 | pno->networks_list[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7042 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7043 | pno->networks_list[i].ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7044 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7045 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7046 | nlo_list[i].ssid.ssid.ssid_len, |
| 7047 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 7048 | nlo_list[i].ssid.ssid.ssid_len); |
| 7049 | |
| 7050 | /* Copy rssi threshold */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7051 | if (pno->networks_list[i].rssi_thresh && |
| 7052 | pno->networks_list[i].rssi_thresh > |
| 7053 | WMI_RSSI_THOLD_DEFAULT) { |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7054 | nlo_list[i].rssi_cond.valid = true; |
| 7055 | nlo_list[i].rssi_cond.rssi = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7056 | pno->networks_list[i].rssi_thresh; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7057 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7058 | nlo_list[i].rssi_cond.rssi); |
| 7059 | } |
| 7060 | nlo_list[i].bcast_nw_type.valid = true; |
| 7061 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7062 | pno->networks_list[i].bc_new_type; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7063 | WMI_LOGI("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7064 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 7065 | } |
| 7066 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 7067 | |
| 7068 | /* Copy channel info */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7069 | cmd->num_of_channels = QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7070 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7071 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7072 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7073 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 7074 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7075 | |
| 7076 | channel_list = (uint32_t *) buf_ptr; |
| 7077 | for (i = 0; i < cmd->num_of_channels; i++) { |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7078 | channel_list[i] = pno->networks_list[0].channels[i]; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7079 | |
| 7080 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7081 | channel_list[i] = |
| 7082 | wlan_chan_to_freq(pno-> |
| 7083 | networks_list[0].channels[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7084 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7085 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7086 | } |
| 7087 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 7088 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7089 | sizeof(nlo_channel_prediction_cfg)); |
| 7090 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7091 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7092 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7093 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 7094 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 7095 | */ |
| 7096 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7097 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 7098 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7099 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7100 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7101 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7102 | } |
| 7103 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7104 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7105 | } |
| 7106 | |
| 7107 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 7108 | * @wmi_handle: wmi handle |
| 7109 | * @msg: message |
| 7110 | * @is_add_ts: is addts required |
| 7111 | * |
| 7112 | * This function sets ric request element for 11r roaming. |
| 7113 | * |
| 7114 | * Return: CDF status |
| 7115 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7116 | 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] | 7117 | void *msg, uint8_t is_add_ts) |
| 7118 | { |
| 7119 | wmi_ric_request_fixed_param *cmd; |
| 7120 | wmi_ric_tspec *tspec_param; |
| 7121 | wmi_buf_t buf; |
| 7122 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7123 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7124 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 7125 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 7126 | |
| 7127 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7128 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7129 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 7130 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7131 | } |
| 7132 | |
| 7133 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7134 | |
| 7135 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 7136 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7137 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 7138 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 7139 | if (is_add_ts) |
| 7140 | cmd->vdev_id = ((struct add_ts_param *) msg)->sessionId; |
| 7141 | else |
| 7142 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 7143 | cmd->num_ric_request = 1; |
| 7144 | cmd->is_add_ric = is_add_ts; |
| 7145 | |
| 7146 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 7147 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 7148 | |
| 7149 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7150 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 7151 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 7152 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 7153 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 7154 | |
| 7155 | if (is_add_ts) |
| 7156 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7157 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7158 | else |
| 7159 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7160 | #endif |
| 7161 | if (ptspecIE) { |
| 7162 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7163 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7164 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 7165 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7166 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7167 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 7168 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7169 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 7170 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7171 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 7172 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 7173 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 7174 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 7175 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 7176 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 7177 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 7178 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 7179 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 7180 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 7181 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 7182 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 7183 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 7184 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 7185 | tspec_param->medium_time = 0; |
| 7186 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7187 | 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] | 7188 | |
| 7189 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7190 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7191 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7192 | __func__); |
| 7193 | if (is_add_ts) |
| 7194 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7195 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7196 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7197 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7198 | } |
| 7199 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7200 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7201 | } |
| 7202 | |
| 7203 | /** |
| 7204 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 7205 | * @wmi_handle: wmi handle |
| 7206 | * @clear_req: ll stats clear request command params |
| 7207 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7208 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7209 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7210 | 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] | 7211 | const struct ll_stats_clear_params *clear_req, |
| 7212 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7213 | { |
| 7214 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 7215 | int32_t len; |
| 7216 | wmi_buf_t buf; |
| 7217 | uint8_t *buf_ptr; |
| 7218 | int ret; |
| 7219 | |
| 7220 | len = sizeof(*cmd); |
| 7221 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7222 | |
| 7223 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7224 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7225 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7226 | } |
| 7227 | |
| 7228 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7229 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7230 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 7231 | |
| 7232 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7233 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 7234 | WMITLV_GET_STRUCT_TLVLEN |
| 7235 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 7236 | |
| 7237 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 7238 | cmd->vdev_id = clear_req->sta_id; |
| 7239 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 7240 | |
| 7241 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7242 | &cmd->peer_macaddr); |
| 7243 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7244 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 7245 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 7246 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 7247 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 7248 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7249 | cmd->peer_macaddr); */ |
| 7250 | |
| 7251 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7252 | WMI_CLEAR_LINK_STATS_CMDID); |
| 7253 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7254 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7255 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7256 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7257 | } |
| 7258 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7259 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 7260 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7261 | } |
| 7262 | |
| 7263 | /** |
| 7264 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 7265 | * @wmi_handle: wmi handle |
| 7266 | * @setReq: ll stats set request command params |
| 7267 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7268 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7269 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7270 | 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] | 7271 | const struct ll_stats_set_params *set_req) |
| 7272 | { |
| 7273 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 7274 | int32_t len; |
| 7275 | wmi_buf_t buf; |
| 7276 | uint8_t *buf_ptr; |
| 7277 | int ret; |
| 7278 | |
| 7279 | len = sizeof(*cmd); |
| 7280 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7281 | |
| 7282 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7283 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7284 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7285 | } |
| 7286 | |
| 7287 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7288 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7289 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 7290 | |
| 7291 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7292 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 7293 | WMITLV_GET_STRUCT_TLVLEN |
| 7294 | (wmi_start_link_stats_cmd_fixed_param)); |
| 7295 | |
| 7296 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 7297 | cmd->aggressive_statistics_gathering = |
| 7298 | set_req->aggressive_statistics_gathering; |
| 7299 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7300 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 7301 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 7302 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7303 | |
| 7304 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7305 | WMI_START_LINK_STATS_CMDID); |
| 7306 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7307 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7308 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7309 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7310 | } |
| 7311 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7312 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7313 | } |
| 7314 | |
| 7315 | /** |
| 7316 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 7317 | * @wmi_handle:wmi handle |
| 7318 | * @get_req:ll stats get request command params |
| 7319 | * @addr: mac address |
| 7320 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7321 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7322 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7323 | 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] | 7324 | const struct ll_stats_get_params *get_req, |
| 7325 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7326 | { |
| 7327 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 7328 | int32_t len; |
| 7329 | wmi_buf_t buf; |
| 7330 | uint8_t *buf_ptr; |
| 7331 | int ret; |
| 7332 | |
| 7333 | len = sizeof(*cmd); |
| 7334 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7335 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 7336 | if (!buf) { |
| 7337 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 7338 | return QDF_STATUS_E_NOMEM; |
| 7339 | } |
| 7340 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7341 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7342 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7343 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 7344 | |
| 7345 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7346 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 7347 | WMITLV_GET_STRUCT_TLVLEN |
| 7348 | (wmi_request_link_stats_cmd_fixed_param)); |
| 7349 | |
| 7350 | cmd->request_id = get_req->req_id; |
| 7351 | cmd->stats_type = get_req->param_id_mask; |
| 7352 | cmd->vdev_id = get_req->sta_id; |
| 7353 | |
| 7354 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7355 | &cmd->peer_macaddr); |
| 7356 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7357 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
Krishna Kumaar Natarajan | f6a996c | 2017-03-10 17:24:55 -0800 | [diff] [blame] | 7358 | WMI_LOGD("Request ID : %u", cmd->request_id); |
| 7359 | WMI_LOGD("Stats Type : %0x", cmd->stats_type); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7360 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 7361 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7362 | |
| 7363 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7364 | WMI_REQUEST_LINK_STATS_CMDID); |
| 7365 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7366 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7367 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7368 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7369 | } |
| 7370 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7371 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7372 | } |
| 7373 | |
| 7374 | /** |
| 7375 | * send_get_stats_cmd_tlv() - get stats request |
| 7376 | * @wmi_handle: wmi handle |
| 7377 | * @get_stats_param: stats params |
| 7378 | * @addr: mac address |
| 7379 | * |
| 7380 | * Return: CDF status |
| 7381 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7382 | 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] | 7383 | struct pe_stats_req *get_stats_param, |
| 7384 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7385 | { |
| 7386 | wmi_buf_t buf; |
| 7387 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7388 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7389 | |
| 7390 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7391 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7392 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 7393 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7394 | } |
| 7395 | |
| 7396 | |
| 7397 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7398 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7399 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7400 | WMITLV_GET_STRUCT_TLVLEN |
| 7401 | (wmi_request_stats_cmd_fixed_param)); |
| 7402 | cmd->stats_id = |
| 7403 | WMI_REQUEST_PEER_STAT | WMI_REQUEST_PDEV_STAT | |
Himanshu Agarwal | c9fc2a3 | 2016-07-21 14:46:58 +0530 | [diff] [blame] | 7404 | WMI_REQUEST_VDEV_STAT | WMI_REQUEST_RSSI_PER_CHAIN_STAT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7405 | cmd->vdev_id = get_stats_param->session_id; |
| 7406 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, &cmd->peer_macaddr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7407 | WMI_LOGD("STATS REQ VDEV_ID:%d-->", cmd->vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7408 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7409 | WMI_REQUEST_STATS_CMDID)) { |
| 7410 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7411 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7412 | __func__); |
| 7413 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7414 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7415 | } |
| 7416 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7417 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7418 | |
| 7419 | } |
| 7420 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7421 | /** |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 7422 | * send_congestion_cmd_tlv() - send request to fw to get CCA |
| 7423 | * @wmi_handle: wmi handle |
| 7424 | * @vdev_id: vdev id |
| 7425 | * |
| 7426 | * Return: CDF status |
| 7427 | */ |
| 7428 | static QDF_STATUS send_congestion_cmd_tlv(wmi_unified_t wmi_handle, |
| 7429 | A_UINT8 vdev_id) |
| 7430 | { |
| 7431 | wmi_buf_t buf; |
| 7432 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7433 | uint8_t len; |
| 7434 | uint8_t *buf_ptr; |
| 7435 | |
| 7436 | len = sizeof(*cmd); |
| 7437 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7438 | if (!buf) { |
| 7439 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 7440 | return QDF_STATUS_E_FAILURE; |
| 7441 | } |
| 7442 | |
| 7443 | buf_ptr = wmi_buf_data(buf); |
| 7444 | cmd = (wmi_request_stats_cmd_fixed_param *)buf_ptr; |
| 7445 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7446 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7447 | WMITLV_GET_STRUCT_TLVLEN |
| 7448 | (wmi_request_stats_cmd_fixed_param)); |
| 7449 | |
| 7450 | cmd->stats_id = WMI_REQUEST_CONGESTION_STAT; |
| 7451 | cmd->vdev_id = vdev_id; |
| 7452 | WMI_LOGD("STATS REQ VDEV_ID:%d stats_id %d -->", |
| 7453 | cmd->vdev_id, cmd->stats_id); |
| 7454 | |
| 7455 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7456 | WMI_REQUEST_STATS_CMDID)) { |
| 7457 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
| 7458 | __func__); |
| 7459 | wmi_buf_free(buf); |
| 7460 | return QDF_STATUS_E_FAILURE; |
| 7461 | } |
| 7462 | |
| 7463 | return QDF_STATUS_SUCCESS; |
| 7464 | } |
| 7465 | |
| 7466 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7467 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 7468 | * @wmi_handle: wmi handle |
| 7469 | * @rssi_req: get RSSI request |
| 7470 | * |
| 7471 | * Return: CDF status |
| 7472 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7473 | 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] | 7474 | { |
| 7475 | wmi_buf_t buf; |
| 7476 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7477 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7478 | |
| 7479 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7480 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7481 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7482 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7483 | } |
| 7484 | |
| 7485 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7486 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7487 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7488 | WMITLV_GET_STRUCT_TLVLEN |
| 7489 | (wmi_request_stats_cmd_fixed_param)); |
| 7490 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 7491 | if (wmi_unified_cmd_send |
| 7492 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7493 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7494 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7495 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7496 | } |
| 7497 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7498 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7499 | } |
| 7500 | |
| 7501 | /** |
| 7502 | * send_snr_cmd_tlv() - get RSSI from fw |
| 7503 | * @wmi_handle: wmi handle |
| 7504 | * @vdev_id: vdev id |
| 7505 | * |
| 7506 | * Return: CDF status |
| 7507 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7508 | 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] | 7509 | { |
| 7510 | wmi_buf_t buf; |
| 7511 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7512 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7513 | |
| 7514 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7515 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7516 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7517 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7518 | } |
| 7519 | |
| 7520 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7521 | cmd->vdev_id = vdev_id; |
| 7522 | |
| 7523 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7524 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7525 | WMITLV_GET_STRUCT_TLVLEN |
| 7526 | (wmi_request_stats_cmd_fixed_param)); |
| 7527 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 7528 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7529 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7530 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7531 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7532 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7533 | } |
| 7534 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7535 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7536 | } |
| 7537 | |
| 7538 | /** |
| 7539 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 7540 | * @wmi_handle: wmi handle |
| 7541 | * @link_status: get link params |
| 7542 | * |
| 7543 | * Return: CDF status |
| 7544 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7545 | 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] | 7546 | struct link_status_params *link_status) |
| 7547 | { |
| 7548 | wmi_buf_t buf; |
| 7549 | wmi_request_stats_cmd_fixed_param *cmd; |
| 7550 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 7551 | |
| 7552 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7553 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7554 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7555 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7556 | } |
| 7557 | |
| 7558 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 7559 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7560 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 7561 | WMITLV_GET_STRUCT_TLVLEN |
| 7562 | (wmi_request_stats_cmd_fixed_param)); |
| 7563 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 7564 | cmd->vdev_id = link_status->session_id; |
| 7565 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7566 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7567 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7568 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7569 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7570 | } |
| 7571 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7572 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7573 | } |
| 7574 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7575 | /** |
| 7576 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 7577 | * @wmi_handle: wmi handle |
| 7578 | * @ta_dhcp_ind: DHCP indication parameter |
| 7579 | * |
| 7580 | * Return: CDF Status |
| 7581 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7582 | 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] | 7583 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 7584 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7585 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7586 | wmi_buf_t buf = NULL; |
| 7587 | uint8_t *buf_ptr; |
| 7588 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 7589 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 7590 | |
| 7591 | |
| 7592 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7593 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7594 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7595 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7596 | } |
| 7597 | |
| 7598 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7599 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 7600 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 7601 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 7602 | WMITLV_GET_STRUCT_TLVLEN |
| 7603 | (wmi_peer_set_param_cmd_fixed_param)); |
| 7604 | |
| 7605 | /* fill in values */ |
| 7606 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 7607 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 7608 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7609 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7610 | &ta_dhcp_ind->peer_macaddr, |
| 7611 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 7612 | |
| 7613 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7614 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7615 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7616 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7617 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 7618 | wmi_buf_free(buf); |
| 7619 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7620 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7621 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7622 | } |
| 7623 | |
| 7624 | /** |
| 7625 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 7626 | * @wmi_handle: wmi handle |
| 7627 | * @pLinkSpeed: link speed info |
| 7628 | * |
| 7629 | * Return: CDF status |
| 7630 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7631 | 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] | 7632 | wmi_mac_addr peer_macaddr) |
| 7633 | { |
| 7634 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 7635 | wmi_buf_t wmi_buf; |
| 7636 | uint32_t len; |
| 7637 | uint8_t *buf_ptr; |
| 7638 | |
| 7639 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 7640 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7641 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7642 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7643 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7644 | } |
| 7645 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7646 | |
| 7647 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 7648 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7649 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 7650 | WMITLV_GET_STRUCT_TLVLEN |
| 7651 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 7652 | |
| 7653 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7654 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7655 | &peer_macaddr, |
| 7656 | sizeof(peer_macaddr)); |
| 7657 | |
| 7658 | |
| 7659 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7660 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7661 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7662 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7663 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7664 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7665 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7666 | } |
| 7667 | |
| 7668 | /** |
| 7669 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 7670 | * @wmi_handle: wmi handler |
| 7671 | * @egap_params: pointer to egap_params |
| 7672 | * |
| 7673 | * Return: 0 for success, otherwise appropriate error code |
| 7674 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7675 | 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] | 7676 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 7677 | { |
| 7678 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 7679 | wmi_buf_t buf; |
| 7680 | int32_t err; |
| 7681 | |
| 7682 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 7683 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7684 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 7685 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7686 | } |
| 7687 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 7688 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7689 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 7690 | WMITLV_GET_STRUCT_TLVLEN( |
| 7691 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 7692 | |
| 7693 | cmd->enable = egap_params->enable; |
| 7694 | cmd->inactivity_time = egap_params->inactivity_time; |
| 7695 | cmd->wait_time = egap_params->wait_time; |
| 7696 | cmd->flags = egap_params->flags; |
| 7697 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 7698 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 7699 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7700 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7701 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7702 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7703 | } |
| 7704 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7705 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7706 | } |
| 7707 | |
| 7708 | /** |
| 7709 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 7710 | * @wmi_handl: wmi handle |
| 7711 | * @cmd: Profiling command index |
| 7712 | * @value1: parameter1 value |
| 7713 | * @value2: parameter2 value |
| 7714 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7715 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7716 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7717 | 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] | 7718 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 7719 | { |
| 7720 | wmi_buf_t buf; |
| 7721 | int32_t len = 0; |
| 7722 | int ret; |
| 7723 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 7724 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 7725 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 7726 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 7727 | |
| 7728 | switch (cmd) { |
| 7729 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 7730 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 7731 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7732 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7733 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7734 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7735 | } |
| 7736 | prof_trig_cmd = |
| 7737 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 7738 | wmi_buf_data(buf); |
| 7739 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 7740 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 7741 | WMITLV_GET_STRUCT_TLVLEN |
| 7742 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 7743 | prof_trig_cmd->enable = value1; |
| 7744 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7745 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 7746 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7747 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7748 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7749 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7750 | return ret; |
| 7751 | } |
| 7752 | break; |
| 7753 | |
| 7754 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 7755 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 7756 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7757 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7758 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7759 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7760 | } |
| 7761 | profile_getdata_cmd = |
| 7762 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 7763 | wmi_buf_data(buf); |
| 7764 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 7765 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 7766 | WMITLV_GET_STRUCT_TLVLEN |
| 7767 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 7768 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7769 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 7770 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7771 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7772 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7773 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7774 | return ret; |
| 7775 | } |
| 7776 | break; |
| 7777 | |
| 7778 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 7779 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 7780 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7781 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7782 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7783 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7784 | } |
| 7785 | hist_intvl_cmd = |
| 7786 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 7787 | wmi_buf_data(buf); |
| 7788 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 7789 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 7790 | WMITLV_GET_STRUCT_TLVLEN |
| 7791 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 7792 | hist_intvl_cmd->profile_id = value1; |
| 7793 | hist_intvl_cmd->value = value2; |
| 7794 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7795 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 7796 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7797 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7798 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7799 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7800 | return ret; |
| 7801 | } |
| 7802 | break; |
| 7803 | |
| 7804 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 7805 | len = |
| 7806 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 7807 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7808 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7809 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7810 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7811 | } |
| 7812 | profile_enable_cmd = |
| 7813 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 7814 | wmi_buf_data(buf); |
| 7815 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 7816 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 7817 | WMITLV_GET_STRUCT_TLVLEN |
| 7818 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 7819 | profile_enable_cmd->profile_id = value1; |
| 7820 | profile_enable_cmd->enable = value2; |
| 7821 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7822 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 7823 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7824 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7825 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7826 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7827 | return ret; |
| 7828 | } |
| 7829 | break; |
| 7830 | |
| 7831 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7832 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7833 | break; |
| 7834 | } |
| 7835 | |
| 7836 | return 0; |
| 7837 | } |
| 7838 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7839 | /** |
| 7840 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 7841 | * @wmi_handle: wmi handle |
| 7842 | * @vdev_id: vdev id |
| 7843 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7844 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7845 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7846 | 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] | 7847 | { |
| 7848 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 7849 | wmi_buf_t buf; |
| 7850 | int32_t len = sizeof(*cmd); |
| 7851 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7852 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7853 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7854 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7855 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7856 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7857 | } |
| 7858 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 7859 | wmi_buf_data(buf); |
| 7860 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7861 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 7862 | WMITLV_GET_STRUCT_TLVLEN |
| 7863 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 7864 | cmd->vdev_id = vdev_id; |
| 7865 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 7866 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7867 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7868 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7869 | __func__); |
| 7870 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7871 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7872 | } |
| 7873 | |
| 7874 | return 0; |
| 7875 | } |
| 7876 | |
| 7877 | /** |
| 7878 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 7879 | * @wmi_handle: wmi handle |
| 7880 | * @vdev_id: vdev id |
| 7881 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 7882 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7883 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7884 | 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] | 7885 | uint8_t vdev_id) |
| 7886 | { |
| 7887 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 7888 | wmi_buf_t buf; |
| 7889 | int32_t len = sizeof(*cmd); |
| 7890 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7891 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7892 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7893 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7894 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7895 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7896 | } |
| 7897 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 7898 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7899 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 7900 | WMITLV_GET_STRUCT_TLVLEN |
| 7901 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 7902 | cmd->vdev_id = vdev_id; |
| 7903 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 7904 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7905 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7906 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7907 | __func__); |
| 7908 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7909 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7910 | } |
| 7911 | |
| 7912 | return 0; |
| 7913 | } |
| 7914 | |
| 7915 | /** |
| 7916 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 7917 | * @wmi_handle: wmi handle |
| 7918 | * @startOemDataReq: start request params |
| 7919 | * |
| 7920 | * Return: CDF status |
| 7921 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7922 | 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] | 7923 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7924 | uint8_t *data) |
| 7925 | { |
| 7926 | wmi_buf_t buf; |
| 7927 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7928 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7929 | |
| 7930 | buf = wmi_buf_alloc(wmi_handle, |
| 7931 | (data_len + WMI_TLV_HDR_SIZE)); |
| 7932 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7933 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 7934 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7935 | } |
| 7936 | |
| 7937 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 7938 | |
| 7939 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 7940 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7941 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7942 | data_len); |
| 7943 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7944 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7945 | data_len); |
| 7946 | |
| 7947 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 7948 | (data_len + |
| 7949 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 7950 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7951 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7952 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7953 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7954 | } |
| 7955 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7956 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7957 | } |
| 7958 | |
| 7959 | /** |
| 7960 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 7961 | * @wmi_handle: wmi handle |
| 7962 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 7963 | * |
| 7964 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 7965 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 7966 | * to firmware based on phyerr filtering |
| 7967 | * offload status. |
| 7968 | * |
| 7969 | * Return: 1 success, 0 failure |
| 7970 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7971 | static QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7972 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 7973 | bool dfs_phyerr_filter_offload) |
| 7974 | { |
| 7975 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 7976 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 7977 | wmi_buf_t buf; |
| 7978 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 7979 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7980 | |
| 7981 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 7982 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7983 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7984 | __func__); |
| 7985 | len = sizeof(*disable_phyerr_offload_cmd); |
| 7986 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7987 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7988 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7989 | return 0; |
| 7990 | } |
| 7991 | disable_phyerr_offload_cmd = |
| 7992 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 7993 | wmi_buf_data(buf); |
| 7994 | |
| 7995 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 7996 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 7997 | WMITLV_GET_STRUCT_TLVLEN |
| 7998 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 7999 | |
| 8000 | /* |
| 8001 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 8002 | * to the firmware to disable the phyerror |
| 8003 | * filtering offload. |
| 8004 | */ |
| 8005 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8006 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8007 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8008 | 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] | 8009 | __func__, ret); |
| 8010 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8011 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8012 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8013 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8014 | __func__); |
| 8015 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8016 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8017 | __func__); |
| 8018 | |
| 8019 | len = sizeof(*enable_phyerr_offload_cmd); |
| 8020 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8021 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8022 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8023 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8024 | } |
| 8025 | |
| 8026 | enable_phyerr_offload_cmd = |
| 8027 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 8028 | wmi_buf_data(buf); |
| 8029 | |
| 8030 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 8031 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 8032 | WMITLV_GET_STRUCT_TLVLEN |
| 8033 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 8034 | |
| 8035 | /* |
| 8036 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 8037 | * to the firmware to enable the phyerror |
| 8038 | * filtering offload. |
| 8039 | */ |
| 8040 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8041 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 8042 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8043 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8044 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8045 | __func__, ret); |
| 8046 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8047 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8048 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8049 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8050 | __func__); |
| 8051 | } |
| 8052 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8053 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8054 | } |
| 8055 | |
| 8056 | #if !defined(REMOVE_PKT_LOG) |
| 8057 | /** |
| 8058 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 8059 | * @wmi_handle: wmi handle |
| 8060 | * @pktlog_event: pktlog event |
| 8061 | * @cmd_id: pktlog cmd id |
| 8062 | * |
| 8063 | * Return: CDF status |
| 8064 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8065 | 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] | 8066 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 8067 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8068 | { |
| 8069 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 8070 | WMI_CMD_ID CMD_ID; |
| 8071 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 8072 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 8073 | int len = 0; |
| 8074 | wmi_buf_t buf; |
| 8075 | |
| 8076 | PKTLOG_EVENT = pktlog_event; |
| 8077 | CMD_ID = cmd_id; |
| 8078 | |
| 8079 | switch (CMD_ID) { |
| 8080 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 8081 | len = sizeof(*cmd); |
| 8082 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8083 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8084 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8085 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8086 | } |
| 8087 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 8088 | wmi_buf_data(buf); |
| 8089 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8090 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 8091 | WMITLV_GET_STRUCT_TLVLEN |
| 8092 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 8093 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 8094 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 8095 | : WMI_PKTLOG_ENABLE_AUTO; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8096 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 8097 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8098 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8099 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8100 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8101 | goto wmi_send_failed; |
| 8102 | } |
| 8103 | break; |
| 8104 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 8105 | len = sizeof(*disable_cmd); |
| 8106 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8107 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8108 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8109 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8110 | } |
| 8111 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 8112 | wmi_buf_data(buf); |
| 8113 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 8114 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 8115 | WMITLV_GET_STRUCT_TLVLEN |
| 8116 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8117 | disable_cmd->pdev_id = |
| 8118 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 8119 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8120 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8121 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8122 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8123 | goto wmi_send_failed; |
| 8124 | } |
| 8125 | break; |
| 8126 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8127 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8128 | break; |
| 8129 | } |
| 8130 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8131 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8132 | |
| 8133 | wmi_send_failed: |
| 8134 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8135 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8136 | } |
| 8137 | #endif /* REMOVE_PKT_LOG */ |
| 8138 | |
| 8139 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8140 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 8141 | * @wmi_handle: wmi handle |
| 8142 | * @ptrn_id: pattern id |
| 8143 | * @vdev_id: vdev id |
| 8144 | * |
| 8145 | * Return: CDF status |
| 8146 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 8147 | static QDF_STATUS send_wow_delete_pattern_cmd_tlv(wmi_unified_t wmi_handle, |
| 8148 | uint8_t ptrn_id, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8149 | { |
| 8150 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 8151 | wmi_buf_t buf; |
| 8152 | int32_t len; |
| 8153 | int ret; |
| 8154 | |
| 8155 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 8156 | |
| 8157 | |
| 8158 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8159 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8160 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8161 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8162 | } |
| 8163 | |
| 8164 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 8165 | |
| 8166 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8167 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 8168 | WMITLV_GET_STRUCT_TLVLEN( |
| 8169 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 8170 | cmd->vdev_id = vdev_id; |
| 8171 | cmd->pattern_id = ptrn_id; |
| 8172 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 8173 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8174 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8175 | cmd->pattern_id, vdev_id); |
| 8176 | |
| 8177 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8178 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 8179 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8180 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8181 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8182 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8183 | } |
| 8184 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8185 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8186 | } |
| 8187 | |
| 8188 | /** |
| 8189 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 8190 | * @wmi_handle: wmi handle |
| 8191 | * |
| 8192 | * Sends host wakeup indication to FW. On receiving this indication, |
| 8193 | * FW will come out of WOW. |
| 8194 | * |
| 8195 | * Return: CDF status |
| 8196 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8197 | 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] | 8198 | { |
| 8199 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 8200 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8201 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8202 | int32_t len; |
| 8203 | int ret; |
| 8204 | |
| 8205 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 8206 | |
| 8207 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8208 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8209 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8210 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8211 | } |
| 8212 | |
| 8213 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 8214 | wmi_buf_data(buf); |
| 8215 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8216 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 8217 | WMITLV_GET_STRUCT_TLVLEN |
| 8218 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 8219 | |
| 8220 | |
| 8221 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8222 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 8223 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8224 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8225 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8226 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8227 | } |
| 8228 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8229 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8230 | } |
| 8231 | |
| 8232 | /** |
| 8233 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8234 | * @wmi_handle: wmi handle |
| 8235 | * @msg: delts params |
| 8236 | * |
| 8237 | * Return: CDF status |
| 8238 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8239 | 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] | 8240 | uint8_t ac) |
| 8241 | { |
| 8242 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8243 | wmi_buf_t buf; |
| 8244 | int32_t len = sizeof(*cmd); |
| 8245 | |
| 8246 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8247 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8248 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8249 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8250 | } |
| 8251 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8252 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8253 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8254 | WMITLV_GET_STRUCT_TLVLEN |
| 8255 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8256 | cmd->vdev_id = vdev_id; |
| 8257 | cmd->ac = ac; |
| 8258 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8259 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8260 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8261 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8262 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8263 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8264 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8265 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8266 | } |
| 8267 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8268 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8269 | } |
| 8270 | |
| 8271 | /** |
| 8272 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8273 | * @wmi_handle: handle to wmi |
| 8274 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8275 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8276 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8277 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8278 | * active flow. |
| 8279 | * |
| 8280 | * Return: CDF status |
| 8281 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8282 | 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] | 8283 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8284 | { |
| 8285 | int i = 0; |
| 8286 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8287 | wmi_buf_t buf; |
| 8288 | int32_t len = sizeof(*cmd); |
| 8289 | |
| 8290 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 8291 | /* if flow in this AC is active */ |
| 8292 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 8293 | /* |
| 8294 | * as per implementation of wma_add_ts_req() we |
| 8295 | * are not waiting any response from firmware so |
| 8296 | * apart from sending ADDTS to firmware just send |
| 8297 | * success to upper layers |
| 8298 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8299 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8300 | |
| 8301 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8302 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8303 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8304 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8305 | } |
| 8306 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 8307 | wmi_buf_data(buf); |
| 8308 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8309 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8310 | WMITLV_GET_STRUCT_TLVLEN |
| 8311 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8312 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 8313 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 8314 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8315 | traffic.userPrio); |
| 8316 | cmd->medium_time_us = |
| 8317 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 8318 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8319 | 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] | 8320 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 8321 | cmd->medium_time_us, cmd->downgrade_type); |
| 8322 | if (wmi_unified_cmd_send |
| 8323 | (wmi_handle, buf, len, |
| 8324 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8325 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8326 | __func__); |
| 8327 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8328 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8329 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8330 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8331 | } |
| 8332 | } |
| 8333 | } |
| 8334 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8335 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8336 | } |
| 8337 | |
| 8338 | /** |
| 8339 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 8340 | * @wmi_handle: wmi handle |
| 8341 | * @msg: ADDTS params |
| 8342 | * |
| 8343 | * Return: CDF status |
| 8344 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8345 | 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] | 8346 | struct add_ts_param *msg) |
| 8347 | { |
| 8348 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8349 | wmi_buf_t buf; |
| 8350 | int32_t len = sizeof(*cmd); |
| 8351 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8352 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8353 | |
| 8354 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8355 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8356 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8357 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8358 | } |
| 8359 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8360 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8361 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 8362 | WMITLV_GET_STRUCT_TLVLEN |
| 8363 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 8364 | cmd->vdev_id = msg->sme_session_id; |
| 8365 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 8366 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 8367 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8368 | 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] | 8369 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 8370 | cmd->downgrade_type, __func__, __LINE__); |
| 8371 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8372 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8373 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 8374 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8375 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8376 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8377 | } |
| 8378 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8379 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8380 | } |
| 8381 | |
| 8382 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8383 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 8384 | * @wmi_handle: wmi handle |
| 8385 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 8386 | * |
| 8387 | * Retrun: CDF status |
| 8388 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8389 | 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] | 8390 | struct periodic_tx_pattern * |
| 8391 | pAddPeriodicTxPtrnParams, |
| 8392 | uint8_t vdev_id) |
| 8393 | { |
| 8394 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8395 | wmi_buf_t wmi_buf; |
| 8396 | uint32_t len; |
| 8397 | uint8_t *buf_ptr; |
| 8398 | uint32_t ptrn_len, ptrn_len_aligned; |
| 8399 | int j; |
| 8400 | |
| 8401 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8402 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 8403 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 8404 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 8405 | |
| 8406 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8407 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8408 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8409 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8410 | } |
| 8411 | |
| 8412 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8413 | |
| 8414 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 8415 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8416 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8417 | WMITLV_GET_STRUCT_TLVLEN |
| 8418 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8419 | |
| 8420 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8421 | cmd->vdev_id = vdev_id; |
| 8422 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 8423 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 8424 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 8425 | |
| 8426 | /* Pattern info */ |
| 8427 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8428 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 8429 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8430 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8431 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8432 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8433 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8434 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8435 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8436 | |
| 8437 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8438 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8439 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8440 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8441 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8442 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8443 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8444 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8445 | } |
| 8446 | |
| 8447 | /** |
| 8448 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 8449 | * @wmi_handle: wmi handle |
| 8450 | * @vdev_id: vdev id |
| 8451 | * @pattern_id: pattern id |
| 8452 | * |
| 8453 | * Retrun: CDF status |
| 8454 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8455 | 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] | 8456 | uint8_t vdev_id, |
| 8457 | uint8_t pattern_id) |
| 8458 | { |
| 8459 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 8460 | wmi_buf_t wmi_buf; |
| 8461 | uint32_t len = |
| 8462 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 8463 | |
| 8464 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8465 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8466 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8467 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8468 | } |
| 8469 | |
| 8470 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 8471 | wmi_buf_data(wmi_buf); |
| 8472 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8473 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 8474 | WMITLV_GET_STRUCT_TLVLEN |
| 8475 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 8476 | |
| 8477 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 8478 | cmd->vdev_id = vdev_id; |
| 8479 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8480 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8481 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 8482 | |
| 8483 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8484 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8485 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8486 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8487 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8488 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8489 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8490 | } |
| 8491 | |
| 8492 | /** |
| 8493 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 8494 | * @wmi_handle: wmi handle |
| 8495 | * @preq: stats ext params |
| 8496 | * |
| 8497 | * Return: CDF status |
| 8498 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8499 | 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] | 8500 | struct stats_ext_params *preq) |
| 8501 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8502 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8503 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 8504 | wmi_buf_t buf; |
| 8505 | uint16_t len; |
| 8506 | uint8_t *buf_ptr; |
| 8507 | |
| 8508 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 8509 | |
| 8510 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8511 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8512 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8513 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8514 | } |
| 8515 | |
| 8516 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8517 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 8518 | |
| 8519 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8520 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 8521 | WMITLV_GET_STRUCT_TLVLEN |
| 8522 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 8523 | cmd->vdev_id = preq->vdev_id; |
| 8524 | cmd->data_len = preq->request_data_len; |
| 8525 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8526 | 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] | 8527 | __func__, preq->request_data_len, preq->vdev_id); |
| 8528 | |
| 8529 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 8530 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 8531 | |
| 8532 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8533 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8534 | |
| 8535 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8536 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8537 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8538 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8539 | ret); |
| 8540 | wmi_buf_free(buf); |
| 8541 | } |
| 8542 | |
| 8543 | return ret; |
| 8544 | } |
| 8545 | |
| 8546 | /** |
| 8547 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 8548 | * @wmi_handle: wmi handle |
| 8549 | * @params: ext wow params |
| 8550 | * |
| 8551 | * Return:0 for success or error code |
| 8552 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8553 | 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] | 8554 | struct ext_wow_params *params) |
| 8555 | { |
| 8556 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 8557 | wmi_buf_t buf; |
| 8558 | int32_t len; |
| 8559 | int ret; |
| 8560 | |
| 8561 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 8562 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8563 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8564 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8565 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8566 | } |
| 8567 | |
| 8568 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8569 | |
| 8570 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8571 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 8572 | WMITLV_GET_STRUCT_TLVLEN |
| 8573 | (wmi_extwow_enable_cmd_fixed_param)); |
| 8574 | |
| 8575 | cmd->vdev_id = params->vdev_id; |
| 8576 | cmd->type = params->type; |
| 8577 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 8578 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8579 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8580 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 8581 | |
| 8582 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8583 | WMI_EXTWOW_ENABLE_CMDID); |
| 8584 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8585 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8586 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8587 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8588 | } |
| 8589 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8590 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8591 | |
| 8592 | } |
| 8593 | |
| 8594 | /** |
| 8595 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 8596 | * @wmi_handle: wmi handle |
| 8597 | * @app_type1_params: app type1 params |
| 8598 | * |
| 8599 | * Return: CDF status |
| 8600 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8601 | 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] | 8602 | struct app_type1_params *app_type1_params) |
| 8603 | { |
| 8604 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 8605 | wmi_buf_t buf; |
| 8606 | int32_t len; |
| 8607 | int ret; |
| 8608 | |
| 8609 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 8610 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8611 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8612 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8613 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8614 | } |
| 8615 | |
| 8616 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 8617 | wmi_buf_data(buf); |
| 8618 | |
| 8619 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8620 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 8621 | WMITLV_GET_STRUCT_TLVLEN |
| 8622 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 8623 | |
| 8624 | cmd->vdev_id = app_type1_params->vdev_id; |
| 8625 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 8626 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8627 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8628 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8629 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8630 | cmd->passwd_len = app_type1_params->pass_length; |
| 8631 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8632 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8633 | "identification_id %.8s id_length %u " |
| 8634 | "password %.16s pass_length %u", |
| 8635 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 8636 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 8637 | |
| 8638 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8639 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 8640 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8641 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8642 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8643 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8644 | } |
| 8645 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8646 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8647 | } |
| 8648 | |
| 8649 | /** |
| 8650 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 8651 | * @wmi_handle: wmi handle |
| 8652 | * @appType2Params: app type2 params |
| 8653 | * |
| 8654 | * Return: CDF status |
| 8655 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8656 | 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] | 8657 | struct app_type2_params *appType2Params) |
| 8658 | { |
| 8659 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 8660 | wmi_buf_t buf; |
| 8661 | int32_t len; |
| 8662 | int ret; |
| 8663 | |
| 8664 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 8665 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8666 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8667 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8668 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8669 | } |
| 8670 | |
| 8671 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 8672 | wmi_buf_data(buf); |
| 8673 | |
| 8674 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8675 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 8676 | WMITLV_GET_STRUCT_TLVLEN |
| 8677 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 8678 | |
| 8679 | cmd->vdev_id = appType2Params->vdev_id; |
| 8680 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8681 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8682 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 8683 | |
| 8684 | cmd->ip_id = appType2Params->ip_id; |
| 8685 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 8686 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 8687 | |
| 8688 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 8689 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 8690 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 8691 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 8692 | |
| 8693 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 8694 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 8695 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 8696 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 8697 | |
| 8698 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 8699 | &cmd->gateway_mac); |
| 8700 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 8701 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 8702 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8703 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8704 | "rc4_key %.16s rc4_key_len %u " |
| 8705 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 8706 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 8707 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 8708 | "keepalive_max %u keepalive_inc %u " |
| 8709 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 8710 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 8711 | cmd->rc4_key, cmd->rc4_key_len, |
| 8712 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 8713 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 8714 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 8715 | cmd->keepalive_max, cmd->keepalive_inc, |
| 8716 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 8717 | |
| 8718 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8719 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 8720 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8721 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8722 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8723 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8724 | } |
| 8725 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8726 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8727 | |
| 8728 | } |
| 8729 | |
| 8730 | /** |
| 8731 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 8732 | * @wmi_handle: wmi handle |
| 8733 | * @timer_val: auto shutdown timer value |
| 8734 | * |
| 8735 | * Return: CDF status |
| 8736 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8737 | 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] | 8738 | uint32_t timer_val) |
| 8739 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8740 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8741 | wmi_buf_t buf = NULL; |
| 8742 | uint8_t *buf_ptr; |
| 8743 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 8744 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 8745 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8746 | 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] | 8747 | __func__, timer_val); |
| 8748 | |
| 8749 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8750 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8751 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8752 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8753 | } |
| 8754 | |
| 8755 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8756 | wmi_auto_sh_cmd = |
| 8757 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 8758 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 8759 | |
| 8760 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 8761 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 8762 | WMITLV_GET_STRUCT_TLVLEN |
| 8763 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 8764 | |
| 8765 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8766 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8767 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8768 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8769 | __func__, status); |
| 8770 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8771 | } |
| 8772 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8773 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8774 | } |
| 8775 | |
| 8776 | /** |
| 8777 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 8778 | * @wmi_handle: wmi handle |
| 8779 | * @nan_req: request data which will be non-null |
| 8780 | * |
| 8781 | * Return: CDF status |
| 8782 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8783 | 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] | 8784 | struct nan_req_params *nan_req) |
| 8785 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8786 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8787 | wmi_nan_cmd_param *cmd; |
| 8788 | wmi_buf_t buf; |
| 8789 | uint16_t len = sizeof(*cmd); |
| 8790 | uint16_t nan_data_len, nan_data_len_aligned; |
| 8791 | uint8_t *buf_ptr; |
| 8792 | |
| 8793 | /* |
| 8794 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 8795 | * +------------+----------+-----------------------+--------------+ |
| 8796 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 8797 | * +------------+----------+-----------------------+--------------+ |
| 8798 | */ |
| 8799 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8800 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 8801 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8802 | } |
| 8803 | nan_data_len = nan_req->request_data_len; |
| 8804 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 8805 | sizeof(uint32_t)); |
| 8806 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 8807 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8808 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8809 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8810 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8811 | } |
| 8812 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8813 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 8814 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8815 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 8816 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 8817 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8818 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8819 | __func__, nan_req->request_data_len); |
| 8820 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 8821 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 8822 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8823 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8824 | |
| 8825 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8826 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8827 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8828 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8829 | __func__, ret); |
| 8830 | wmi_buf_free(buf); |
| 8831 | } |
| 8832 | |
| 8833 | return ret; |
| 8834 | } |
| 8835 | |
| 8836 | /** |
| 8837 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 8838 | * @wmi_handle: wmi handle |
| 8839 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 8840 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8841 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8842 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8843 | 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] | 8844 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 8845 | { |
| 8846 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 8847 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8848 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8849 | |
| 8850 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8851 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8852 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8853 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8854 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8855 | } |
| 8856 | |
| 8857 | 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] | 8858 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8859 | |
| 8860 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8861 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 8862 | WMITLV_GET_STRUCT_TLVLEN |
| 8863 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 8864 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 8865 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 8866 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 8867 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 8868 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8869 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8870 | sizeof(*cmd), |
| 8871 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8872 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8873 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8874 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8875 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8876 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8877 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8878 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8879 | |
| 8880 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8881 | } |
| 8882 | |
| 8883 | /** |
| 8884 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 8885 | * @wmi_handle: wmi handle |
| 8886 | * @flashing: flashing request |
| 8887 | * |
| 8888 | * Return: CDF status |
| 8889 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8890 | 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] | 8891 | struct flashing_req_params *flashing) |
| 8892 | { |
| 8893 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8894 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8895 | wmi_buf_t buf; |
| 8896 | uint8_t *buf_ptr; |
| 8897 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 8898 | |
| 8899 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8900 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8901 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8902 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8903 | } |
| 8904 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8905 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 8906 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8907 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 8908 | WMITLV_GET_STRUCT_TLVLEN |
| 8909 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 8910 | cmd->pattern_id = flashing->pattern_id; |
| 8911 | cmd->led_x0 = flashing->led_x0; |
| 8912 | cmd->led_x1 = flashing->led_x1; |
| 8913 | |
| 8914 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8915 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8916 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8917 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8918 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8919 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8920 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8921 | |
| 8922 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8923 | } |
| 8924 | |
| 8925 | /** |
| 8926 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 8927 | * @wmi_handle: wmi handle |
| 8928 | * @ch_avoid_update_req: channel avoid update params |
| 8929 | * |
| 8930 | * Return: CDF status |
| 8931 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8932 | 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] | 8933 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8934 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8935 | wmi_buf_t buf = NULL; |
| 8936 | uint8_t *buf_ptr; |
| 8937 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 8938 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 8939 | |
| 8940 | |
| 8941 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8942 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8943 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8944 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8945 | } |
| 8946 | |
| 8947 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8948 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 8949 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 8950 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 8951 | WMITLV_GET_STRUCT_TLVLEN |
| 8952 | (wmi_chan_avoid_update_cmd_param)); |
| 8953 | |
| 8954 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8955 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8956 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8957 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8958 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 8959 | " returned Error %d", status); |
| 8960 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8961 | } |
| 8962 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8963 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8964 | } |
| 8965 | |
| 8966 | /** |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 8967 | * send_pdev_set_regdomain_cmd_tlv() - send set regdomain command to fw |
| 8968 | * @wmi_handle: wmi handle |
| 8969 | * @param: pointer to pdev regdomain params |
| 8970 | * |
| 8971 | * Return: 0 for success or error code |
| 8972 | */ |
| 8973 | static QDF_STATUS |
| 8974 | send_pdev_set_regdomain_cmd_tlv(wmi_unified_t wmi_handle, |
| 8975 | struct pdev_set_regdomain_params *param) |
| 8976 | { |
| 8977 | wmi_buf_t buf; |
| 8978 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 8979 | int32_t len = sizeof(*cmd); |
| 8980 | |
| 8981 | |
| 8982 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8983 | if (!buf) { |
| 8984 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8985 | return QDF_STATUS_E_NOMEM; |
| 8986 | } |
| 8987 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 8988 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8989 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 8990 | WMITLV_GET_STRUCT_TLVLEN |
| 8991 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 8992 | |
| 8993 | cmd->reg_domain = param->currentRDinuse; |
| 8994 | cmd->reg_domain_2G = param->currentRD2G; |
| 8995 | cmd->reg_domain_5G = param->currentRD5G; |
| 8996 | cmd->conformance_test_limit_2G = param->ctl_2G; |
| 8997 | cmd->conformance_test_limit_5G = param->ctl_5G; |
| 8998 | cmd->dfs_domain = param->dfsDomain; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8999 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9000 | param->pdev_id); |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 9001 | |
| 9002 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9003 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
| 9004 | WMI_LOGE("%s: Failed to send pdev set regdomain command", |
| 9005 | __func__); |
| 9006 | wmi_buf_free(buf); |
| 9007 | return QDF_STATUS_E_FAILURE; |
| 9008 | } |
| 9009 | |
| 9010 | return QDF_STATUS_SUCCESS; |
| 9011 | } |
| 9012 | |
| 9013 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9014 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 9015 | * @wmi_handle: wmi handle |
| 9016 | * @reg_dmn: reg domain |
| 9017 | * @regdmn2G: 2G reg domain |
| 9018 | * @regdmn5G: 5G reg domain |
| 9019 | * @ctl2G: 2G test limit |
| 9020 | * @ctl5G: 5G test limit |
| 9021 | * |
| 9022 | * Return: none |
| 9023 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9024 | 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] | 9025 | uint32_t reg_dmn, uint16_t regdmn2G, |
| 9026 | uint16_t regdmn5G, int8_t ctl2G, |
| 9027 | int8_t ctl5G) |
| 9028 | { |
| 9029 | wmi_buf_t buf; |
| 9030 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9031 | int32_t len = sizeof(*cmd); |
| 9032 | |
| 9033 | |
| 9034 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9035 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9036 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9037 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9038 | } |
| 9039 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9040 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9041 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9042 | WMITLV_GET_STRUCT_TLVLEN |
| 9043 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9044 | cmd->reg_domain = reg_dmn; |
| 9045 | cmd->reg_domain_2G = regdmn2G; |
| 9046 | cmd->reg_domain_5G = regdmn5G; |
| 9047 | cmd->conformance_test_limit_2G = ctl2G; |
| 9048 | cmd->conformance_test_limit_5G = ctl5G; |
| 9049 | |
| 9050 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9051 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9052 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9053 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9054 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9055 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9056 | } |
| 9057 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9058 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9059 | } |
| 9060 | |
| 9061 | |
| 9062 | /** |
| 9063 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 9064 | * @wmi_handle: wmi handle |
| 9065 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 9066 | * |
| 9067 | * This function sets tdls off channel mode |
| 9068 | * |
| 9069 | * Return: 0 on success; Negative errno otherwise |
| 9070 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9071 | 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] | 9072 | struct tdls_channel_switch_params *chan_switch_params) |
| 9073 | { |
| 9074 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9075 | wmi_buf_t wmi_buf; |
| 9076 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9077 | |
| 9078 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9079 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9080 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9081 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9082 | } |
| 9083 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9084 | wmi_buf_data(wmi_buf); |
| 9085 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9086 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9087 | WMITLV_GET_STRUCT_TLVLEN( |
| 9088 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9089 | |
| 9090 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9091 | &cmd->peer_macaddr); |
| 9092 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9093 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9094 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9095 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9096 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9097 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9098 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9099 | 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] | 9100 | cmd->peer_macaddr.mac_addr31to0, |
| 9101 | cmd->peer_macaddr.mac_addr47to32); |
| 9102 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9103 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9104 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9105 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9106 | ), |
| 9107 | cmd->vdev_id, |
| 9108 | cmd->offchan_mode, |
| 9109 | cmd->offchan_num, |
| 9110 | cmd->offchan_bw_bitmap, |
| 9111 | cmd->is_peer_responder, |
| 9112 | cmd->offchan_oper_class); |
| 9113 | |
| 9114 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9115 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9116 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9117 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9118 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9119 | } |
| 9120 | |
| 9121 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9122 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9123 | } |
| 9124 | |
| 9125 | /** |
| 9126 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9127 | * @wmi_handle: wmi handle |
| 9128 | * @pwmaTdlsparams: TDLS params |
| 9129 | * |
| 9130 | * Return: 0 for sucess or error code |
| 9131 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9132 | 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] | 9133 | void *tdls_param, uint8_t tdls_state) |
| 9134 | { |
| 9135 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9136 | wmi_buf_t wmi_buf; |
| 9137 | |
| 9138 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9139 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9140 | |
| 9141 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9142 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9143 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9144 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9145 | } |
| 9146 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9147 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9148 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9149 | WMITLV_GET_STRUCT_TLVLEN |
| 9150 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9151 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9152 | cmd->state = tdls_state; |
| 9153 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9154 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9155 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9156 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9157 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9158 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9159 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9160 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9161 | wmi_tdls->peer_traffic_response_timeout; |
| 9162 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9163 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9164 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9165 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9166 | cmd->teardown_notification_ms = |
| 9167 | wmi_tdls->teardown_notification_ms; |
| 9168 | cmd->tdls_peer_kickout_threshold = |
| 9169 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9170 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9171 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9172 | "notification_interval_ms: %d, " |
| 9173 | "tx_discovery_threshold: %d, " |
| 9174 | "tx_teardown_threshold: %d, " |
| 9175 | "rssi_teardown_threshold: %d, " |
| 9176 | "rssi_delta: %d, " |
| 9177 | "tdls_options: 0x%x, " |
| 9178 | "tdls_peer_traffic_ind_window: %d, " |
| 9179 | "tdls_peer_traffic_response_timeout: %d, " |
| 9180 | "tdls_puapsd_mask: 0x%x, " |
| 9181 | "tdls_puapsd_inactivity_time: %d, " |
| 9182 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9183 | "teardown_notification_ms: %d, " |
| 9184 | "tdls_peer_kickout_threshold: %d", |
| 9185 | __func__, tdls_state, cmd->state, |
| 9186 | cmd->notification_interval_ms, |
| 9187 | cmd->tx_discovery_threshold, |
| 9188 | cmd->tx_teardown_threshold, |
| 9189 | cmd->rssi_teardown_threshold, |
| 9190 | cmd->rssi_delta, |
| 9191 | cmd->tdls_options, |
| 9192 | cmd->tdls_peer_traffic_ind_window, |
| 9193 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9194 | cmd->tdls_puapsd_mask, |
| 9195 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9196 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9197 | cmd->teardown_notification_ms, |
| 9198 | cmd->tdls_peer_kickout_threshold); |
| 9199 | |
| 9200 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9201 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9202 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9203 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9204 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9205 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9206 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9207 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9208 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9209 | } |
| 9210 | |
| 9211 | /** |
| 9212 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9213 | * @wmi_handle: wmi handle |
| 9214 | * @peerStateParams: TDLS peer state params |
| 9215 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9216 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9217 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9218 | 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] | 9219 | struct tdls_peer_state_params *peerStateParams, |
| 9220 | uint32_t *ch_mhz) |
| 9221 | { |
| 9222 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9223 | wmi_tdls_peer_capabilities *peer_cap; |
| 9224 | wmi_channel *chan_info; |
| 9225 | wmi_buf_t wmi_buf; |
| 9226 | uint8_t *buf_ptr; |
| 9227 | uint32_t i; |
| 9228 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9229 | sizeof(wmi_tdls_peer_capabilities); |
| 9230 | |
| 9231 | |
| 9232 | len += WMI_TLV_HDR_SIZE + |
| 9233 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9234 | |
| 9235 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9236 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9237 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9238 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9239 | } |
| 9240 | |
| 9241 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9242 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9243 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9244 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9245 | WMITLV_GET_STRUCT_TLVLEN |
| 9246 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9247 | |
| 9248 | cmd->vdev_id = peerStateParams->vdevId; |
| 9249 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9250 | &cmd->peer_macaddr); |
| 9251 | |
| 9252 | |
| 9253 | cmd->peer_state = peerStateParams->peerState; |
| 9254 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9255 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9256 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9257 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9258 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9259 | cmd->peer_macaddr.mac_addr31to0, |
| 9260 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9261 | |
| 9262 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9263 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9264 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9265 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9266 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9267 | |
| 9268 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9269 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9270 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9271 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9272 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9273 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9274 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9275 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9276 | |
| 9277 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9278 | * but fill SP |
| 9279 | */ |
| 9280 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9281 | peerStateParams->peerCap.peerMaxSp); |
| 9282 | |
| 9283 | peer_cap->buff_sta_support = |
| 9284 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9285 | peer_cap->off_chan_support = |
| 9286 | peerStateParams->peerCap.peerOffChanSupport; |
| 9287 | peer_cap->peer_curr_operclass = |
| 9288 | peerStateParams->peerCap.peerCurrOperClass; |
| 9289 | /* self curr operclass is not being used and so pass op class for |
| 9290 | * preferred off chan in it. |
| 9291 | */ |
| 9292 | peer_cap->self_curr_operclass = |
| 9293 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 9294 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 9295 | peer_cap->peer_operclass_len = |
| 9296 | peerStateParams->peerCap.peerOperClassLen; |
| 9297 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9298 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9299 | __func__, peer_cap->peer_operclass_len); |
| 9300 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 9301 | peer_cap->peer_operclass[i] = |
| 9302 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9303 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9304 | __func__, i, peer_cap->peer_operclass[i]); |
| 9305 | } |
| 9306 | |
| 9307 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 9308 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 9309 | peer_cap->pref_offchan_bw = |
| 9310 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 9311 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9312 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9313 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 9314 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 9315 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 9316 | " %d, pref_offchan_bw: %d", |
| 9317 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 9318 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 9319 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 9320 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 9321 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 9322 | |
| 9323 | /* next fill variable size array of peer chan info */ |
| 9324 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 9325 | WMITLV_SET_HDR(buf_ptr, |
| 9326 | WMITLV_TAG_ARRAY_STRUC, |
| 9327 | sizeof(wmi_channel) * |
| 9328 | peerStateParams->peerCap.peerChanLen); |
| 9329 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 9330 | |
| 9331 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 9332 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 9333 | WMITLV_TAG_STRUC_wmi_channel, |
| 9334 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 9335 | chan_info->mhz = ch_mhz[i]; |
| 9336 | chan_info->band_center_freq1 = chan_info->mhz; |
| 9337 | chan_info->band_center_freq2 = 0; |
| 9338 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9339 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9340 | |
| 9341 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 9342 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9343 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9344 | peerStateParams->peerCap.peerChan[i].chanId, |
| 9345 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 9346 | } |
| 9347 | |
| 9348 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 9349 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 9350 | else |
| 9351 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 9352 | |
| 9353 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 9354 | peerStateParams->peerCap. |
| 9355 | peerChan[i].pwr); |
| 9356 | |
| 9357 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 9358 | peerStateParams->peerCap.peerChan[i]. |
| 9359 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9360 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9361 | peerStateParams->peerCap.peerChan[i].pwr); |
| 9362 | |
| 9363 | chan_info++; |
| 9364 | } |
| 9365 | |
| 9366 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9367 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9368 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9369 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9370 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9371 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9372 | } |
| 9373 | |
| 9374 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9375 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9376 | } |
| 9377 | |
| 9378 | /* |
| 9379 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 9380 | * firmware |
| 9381 | * @wmi_handle: Pointer to wmi handle |
| 9382 | * @mem_dump_req: Pointer for mem_dump_req |
| 9383 | * |
| 9384 | * This function sends memory dump request to firmware |
| 9385 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9386 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9387 | * |
| 9388 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9389 | 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] | 9390 | struct fw_dump_req_param *mem_dump_req) |
| 9391 | { |
| 9392 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 9393 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9394 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9395 | int32_t len; |
| 9396 | wmi_buf_t buf; |
| 9397 | u_int8_t *buf_ptr; |
| 9398 | int ret, loop; |
| 9399 | |
| 9400 | /* |
| 9401 | * len = sizeof(fixed param) that includes tlv header + |
| 9402 | * tlv header for array of struc + |
| 9403 | * sizeof (each struct) |
| 9404 | */ |
| 9405 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9406 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 9407 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9408 | |
| 9409 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9410 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 9411 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9412 | } |
| 9413 | |
| 9414 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9415 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9416 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 9417 | |
| 9418 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9419 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 9420 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 9421 | |
| 9422 | cmd->request_id = mem_dump_req->request_id; |
| 9423 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 9424 | |
| 9425 | /* TLV indicating array of structures to follow */ |
| 9426 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 9427 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9428 | sizeof(wmi_fw_mem_dump) * |
| 9429 | cmd->num_fw_mem_dump_segs); |
| 9430 | |
| 9431 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9432 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 9433 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9434 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9435 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 9436 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9437 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9438 | ((uint8_t *)(mem_dump_req->segment) + |
| 9439 | loop * sizeof(*seg_req)); |
| 9440 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 9441 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 9442 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 9443 | dump_params->seg_id = seg_req->seg_id; |
| 9444 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 9445 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 9446 | dump_params->seg_length = seg_req->seg_length; |
| 9447 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 9448 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9449 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 9450 | 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] | 9451 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 9452 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9453 | 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] | 9454 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 9455 | dump_params->dest_addr_hi); |
| 9456 | dump_params++; |
| 9457 | } |
| 9458 | |
| 9459 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9460 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 9461 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9462 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9463 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9464 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9465 | } |
| 9466 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9467 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 9468 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9469 | } |
| 9470 | |
| 9471 | /* |
| 9472 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 9473 | * @wmi_handle: Pointer to WMi handle |
| 9474 | * @ie_data: Pointer for ie data |
| 9475 | * |
| 9476 | * This function sends IE information to firmware |
| 9477 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9478 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9479 | * |
| 9480 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9481 | 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] | 9482 | struct vdev_ie_info_param *ie_info) |
| 9483 | { |
| 9484 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 9485 | wmi_buf_t buf; |
| 9486 | uint8_t *buf_ptr; |
| 9487 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9488 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9489 | |
| 9490 | |
| 9491 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 9492 | /* Allocate memory for the WMI command */ |
| 9493 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 9494 | |
| 9495 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9496 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9497 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9498 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9499 | } |
| 9500 | |
| 9501 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9502 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9503 | |
| 9504 | /* Populate the WMI command */ |
| 9505 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 9506 | |
| 9507 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9508 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 9509 | WMITLV_GET_STRUCT_TLVLEN( |
| 9510 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 9511 | cmd->vdev_id = ie_info->vdev_id; |
| 9512 | cmd->ie_id = ie_info->ie_id; |
| 9513 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 9514 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9515 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9516 | 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] | 9517 | ie_info->length, ie_info->vdev_id); |
| 9518 | |
| 9519 | buf_ptr += sizeof(*cmd); |
| 9520 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 9521 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9522 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9523 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9524 | |
| 9525 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9526 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9527 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9528 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9529 | wmi_buf_free(buf); |
| 9530 | } |
| 9531 | |
| 9532 | return ret; |
| 9533 | } |
| 9534 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9535 | /** |
| 9536 | * send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function |
| 9537 | * |
| 9538 | * @param wmi_handle : handle to WMI. |
| 9539 | * @param param : pointer to antenna param |
| 9540 | * |
| 9541 | * This function sends smart antenna enable command to FW |
| 9542 | * |
| 9543 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9544 | */ |
| 9545 | static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 9546 | struct smart_ant_enable_params *param) |
| 9547 | { |
| 9548 | /* Send WMI COMMAND to Enable */ |
| 9549 | wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd; |
| 9550 | wmi_pdev_smart_ant_gpio_handle *gpio_param; |
| 9551 | wmi_buf_t buf; |
| 9552 | uint8_t *buf_ptr; |
| 9553 | int len = 0; |
| 9554 | QDF_STATUS ret; |
| 9555 | int loop = 0; |
| 9556 | |
| 9557 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 9558 | len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle); |
| 9559 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9560 | |
| 9561 | if (!buf) { |
| 9562 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9563 | return QDF_STATUS_E_NOMEM; |
| 9564 | } |
| 9565 | |
| 9566 | buf_ptr = wmi_buf_data(buf); |
| 9567 | qdf_mem_zero(buf_ptr, len); |
| 9568 | cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr; |
| 9569 | |
| 9570 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9571 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param, |
| 9572 | WMITLV_GET_STRUCT_TLVLEN( |
| 9573 | wmi_pdev_smart_ant_enable_cmd_fixed_param)); |
| 9574 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9575 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9576 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9577 | cmd->enable = param->enable; |
| 9578 | cmd->mode = param->mode; |
| 9579 | cmd->rx_antenna = param->rx_antenna; |
| 9580 | cmd->tx_default_antenna = param->rx_antenna; |
| 9581 | |
| 9582 | /* TLV indicating array of structures to follow */ |
| 9583 | buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param); |
| 9584 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 9585 | WMI_HAL_MAX_SANTENNA * |
| 9586 | sizeof(wmi_pdev_smart_ant_gpio_handle)); |
| 9587 | |
| 9588 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9589 | gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr; |
| 9590 | |
| 9591 | for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) { |
| 9592 | WMITLV_SET_HDR(&gpio_param->tlv_header, |
| 9593 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle, |
| 9594 | WMITLV_GET_STRUCT_TLVLEN( |
| 9595 | wmi_pdev_smart_ant_gpio_handle)); |
| 9596 | if (param->mode == SMART_ANT_MODE_SERIAL) { |
| 9597 | if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) { |
| 9598 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 9599 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 9600 | } else { |
| 9601 | gpio_param->gpio_pin = 0; |
| 9602 | gpio_param->gpio_func = 0; |
| 9603 | } |
| 9604 | } else if (param->mode == SMART_ANT_MODE_PARALLEL) { |
| 9605 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 9606 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 9607 | } |
| 9608 | /* Setting it to 0 for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9609 | gpio_param->pdev_id = |
| 9610 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9611 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9612 | gpio_param++; |
| 9613 | } |
| 9614 | |
| 9615 | ret = wmi_unified_cmd_send(wmi_handle, |
| 9616 | buf, |
| 9617 | len, |
| 9618 | WMI_PDEV_SMART_ANT_ENABLE_CMDID); |
| 9619 | |
| 9620 | if (ret != 0) { |
| 9621 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 9622 | WMI_LOGE("enable:%d mode:%d rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n", |
| 9623 | cmd->enable, |
| 9624 | cmd->mode, |
| 9625 | cmd->rx_antenna, |
| 9626 | param->gpio_pin[0], param->gpio_pin[1], |
| 9627 | param->gpio_pin[2], param->gpio_pin[3], |
| 9628 | param->gpio_func[0], param->gpio_func[1], |
| 9629 | param->gpio_func[2], param->gpio_func[3], |
| 9630 | ret); |
| 9631 | wmi_buf_free(buf); |
| 9632 | } |
| 9633 | |
| 9634 | return ret; |
| 9635 | } |
| 9636 | |
| 9637 | /** |
| 9638 | * send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function |
| 9639 | * |
| 9640 | * @param wmi_handle : handle to WMI. |
| 9641 | * @param param : pointer to rx antenna param |
| 9642 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9643 | */ |
| 9644 | static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 9645 | struct smart_ant_rx_ant_params *param) |
| 9646 | { |
| 9647 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd; |
| 9648 | wmi_buf_t buf; |
| 9649 | uint8_t *buf_ptr; |
| 9650 | uint32_t len; |
| 9651 | QDF_STATUS ret; |
| 9652 | |
| 9653 | len = sizeof(*cmd); |
| 9654 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9655 | WMI_LOGD("%s:\n", __func__); |
| 9656 | if (!buf) { |
| 9657 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9658 | return QDF_STATUS_E_NOMEM; |
| 9659 | } |
| 9660 | |
| 9661 | buf_ptr = wmi_buf_data(buf); |
| 9662 | cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr; |
| 9663 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9664 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param, |
| 9665 | WMITLV_GET_STRUCT_TLVLEN( |
| 9666 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param)); |
| 9667 | cmd->rx_antenna = param->antenna; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9668 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9669 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9670 | |
| 9671 | ret = wmi_unified_cmd_send(wmi_handle, |
| 9672 | buf, |
| 9673 | len, |
| 9674 | WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID); |
| 9675 | |
| 9676 | if (ret != 0) { |
| 9677 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 9678 | WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n", |
| 9679 | __func__, |
| 9680 | cmd->rx_antenna, |
| 9681 | ret); |
| 9682 | wmi_buf_free(buf); |
| 9683 | } |
| 9684 | |
| 9685 | return ret; |
| 9686 | } |
| 9687 | |
| 9688 | /** |
| 9689 | * send_set_ctl_table_cmd_tlv() - send ctl table cmd to fw |
| 9690 | * @wmi_handle: wmi handle |
| 9691 | * @param: pointer to hold ctl table param |
| 9692 | * |
| 9693 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9694 | */ |
| 9695 | static QDF_STATUS |
| 9696 | send_set_ctl_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 9697 | struct ctl_table_params *param) |
| 9698 | { |
| 9699 | uint16_t len, ctl_tlv_len; |
| 9700 | uint8_t *buf_ptr; |
| 9701 | wmi_buf_t buf; |
| 9702 | wmi_pdev_set_ctl_table_cmd_fixed_param *cmd; |
| 9703 | uint32_t *ctl_array; |
| 9704 | |
| 9705 | if (!param->ctl_array) |
| 9706 | return QDF_STATUS_E_FAILURE; |
| 9707 | |
| 9708 | if (param->ctl_cmd_len != |
| 9709 | WMI_HOST_NUM_CTLS_2G * WMI_HOST_NUM_BAND_EDGES_2G * 2 + |
| 9710 | WMI_HOST_NUM_CTLS_5G * WMI_HOST_NUM_BAND_EDGES_5G * 2) { |
| 9711 | qdf_print("CTL array len not correct\n"); |
| 9712 | return QDF_STATUS_E_FAILURE; |
| 9713 | } |
| 9714 | |
| 9715 | ctl_tlv_len = WMI_TLV_HDR_SIZE + |
| 9716 | roundup(param->ctl_cmd_len, sizeof(A_UINT32)); |
| 9717 | len = sizeof(*cmd) + ctl_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_ctl_table_cmd_fixed_param *)buf_ptr; |
| 9729 | |
| 9730 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9731 | WMITLV_TAG_STRUC_wmi_pdev_set_ctl_table_cmd_fixed_param, |
| 9732 | WMITLV_GET_STRUCT_TLVLEN( |
| 9733 | wmi_pdev_set_ctl_table_cmd_fixed_param)); |
| 9734 | cmd->ctl_len = param->ctl_cmd_len; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9735 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9736 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9737 | |
| 9738 | buf_ptr += sizeof(*cmd); |
| 9739 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9740 | (cmd->ctl_len)); |
| 9741 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9742 | ctl_array = (uint32_t *)buf_ptr; |
| 9743 | |
| 9744 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[0], ¶m->ctl_band, |
| 9745 | sizeof(param->ctl_band)); |
| 9746 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[1], param->ctl_array, |
| 9747 | param->ctl_cmd_len - |
| 9748 | sizeof(param->ctl_band)); |
| 9749 | |
| 9750 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9751 | WMI_PDEV_SET_CTL_TABLE_CMDID)) { |
| 9752 | WMI_LOGE("%s:Failed to send command\n", __func__); |
| 9753 | wmi_buf_free(buf); |
| 9754 | return QDF_STATUS_E_FAILURE; |
| 9755 | } |
| 9756 | |
| 9757 | return QDF_STATUS_SUCCESS; |
| 9758 | } |
| 9759 | |
| 9760 | /** |
| 9761 | * send_set_mimogain_table_cmd_tlv() - send mimogain table cmd to fw |
| 9762 | * @wmi_handle: wmi handle |
| 9763 | * @param: pointer to hold mimogain table param |
| 9764 | * |
| 9765 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9766 | */ |
| 9767 | static QDF_STATUS |
| 9768 | send_set_mimogain_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 9769 | struct mimogain_table_params *param) |
| 9770 | { |
| 9771 | uint16_t len, table_tlv_len; |
| 9772 | wmi_buf_t buf; |
| 9773 | uint8_t *buf_ptr; |
| 9774 | wmi_pdev_set_mimogain_table_cmd_fixed_param *cmd; |
| 9775 | uint32_t *gain_table; |
| 9776 | |
| 9777 | if (!param->array_gain) |
| 9778 | return QDF_STATUS_E_FAILURE; |
| 9779 | |
| 9780 | /* len must be multiple of a single array gain table */ |
| 9781 | if (param->tbl_len % |
| 9782 | ((WMI_HOST_TX_NUM_CHAIN-1) * WMI_HOST_TPC_REGINDEX_MAX * |
| 9783 | WMI_HOST_ARRAY_GAIN_NUM_STREAMS) != 0) { |
| 9784 | WMI_LOGE("Array gain table len not correct\n"); |
| 9785 | return QDF_STATUS_E_FAILURE; |
| 9786 | } |
| 9787 | |
| 9788 | table_tlv_len = WMI_TLV_HDR_SIZE + |
| 9789 | roundup(param->tbl_len, sizeof(uint32_t)); |
| 9790 | len = sizeof(*cmd) + table_tlv_len; |
| 9791 | |
| 9792 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9793 | if (!buf) { |
| 9794 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9795 | return QDF_STATUS_E_FAILURE; |
| 9796 | } |
| 9797 | |
| 9798 | buf_ptr = wmi_buf_data(buf); |
| 9799 | qdf_mem_zero(buf_ptr, len); |
| 9800 | |
| 9801 | cmd = (wmi_pdev_set_mimogain_table_cmd_fixed_param *)buf_ptr; |
| 9802 | |
| 9803 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9804 | WMITLV_TAG_STRUC_wmi_pdev_set_mimogain_table_cmd_fixed_param, |
| 9805 | WMITLV_GET_STRUCT_TLVLEN( |
| 9806 | wmi_pdev_set_mimogain_table_cmd_fixed_param)); |
| 9807 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9808 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9809 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9810 | WMI_MIMOGAIN_ARRAY_GAIN_LEN_SET(cmd->mimogain_info, param->tbl_len); |
| 9811 | WMI_MIMOGAIN_MULTI_CHAIN_BYPASS_SET(cmd->mimogain_info, |
| 9812 | param->multichain_gain_bypass); |
| 9813 | |
| 9814 | buf_ptr += sizeof(*cmd); |
| 9815 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 9816 | (param->tbl_len)); |
| 9817 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 9818 | gain_table = (uint32_t *)buf_ptr; |
| 9819 | |
| 9820 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(gain_table, |
| 9821 | param->array_gain, |
| 9822 | param->tbl_len); |
| 9823 | |
| 9824 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9825 | WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID)) { |
| 9826 | return QDF_STATUS_E_FAILURE; |
| 9827 | } |
| 9828 | |
| 9829 | return QDF_STATUS_SUCCESS; |
| 9830 | } |
| 9831 | |
| 9832 | /** |
| 9833 | * send_packet_power_info_get_cmd_tlv() - send request to get packet power |
| 9834 | * info to fw |
| 9835 | * @wmi_handle: wmi handle |
| 9836 | * @param: pointer to hold packet power info param |
| 9837 | * |
| 9838 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9839 | */ |
| 9840 | static QDF_STATUS |
| 9841 | send_packet_power_info_get_cmd_tlv(wmi_unified_t wmi_handle, |
| 9842 | struct packet_power_info_params *param) |
| 9843 | { |
| 9844 | wmi_pdev_get_tpc_cmd_fixed_param *cmd; |
| 9845 | wmi_buf_t wmibuf; |
| 9846 | uint8_t *buf_ptr; |
| 9847 | u_int32_t len = sizeof(wmi_pdev_get_tpc_cmd_fixed_param); |
| 9848 | |
| 9849 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 9850 | if (wmibuf == NULL) |
| 9851 | return QDF_STATUS_E_NOMEM; |
| 9852 | |
| 9853 | buf_ptr = (uint8_t *)wmi_buf_data(wmibuf); |
| 9854 | |
| 9855 | cmd = (wmi_pdev_get_tpc_cmd_fixed_param *)buf_ptr; |
| 9856 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9857 | WMITLV_TAG_STRUC_wmi_pdev_get_tpc_cmd_fixed_param, |
| 9858 | WMITLV_GET_STRUCT_TLVLEN( |
| 9859 | wmi_pdev_get_tpc_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9860 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9861 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 9862 | cmd->rate_flags = param->rate_flags; |
| 9863 | cmd->nss = param->nss; |
| 9864 | cmd->preamble = param->preamble; |
| 9865 | cmd->hw_rate = param->hw_rate; |
| 9866 | WMI_LOGI("%s[%d] commandID %d, wmi_pdev_get_tpc_cmd=0x%x\n", |
| 9867 | __func__, |
| 9868 | __LINE__, |
| 9869 | WMI_PDEV_GET_TPC_CMDID, |
| 9870 | *((u_int32_t *)cmd)); |
| 9871 | if (wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 9872 | WMI_PDEV_GET_TPC_CMDID)) { |
| 9873 | WMI_LOGE(FL("Failed to get tpc command\n")); |
| 9874 | wmi_buf_free(wmibuf); |
| 9875 | return QDF_STATUS_E_FAILURE; |
| 9876 | } |
| 9877 | |
| 9878 | return QDF_STATUS_SUCCESS; |
| 9879 | } |
| 9880 | |
| 9881 | /** |
| 9882 | * send_vdev_config_ratemask_cmd_tlv() - config ratemask param in fw |
| 9883 | * @wmi_handle: wmi handle |
| 9884 | * @param: pointer to hold config ratemask params |
| 9885 | * |
| 9886 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9887 | */ |
| 9888 | static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle, |
| 9889 | struct config_ratemask_params *param) |
| 9890 | { |
| 9891 | wmi_vdev_config_ratemask_cmd_fixed_param *cmd; |
| 9892 | wmi_buf_t buf; |
| 9893 | int32_t len = sizeof(*cmd); |
| 9894 | |
| 9895 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9896 | if (!buf) { |
| 9897 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9898 | return QDF_STATUS_E_FAILURE; |
| 9899 | } |
| 9900 | cmd = (wmi_vdev_config_ratemask_cmd_fixed_param *)wmi_buf_data(buf); |
| 9901 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9902 | WMITLV_TAG_STRUC_wmi_vdev_config_ratemask_fixed_param, |
| 9903 | WMITLV_GET_STRUCT_TLVLEN( |
| 9904 | wmi_vdev_config_ratemask_cmd_fixed_param)); |
| 9905 | cmd->vdev_id = param->vdev_id; |
| 9906 | cmd->type = param->type; |
| 9907 | cmd->mask_lower32 = param->lower32; |
| 9908 | cmd->mask_higher32 = param->higher32; |
| 9909 | WMI_LOGI("Setting vdev ratemask vdev id = 0x%X, type = 0x%X, mask_l32 = 0x%X mask_h32 = 0x%X\n", |
| 9910 | param->vdev_id, param->type, param->lower32, param->higher32); |
| 9911 | |
| 9912 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9913 | WMI_VDEV_RATEMASK_CMDID)) { |
| 9914 | WMI_LOGE("Seting vdev ratemask failed\n"); |
| 9915 | wmi_buf_free(buf); |
| 9916 | return QDF_STATUS_E_FAILURE; |
| 9917 | } |
| 9918 | |
| 9919 | return QDF_STATUS_SUCCESS; |
| 9920 | } |
| 9921 | |
| 9922 | /** |
| 9923 | * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw |
| 9924 | * @wmi_handle: wmi handle |
| 9925 | * @param: pointer to hold vap dscp tid map param |
| 9926 | * |
| 9927 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9928 | */ |
| 9929 | static QDF_STATUS |
| 9930 | send_set_vap_dscp_tid_map_cmd_tlv(wmi_unified_t wmi_handle, |
| 9931 | struct vap_dscp_tid_map_params *param) |
| 9932 | { |
| 9933 | wmi_buf_t buf; |
| 9934 | wmi_vdev_set_dscp_tid_map_cmd_fixed_param *cmd; |
| 9935 | int32_t len = sizeof(*cmd); |
| 9936 | |
| 9937 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9938 | if (!buf) { |
| 9939 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9940 | return QDF_STATUS_E_FAILURE; |
| 9941 | } |
| 9942 | |
| 9943 | cmd = (wmi_vdev_set_dscp_tid_map_cmd_fixed_param *)wmi_buf_data(buf); |
| 9944 | qdf_mem_copy(cmd->dscp_to_tid_map, param->dscp_to_tid_map, |
| 9945 | sizeof(A_UINT32) * WMI_DSCP_MAP_MAX); |
| 9946 | |
| 9947 | cmd->vdev_id = param->vdev_id; |
| 9948 | cmd->enable_override = 0; |
| 9949 | |
| 9950 | WMI_LOGI("Setting dscp for vap id: %d\n", cmd->vdev_id); |
| 9951 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9952 | WMI_VDEV_SET_DSCP_TID_MAP_CMDID)) { |
| 9953 | WMI_LOGE("Failed to set dscp cmd\n"); |
| 9954 | wmi_buf_free(buf); |
| 9955 | return QDF_STATUS_E_FAILURE; |
| 9956 | } |
| 9957 | |
| 9958 | return QDF_STATUS_SUCCESS; |
| 9959 | } |
| 9960 | |
| 9961 | /** |
| 9962 | * send_vdev_set_neighbour_rx_cmd_tlv() - set neighbour rx param in fw |
| 9963 | * @wmi_handle: wmi handle |
| 9964 | * @macaddr: vdev mac address |
| 9965 | * @param: pointer to hold neigbour rx param |
| 9966 | * |
| 9967 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 9968 | */ |
| 9969 | static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(wmi_unified_t wmi_handle, |
| 9970 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 9971 | struct set_neighbour_rx_params *param) |
| 9972 | { |
| 9973 | wmi_vdev_filter_nrp_config_cmd_fixed_param *cmd; |
| 9974 | wmi_buf_t buf; |
| 9975 | int32_t len = sizeof(*cmd); |
| 9976 | |
| 9977 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9978 | if (!buf) { |
| 9979 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 9980 | return QDF_STATUS_E_FAILURE; |
| 9981 | } |
| 9982 | cmd = (wmi_vdev_filter_nrp_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 9983 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9984 | WMITLV_TAG_STRUC_wmi_vdev_filter_nrp_config_cmd_fixed_param, |
| 9985 | WMITLV_GET_STRUCT_TLVLEN( |
| 9986 | wmi_vdev_filter_nrp_config_cmd_fixed_param)); |
| 9987 | cmd->vdev_id = param->vdev_id; |
| 9988 | cmd->bssid_idx = param->idx; |
| 9989 | cmd->action = param->action; |
| 9990 | cmd->type = param->type; |
| 9991 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr); |
| 9992 | cmd->flag = 0; |
| 9993 | |
| 9994 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9995 | WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID)) { |
| 9996 | WMI_LOGE("Failed to set neighbour rx param\n"); |
| 9997 | wmi_buf_free(buf); |
| 9998 | return QDF_STATUS_E_FAILURE; |
| 9999 | } |
| 10000 | |
| 10001 | return QDF_STATUS_SUCCESS; |
| 10002 | } |
| 10003 | |
| 10004 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 10005 | * 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] | 10006 | * @param wmi_handle : handle to WMI. |
| 10007 | * @param macaddr : vdev mac address |
| 10008 | * @param param : pointer to tx antenna param |
| 10009 | * |
| 10010 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10011 | */ |
| 10012 | static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 10013 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10014 | struct smart_ant_tx_ant_params *param) |
| 10015 | { |
| 10016 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd; |
| 10017 | wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series; |
| 10018 | wmi_buf_t buf; |
| 10019 | int32_t len = 0; |
| 10020 | int i; |
| 10021 | uint8_t *buf_ptr; |
| 10022 | QDF_STATUS ret; |
| 10023 | |
| 10024 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10025 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10026 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series); |
| 10027 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10028 | |
| 10029 | if (!buf) { |
| 10030 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10031 | return QDF_STATUS_E_NOMEM; |
| 10032 | } |
| 10033 | |
| 10034 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10035 | qdf_mem_zero(buf_ptr, len); |
| 10036 | cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr; |
| 10037 | |
| 10038 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10039 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param, |
| 10040 | WMITLV_GET_STRUCT_TLVLEN( |
| 10041 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param)); |
| 10042 | |
| 10043 | cmd->vdev_id = param->vdev_id; |
| 10044 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10045 | |
| 10046 | buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param); |
| 10047 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10048 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series)); |
| 10049 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10050 | ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr; |
| 10051 | |
| 10052 | for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) { |
| 10053 | WMITLV_SET_HDR(&ant_tx_series->tlv_header, |
| 10054 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series, |
| 10055 | WMITLV_GET_STRUCT_TLVLEN( |
| 10056 | wmi_peer_smart_ant_set_tx_antenna_series)); |
| 10057 | ant_tx_series->antenna_series = param->antenna_array[i]; |
| 10058 | ant_tx_series++; |
| 10059 | } |
| 10060 | |
| 10061 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10062 | buf, |
| 10063 | len, |
| 10064 | WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID); |
| 10065 | |
| 10066 | if (ret != 0) { |
| 10067 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10068 | wmi_buf_free(buf); |
| 10069 | } |
| 10070 | |
| 10071 | return ret; |
| 10072 | } |
| 10073 | |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10074 | /** |
| 10075 | * send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw |
| 10076 | * @wmi_handle: wmi handle |
| 10077 | * @param: pointer to hold ant switch tbl param |
| 10078 | * |
| 10079 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10080 | */ |
| 10081 | static QDF_STATUS |
| 10082 | send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10083 | struct ant_switch_tbl_params *param) |
| 10084 | { |
| 10085 | uint8_t len; |
| 10086 | wmi_buf_t buf; |
| 10087 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd; |
| 10088 | wmi_pdev_set_ant_ctrl_chain *ctrl_chain; |
| 10089 | uint8_t *buf_ptr; |
| 10090 | |
| 10091 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10092 | len += sizeof(wmi_pdev_set_ant_ctrl_chain); |
| 10093 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10094 | |
| 10095 | if (!buf) { |
| 10096 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10097 | return QDF_STATUS_E_NOMEM; |
| 10098 | } |
| 10099 | |
| 10100 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10101 | qdf_mem_zero(buf_ptr, len); |
| 10102 | cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr; |
| 10103 | |
| 10104 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10105 | WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param, |
| 10106 | WMITLV_GET_STRUCT_TLVLEN( |
| 10107 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param)); |
| 10108 | |
| 10109 | cmd->antCtrlCommon1 = param->ant_ctrl_common1; |
| 10110 | cmd->antCtrlCommon2 = param->ant_ctrl_common2; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10111 | cmd->mac_id = |
| 10112 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10113 | |
| 10114 | /* TLV indicating array of structures to follow */ |
| 10115 | buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param); |
| 10116 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10117 | sizeof(wmi_pdev_set_ant_ctrl_chain)); |
| 10118 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10119 | ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr; |
| 10120 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10121 | ctrl_chain->pdev_id = |
| 10122 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10123 | ctrl_chain->antCtrlChain = param->antCtrlChain; |
| 10124 | |
| 10125 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10126 | WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) { |
| 10127 | wmi_buf_free(buf); |
| 10128 | return QDF_STATUS_E_FAILURE; |
| 10129 | } |
| 10130 | |
| 10131 | return QDF_STATUS_SUCCESS; |
| 10132 | } |
| 10133 | |
| 10134 | /** |
| 10135 | * send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna |
| 10136 | * training information function |
| 10137 | * @param wmi_handle : handle to WMI. |
| 10138 | * @macaddr : vdev mac address |
| 10139 | * @param param : pointer to tx antenna param |
| 10140 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10141 | */ |
| 10142 | static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv( |
| 10143 | wmi_unified_t wmi_handle, |
| 10144 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10145 | struct smart_ant_training_info_params *param) |
| 10146 | { |
| 10147 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd; |
| 10148 | wmi_peer_smart_ant_set_train_antenna_param *train_param; |
| 10149 | wmi_buf_t buf; |
| 10150 | uint8_t *buf_ptr; |
| 10151 | int32_t len = 0; |
| 10152 | QDF_STATUS ret; |
| 10153 | int loop; |
| 10154 | |
| 10155 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10156 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10157 | sizeof(wmi_peer_smart_ant_set_train_antenna_param); |
| 10158 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10159 | |
| 10160 | if (!buf) { |
| 10161 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10162 | return QDF_STATUS_E_NOMEM; |
| 10163 | } |
| 10164 | |
| 10165 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10166 | qdf_mem_zero(buf_ptr, len); |
| 10167 | cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr; |
| 10168 | |
| 10169 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10170 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param, |
| 10171 | WMITLV_GET_STRUCT_TLVLEN( |
| 10172 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param)); |
| 10173 | |
| 10174 | cmd->vdev_id = param->vdev_id; |
| 10175 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10176 | cmd->num_pkts = param->numpkts; |
| 10177 | |
| 10178 | buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param); |
| 10179 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10180 | sizeof(wmi_peer_smart_ant_set_train_antenna_param) * |
| 10181 | WMI_SMART_ANT_MAX_RATE_SERIES); |
| 10182 | |
| 10183 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10184 | train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr; |
| 10185 | |
| 10186 | for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) { |
| 10187 | WMITLV_SET_HDR(&train_param->tlv_header, |
| 10188 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param, |
| 10189 | WMITLV_GET_STRUCT_TLVLEN( |
| 10190 | wmi_peer_smart_ant_set_train_antenna_param)); |
| 10191 | train_param->train_rate_series = param->rate_array[loop]; |
| 10192 | train_param->train_antenna_series = param->antenna_array[loop]; |
| 10193 | train_param->rc_flags = 0; |
| 10194 | WMI_LOGI(FL("Series number:%d\n"), loop); |
| 10195 | WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"), |
| 10196 | train_param->train_rate_series, |
| 10197 | train_param->train_antenna_series); |
| 10198 | train_param++; |
| 10199 | } |
| 10200 | |
| 10201 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10202 | buf, |
| 10203 | len, |
| 10204 | WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID); |
| 10205 | |
| 10206 | if (ret != 0) { |
| 10207 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10208 | wmi_buf_free(buf); |
| 10209 | return QDF_STATUS_E_FAILURE; |
| 10210 | } |
| 10211 | |
| 10212 | return ret; |
| 10213 | } |
| 10214 | |
| 10215 | /** |
| 10216 | * send_smart_ant_set_node_config_cmd_tlv() - WMI set node |
| 10217 | * configuration function |
| 10218 | * @param wmi_handle : handle to WMI. |
| 10219 | * @macaddr : vdev mad address |
| 10220 | * @param param : pointer to tx antenna param |
| 10221 | * |
| 10222 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10223 | */ |
| 10224 | static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv( |
| 10225 | wmi_unified_t wmi_handle, |
| 10226 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10227 | struct smart_ant_node_config_params *param) |
| 10228 | { |
| 10229 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd; |
| 10230 | wmi_buf_t buf; |
| 10231 | uint8_t *buf_ptr; |
| 10232 | int32_t len = 0, args_tlv_len; |
| 10233 | int ret; |
| 10234 | int i = 0; |
| 10235 | A_UINT32 *node_config_args; |
| 10236 | |
| 10237 | args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(A_UINT32); |
| 10238 | len = sizeof(*cmd) + args_tlv_len; |
| 10239 | |
| 10240 | if ((param->args_count == 0)) { |
| 10241 | WMI_LOGE("%s: Can't send a command with %d arguments\n", |
| 10242 | __func__, param->args_count); |
| 10243 | return QDF_STATUS_E_FAILURE; |
| 10244 | } |
| 10245 | |
| 10246 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10247 | if (!buf) { |
| 10248 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10249 | return QDF_STATUS_E_NOMEM; |
| 10250 | } |
| 10251 | |
| 10252 | cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *) |
| 10253 | wmi_buf_data(buf); |
| 10254 | buf_ptr = (uint8_t *)cmd; |
| 10255 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10256 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param, |
| 10257 | WMITLV_GET_STRUCT_TLVLEN( |
| 10258 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param)); |
| 10259 | cmd->vdev_id = param->vdev_id; |
| 10260 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10261 | cmd->cmd_id = param->cmd_id; |
| 10262 | cmd->args_count = param->args_count; |
| 10263 | buf_ptr += sizeof( |
| 10264 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param); |
| 10265 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10266 | (cmd->args_count * sizeof(A_UINT32))); |
| 10267 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10268 | node_config_args = (A_UINT32 *)buf_ptr; |
| 10269 | |
| 10270 | for (i = 0; i < param->args_count; i++) { |
| 10271 | node_config_args[i] = param->args_arr[i]; |
| 10272 | WMI_LOGI("%d", param->args_arr[i]); |
| 10273 | } |
| 10274 | |
| 10275 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10276 | buf, |
| 10277 | len, |
| 10278 | WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID); |
| 10279 | |
| 10280 | if (ret != 0) { |
| 10281 | WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n", |
| 10282 | __func__, param->cmd_id, macaddr[0], |
| 10283 | macaddr[1], macaddr[2], macaddr[3], |
| 10284 | macaddr[4], macaddr[5], ret); |
| 10285 | wmi_buf_free(buf); |
| 10286 | } |
| 10287 | |
| 10288 | return ret; |
| 10289 | } |
| 10290 | |
| 10291 | /** |
| 10292 | * send_set_atf_cmd_tlv() - send set atf command to fw |
| 10293 | * @wmi_handle: wmi handle |
| 10294 | * @param: pointer to set atf param |
| 10295 | * |
| 10296 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10297 | */ |
| 10298 | static QDF_STATUS |
| 10299 | send_set_atf_cmd_tlv(wmi_unified_t wmi_handle, |
| 10300 | struct set_atf_params *param) |
| 10301 | { |
| 10302 | wmi_atf_peer_info *peer_info; |
| 10303 | wmi_peer_atf_request_fixed_param *cmd; |
| 10304 | wmi_buf_t buf; |
| 10305 | uint8_t *buf_ptr; |
| 10306 | int i; |
| 10307 | int32_t len = 0; |
| 10308 | QDF_STATUS retval; |
| 10309 | |
| 10310 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10311 | len += param->num_peers * sizeof(wmi_atf_peer_info); |
| 10312 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10313 | if (!buf) { |
| 10314 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10315 | return QDF_STATUS_E_FAILURE; |
| 10316 | } |
| 10317 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10318 | cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr; |
| 10319 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10320 | WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param, |
| 10321 | WMITLV_GET_STRUCT_TLVLEN( |
| 10322 | wmi_peer_atf_request_fixed_param)); |
| 10323 | cmd->num_peers = param->num_peers; |
| 10324 | |
| 10325 | buf_ptr += sizeof(*cmd); |
| 10326 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10327 | sizeof(wmi_atf_peer_info) * |
| 10328 | cmd->num_peers); |
| 10329 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10330 | peer_info = (wmi_atf_peer_info *)buf_ptr; |
| 10331 | |
| 10332 | for (i = 0; i < cmd->num_peers; i++) { |
| 10333 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 10334 | WMITLV_TAG_STRUC_wmi_atf_peer_info, |
| 10335 | WMITLV_GET_STRUCT_TLVLEN( |
| 10336 | wmi_atf_peer_info)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 10337 | qdf_mem_copy(&(peer_info->peer_macaddr), |
| 10338 | &(param->peer_info[i].peer_macaddr), |
| 10339 | sizeof(wmi_mac_addr)); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10340 | peer_info->atf_units = param->peer_info[i].percentage_peer; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 10341 | peer_info->vdev_id = param->peer_info[i].vdev_id; |
| 10342 | peer_info->pdev_id = |
| 10343 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10344 | param->peer_info[i].pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10345 | /* |
| 10346 | * TLV definition for peer atf request fixed param combines |
| 10347 | * extension stats. Legacy FW for WIN (Non-TLV) has peer atf |
| 10348 | * stats and atf extension stats as two different |
| 10349 | * implementations. |
| 10350 | * Need to discuss with FW on this. |
| 10351 | * |
| 10352 | * peer_info->atf_groupid = param->peer_ext_info[i].group_index; |
| 10353 | * peer_info->atf_units_reserved = |
| 10354 | * param->peer_ext_info[i].atf_index_reserved; |
| 10355 | */ |
| 10356 | peer_info++; |
| 10357 | } |
| 10358 | |
| 10359 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10360 | WMI_PEER_ATF_REQUEST_CMDID); |
| 10361 | |
| 10362 | if (retval != QDF_STATUS_SUCCESS) { |
| 10363 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 10364 | wmi_buf_free(buf); |
| 10365 | } |
| 10366 | |
| 10367 | return retval; |
| 10368 | } |
| 10369 | |
| 10370 | /** |
| 10371 | * send_vdev_set_fwtest_param_cmd_tlv() - send fwtest param in fw |
| 10372 | * @wmi_handle: wmi handle |
| 10373 | * @param: pointer to hold fwtest param |
| 10374 | * |
| 10375 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10376 | */ |
| 10377 | static QDF_STATUS send_vdev_set_fwtest_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 10378 | struct set_fwtest_params *param) |
| 10379 | { |
| 10380 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 10381 | wmi_buf_t buf; |
| 10382 | int32_t len = sizeof(*cmd); |
| 10383 | |
| 10384 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10385 | |
| 10386 | if (!buf) { |
| 10387 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10388 | return QDF_STATUS_E_FAILURE; |
| 10389 | } |
| 10390 | |
| 10391 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 10392 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10393 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 10394 | WMITLV_GET_STRUCT_TLVLEN( |
| 10395 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 10396 | cmd->param_id = param->arg; |
| 10397 | cmd->param_value = param->value; |
| 10398 | |
| 10399 | if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FWTEST_CMDID)) { |
| 10400 | WMI_LOGE("Setting FW test param failed\n"); |
| 10401 | wmi_buf_free(buf); |
| 10402 | return QDF_STATUS_E_FAILURE; |
| 10403 | } |
| 10404 | |
| 10405 | return QDF_STATUS_SUCCESS; |
| 10406 | } |
| 10407 | |
| 10408 | /** |
| 10409 | * send_set_qboost_param_cmd_tlv() - send set qboost command to fw |
| 10410 | * @wmi_handle: wmi handle |
| 10411 | * @param: pointer to qboost params |
| 10412 | * @macaddr: vdev mac address |
| 10413 | * |
| 10414 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10415 | */ |
| 10416 | static QDF_STATUS |
| 10417 | send_set_qboost_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 10418 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10419 | struct set_qboost_params *param) |
| 10420 | { |
| 10421 | WMI_QBOOST_CFG_CMD_fixed_param *cmd; |
| 10422 | wmi_buf_t buf; |
| 10423 | int32_t len; |
| 10424 | QDF_STATUS ret; |
| 10425 | |
| 10426 | len = sizeof(*cmd); |
| 10427 | |
| 10428 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10429 | if (!buf) { |
| 10430 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10431 | return QDF_STATUS_E_FAILURE; |
| 10432 | } |
| 10433 | |
| 10434 | cmd = (WMI_QBOOST_CFG_CMD_fixed_param *)wmi_buf_data(buf); |
| 10435 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10436 | WMITLV_TAG_STRUC_WMI_QBOOST_CFG_CMD_fixed_param, |
| 10437 | WMITLV_GET_STRUCT_TLVLEN( |
| 10438 | WMI_QBOOST_CFG_CMD_fixed_param)); |
| 10439 | cmd->vdev_id = param->vdev_id; |
| 10440 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10441 | cmd->qb_enable = param->value; |
| 10442 | |
| 10443 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10444 | WMI_QBOOST_CFG_CMDID); |
| 10445 | |
| 10446 | if (ret != 0) { |
| 10447 | WMI_LOGE("Setting qboost cmd failed\n"); |
| 10448 | wmi_buf_free(buf); |
| 10449 | } |
| 10450 | |
| 10451 | return ret; |
| 10452 | } |
| 10453 | |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 10454 | /** |
| 10455 | * send_gpio_config_cmd_tlv() - send gpio config to fw |
| 10456 | * @wmi_handle: wmi handle |
| 10457 | * @param: pointer to hold gpio config param |
| 10458 | * |
| 10459 | * Return: 0 for success or error code |
| 10460 | */ |
| 10461 | static QDF_STATUS |
| 10462 | send_gpio_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 10463 | struct gpio_config_params *param) |
| 10464 | { |
| 10465 | wmi_gpio_config_cmd_fixed_param *cmd; |
| 10466 | wmi_buf_t buf; |
| 10467 | int32_t len; |
| 10468 | QDF_STATUS ret; |
| 10469 | |
| 10470 | len = sizeof(*cmd); |
| 10471 | |
| 10472 | /* Sanity Checks */ |
| 10473 | if (param->pull_type > WMI_GPIO_PULL_DOWN || |
| 10474 | param->intr_mode > WMI_GPIO_INTTYPE_LEVEL_HIGH) { |
| 10475 | return QDF_STATUS_E_FAILURE; |
| 10476 | } |
| 10477 | |
| 10478 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10479 | if (!buf) { |
| 10480 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10481 | return QDF_STATUS_E_FAILURE; |
| 10482 | } |
| 10483 | |
| 10484 | cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 10485 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10486 | WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param, |
| 10487 | WMITLV_GET_STRUCT_TLVLEN( |
| 10488 | wmi_gpio_config_cmd_fixed_param)); |
| 10489 | cmd->gpio_num = param->gpio_num; |
| 10490 | cmd->input = param->input; |
| 10491 | cmd->pull_type = param->pull_type; |
| 10492 | cmd->intr_mode = param->intr_mode; |
| 10493 | |
| 10494 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10495 | WMI_GPIO_CONFIG_CMDID); |
| 10496 | |
| 10497 | if (ret != 0) { |
| 10498 | WMI_LOGE("Sending GPIO config cmd failed\n"); |
| 10499 | wmi_buf_free(buf); |
| 10500 | } |
| 10501 | |
| 10502 | return ret; |
| 10503 | } |
| 10504 | |
| 10505 | /** |
| 10506 | * send_gpio_output_cmd_tlv() - send gpio output to fw |
| 10507 | * @wmi_handle: wmi handle |
| 10508 | * @param: pointer to hold gpio output param |
| 10509 | * |
| 10510 | * Return: 0 for success or error code |
| 10511 | */ |
| 10512 | static QDF_STATUS |
| 10513 | send_gpio_output_cmd_tlv(wmi_unified_t wmi_handle, |
| 10514 | struct gpio_output_params *param) |
| 10515 | { |
| 10516 | wmi_gpio_output_cmd_fixed_param *cmd; |
| 10517 | wmi_buf_t buf; |
| 10518 | int32_t len; |
| 10519 | QDF_STATUS ret; |
| 10520 | |
| 10521 | len = sizeof(*cmd); |
| 10522 | |
| 10523 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10524 | if (!buf) { |
| 10525 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10526 | return QDF_STATUS_E_FAILURE; |
| 10527 | } |
| 10528 | |
| 10529 | cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf); |
| 10530 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10531 | WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param, |
| 10532 | WMITLV_GET_STRUCT_TLVLEN( |
| 10533 | wmi_gpio_output_cmd_fixed_param)); |
| 10534 | cmd->gpio_num = param->gpio_num; |
| 10535 | cmd->set = param->set; |
| 10536 | |
| 10537 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10538 | WMI_GPIO_OUTPUT_CMDID); |
| 10539 | |
| 10540 | if (ret != 0) { |
| 10541 | WMI_LOGE("Sending GPIO output cmd failed\n"); |
| 10542 | wmi_buf_free(buf); |
| 10543 | } |
| 10544 | |
| 10545 | return ret; |
| 10546 | |
| 10547 | } |
| 10548 | |
| 10549 | /** |
| 10550 | * send_phyerr_disable_cmd_tlv() - WMI phyerr disable function |
| 10551 | * |
| 10552 | * @param wmi_handle : handle to WMI. |
| 10553 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10554 | */ |
| 10555 | static QDF_STATUS send_phyerr_disable_cmd_tlv(wmi_unified_t wmi_handle) |
| 10556 | { |
| 10557 | wmi_pdev_dfs_disable_cmd_fixed_param *cmd; |
| 10558 | wmi_buf_t buf; |
| 10559 | QDF_STATUS ret; |
| 10560 | int32_t len; |
| 10561 | |
| 10562 | len = sizeof(*cmd); |
| 10563 | |
| 10564 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10565 | if (!buf) { |
| 10566 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10567 | return QDF_STATUS_E_FAILURE; |
| 10568 | } |
| 10569 | |
| 10570 | cmd = (wmi_pdev_dfs_disable_cmd_fixed_param *)wmi_buf_data(buf); |
| 10571 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10572 | WMITLV_TAG_STRUC_wmi_pdev_dfs_disable_cmd_fixed_param, |
| 10573 | WMITLV_GET_STRUCT_TLVLEN( |
| 10574 | wmi_pdev_dfs_disable_cmd_fixed_param)); |
| 10575 | /* Filling it with WMI_PDEV_ID_SOC for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10576 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10577 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 10578 | |
| 10579 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10580 | WMI_PDEV_DFS_DISABLE_CMDID); |
| 10581 | |
| 10582 | if (ret != 0) { |
| 10583 | WMI_LOGE("Sending PDEV DFS disable cmd failed\n"); |
| 10584 | wmi_buf_free(buf); |
| 10585 | } |
| 10586 | |
| 10587 | return ret; |
| 10588 | } |
| 10589 | |
| 10590 | /** |
| 10591 | * send_phyerr_enable_cmd_tlv() - WMI phyerr disable function |
| 10592 | * |
| 10593 | * @param wmi_handle : handle to WMI. |
| 10594 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10595 | */ |
| 10596 | static QDF_STATUS send_phyerr_enable_cmd_tlv(wmi_unified_t wmi_handle) |
| 10597 | { |
| 10598 | wmi_pdev_dfs_enable_cmd_fixed_param *cmd; |
| 10599 | wmi_buf_t buf; |
| 10600 | QDF_STATUS ret; |
| 10601 | int32_t len; |
| 10602 | |
| 10603 | len = sizeof(*cmd); |
| 10604 | |
| 10605 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10606 | if (!buf) { |
| 10607 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10608 | return QDF_STATUS_E_FAILURE; |
| 10609 | } |
| 10610 | |
| 10611 | cmd = (wmi_pdev_dfs_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 10612 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10613 | WMITLV_TAG_STRUC_wmi_pdev_dfs_enable_cmd_fixed_param, |
| 10614 | WMITLV_GET_STRUCT_TLVLEN( |
| 10615 | wmi_pdev_dfs_enable_cmd_fixed_param)); |
| 10616 | /* Reserved for future use */ |
| 10617 | cmd->reserved0 = 0; |
| 10618 | |
| 10619 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 10620 | WMI_PDEV_DFS_ENABLE_CMDID); |
| 10621 | |
| 10622 | if (ret != 0) { |
| 10623 | WMI_LOGE("Sending PDEV DFS enable cmd failed\n"); |
| 10624 | wmi_buf_free(buf); |
| 10625 | } |
| 10626 | |
| 10627 | return ret; |
| 10628 | } |
| 10629 | |
| 10630 | /** |
| 10631 | * send_nf_dbr_dbm_info_get_cmd_tlv() - send request to get nf to fw |
| 10632 | * @wmi_handle: wmi handle |
| 10633 | * |
| 10634 | * Return: 0 for success or error code |
| 10635 | */ |
| 10636 | static QDF_STATUS |
| 10637 | send_nf_dbr_dbm_info_get_cmd_tlv(wmi_unified_t wmi_handle) |
| 10638 | { |
| 10639 | wmi_buf_t buf; |
| 10640 | QDF_STATUS ret; |
| 10641 | |
| 10642 | buf = wmi_buf_alloc(wmi_handle, 0); |
| 10643 | if (buf == NULL) |
| 10644 | return QDF_STATUS_E_NOMEM; |
| 10645 | |
| 10646 | ret = wmi_unified_cmd_send(wmi_handle, buf, 0, |
| 10647 | WMI_PDEV_GET_NFCAL_POWER_CMDID); |
| 10648 | if (ret != 0) { |
| 10649 | WMI_LOGE("Sending get nfcal power cmd failed\n"); |
| 10650 | wmi_buf_free(buf); |
| 10651 | } |
| 10652 | |
| 10653 | return ret; |
| 10654 | } |
| 10655 | |
| 10656 | /** |
| 10657 | * send_set_ht_ie_cmd_tlv() - send ht ie command to fw |
| 10658 | * @wmi_handle: wmi handle |
| 10659 | * @param: pointer to ht ie param |
| 10660 | * |
| 10661 | * Return: 0 for success or error code |
| 10662 | */ |
| 10663 | static QDF_STATUS |
| 10664 | send_set_ht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 10665 | struct ht_ie_params *param) |
| 10666 | { |
| 10667 | wmi_pdev_set_ht_ie_cmd_fixed_param *cmd; |
| 10668 | wmi_buf_t buf; |
| 10669 | QDF_STATUS ret; |
| 10670 | int32_t len; |
| 10671 | uint8_t *buf_ptr; |
| 10672 | |
| 10673 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10674 | roundup(param->ie_len, sizeof(uint32_t)); |
| 10675 | |
| 10676 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10677 | if (!buf) { |
| 10678 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10679 | return QDF_STATUS_E_FAILURE; |
| 10680 | } |
| 10681 | |
| 10682 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10683 | cmd = (wmi_pdev_set_ht_ie_cmd_fixed_param *)buf_ptr; |
| 10684 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10685 | WMITLV_TAG_STRUC_wmi_pdev_set_ht_ie_cmd_fixed_param, |
| 10686 | WMITLV_GET_STRUCT_TLVLEN( |
| 10687 | wmi_pdev_set_ht_ie_cmd_fixed_param)); |
| 10688 | cmd->reserved0 = 0; |
| 10689 | cmd->ie_len = param->ie_len; |
| 10690 | cmd->tx_streams = param->tx_streams; |
| 10691 | cmd->rx_streams = param->rx_streams; |
| 10692 | |
| 10693 | buf_ptr += sizeof(*cmd); |
| 10694 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 10695 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10696 | if (param->ie_len) |
| 10697 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 10698 | cmd->ie_len); |
| 10699 | |
| 10700 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10701 | WMI_PDEV_SET_HT_CAP_IE_CMDID); |
| 10702 | |
| 10703 | if (ret != 0) { |
| 10704 | WMI_LOGE("Sending set ht ie cmd failed\n"); |
| 10705 | wmi_buf_free(buf); |
| 10706 | } |
| 10707 | |
| 10708 | return ret; |
| 10709 | } |
| 10710 | |
| 10711 | /** |
| 10712 | * send_set_vht_ie_cmd_tlv() - send vht ie command to fw |
| 10713 | * @wmi_handle: wmi handle |
| 10714 | * @param: pointer to vht ie param |
| 10715 | * |
| 10716 | * Return: 0 for success or error code |
| 10717 | */ |
| 10718 | static QDF_STATUS |
| 10719 | send_set_vht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 10720 | struct vht_ie_params *param) |
| 10721 | { |
| 10722 | wmi_pdev_set_vht_ie_cmd_fixed_param *cmd; |
| 10723 | wmi_buf_t buf; |
| 10724 | QDF_STATUS ret; |
| 10725 | int32_t len; |
| 10726 | uint8_t *buf_ptr; |
| 10727 | |
| 10728 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 10729 | roundup(param->ie_len, sizeof(uint32_t)); |
| 10730 | |
| 10731 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10732 | if (!buf) { |
| 10733 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10734 | return QDF_STATUS_E_FAILURE; |
| 10735 | } |
| 10736 | |
| 10737 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10738 | cmd = (wmi_pdev_set_vht_ie_cmd_fixed_param *)buf_ptr; |
| 10739 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10740 | WMITLV_TAG_STRUC_wmi_pdev_set_vht_ie_cmd_fixed_param, |
| 10741 | WMITLV_GET_STRUCT_TLVLEN( |
| 10742 | wmi_pdev_set_vht_ie_cmd_fixed_param)); |
| 10743 | cmd->reserved0 = 0; |
| 10744 | cmd->ie_len = param->ie_len; |
| 10745 | cmd->tx_streams = param->tx_streams; |
| 10746 | cmd->rx_streams = param->rx_streams; |
| 10747 | |
| 10748 | buf_ptr += sizeof(*cmd); |
| 10749 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 10750 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10751 | if (param->ie_len) |
| 10752 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 10753 | cmd->ie_len); |
| 10754 | |
| 10755 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10756 | WMI_PDEV_SET_VHT_CAP_IE_CMDID); |
| 10757 | |
| 10758 | if (ret != 0) { |
| 10759 | WMI_LOGE("Sending set vht ie cmd failed\n"); |
| 10760 | wmi_buf_free(buf); |
| 10761 | } |
| 10762 | |
| 10763 | return ret; |
| 10764 | } |
| 10765 | |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 10766 | /** |
| 10767 | * send_set_quiet_mode_cmd_tlv() - send set quiet mode command to fw |
| 10768 | * @wmi_handle: wmi handle |
| 10769 | * @param: pointer to quiet mode params |
| 10770 | * |
| 10771 | * Return: 0 for success or error code |
| 10772 | */ |
| 10773 | static QDF_STATUS |
| 10774 | send_set_quiet_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 10775 | struct set_quiet_mode_params *param) |
| 10776 | { |
| 10777 | wmi_pdev_set_quiet_cmd_fixed_param *quiet_cmd; |
| 10778 | wmi_buf_t buf; |
| 10779 | QDF_STATUS ret; |
| 10780 | int32_t len; |
| 10781 | |
| 10782 | len = sizeof(*quiet_cmd); |
| 10783 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10784 | if (!buf) { |
| 10785 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10786 | return QDF_STATUS_E_FAILURE; |
| 10787 | } |
| 10788 | |
| 10789 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 10790 | WMITLV_SET_HDR(&quiet_cmd->tlv_header, |
| 10791 | WMITLV_TAG_STRUC_wmi_pdev_set_quiet_cmd_fixed_param, |
| 10792 | WMITLV_GET_STRUCT_TLVLEN( |
| 10793 | wmi_pdev_set_quiet_cmd_fixed_param)); |
| 10794 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 10795 | quiet_cmd->enabled = param->enabled; |
| 10796 | quiet_cmd->period = (param->period)*(param->intval); |
| 10797 | quiet_cmd->duration = param->duration; |
| 10798 | quiet_cmd->next_start = param->offset; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10799 | quiet_cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10800 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 10801 | |
| 10802 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10803 | WMI_PDEV_SET_QUIET_MODE_CMDID); |
| 10804 | |
| 10805 | if (ret != 0) { |
| 10806 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 10807 | wmi_buf_free(buf); |
| 10808 | } |
| 10809 | |
| 10810 | return ret; |
| 10811 | } |
| 10812 | |
| 10813 | /** |
| 10814 | * send_set_bwf_cmd_tlv() - send set bwf command to fw |
| 10815 | * @wmi_handle: wmi handle |
| 10816 | * @param: pointer to set bwf param |
| 10817 | * |
| 10818 | * Return: 0 for success or error code |
| 10819 | */ |
| 10820 | static QDF_STATUS |
| 10821 | send_set_bwf_cmd_tlv(wmi_unified_t wmi_handle, |
| 10822 | struct set_bwf_params *param) |
| 10823 | { |
| 10824 | wmi_bwf_peer_info *peer_info; |
| 10825 | wmi_peer_bwf_request_fixed_param *cmd; |
| 10826 | wmi_buf_t buf; |
| 10827 | QDF_STATUS retval; |
| 10828 | int32_t len; |
| 10829 | uint8_t *buf_ptr; |
| 10830 | int i; |
| 10831 | |
| 10832 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10833 | len += param->num_peers * sizeof(wmi_bwf_peer_info); |
| 10834 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10835 | if (!buf) { |
| 10836 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10837 | return QDF_STATUS_E_FAILURE; |
| 10838 | } |
| 10839 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10840 | cmd = (wmi_peer_bwf_request_fixed_param *)buf_ptr; |
| 10841 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10842 | WMITLV_TAG_STRUC_wmi_peer_bwf_request_fixed_param, |
| 10843 | WMITLV_GET_STRUCT_TLVLEN( |
| 10844 | wmi_peer_bwf_request_fixed_param)); |
| 10845 | cmd->num_peers = param->num_peers; |
| 10846 | |
| 10847 | buf_ptr += sizeof(*cmd); |
| 10848 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10849 | sizeof(wmi_bwf_peer_info) * |
| 10850 | cmd->num_peers); |
| 10851 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10852 | peer_info = (wmi_bwf_peer_info *)buf_ptr; |
| 10853 | |
| 10854 | for (i = 0; i < cmd->num_peers; i++) { |
| 10855 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 10856 | WMITLV_TAG_STRUC_wmi_bwf_peer_info, |
| 10857 | WMITLV_GET_STRUCT_TLVLEN(wmi_bwf_peer_info)); |
| 10858 | peer_info->bwf_guaranteed_bandwidth = |
| 10859 | param->peer_info[i].throughput; |
| 10860 | peer_info->bwf_max_airtime = |
| 10861 | param->peer_info[i].max_airtime; |
| 10862 | peer_info->bwf_peer_priority = |
| 10863 | param->peer_info[i].priority; |
| 10864 | qdf_mem_copy(&peer_info->peer_macaddr, |
| 10865 | ¶m->peer_info[i].peer_macaddr, |
| 10866 | sizeof(param->peer_info[i].peer_macaddr)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 10867 | peer_info->vdev_id = |
| 10868 | param->peer_info[i].vdev_id; |
| 10869 | peer_info->pdev_id = |
| 10870 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10871 | param->peer_info[i].pdev_id); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 10872 | peer_info++; |
| 10873 | } |
| 10874 | |
| 10875 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10876 | WMI_PEER_BWF_REQUEST_CMDID); |
| 10877 | |
| 10878 | if (retval != QDF_STATUS_SUCCESS) { |
| 10879 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 10880 | wmi_buf_free(buf); |
| 10881 | } |
| 10882 | |
| 10883 | return retval; |
| 10884 | } |
| 10885 | |
| 10886 | /** |
| 10887 | * send_mcast_group_update_cmd_tlv() - send mcast group update cmd to fw |
| 10888 | * @wmi_handle: wmi handle |
| 10889 | * @param: pointer to hold mcast update param |
| 10890 | * |
| 10891 | * Return: 0 for success or error code |
| 10892 | */ |
| 10893 | static QDF_STATUS |
| 10894 | send_mcast_group_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 10895 | struct mcast_group_update_params *param) |
| 10896 | { |
| 10897 | wmi_peer_mcast_group_cmd_fixed_param *cmd; |
| 10898 | wmi_buf_t buf; |
| 10899 | QDF_STATUS ret; |
| 10900 | int32_t len; |
| 10901 | int offset = 0; |
| 10902 | static char dummymask[4] = { 0xFF, 0xFF, 0xFF, 0xFF}; |
| 10903 | |
| 10904 | len = sizeof(*cmd); |
| 10905 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10906 | if (!buf) { |
| 10907 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10908 | return QDF_STATUS_E_FAILURE; |
| 10909 | } |
| 10910 | cmd = (wmi_peer_mcast_group_cmd_fixed_param *)wmi_buf_data(buf); |
| 10911 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10912 | WMITLV_TAG_STRUC_wmi_peer_mcast_group_cmd_fixed_param, |
| 10913 | WMITLV_GET_STRUCT_TLVLEN( |
| 10914 | wmi_peer_mcast_group_cmd_fixed_param)); |
| 10915 | /* confirm the buffer is 4-byte aligned */ |
| 10916 | QDF_ASSERT((((size_t) cmd) & 0x3) == 0); |
| 10917 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 10918 | |
| 10919 | cmd->vdev_id = param->vap_id; |
| 10920 | /* construct the message assuming our endianness matches the target */ |
| 10921 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_ACTION_M & |
| 10922 | (param->action << WMI_PEER_MCAST_GROUP_FLAG_ACTION_S); |
| 10923 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_M & |
| 10924 | (param->wildcard << WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_S); |
| 10925 | if (param->is_action_delete) |
| 10926 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_DELETEALL_M; |
| 10927 | |
| 10928 | if (param->is_mcast_addr_len) |
| 10929 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_IPV6_M; |
| 10930 | |
| 10931 | if (param->is_filter_mode_snoop) |
| 10932 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_SRC_FILTER_EXCLUDE_M; |
| 10933 | |
| 10934 | /* unicast address spec only applies for non-wildcard cases */ |
| 10935 | if (!param->wildcard && param->ucast_mac_addr) { |
| 10936 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->ucast_mac_addr, |
| 10937 | &cmd->ucast_mac_addr); |
| 10938 | } |
| 10939 | if (param->mcast_ip_addr) { |
| 10940 | QDF_ASSERT(param->mcast_ip_addr_bytes <= |
| 10941 | sizeof(cmd->mcast_ip_addr)); |
| 10942 | offset = sizeof(cmd->mcast_ip_addr) - |
| 10943 | param->mcast_ip_addr_bytes; |
| 10944 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_addr) + offset, |
| 10945 | param->mcast_ip_addr, |
| 10946 | param->mcast_ip_addr_bytes); |
| 10947 | } |
| 10948 | if (!param->mask) |
| 10949 | param->mask = &dummymask[0]; |
| 10950 | |
| 10951 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_mask) + offset, |
| 10952 | param->mask, |
| 10953 | param->mcast_ip_addr_bytes); |
| 10954 | |
| 10955 | if (param->srcs && param->nsrcs) { |
| 10956 | cmd->num_filter_addr = param->nsrcs; |
| 10957 | QDF_ASSERT((param->nsrcs * param->mcast_ip_addr_bytes) <= |
| 10958 | sizeof(cmd->filter_addr)); |
| 10959 | |
| 10960 | qdf_mem_copy(((uint8_t *) &cmd->filter_addr), param->srcs, |
| 10961 | param->nsrcs * param->mcast_ip_addr_bytes); |
| 10962 | } |
| 10963 | |
| 10964 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10965 | WMI_PEER_MCAST_GROUP_CMDID); |
| 10966 | |
| 10967 | if (ret != QDF_STATUS_SUCCESS) { |
| 10968 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 10969 | wmi_buf_free(buf); |
| 10970 | } |
| 10971 | |
| 10972 | return ret; |
| 10973 | } |
| 10974 | |
| 10975 | /** |
| 10976 | * send_vdev_spectral_configure_cmd_tlv() - send VDEV spectral configure |
| 10977 | * command to fw |
| 10978 | * @wmi_handle: wmi handle |
| 10979 | * @param: pointer to hold spectral config parameter |
| 10980 | * |
| 10981 | * Return: 0 for success or error code |
| 10982 | */ |
| 10983 | static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle, |
| 10984 | struct vdev_spectral_configure_params *param) |
| 10985 | { |
| 10986 | wmi_vdev_spectral_configure_cmd_fixed_param *cmd; |
| 10987 | wmi_buf_t buf; |
| 10988 | QDF_STATUS ret; |
| 10989 | int32_t len; |
| 10990 | |
| 10991 | len = sizeof(*cmd); |
| 10992 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10993 | if (!buf) { |
| 10994 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 10995 | return QDF_STATUS_E_FAILURE; |
| 10996 | } |
| 10997 | |
| 10998 | cmd = (wmi_vdev_spectral_configure_cmd_fixed_param *)wmi_buf_data(buf); |
| 10999 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11000 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param, |
| 11001 | WMITLV_GET_STRUCT_TLVLEN( |
| 11002 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param)); |
| 11003 | |
| 11004 | cmd->vdev_id = param->vdev_id; |
| 11005 | cmd->spectral_scan_count = param->count; |
| 11006 | cmd->spectral_scan_period = param->period; |
| 11007 | cmd->spectral_scan_priority = param->spectral_pri; |
| 11008 | cmd->spectral_scan_fft_size = param->fft_size; |
| 11009 | cmd->spectral_scan_gc_ena = param->gc_enable; |
| 11010 | cmd->spectral_scan_restart_ena = param->restart_enable; |
| 11011 | cmd->spectral_scan_noise_floor_ref = param->noise_floor_ref; |
| 11012 | cmd->spectral_scan_init_delay = param->init_delay; |
| 11013 | cmd->spectral_scan_nb_tone_thr = param->nb_tone_thr; |
| 11014 | cmd->spectral_scan_str_bin_thr = param->str_bin_thr; |
| 11015 | cmd->spectral_scan_wb_rpt_mode = param->wb_rpt_mode; |
| 11016 | cmd->spectral_scan_rssi_rpt_mode = param->rssi_rpt_mode; |
| 11017 | cmd->spectral_scan_rssi_thr = param->rssi_thr; |
| 11018 | cmd->spectral_scan_pwr_format = param->pwr_format; |
| 11019 | cmd->spectral_scan_rpt_mode = param->rpt_mode; |
| 11020 | cmd->spectral_scan_bin_scale = param->bin_scale; |
| 11021 | cmd->spectral_scan_dBm_adj = param->dBm_adj; |
| 11022 | cmd->spectral_scan_chn_mask = param->chn_mask; |
| 11023 | |
| 11024 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11025 | WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID); |
| 11026 | |
| 11027 | if (ret != 0) { |
| 11028 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 11029 | wmi_buf_free(buf); |
| 11030 | } |
| 11031 | |
| 11032 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID\n", |
| 11033 | __func__); |
| 11034 | |
| 11035 | WMI_LOGI("vdev_id = %u\n" |
| 11036 | "spectral_scan_count = %u\n" |
| 11037 | "spectral_scan_period = %u\n" |
| 11038 | "spectral_scan_priority = %u\n" |
| 11039 | "spectral_scan_fft_size = %u\n" |
| 11040 | "spectral_scan_gc_ena = %u\n" |
| 11041 | "spectral_scan_restart_ena = %u\n" |
| 11042 | "spectral_scan_noise_floor_ref = %u\n" |
| 11043 | "spectral_scan_init_delay = %u\n" |
| 11044 | "spectral_scan_nb_tone_thr = %u\n" |
| 11045 | "spectral_scan_str_bin_thr = %u\n" |
| 11046 | "spectral_scan_wb_rpt_mode = %u\n" |
| 11047 | "spectral_scan_rssi_rpt_mode = %u\n" |
| 11048 | "spectral_scan_rssi_thr = %u\n" |
| 11049 | "spectral_scan_pwr_format = %u\n" |
| 11050 | "spectral_scan_rpt_mode = %u\n" |
| 11051 | "spectral_scan_bin_scale = %u\n" |
| 11052 | "spectral_scan_dBm_adj = %u\n" |
| 11053 | "spectral_scan_chn_mask = %u\n", |
| 11054 | param->vdev_id, |
| 11055 | param->count, |
| 11056 | param->period, |
| 11057 | param->spectral_pri, |
| 11058 | param->fft_size, |
| 11059 | param->gc_enable, |
| 11060 | param->restart_enable, |
| 11061 | param->noise_floor_ref, |
| 11062 | param->init_delay, |
| 11063 | param->nb_tone_thr, |
| 11064 | param->str_bin_thr, |
| 11065 | param->wb_rpt_mode, |
| 11066 | param->rssi_rpt_mode, |
| 11067 | param->rssi_thr, |
| 11068 | param->pwr_format, |
| 11069 | param->rpt_mode, |
| 11070 | param->bin_scale, |
| 11071 | param->dBm_adj, |
| 11072 | param->chn_mask); |
| 11073 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 11074 | |
| 11075 | return ret; |
| 11076 | } |
| 11077 | |
| 11078 | /** |
| 11079 | * send_vdev_spectral_enable_cmd_tlv() - send VDEV spectral configure |
| 11080 | * command to fw |
| 11081 | * @wmi_handle: wmi handle |
| 11082 | * @param: pointer to hold spectral enable parameter |
| 11083 | * |
| 11084 | * Return: 0 for success or error code |
| 11085 | */ |
| 11086 | static QDF_STATUS send_vdev_spectral_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 11087 | struct vdev_spectral_enable_params *param) |
| 11088 | { |
| 11089 | wmi_vdev_spectral_enable_cmd_fixed_param *cmd; |
| 11090 | wmi_buf_t buf; |
| 11091 | QDF_STATUS ret; |
| 11092 | int32_t len; |
| 11093 | |
| 11094 | len = sizeof(*cmd); |
| 11095 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11096 | if (!buf) { |
| 11097 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11098 | return QDF_STATUS_E_FAILURE; |
| 11099 | } |
| 11100 | |
| 11101 | cmd = (wmi_vdev_spectral_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11102 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11103 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param, |
| 11104 | WMITLV_GET_STRUCT_TLVLEN( |
| 11105 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param)); |
| 11106 | |
| 11107 | cmd->vdev_id = param->vdev_id; |
| 11108 | |
| 11109 | if (param->active_valid) { |
| 11110 | cmd->trigger_cmd = param->active ? 1 : 2; |
| 11111 | /* 1: Trigger, 2: Clear Trigger */ |
| 11112 | } else { |
| 11113 | cmd->trigger_cmd = 0; /* 0: Ignore */ |
| 11114 | } |
| 11115 | |
| 11116 | if (param->enabled_valid) { |
| 11117 | cmd->enable_cmd = param->enabled ? 1 : 2; |
| 11118 | /* 1: Enable 2: Disable */ |
| 11119 | } else { |
| 11120 | cmd->enable_cmd = 0; /* 0: Ignore */ |
| 11121 | } |
| 11122 | |
| 11123 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11124 | WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID); |
| 11125 | |
| 11126 | if (ret != 0) { |
| 11127 | WMI_LOGE("Sending scan enable CMD failed\n"); |
| 11128 | wmi_buf_free(buf); |
| 11129 | } |
| 11130 | |
| 11131 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID\n", __func__); |
| 11132 | |
| 11133 | WMI_LOGI("vdev_id = %u\n" |
| 11134 | "trigger_cmd = %u\n" |
| 11135 | "enable_cmd = %u\n", |
| 11136 | cmd->vdev_id, |
| 11137 | cmd->trigger_cmd, |
| 11138 | cmd->enable_cmd); |
| 11139 | |
| 11140 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 11141 | |
| 11142 | return ret; |
| 11143 | } |
| 11144 | |
| 11145 | /** |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11146 | * send_thermal_mitigation_param_cmd_tlv() - configure thermal mitigation params |
| 11147 | * @param wmi_handle : handle to WMI. |
| 11148 | * @param param : pointer to hold thermal mitigation param |
| 11149 | * |
| 11150 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11151 | */ |
| 11152 | static QDF_STATUS send_thermal_mitigation_param_cmd_tlv( |
| 11153 | wmi_unified_t wmi_handle, |
| 11154 | struct thermal_mitigation_params *param) |
| 11155 | { |
| 11156 | wmi_therm_throt_config_request_fixed_param *tt_conf = NULL; |
| 11157 | wmi_therm_throt_level_config_info *lvl_conf = NULL; |
| 11158 | wmi_buf_t buf = NULL; |
| 11159 | uint8_t *buf_ptr = NULL; |
| 11160 | int error; |
| 11161 | int32_t len; |
| 11162 | int i; |
| 11163 | |
| 11164 | len = sizeof(*tt_conf) + WMI_TLV_HDR_SIZE + |
| 11165 | THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info); |
| 11166 | |
| 11167 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11168 | if (!buf) { |
| 11169 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 11170 | return QDF_STATUS_E_NOMEM; |
| 11171 | } |
| 11172 | tt_conf = (wmi_therm_throt_config_request_fixed_param *) wmi_buf_data(buf); |
| 11173 | |
| 11174 | /* init fixed params */ |
| 11175 | WMITLV_SET_HDR(tt_conf, |
| 11176 | WMITLV_TAG_STRUC_wmi_therm_throt_config_request_fixed_param, |
| 11177 | (WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_config_request_fixed_param))); |
| 11178 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11179 | tt_conf->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11180 | param->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11181 | tt_conf->enable = param->enable; |
| 11182 | tt_conf->dc = param->dc; |
| 11183 | tt_conf->dc_per_event = param->dc_per_event; |
| 11184 | tt_conf->therm_throt_levels = THERMAL_LEVELS; |
| 11185 | |
| 11186 | buf_ptr = (uint8_t *) ++tt_conf; |
| 11187 | /* init TLV params */ |
| 11188 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11189 | (THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info))); |
| 11190 | |
| 11191 | lvl_conf = (wmi_therm_throt_level_config_info *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11192 | for (i = 0; i < THERMAL_LEVELS; i++) { |
| 11193 | WMITLV_SET_HDR(&lvl_conf->tlv_header, |
| 11194 | WMITLV_TAG_STRUC_wmi_therm_throt_level_config_info, |
| 11195 | WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_level_config_info)); |
| 11196 | lvl_conf->temp_lwm = param->levelconf[i].tmplwm; |
| 11197 | lvl_conf->temp_hwm = param->levelconf[i].tmphwm; |
| 11198 | lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; |
| 11199 | lvl_conf->prio = param->levelconf[i].priority; |
| 11200 | lvl_conf++; |
| 11201 | } |
| 11202 | |
| 11203 | error = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11204 | WMI_THERM_THROT_SET_CONF_CMDID); |
| 11205 | if (QDF_IS_STATUS_ERROR(error)) { |
| 11206 | wmi_buf_free(buf); |
| 11207 | WMI_LOGE("Failed to send WMI_THERM_THROT_SET_CONF_CMDID command"); |
| 11208 | } |
| 11209 | |
| 11210 | return error; |
| 11211 | } |
| 11212 | |
| 11213 | /** |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11214 | * send_pdev_qvit_cmd_tlv() - send qvit command to fw |
| 11215 | * @wmi_handle: wmi handle |
| 11216 | * @param: pointer to pdev_qvit_params |
| 11217 | * |
| 11218 | * Return: 0 for success or error code |
| 11219 | */ |
| 11220 | static QDF_STATUS |
| 11221 | send_pdev_qvit_cmd_tlv(wmi_unified_t wmi_handle, |
| 11222 | struct pdev_qvit_params *param) |
| 11223 | { |
| 11224 | wmi_buf_t buf; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11225 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11226 | uint8_t *cmd; |
| 11227 | static uint8_t msgref = 1; |
| 11228 | uint8_t segnumber = 0, seginfo, numsegments; |
| 11229 | uint16_t chunk_len, total_bytes; |
| 11230 | uint8_t *bufpos; |
| 11231 | QVIT_SEG_HDR_INFO_STRUCT seghdrinfo; |
| 11232 | |
| 11233 | bufpos = param->utf_payload; |
| 11234 | total_bytes = param->len; |
| 11235 | ASSERT(total_bytes / MAX_WMI_QVIT_LEN == |
| 11236 | (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN)); |
| 11237 | numsegments = (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN); |
| 11238 | |
| 11239 | if (param->len - (numsegments * MAX_WMI_QVIT_LEN)) |
| 11240 | numsegments++; |
| 11241 | |
| 11242 | while (param->len) { |
| 11243 | if (param->len > MAX_WMI_QVIT_LEN) |
| 11244 | chunk_len = MAX_WMI_QVIT_LEN; /* MAX messsage */ |
| 11245 | else |
| 11246 | chunk_len = param->len; |
| 11247 | |
| 11248 | buf = wmi_buf_alloc(wmi_handle, |
| 11249 | (chunk_len + sizeof(seghdrinfo) + |
| 11250 | WMI_TLV_HDR_SIZE)); |
| 11251 | if (!buf) { |
| 11252 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 11253 | return QDF_STATUS_E_NOMEM; |
| 11254 | } |
| 11255 | |
| 11256 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 11257 | |
| 11258 | seghdrinfo.len = total_bytes; |
| 11259 | seghdrinfo.msgref = msgref; |
| 11260 | seginfo = ((numsegments << 4) & 0xF0) | (segnumber & 0xF); |
| 11261 | seghdrinfo.segmentInfo = seginfo; |
| 11262 | |
| 11263 | segnumber++; |
| 11264 | |
| 11265 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 11266 | (chunk_len + sizeof(seghdrinfo))); |
| 11267 | cmd += WMI_TLV_HDR_SIZE; |
| 11268 | qdf_mem_copy(cmd, &seghdrinfo, sizeof(seghdrinfo)); |
| 11269 | qdf_mem_copy(&cmd[sizeof(seghdrinfo)], bufpos, chunk_len); |
| 11270 | |
| 11271 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 11272 | (chunk_len + sizeof(seghdrinfo) + |
| 11273 | WMI_TLV_HDR_SIZE), |
| 11274 | WMI_PDEV_QVIT_CMDID); |
| 11275 | |
| 11276 | if (ret != 0) { |
| 11277 | WMI_LOGE("Failed to send WMI_PDEV_QVIT_CMDID command"); |
| 11278 | wmi_buf_free(buf); |
| 11279 | break; |
| 11280 | } |
| 11281 | |
| 11282 | param->len -= chunk_len; |
| 11283 | bufpos += chunk_len; |
| 11284 | } |
| 11285 | msgref++; |
| 11286 | |
| 11287 | return ret; |
| 11288 | } |
| 11289 | |
| 11290 | /** |
| 11291 | * send_wmm_update_cmd_tlv() - send wmm update command to fw |
| 11292 | * @wmi_handle: wmi handle |
| 11293 | * @param: pointer to wmm update param |
| 11294 | * |
| 11295 | * Return: 0 for success or error code |
| 11296 | */ |
| 11297 | static QDF_STATUS |
| 11298 | send_wmm_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 11299 | struct wmm_update_params *param) |
| 11300 | { |
| 11301 | wmi_pdev_set_wmm_params_cmd_fixed_param *cmd; |
| 11302 | wmi_wmm_params *wmm_param; |
| 11303 | wmi_buf_t buf; |
| 11304 | QDF_STATUS ret; |
| 11305 | int32_t len; |
| 11306 | int ac = 0; |
| 11307 | struct wmi_host_wmeParams *wmep; |
| 11308 | uint8_t *buf_ptr; |
| 11309 | |
| 11310 | len = sizeof(*cmd) + (WME_NUM_AC * sizeof(*wmm_param)); |
| 11311 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11312 | if (!buf) { |
| 11313 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11314 | return QDF_STATUS_E_FAILURE; |
| 11315 | } |
| 11316 | |
| 11317 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11318 | cmd = (wmi_pdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 11319 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11320 | WMITLV_TAG_STRUC_wmi_pdev_set_wmm_params_cmd_fixed_param, |
| 11321 | WMITLV_GET_STRUCT_TLVLEN |
| 11322 | (wmi_pdev_set_wmm_params_cmd_fixed_param)); |
| 11323 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11324 | cmd->reserved0 = WMI_HOST_PDEV_ID_SOC; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11325 | |
| 11326 | buf_ptr += sizeof(wmi_pdev_set_wmm_params_cmd_fixed_param); |
| 11327 | |
| 11328 | for (ac = 0; ac < WME_NUM_AC; ac++) { |
| 11329 | wmep = ¶m->wmep_array[ac]; |
| 11330 | wmm_param = (wmi_wmm_params *)buf_ptr; |
| 11331 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 11332 | WMITLV_TAG_STRUC_wmi_wmm_params, |
| 11333 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_params)); |
| 11334 | wmm_param->aifs = wmep->wmep_aifsn; |
| 11335 | wmm_param->cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin); |
| 11336 | wmm_param->cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax); |
| 11337 | wmm_param->txoplimit = ATH_TXOP_TO_US(wmep->wmep_txopLimit); |
| 11338 | wmm_param->acm = wmep->wmep_acm; |
| 11339 | wmm_param->no_ack = wmep->wmep_noackPolicy; |
| 11340 | buf_ptr += sizeof(wmi_wmm_params); |
| 11341 | } |
| 11342 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11343 | WMI_PDEV_SET_WMM_PARAMS_CMDID); |
| 11344 | |
| 11345 | if (ret != 0) { |
| 11346 | WMI_LOGE("Sending WMM update CMD failed\n"); |
| 11347 | wmi_buf_free(buf); |
| 11348 | } |
| 11349 | |
| 11350 | return ret; |
| 11351 | } |
| 11352 | |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 11353 | /** |
| 11354 | * send_coex_config_cmd_tlv() - send coex config command to fw |
| 11355 | * @wmi_handle: wmi handle |
| 11356 | * @param: pointer to coex config param |
| 11357 | * |
| 11358 | * Return: 0 for success or error code |
| 11359 | */ |
| 11360 | static QDF_STATUS |
| 11361 | send_coex_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 11362 | struct coex_config_params *param) |
| 11363 | { |
| 11364 | WMI_COEX_CONFIG_CMD_fixed_param *cmd; |
| 11365 | wmi_buf_t buf; |
| 11366 | QDF_STATUS ret; |
| 11367 | int32_t len; |
| 11368 | |
| 11369 | len = sizeof(*cmd); |
| 11370 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11371 | if (!buf) { |
| 11372 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11373 | return QDF_STATUS_E_FAILURE; |
| 11374 | } |
| 11375 | |
| 11376 | cmd = (WMI_COEX_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 11377 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11378 | WMITLV_TAG_STRUC_WMI_COEX_CONFIG_CMD_fixed_param, |
| 11379 | WMITLV_GET_STRUCT_TLVLEN( |
Sathish Kumar | 8458a05 | 2017-05-12 15:52:00 +0530 | [diff] [blame] | 11380 | WMI_COEX_CONFIG_CMD_fixed_param)); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 11381 | |
| 11382 | cmd->vdev_id = param->vdev_id; |
| 11383 | cmd->config_type = param->config_type; |
| 11384 | cmd->config_arg1 = param->config_arg1; |
| 11385 | cmd->config_arg2 = param->config_arg2; |
| 11386 | cmd->config_arg3 = param->config_arg3; |
| 11387 | cmd->config_arg4 = param->config_arg4; |
| 11388 | cmd->config_arg5 = param->config_arg5; |
| 11389 | cmd->config_arg6 = param->config_arg6; |
| 11390 | |
| 11391 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11392 | WMI_COEX_CONFIG_CMDID); |
| 11393 | |
| 11394 | if (ret != 0) { |
| 11395 | WMI_LOGE("Sending COEX CONFIG CMD failed\n"); |
| 11396 | wmi_buf_free(buf); |
| 11397 | } |
| 11398 | |
| 11399 | return ret; |
| 11400 | } |
| 11401 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 11402 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11403 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11404 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11405 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11406 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11407 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 11408 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 11409 | resource_cfg->num_offload_reorder_buffs = |
| 11410 | tgt_res_cfg->num_offload_reorder_buffs; |
| 11411 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 11412 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 11413 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 11414 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 11415 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 11416 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 11417 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 11418 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 11419 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 11420 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 11421 | resource_cfg->scan_max_pending_req = |
| 11422 | tgt_res_cfg->scan_max_pending_req; |
| 11423 | resource_cfg->bmiss_offload_max_vdev = |
| 11424 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 11425 | resource_cfg->roam_offload_max_vdev = |
| 11426 | tgt_res_cfg->roam_offload_max_vdev; |
| 11427 | resource_cfg->roam_offload_max_ap_profiles = |
| 11428 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 11429 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 11430 | resource_cfg->num_mcast_table_elems = |
| 11431 | tgt_res_cfg->num_mcast_table_elems; |
| 11432 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 11433 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 11434 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 11435 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 11436 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 11437 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 11438 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 11439 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 11440 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 11441 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 11442 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 11443 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 11444 | resource_cfg->num_tdls_conn_table_entries = |
| 11445 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 11446 | resource_cfg->beacon_tx_offload_max_vdev = |
| 11447 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 11448 | resource_cfg->num_multicast_filter_entries = |
| 11449 | tgt_res_cfg->num_multicast_filter_entries; |
| 11450 | resource_cfg->num_wow_filters = |
| 11451 | tgt_res_cfg->num_wow_filters; |
| 11452 | resource_cfg->num_keep_alive_pattern = |
| 11453 | tgt_res_cfg->num_keep_alive_pattern; |
| 11454 | resource_cfg->keep_alive_pattern_size = |
| 11455 | tgt_res_cfg->keep_alive_pattern_size; |
| 11456 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 11457 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 11458 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 11459 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 11460 | resource_cfg->wmi_send_separate = |
| 11461 | tgt_res_cfg->wmi_send_separate; |
| 11462 | resource_cfg->num_ocb_vdevs = |
| 11463 | tgt_res_cfg->num_ocb_vdevs; |
| 11464 | resource_cfg->num_ocb_channels = |
| 11465 | tgt_res_cfg->num_ocb_channels; |
| 11466 | resource_cfg->num_ocb_schedules = |
| 11467 | tgt_res_cfg->num_ocb_schedules; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 11468 | resource_cfg->bpf_instruction_size = tgt_res_cfg->bpf_instruction_size; |
| 11469 | resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters; |
| 11470 | resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11471 | |
| 11472 | WMI_RSRC_CFG_FLAG_ATF_CONFIG_ENABLE_SET(resource_cfg->flag1, |
| 11473 | tgt_res_cfg->atf_config); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11474 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 11475 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11476 | /** |
| 11477 | * send_init_cmd_tlv() - wmi init command |
| 11478 | * @wmi_handle: pointer to wmi handle |
| 11479 | * @res_cfg: resource config |
| 11480 | * @num_mem_chunks: no of mem chunck |
| 11481 | * @mem_chunk: pointer to mem chunck structure |
| 11482 | * |
| 11483 | * This function sends IE information to firmware |
| 11484 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11485 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11486 | * |
| 11487 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11488 | static QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11489 | wmi_resource_config *tgt_res_cfg, |
| 11490 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 11491 | bool action) |
| 11492 | { |
| 11493 | wmi_buf_t buf; |
| 11494 | wmi_init_cmd_fixed_param *cmd; |
| 11495 | wmi_abi_version my_vers; |
| 11496 | int num_whitelist; |
| 11497 | uint8_t *buf_ptr; |
| 11498 | wmi_resource_config *resource_cfg; |
| 11499 | wlan_host_memory_chunk *host_mem_chunks; |
| 11500 | uint32_t mem_chunk_len = 0; |
| 11501 | uint16_t idx; |
| 11502 | int len; |
| 11503 | int ret; |
| 11504 | |
| 11505 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 11506 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 11507 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 11508 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11509 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 11510 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11511 | } |
| 11512 | |
| 11513 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 11514 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 11515 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 11516 | |
| 11517 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 11518 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 11519 | + WMI_TLV_HDR_SIZE); |
| 11520 | |
| 11521 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11522 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 11523 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 11524 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11525 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11526 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 11527 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 11528 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 11529 | |
| 11530 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 11531 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 11532 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 11533 | WMITLV_GET_STRUCT_TLVLEN |
| 11534 | (wlan_host_memory_chunk)); |
| 11535 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 11536 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 11537 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11538 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11539 | idx, host_mem_chunks[idx].size, |
| 11540 | host_mem_chunks[idx].ptr); |
| 11541 | } |
| 11542 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 11543 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 11544 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 11545 | WMITLV_TAG_ARRAY_STRUC, |
| 11546 | (sizeof(wlan_host_memory_chunk) * |
| 11547 | num_mem_chunks)); |
| 11548 | |
| 11549 | num_whitelist = sizeof(version_whitelist) / |
| 11550 | sizeof(wmi_whitelist_version_info); |
| 11551 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 11552 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 11553 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 11554 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 11555 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 11556 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11557 | #ifdef CONFIG_MCL |
| 11558 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 11559 | * 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] | 11560 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 11561 | &my_vers, |
| 11562 | &wmi_handle->fw_abi_version, |
| 11563 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11564 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11565 | 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] | 11566 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 11567 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 11568 | cmd->host_abi_vers.abi_version_ns_0, |
| 11569 | cmd->host_abi_vers.abi_version_ns_1, |
| 11570 | cmd->host_abi_vers.abi_version_ns_2, |
| 11571 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11572 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11573 | /* Save version sent from host - |
| 11574 | * Will be used to check ready event |
| 11575 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11576 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11577 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11578 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11579 | if (action) { |
| 11580 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11581 | WMI_INIT_CMDID); |
| 11582 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11583 | 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] | 11584 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11585 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11586 | } |
| 11587 | } else { |
| 11588 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 11589 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 11590 | } |
| 11591 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11592 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11593 | |
| 11594 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 11595 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11596 | /** |
| 11597 | * send_saved_init_cmd_tlv() - wmi init command |
| 11598 | * @wmi_handle: pointer to wmi handle |
| 11599 | * |
| 11600 | * This function sends IE information to firmware |
| 11601 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11602 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11603 | * |
| 11604 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11605 | 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] | 11606 | { |
| 11607 | int status; |
| 11608 | |
| 11609 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 11610 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11611 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 11612 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11613 | } |
| 11614 | status = wmi_unified_cmd_send(wmi_handle, |
| 11615 | wmi_handle->saved_wmi_init_cmd.buf, |
| 11616 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 11617 | WMI_INIT_CMDID); |
| 11618 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11619 | 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] | 11620 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11621 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11622 | } |
| 11623 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 11624 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 11625 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11626 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11627 | } |
| 11628 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11629 | 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] | 11630 | { |
| 11631 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 11632 | wmi_service_ready_event_fixed_param *ev; |
| 11633 | |
| 11634 | |
| 11635 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 11636 | |
| 11637 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 11638 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11639 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11640 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11641 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11642 | /*Save fw version from service ready message */ |
| 11643 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11644 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11645 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11646 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11647 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11648 | } |
| 11649 | |
| 11650 | /** |
| 11651 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 11652 | * @wmi_handle: pointer to wmi handle |
| 11653 | * @res_cfg: resource config |
| 11654 | * @num_mem_chunks: no of mem chunck |
| 11655 | * @mem_chunk: pointer to mem chunck structure |
| 11656 | * |
| 11657 | * This function sends IE information to firmware |
| 11658 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11659 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11660 | * |
| 11661 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11662 | 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] | 11663 | void *evt_buf) |
| 11664 | { |
| 11665 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 11666 | wmi_ready_event_fixed_param *ev = NULL; |
| 11667 | |
| 11668 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 11669 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11670 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11671 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 11672 | &ev->fw_abi_vers)) { |
| 11673 | /* |
| 11674 | * Error: Our host version and the given firmware version |
| 11675 | * are incompatible. |
| 11676 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11677 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11678 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 11679 | __func__, |
| 11680 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 11681 | abi_version_0), |
| 11682 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 11683 | abi_version_0), |
| 11684 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 11685 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 11686 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 11687 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 11688 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 11689 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 11690 | ev->fw_abi_vers.abi_version_ns_0, |
| 11691 | ev->fw_abi_vers.abi_version_ns_1, |
| 11692 | ev->fw_abi_vers.abi_version_ns_2, |
| 11693 | ev->fw_abi_vers.abi_version_ns_3); |
| 11694 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11695 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11696 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11697 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11698 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11699 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11700 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 11701 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11702 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11703 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 11704 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11705 | |
| 11706 | /** |
| 11707 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 11708 | * @wmi_handle: wmi handle |
| 11709 | * @custom_addr: base mac address |
| 11710 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 11711 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11712 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11713 | 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] | 11714 | uint8_t *custom_addr) |
| 11715 | { |
| 11716 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 11717 | wmi_buf_t buf; |
| 11718 | int err; |
| 11719 | |
| 11720 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 11721 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11722 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11723 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11724 | } |
| 11725 | |
| 11726 | 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] | 11727 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11728 | |
| 11729 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11730 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 11731 | WMITLV_GET_STRUCT_TLVLEN |
| 11732 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 11733 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11734 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11735 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11736 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 11737 | sizeof(*cmd), |
| 11738 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 11739 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11740 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 11741 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11742 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11743 | } |
| 11744 | |
| 11745 | return 0; |
| 11746 | } |
| 11747 | |
| 11748 | /** |
| 11749 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 11750 | * @handle: wmi handle |
| 11751 | * @event: Event received from FW |
| 11752 | * @len: Length of the event |
| 11753 | * |
| 11754 | * Enables the low frequency events and disables the high frequency |
| 11755 | * events. Bit 17 indicates if the event if low/high frequency. |
| 11756 | * 1 - high frequency, 0 - low frequency |
| 11757 | * |
| 11758 | * Return: 0 on successfully enabling/disabling the events |
| 11759 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11760 | 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] | 11761 | uint8_t *event, |
| 11762 | uint32_t len) |
| 11763 | { |
| 11764 | uint32_t num_of_diag_events_logs; |
| 11765 | wmi_diag_event_log_config_fixed_param *cmd; |
| 11766 | wmi_buf_t buf; |
| 11767 | uint8_t *buf_ptr; |
| 11768 | uint32_t *cmd_args, *evt_args; |
| 11769 | uint32_t buf_len, i; |
| 11770 | |
| 11771 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 11772 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 11773 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11774 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11775 | |
| 11776 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 11777 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11778 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11779 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11780 | } |
| 11781 | wmi_event = param_buf->fixed_param; |
| 11782 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 11783 | evt_args = param_buf->diag_events_logs_list; |
| 11784 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11785 | 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] | 11786 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11787 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11788 | } |
| 11789 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11790 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11791 | __func__, num_of_diag_events_logs); |
| 11792 | |
| 11793 | /* Free any previous allocation */ |
| 11794 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11795 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11796 | |
| 11797 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11798 | 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] | 11799 | sizeof(uint32_t)); |
| 11800 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11801 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11802 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11803 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11804 | } |
| 11805 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 11806 | |
| 11807 | /* Prepare the send buffer */ |
| 11808 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11809 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 11810 | |
| 11811 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 11812 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11813 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 11814 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11815 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11816 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11817 | } |
| 11818 | |
| 11819 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 11820 | buf_ptr = (uint8_t *) cmd; |
| 11821 | |
| 11822 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11823 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 11824 | WMITLV_GET_STRUCT_TLVLEN( |
| 11825 | wmi_diag_event_log_config_fixed_param)); |
| 11826 | |
| 11827 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 11828 | |
| 11829 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 11830 | |
| 11831 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11832 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 11833 | |
| 11834 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11835 | |
| 11836 | /* Populate the events */ |
| 11837 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 11838 | /* Low freq (0) - Enable (1) the event |
| 11839 | * High freq (1) - Disable (0) the event |
| 11840 | */ |
| 11841 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 11842 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 11843 | /* Set the event ID */ |
| 11844 | WMI_DIAG_ID_SET(cmd_args[i], |
| 11845 | WMI_DIAG_ID_GET(evt_args[i])); |
| 11846 | /* Set the type */ |
| 11847 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 11848 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11849 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11850 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 11851 | } |
| 11852 | |
| 11853 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 11854 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11855 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11856 | __func__); |
| 11857 | wmi_buf_free(buf); |
| 11858 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 11859 | * Host can still have this list |
| 11860 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11861 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11862 | } |
| 11863 | |
| 11864 | return 0; |
| 11865 | } |
| 11866 | |
| 11867 | /** |
| 11868 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 11869 | * @wmi_handle: wmi handle |
| 11870 | * @start_log: Start logging related parameters |
| 11871 | * |
| 11872 | * Send the command to the FW based on which specific logging of diag |
| 11873 | * event/log id can be started/stopped |
| 11874 | * |
| 11875 | * Return: None |
| 11876 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11877 | 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] | 11878 | struct wmi_wifi_start_log *start_log) |
| 11879 | { |
| 11880 | wmi_diag_event_log_config_fixed_param *cmd; |
| 11881 | wmi_buf_t buf; |
| 11882 | uint8_t *buf_ptr; |
| 11883 | uint32_t len, count, log_level, i; |
| 11884 | uint32_t *cmd_args; |
| 11885 | uint32_t total_len; |
| 11886 | count = 0; |
| 11887 | |
| 11888 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11889 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11890 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11891 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11892 | } |
| 11893 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 11894 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 11895 | */ |
| 11896 | total_len = 0; |
| 11897 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 11898 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 11899 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 11900 | total_len++; |
| 11901 | } |
| 11902 | |
| 11903 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11904 | (total_len * sizeof(uint32_t)); |
| 11905 | |
| 11906 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11907 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11908 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11909 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11910 | } |
| 11911 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 11912 | buf_ptr = (uint8_t *) cmd; |
| 11913 | |
| 11914 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11915 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 11916 | WMITLV_GET_STRUCT_TLVLEN( |
| 11917 | wmi_diag_event_log_config_fixed_param)); |
| 11918 | |
| 11919 | cmd->num_of_diag_events_logs = total_len; |
| 11920 | |
| 11921 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 11922 | |
| 11923 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11924 | (total_len * sizeof(uint32_t))); |
| 11925 | |
| 11926 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 11927 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 11928 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11929 | log_level = 1; |
| 11930 | else |
| 11931 | log_level = 0; |
| 11932 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11933 | 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] | 11934 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 11935 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 11936 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 11937 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 11938 | |
| 11939 | WMI_DIAG_ID_SET(cmd_args[count], |
| 11940 | WMI_DIAG_ID_GET(val)); |
| 11941 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 11942 | WMI_DIAG_TYPE_GET(val)); |
| 11943 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 11944 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11945 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11946 | count++; |
| 11947 | } |
| 11948 | } |
| 11949 | |
| 11950 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11951 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11952 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11953 | __func__); |
| 11954 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11955 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11956 | } |
| 11957 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11958 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11959 | } |
| 11960 | |
| 11961 | /** |
| 11962 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 11963 | * @wmi_handle: WMI handle |
| 11964 | * |
| 11965 | * This function is used to send the flush command to the FW, |
| 11966 | * that will flush the fw logs that are residue in the FW |
| 11967 | * |
| 11968 | * Return: None |
| 11969 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 11970 | 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] | 11971 | { |
| 11972 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 11973 | wmi_buf_t buf; |
| 11974 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11975 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11976 | |
| 11977 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11978 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11979 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11980 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11981 | } |
| 11982 | |
| 11983 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 11984 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11985 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 11986 | WMITLV_GET_STRUCT_TLVLEN( |
| 11987 | wmi_debug_mesg_flush_fixed_param)); |
| 11988 | cmd->reserved0 = 0; |
| 11989 | |
| 11990 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11991 | buf, |
| 11992 | len, |
| 11993 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11994 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11995 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11996 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 11997 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 11998 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 11999 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12000 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12001 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12002 | } |
| 12003 | |
| 12004 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12005 | * 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] | 12006 | * @wmi_handle: wmi handle |
| 12007 | * @msg: PCL structure containing the PCL and the number of channels |
| 12008 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12009 | * 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] | 12010 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 12011 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 12012 | * to migrate to a new channel without host driver involvement. An example of |
| 12013 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 12014 | * manage the channel selection without firmware involvement. |
| 12015 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12016 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 12017 | * channel list. The weights corresponds to the channels sent in |
| 12018 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 12019 | * weightage compared to the non PCL channels. |
| 12020 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12021 | * Return: Success if the cmd is sent successfully to the firmware |
| 12022 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12023 | 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] | 12024 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12025 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12026 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12027 | wmi_buf_t buf; |
| 12028 | uint8_t *buf_ptr; |
| 12029 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12030 | uint32_t chan_len; |
| 12031 | |
| 12032 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12033 | |
| 12034 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12035 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12036 | |
| 12037 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12038 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12039 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12040 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12041 | } |
| 12042 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12043 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12044 | buf_ptr = (uint8_t *) cmd; |
| 12045 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12046 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 12047 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12048 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12049 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12050 | WMI_HOST_PDEV_ID_SOC); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12051 | cmd->num_chan = chan_len; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12052 | WMI_LOGI("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12053 | |
| 12054 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12055 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12056 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12057 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12058 | for (i = 0; i < chan_len ; i++) { |
| 12059 | cmd_args[i] = msg->weighed_valid_list[i]; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12060 | WMI_LOGI("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12061 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12062 | } |
| 12063 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12064 | WMI_PDEV_SET_PCL_CMDID)) { |
| 12065 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12066 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12067 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12068 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12069 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12070 | } |
| 12071 | |
| 12072 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12073 | * 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] | 12074 | * @wmi_handle: wmi handle |
| 12075 | * @msg: Structure containing the following parameters |
| 12076 | * |
| 12077 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 12078 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 12079 | * |
| 12080 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 12081 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 12082 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 12083 | * |
| 12084 | * Return: Success if the cmd is sent successfully to the firmware |
| 12085 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12086 | 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] | 12087 | uint32_t hw_mode_index) |
| 12088 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12089 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12090 | wmi_buf_t buf; |
| 12091 | uint32_t len; |
| 12092 | |
| 12093 | len = sizeof(*cmd); |
| 12094 | |
| 12095 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12096 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12097 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12098 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12099 | } |
| 12100 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12101 | 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] | 12102 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12103 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 12104 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 12105 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12106 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12107 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12108 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12109 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12110 | |
| 12111 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12112 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 12113 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12114 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12115 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12116 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12117 | } |
| 12118 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12119 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12120 | } |
| 12121 | |
| 12122 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12123 | * 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] | 12124 | * @wmi_handle: wmi handle |
| 12125 | * @msg: Dual MAC config parameters |
| 12126 | * |
| 12127 | * Configures WLAN firmware with the dual MAC features |
| 12128 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12129 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12130 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 12131 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12132 | 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] | 12133 | struct wmi_dual_mac_config *msg) |
| 12134 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12135 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12136 | wmi_buf_t buf; |
| 12137 | uint32_t len; |
| 12138 | |
| 12139 | len = sizeof(*cmd); |
| 12140 | |
| 12141 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12142 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12143 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12144 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12145 | } |
| 12146 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12147 | 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] | 12148 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12149 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12150 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12151 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 12152 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12153 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12154 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12155 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 12156 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12157 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12158 | __func__, msg->scan_config, msg->fw_mode_config); |
| 12159 | |
| 12160 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12161 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 12162 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12163 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12164 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12165 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12166 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12167 | } |
| 12168 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 12169 | #ifdef BIG_ENDIAN_HOST |
| 12170 | /** |
| 12171 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 12172 | * @param data_len - data length |
| 12173 | * @param data - pointer to data |
| 12174 | * |
| 12175 | * Return: QDF_STATUS - success or error status |
| 12176 | */ |
| 12177 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 12178 | struct fips_params *param) |
| 12179 | { |
| 12180 | unsigned char *key_unaligned, *data_unaligned; |
| 12181 | int c; |
| 12182 | u_int8_t *key_aligned = NULL; |
| 12183 | u_int8_t *data_aligned = NULL; |
| 12184 | |
| 12185 | /* Assigning unaligned space to copy the key */ |
| 12186 | key_unaligned = qdf_mem_malloc( |
| 12187 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 12188 | data_unaligned = qdf_mem_malloc( |
| 12189 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 12190 | |
| 12191 | /* Checking if kmalloc is succesful to allocate space */ |
| 12192 | if (key_unaligned == NULL) |
| 12193 | return QDF_STATUS_SUCCESS; |
| 12194 | /* Checking if space is aligned */ |
| 12195 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 12196 | /* align to 4 */ |
| 12197 | key_aligned = |
| 12198 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 12199 | FIPS_ALIGN); |
| 12200 | } else { |
| 12201 | key_aligned = (u_int8_t *)key_unaligned; |
| 12202 | } |
| 12203 | |
| 12204 | /* memset and copy content from key to key aligned */ |
| 12205 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 12206 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 12207 | |
| 12208 | /* print a hexdump for host debug */ |
| 12209 | print_hex_dump(KERN_DEBUG, |
| 12210 | "\t Aligned and Copied Key:@@@@ ", |
| 12211 | DUMP_PREFIX_NONE, |
| 12212 | 16, 1, key_aligned, param->key_len, true); |
| 12213 | |
| 12214 | /* Checking if kmalloc is succesful to allocate space */ |
| 12215 | if (data_unaligned == NULL) |
| 12216 | return QDF_STATUS_SUCCESS; |
| 12217 | /* Checking of space is aligned */ |
| 12218 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 12219 | /* align to 4 */ |
| 12220 | data_aligned = |
| 12221 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 12222 | FIPS_ALIGN); |
| 12223 | } else { |
| 12224 | data_aligned = (u_int8_t *)data_unaligned; |
| 12225 | } |
| 12226 | |
| 12227 | /* memset and copy content from data to data aligned */ |
| 12228 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 12229 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 12230 | |
| 12231 | /* print a hexdump for host debug */ |
| 12232 | print_hex_dump(KERN_DEBUG, |
| 12233 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 12234 | DUMP_PREFIX_NONE, |
| 12235 | 16, 1, data_aligned, param->data_len, true); |
| 12236 | |
| 12237 | /* converting to little Endian both key_aligned and |
| 12238 | * data_aligned*/ |
| 12239 | for (c = 0; c < param->key_len/4; c++) { |
| 12240 | *((u_int32_t *)key_aligned+c) = |
| 12241 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 12242 | } |
| 12243 | for (c = 0; c < param->data_len/4; c++) { |
| 12244 | *((u_int32_t *)data_aligned+c) = |
| 12245 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 12246 | } |
| 12247 | |
| 12248 | /* update endian data to key and data vectors */ |
| 12249 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 12250 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 12251 | |
| 12252 | /* clean up allocated spaces */ |
| 12253 | qdf_mem_free(key_unaligned); |
| 12254 | key_unaligned = NULL; |
| 12255 | key_aligned = NULL; |
| 12256 | |
| 12257 | qdf_mem_free(data_unaligned); |
| 12258 | data_unaligned = NULL; |
| 12259 | data_aligned = NULL; |
| 12260 | |
| 12261 | return QDF_STATUS_SUCCESS; |
| 12262 | } |
| 12263 | #else |
| 12264 | /** |
| 12265 | * fips_align_data_be() - DUMMY for LE platform |
| 12266 | * |
| 12267 | * Return: QDF_STATUS - success |
| 12268 | */ |
| 12269 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 12270 | struct fips_params *param) |
| 12271 | { |
| 12272 | return QDF_STATUS_SUCCESS; |
| 12273 | } |
| 12274 | #endif |
| 12275 | |
| 12276 | |
| 12277 | /** |
| 12278 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 12279 | * @wmi_handle: wmi handle |
| 12280 | * @param: pointer to hold pdev fips param |
| 12281 | * |
| 12282 | * Return: 0 for success or error code |
| 12283 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12284 | static QDF_STATUS |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 12285 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 12286 | struct fips_params *param) |
| 12287 | { |
| 12288 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 12289 | wmi_buf_t buf; |
| 12290 | uint8_t *buf_ptr; |
| 12291 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 12292 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 12293 | |
| 12294 | /* Length TLV placeholder for array of bytes */ |
| 12295 | len += WMI_TLV_HDR_SIZE; |
| 12296 | if (param->data_len) |
| 12297 | len += (param->data_len*sizeof(uint8_t)); |
| 12298 | |
| 12299 | /* |
| 12300 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 12301 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 12302 | * wmi_pdev_fips_cmd structure |
| 12303 | */ |
| 12304 | |
| 12305 | /* do sanity on the input */ |
| 12306 | if (!(((param->data_len & 0xF) == 0) && |
| 12307 | ((param->data_len > 0) && |
| 12308 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 12309 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 12310 | return QDF_STATUS_E_INVAL; |
| 12311 | } |
| 12312 | |
| 12313 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12314 | if (!buf) { |
| 12315 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 12316 | return QDF_STATUS_E_FAILURE; |
| 12317 | } |
| 12318 | |
| 12319 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12320 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 12321 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12322 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 12323 | WMITLV_GET_STRUCT_TLVLEN |
| 12324 | (wmi_pdev_fips_cmd_fixed_param)); |
| 12325 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12326 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12327 | param->pdev_id); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 12328 | if (param->key != NULL && param->data != NULL) { |
| 12329 | cmd->key_len = param->key_len; |
| 12330 | cmd->data_len = param->data_len; |
| 12331 | cmd->fips_cmd = !!(param->op); |
| 12332 | |
| 12333 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 12334 | return QDF_STATUS_E_FAILURE; |
| 12335 | |
| 12336 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 12337 | |
| 12338 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 12339 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 12340 | cmd->mode = param->mode; |
| 12341 | } else { |
| 12342 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 12343 | } |
| 12344 | qdf_print(KERN_ERR "Key len = %d, Data len = %d\n", |
| 12345 | cmd->key_len, cmd->data_len); |
| 12346 | |
| 12347 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 12348 | cmd->key, cmd->key_len, true); |
| 12349 | buf_ptr += sizeof(*cmd); |
| 12350 | |
| 12351 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 12352 | |
| 12353 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12354 | if (param->data_len) |
| 12355 | qdf_mem_copy(buf_ptr, |
| 12356 | (uint8_t *) param->data, param->data_len); |
| 12357 | |
| 12358 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 12359 | 16, 1, buf_ptr, cmd->data_len, true); |
| 12360 | |
| 12361 | buf_ptr += param->data_len; |
| 12362 | |
| 12363 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12364 | WMI_PDEV_FIPS_CMDID); |
| 12365 | qdf_print("%s return value %d\n", __func__, retval); |
| 12366 | } else { |
| 12367 | qdf_print("\n%s:%d Key or Data is NULL\n", __func__, __LINE__); |
| 12368 | wmi_buf_free(buf); |
| 12369 | retval = -QDF_STATUS_E_BADMSG; |
| 12370 | } |
| 12371 | |
| 12372 | return retval; |
| 12373 | } |
| 12374 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12375 | #ifdef WLAN_PMO_ENABLE |
| 12376 | /** |
| 12377 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 12378 | * @wmi_handle: wmi handle |
| 12379 | * @vdev_id: vdev id |
| 12380 | * @bitmap: Event bitmap |
| 12381 | * @enable: enable/disable |
| 12382 | * |
| 12383 | * Return: CDF status |
| 12384 | */ |
| 12385 | static QDF_STATUS send_add_wow_wakeup_event_cmd_tlv(wmi_unified_t wmi_handle, |
| 12386 | uint32_t vdev_id, |
| 12387 | uint32_t bitmap, |
| 12388 | bool enable) |
| 12389 | { |
| 12390 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 12391 | uint16_t len; |
| 12392 | wmi_buf_t buf; |
| 12393 | int ret; |
| 12394 | |
| 12395 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 12396 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12397 | if (!buf) { |
| 12398 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 12399 | return QDF_STATUS_E_NOMEM; |
| 12400 | } |
| 12401 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 12402 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12403 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 12404 | WMITLV_GET_STRUCT_TLVLEN |
| 12405 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 12406 | cmd->vdev_id = vdev_id; |
| 12407 | cmd->is_add = enable; |
| 12408 | cmd->event_bitmap = bitmap; |
| 12409 | |
| 12410 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12411 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 12412 | if (ret) { |
| 12413 | WMI_LOGE("Failed to config wow wakeup event"); |
| 12414 | wmi_buf_free(buf); |
| 12415 | return QDF_STATUS_E_FAILURE; |
| 12416 | } |
| 12417 | |
| 12418 | WMI_LOGD("Wakeup pattern 0x%x %s in fw", bitmap, |
| 12419 | enable ? "enabled" : "disabled"); |
| 12420 | |
| 12421 | return QDF_STATUS_SUCCESS; |
| 12422 | } |
| 12423 | |
| 12424 | /** |
| 12425 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 12426 | * @wmi_handle: wmi handle |
| 12427 | * @vdev_id: vdev id |
| 12428 | * @ptrn_id: pattern id |
| 12429 | * @ptrn: pattern |
| 12430 | * @ptrn_len: pattern length |
| 12431 | * @ptrn_offset: pattern offset |
| 12432 | * @mask: mask |
| 12433 | * @mask_len: mask length |
| 12434 | * @user: true for user configured pattern and false for default pattern |
| 12435 | * @default_patterns: default patterns |
| 12436 | * |
| 12437 | * Return: CDF status |
| 12438 | */ |
| 12439 | static QDF_STATUS send_wow_patterns_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
| 12440 | uint8_t vdev_id, uint8_t ptrn_id, |
| 12441 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 12442 | uint8_t ptrn_offset, const uint8_t *mask, |
| 12443 | uint8_t mask_len, bool user, |
| 12444 | uint8_t default_patterns) |
| 12445 | { |
| 12446 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 12447 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 12448 | wmi_buf_t buf; |
| 12449 | uint8_t *buf_ptr; |
| 12450 | int32_t len; |
| 12451 | int ret; |
| 12452 | |
| 12453 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 12454 | WMI_TLV_HDR_SIZE + |
| 12455 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 12456 | WMI_TLV_HDR_SIZE + |
| 12457 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 12458 | WMI_TLV_HDR_SIZE + |
| 12459 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 12460 | WMI_TLV_HDR_SIZE + |
| 12461 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 12462 | WMI_TLV_HDR_SIZE + |
| 12463 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 12464 | |
| 12465 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12466 | if (!buf) { |
| 12467 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 12468 | return QDF_STATUS_E_NOMEM; |
| 12469 | } |
| 12470 | |
| 12471 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 12472 | buf_ptr = (uint8_t *) cmd; |
| 12473 | |
| 12474 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12475 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 12476 | WMITLV_GET_STRUCT_TLVLEN |
| 12477 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 12478 | cmd->vdev_id = vdev_id; |
| 12479 | cmd->pattern_id = ptrn_id; |
| 12480 | |
| 12481 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 12482 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 12483 | |
| 12484 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12485 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 12486 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12487 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 12488 | |
| 12489 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 12490 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 12491 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 12492 | |
| 12493 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 12494 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
| 12495 | |
| 12496 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 12497 | bitmap_pattern->pattern_len = ptrn_len; |
| 12498 | |
| 12499 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 12500 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 12501 | |
| 12502 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 12503 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 12504 | |
| 12505 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 12506 | bitmap_pattern->pattern_id = ptrn_id; |
| 12507 | |
| 12508 | WMI_LOGI("vdev: %d, ptrn id: %d, ptrn len: %d, ptrn offset: %d user %d", |
| 12509 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 12510 | bitmap_pattern->pattern_offset, user); |
| 12511 | WMI_LOGI("Pattern : "); |
| 12512 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 12513 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 12514 | |
| 12515 | WMI_LOGI("Mask : "); |
| 12516 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 12517 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
| 12518 | |
| 12519 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 12520 | |
| 12521 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 12522 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12523 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12524 | |
| 12525 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 12526 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12527 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12528 | |
| 12529 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 12530 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12531 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12532 | |
| 12533 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 12534 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 12535 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12536 | |
| 12537 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 12538 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 12539 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12540 | *(A_UINT32 *) buf_ptr = 0; |
| 12541 | |
| 12542 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12543 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 12544 | if (ret) { |
| 12545 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
| 12546 | wmi_buf_free(buf); |
| 12547 | return QDF_STATUS_E_FAILURE; |
| 12548 | } |
| 12549 | |
| 12550 | return QDF_STATUS_SUCCESS; |
| 12551 | } |
| 12552 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12553 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12554 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 12555 | * @wmi_handle: wmi handle |
| 12556 | * @offload_req: offload request |
| 12557 | * @buf_ptr: buffer pointer |
| 12558 | * |
| 12559 | * To fill ARP offload data to firmware |
| 12560 | * when target goes to wow mode. |
| 12561 | * |
| 12562 | * Return: None |
| 12563 | */ |
| 12564 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12565 | struct pmo_arp_offload_params *offload_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12566 | { |
| 12567 | |
| 12568 | int i; |
| 12569 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12570 | bool enable_or_disable = offload_req->enable; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12571 | |
| 12572 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12573 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 12574 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 12575 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 12576 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 12577 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 12578 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 12579 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 12580 | |
| 12581 | /* Fill data for ARP and NS in the first tupple for LA */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12582 | if ((enable_or_disable & PMO_OFFLOAD_ENABLE) && (i == 0)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12583 | /* Copy the target ip addr and flags */ |
| 12584 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 12585 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12586 | offload_req->host_ipv4_addr, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12587 | WMI_IPV4_ADDR_LEN); |
| 12588 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12589 | offload_req->host_ipv4_addr); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12590 | } |
| 12591 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 12592 | } |
| 12593 | } |
| 12594 | |
| 12595 | #ifdef WLAN_NS_OFFLOAD |
| 12596 | /** |
| 12597 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 12598 | * @wmi|_handle: wmi handle |
| 12599 | * @offload_req: offload request |
| 12600 | * @buf_ptr: buffer pointer |
| 12601 | * |
| 12602 | * To fill NS offload data to firmware |
| 12603 | * when target goes to wow mode. |
| 12604 | * |
| 12605 | * Return: None |
| 12606 | */ |
| 12607 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12608 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12609 | { |
| 12610 | |
| 12611 | int i; |
| 12612 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12613 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12614 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12615 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 12616 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 12617 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 12618 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 12619 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 12620 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 12621 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 12622 | |
| 12623 | /* |
| 12624 | * Fill data only for NS offload in the first ARP tuple for LA |
| 12625 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12626 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12627 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 12628 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12629 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12630 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12631 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12632 | sizeof(WMI_IPV6_ADDR)); |
| 12633 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12634 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12635 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12636 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12637 | ns_tuple->flags |= |
| 12638 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 12639 | } |
| 12640 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12641 | i, &ns_req->self_ipv6_addr[i], |
| 12642 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12643 | |
| 12644 | /* target MAC is optional, check if it is valid, |
| 12645 | * if this is not valid, the target will use the known |
| 12646 | * local MAC address rather than the tuple |
| 12647 | */ |
| 12648 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12649 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12650 | &ns_tuple->target_mac); |
| 12651 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 12652 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 12653 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 12654 | } |
| 12655 | } |
| 12656 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 12657 | } |
| 12658 | } |
| 12659 | |
| 12660 | |
| 12661 | /** |
| 12662 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 12663 | * @wmi: wmi handle |
| 12664 | * @offload_req: offload request |
| 12665 | * @buf_ptr: buffer pointer |
| 12666 | * |
| 12667 | * To fill extended NS offload extended data to firmware |
| 12668 | * when target goes to wow mode. |
| 12669 | * |
| 12670 | * Return: None |
| 12671 | */ |
| 12672 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12673 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12674 | { |
| 12675 | int i; |
| 12676 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 12677 | uint32_t count, num_ns_ext_tuples; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12678 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12679 | count = ns_req->num_ns_offload_count; |
| 12680 | num_ns_ext_tuples = ns_req->num_ns_offload_count - |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12681 | WMI_MAX_NS_OFFLOADS; |
| 12682 | |
| 12683 | /* Populate extended NS offload tuples */ |
| 12684 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12685 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 12686 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 12687 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 12688 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 12689 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 12690 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 12691 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 12692 | |
| 12693 | /* |
| 12694 | * Fill data only for NS offload in the first ARP tuple for LA |
| 12695 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12696 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12697 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 12698 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12699 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12700 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12701 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12702 | sizeof(WMI_IPV6_ADDR)); |
| 12703 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12704 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12705 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12706 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12707 | ns_tuple->flags |= |
| 12708 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 12709 | } |
| 12710 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12711 | i, &ns_req->self_ipv6_addr[i], |
| 12712 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12713 | |
| 12714 | /* target MAC is optional, check if it is valid, |
| 12715 | * if this is not valid, the target will use the |
| 12716 | * known local MAC address rather than the tuple |
| 12717 | */ |
| 12718 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12719 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12720 | &ns_tuple->target_mac); |
| 12721 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 12722 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 12723 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 12724 | } |
| 12725 | } |
| 12726 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 12727 | } |
| 12728 | } |
| 12729 | #else |
| 12730 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12731 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12732 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12733 | } |
| 12734 | |
| 12735 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12736 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12737 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12738 | } |
| 12739 | #endif |
| 12740 | |
| 12741 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12742 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 12743 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12744 | * @arp_offload_req: arp offload request |
| 12745 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12746 | * @arp_only: flag |
| 12747 | * |
| 12748 | * To configure ARP NS off load data to firmware |
| 12749 | * when target goes to wow mode. |
| 12750 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12751 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12752 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12753 | 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] | 12754 | struct pmo_arp_offload_params *arp_offload_req, |
| 12755 | struct pmo_ns_offload_params *ns_offload_req, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12756 | uint8_t vdev_id) |
| 12757 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12758 | int32_t res; |
| 12759 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12760 | A_UINT8 *buf_ptr; |
| 12761 | wmi_buf_t buf; |
| 12762 | int32_t len; |
| 12763 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 12764 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12765 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12766 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12767 | /* |
| 12768 | * TLV place holder size for array of NS tuples |
| 12769 | * TLV place holder size for array of ARP tuples |
| 12770 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12771 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 12772 | WMI_TLV_HDR_SIZE + |
| 12773 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 12774 | WMI_TLV_HDR_SIZE + |
| 12775 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12776 | |
| 12777 | /* |
| 12778 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 12779 | * extra length for extended NS offload tuples which follows ARP offload |
| 12780 | * tuples. Host needs to fill this structure in following format: |
| 12781 | * 2 NS ofload tuples |
| 12782 | * 2 ARP offload tuples |
| 12783 | * N numbers of extended NS offload tuples if HDD has given more than |
| 12784 | * 2 NS offload addresses |
| 12785 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12786 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12787 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12788 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 12789 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12790 | } |
| 12791 | |
| 12792 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12793 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12794 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12795 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12796 | } |
| 12797 | |
| 12798 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 12799 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 12800 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12801 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 12802 | WMITLV_GET_STRUCT_TLVLEN |
| 12803 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 12804 | cmd->flags = 0; |
| 12805 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12806 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12807 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12808 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12809 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12810 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 12811 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 12812 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 12813 | if (num_ns_ext_tuples) |
| 12814 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12815 | |
| 12816 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12817 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 12818 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12819 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12820 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12821 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12822 | } |
| 12823 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12824 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12825 | } |
| 12826 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 12827 | /** |
| 12828 | * send_enable_enhance_multicast_offload_tlv() - send enhance multicast offload |
| 12829 | * @wmi_handle: wmi handle |
| 12830 | * @vdev_id: vdev id |
| 12831 | * @action: true for enable else false |
| 12832 | * |
| 12833 | * To enable enhance multicast offload to firmware |
| 12834 | * when target goes to wow mode. |
| 12835 | * |
| 12836 | * Return: QDF Status |
| 12837 | */ |
| 12838 | |
| 12839 | static |
| 12840 | QDF_STATUS send_enable_enhance_multicast_offload_tlv( |
| 12841 | wmi_unified_t wmi_handle, |
| 12842 | uint8_t vdev_id, bool action) |
| 12843 | { |
| 12844 | QDF_STATUS status; |
| 12845 | wmi_buf_t buf; |
| 12846 | wmi_config_enhanced_mcast_filter_cmd_fixed_param *cmd; |
| 12847 | |
| 12848 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12849 | if (!buf) { |
| 12850 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 12851 | return QDF_STATUS_E_NOMEM; |
| 12852 | } |
| 12853 | |
| 12854 | cmd = (wmi_config_enhanced_mcast_filter_cmd_fixed_param *) |
| 12855 | wmi_buf_data(buf); |
| 12856 | |
| 12857 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12858 | WMITLV_TAG_STRUC_wmi_config_enhanced_mcast_filter_fixed_param, |
| 12859 | WMITLV_GET_STRUCT_TLVLEN( |
| 12860 | wmi_config_enhanced_mcast_filter_cmd_fixed_param)); |
| 12861 | |
| 12862 | cmd->vdev_id = vdev_id; |
| 12863 | cmd->enable = ((action == 0) ? ENHANCED_MCAST_FILTER_DISABLED : |
| 12864 | ENHANCED_MCAST_FILTER_ENABLED); |
| 12865 | WMI_LOGD("%s: config enhance multicast offload action %d for vdev %d", |
| 12866 | __func__, action, vdev_id); |
| 12867 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 12868 | sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID); |
| 12869 | if (status != QDF_STATUS_SUCCESS) { |
| 12870 | qdf_nbuf_free(buf); |
| 12871 | WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID", |
| 12872 | __func__); |
| 12873 | } |
| 12874 | |
| 12875 | return status; |
| 12876 | } |
| 12877 | |
| 12878 | /** |
| 12879 | * extract_gtk_rsp_event_tlv() - extract gtk rsp params from event |
| 12880 | * @wmi_handle: wmi handle |
| 12881 | * @param evt_buf: pointer to event buffer |
| 12882 | * @param hdr: Pointer to hold header |
| 12883 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 12884 | * |
| 12885 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 12886 | */ |
| 12887 | static QDF_STATUS extract_gtk_rsp_event_tlv(wmi_unified_t wmi_handle, |
| 12888 | void *evt_buf, struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len) |
| 12889 | { |
| 12890 | WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *fixed_param; |
| 12891 | WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *param_buf; |
| 12892 | |
| 12893 | param_buf = (WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *)evt_buf; |
| 12894 | if (!param_buf) { |
| 12895 | WMI_LOGE("gtk param_buf is NULL"); |
| 12896 | return QDF_STATUS_E_INVAL; |
| 12897 | } |
| 12898 | |
| 12899 | if (len < sizeof(WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param)) { |
| 12900 | WMI_LOGE("Invalid length for GTK status"); |
| 12901 | return QDF_STATUS_E_INVAL; |
| 12902 | } |
| 12903 | |
| 12904 | fixed_param = (WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *) |
| 12905 | param_buf->fixed_param; |
| 12906 | gtk_rsp_param->vdev_id = fixed_param->vdev_id; |
| 12907 | gtk_rsp_param->status_flag = QDF_STATUS_SUCCESS; |
| 12908 | gtk_rsp_param->refresh_cnt = fixed_param->refresh_cnt; |
| 12909 | qdf_mem_copy(>k_rsp_param->replay_counter, |
| 12910 | &fixed_param->replay_counter, |
| 12911 | GTK_REPLAY_COUNTER_BYTES); |
| 12912 | |
| 12913 | return QDF_STATUS_SUCCESS; |
| 12914 | |
| 12915 | } |
| 12916 | |
| 12917 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 12918 | /** |
| 12919 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 12920 | * @wmi_handle: wmi handle |
| 12921 | * @vdev_id: vdev id |
| 12922 | * |
| 12923 | * Return: CDF status |
| 12924 | */ |
| 12925 | static QDF_STATUS send_wow_sta_ra_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 12926 | uint8_t vdev_id, uint8_t default_pattern, |
| 12927 | uint16_t rate_limit_interval) |
| 12928 | { |
| 12929 | |
| 12930 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 12931 | wmi_buf_t buf; |
| 12932 | uint8_t *buf_ptr; |
| 12933 | int32_t len; |
| 12934 | int ret; |
| 12935 | |
| 12936 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 12937 | WMI_TLV_HDR_SIZE + |
| 12938 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 12939 | WMI_TLV_HDR_SIZE + |
| 12940 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 12941 | WMI_TLV_HDR_SIZE + |
| 12942 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 12943 | WMI_TLV_HDR_SIZE + |
| 12944 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 12945 | WMI_TLV_HDR_SIZE + |
| 12946 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 12947 | |
| 12948 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12949 | if (!buf) { |
| 12950 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 12951 | return QDF_STATUS_E_NOMEM; |
| 12952 | } |
| 12953 | |
| 12954 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 12955 | buf_ptr = (uint8_t *) cmd; |
| 12956 | |
| 12957 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12958 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 12959 | WMITLV_GET_STRUCT_TLVLEN |
| 12960 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 12961 | cmd->vdev_id = vdev_id; |
| 12962 | cmd->pattern_id = default_pattern, |
| 12963 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 12964 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 12965 | |
| 12966 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 12967 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12968 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12969 | |
| 12970 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 12971 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12972 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12973 | |
| 12974 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 12975 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12976 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12977 | |
| 12978 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 12979 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 12980 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12981 | |
| 12982 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 12983 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 12984 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12985 | |
| 12986 | /* Fill TLV for ra_ratelimit_interval. */ |
| 12987 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 12988 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 12989 | |
| 12990 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 12991 | |
| 12992 | WMI_LOGD("%s: send RA rate limit [%d] to fw vdev = %d", __func__, |
| 12993 | rate_limit_interval, vdev_id); |
| 12994 | |
| 12995 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12996 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 12997 | if (ret) { |
| 12998 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
| 12999 | wmi_buf_free(buf); |
| 13000 | return QDF_STATUS_E_FAILURE; |
| 13001 | } |
| 13002 | |
| 13003 | return QDF_STATUS_SUCCESS; |
| 13004 | |
| 13005 | } |
| 13006 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 13007 | |
| 13008 | /** |
| 13009 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 13010 | * @wmi_handle: wmi handle |
| 13011 | * @vdev_id: vdev id |
| 13012 | * @multicastAddr: mcast address |
| 13013 | * @clearList: clear list flag |
| 13014 | * |
| 13015 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13016 | */ |
| 13017 | static QDF_STATUS send_add_clear_mcbc_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13018 | uint8_t vdev_id, |
| 13019 | struct qdf_mac_addr multicast_addr, |
| 13020 | bool clearList) |
| 13021 | { |
| 13022 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 13023 | wmi_buf_t buf; |
| 13024 | int err; |
| 13025 | |
| 13026 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13027 | if (!buf) { |
| 13028 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 13029 | return QDF_STATUS_E_NOMEM; |
| 13030 | } |
| 13031 | |
| 13032 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
| 13033 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 13034 | |
| 13035 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13036 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 13037 | WMITLV_GET_STRUCT_TLVLEN |
| 13038 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 13039 | cmd->action = |
| 13040 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 13041 | cmd->vdev_id = vdev_id; |
| 13042 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
| 13043 | |
| 13044 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 13045 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 13046 | |
| 13047 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 13048 | sizeof(*cmd), |
| 13049 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 13050 | if (err) { |
| 13051 | WMI_LOGE("Failed to send set_param cmd"); |
| 13052 | wmi_buf_free(buf); |
| 13053 | return QDF_STATUS_E_FAILURE; |
| 13054 | } |
| 13055 | |
| 13056 | return QDF_STATUS_SUCCESS; |
| 13057 | } |
| 13058 | |
| 13059 | /** |
| 13060 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 13061 | * @wmi_handle: wmi handle |
| 13062 | * @vdev_id: vdev id |
| 13063 | * @params: GTK offload parameters |
| 13064 | * |
| 13065 | * Return: CDF status |
| 13066 | */ |
| 13067 | static |
| 13068 | QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
| 13069 | struct pmo_gtk_req *params, |
| 13070 | bool enable_offload, |
| 13071 | uint32_t gtk_offload_opcode) |
| 13072 | { |
| 13073 | int len; |
| 13074 | wmi_buf_t buf; |
| 13075 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 13076 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13077 | |
| 13078 | WMI_LOGD("%s Enter", __func__); |
| 13079 | |
| 13080 | len = sizeof(*cmd); |
| 13081 | |
| 13082 | /* alloc wmi buffer */ |
| 13083 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13084 | if (!buf) { |
| 13085 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 13086 | status = QDF_STATUS_E_NOMEM; |
| 13087 | goto out; |
| 13088 | } |
| 13089 | |
| 13090 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 13091 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13092 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 13093 | WMITLV_GET_STRUCT_TLVLEN |
| 13094 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 13095 | |
| 13096 | cmd->vdev_id = vdev_id; |
| 13097 | |
| 13098 | /* Request target to enable GTK offload */ |
| 13099 | if (enable_offload == PMO_GTK_OFFLOAD_ENABLE) { |
| 13100 | cmd->flags = gtk_offload_opcode; |
| 13101 | |
| 13102 | /* Copy the keys and replay counter */ |
| 13103 | qdf_mem_copy(cmd->KCK, params->kck, PMO_KCK_LEN); |
| 13104 | qdf_mem_copy(cmd->KEK, params->kek, PMO_KEK_LEN); |
| 13105 | qdf_mem_copy(cmd->replay_counter, ¶ms->replay_counter, |
| 13106 | GTK_REPLAY_COUNTER_BYTES); |
| 13107 | } else { |
| 13108 | cmd->flags = gtk_offload_opcode; |
| 13109 | } |
| 13110 | |
| 13111 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 13112 | |
| 13113 | /* send the wmi command */ |
| 13114 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13115 | WMI_GTK_OFFLOAD_CMDID)) { |
| 13116 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
| 13117 | wmi_buf_free(buf); |
| 13118 | status = QDF_STATUS_E_FAILURE; |
| 13119 | } |
| 13120 | |
| 13121 | out: |
| 13122 | WMI_LOGD("%s Exit", __func__); |
| 13123 | return status; |
| 13124 | } |
| 13125 | |
| 13126 | /** |
| 13127 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 13128 | * @wmi_handle: wmi handle |
| 13129 | * @params: GTK offload params |
| 13130 | * |
| 13131 | * Return: CDF status |
| 13132 | */ |
| 13133 | static QDF_STATUS send_process_gtk_offload_getinfo_cmd_tlv( |
| 13134 | wmi_unified_t wmi_handle, |
| 13135 | uint8_t vdev_id, |
| 13136 | uint64_t offload_req_opcode) |
| 13137 | { |
| 13138 | int len; |
| 13139 | wmi_buf_t buf; |
| 13140 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 13141 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13142 | |
| 13143 | len = sizeof(*cmd); |
| 13144 | |
| 13145 | /* alloc wmi buffer */ |
| 13146 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13147 | if (!buf) { |
| 13148 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 13149 | status = QDF_STATUS_E_NOMEM; |
| 13150 | goto out; |
| 13151 | } |
| 13152 | |
| 13153 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 13154 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13155 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 13156 | WMITLV_GET_STRUCT_TLVLEN |
| 13157 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 13158 | |
| 13159 | /* Request for GTK offload status */ |
| 13160 | cmd->flags = offload_req_opcode; |
| 13161 | cmd->vdev_id = vdev_id; |
| 13162 | |
| 13163 | /* send the wmi command */ |
| 13164 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13165 | WMI_GTK_OFFLOAD_CMDID)) { |
| 13166 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
| 13167 | wmi_buf_free(buf); |
| 13168 | status = QDF_STATUS_E_FAILURE; |
| 13169 | } |
| 13170 | |
| 13171 | out: |
| 13172 | return status; |
| 13173 | } |
| 13174 | |
| 13175 | /** |
| 13176 | * send_action_frame_patterns_cmd_tlv() - send wmi cmd of action filter params |
| 13177 | * @wmi_handle: wmi handler |
| 13178 | * @action_params: pointer to action_params |
| 13179 | * |
| 13180 | * Return: 0 for success, otherwise appropriate error code |
| 13181 | */ |
| 13182 | static QDF_STATUS send_action_frame_patterns_cmd_tlv(wmi_unified_t wmi_handle, |
| 13183 | struct pmo_action_wakeup_set_params *action_params) |
| 13184 | { |
| 13185 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *cmd; |
| 13186 | wmi_buf_t buf; |
| 13187 | int i; |
| 13188 | int32_t err; |
| 13189 | |
| 13190 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13191 | if (!buf) { |
| 13192 | WMI_LOGE("Failed to allocate buffer to send action filter cmd"); |
| 13193 | return QDF_STATUS_E_NOMEM; |
| 13194 | } |
| 13195 | cmd = (WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *) wmi_buf_data(buf); |
| 13196 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13197 | WMITLV_TAG_STRUC_wmi_wow_set_action_wake_up_cmd_fixed_param, |
| 13198 | WMITLV_GET_STRUCT_TLVLEN( |
| 13199 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param)); |
| 13200 | |
| 13201 | cmd->vdev_id = action_params->vdev_id; |
| 13202 | cmd->operation = action_params->operation; |
| 13203 | |
| 13204 | for (i = 0; i < MAX_SUPPORTED_ACTION_CATEGORY_ELE_LIST; i++) |
| 13205 | cmd->action_category_map[i] = |
| 13206 | action_params->action_category_map[i]; |
| 13207 | |
| 13208 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 13209 | sizeof(*cmd), WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
| 13210 | if (err) { |
| 13211 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
| 13212 | wmi_buf_free(buf); |
| 13213 | return QDF_STATUS_E_FAILURE; |
| 13214 | } |
| 13215 | |
| 13216 | return QDF_STATUS_SUCCESS; |
| 13217 | } |
| 13218 | |
| 13219 | #ifdef FEATURE_WLAN_LPHB |
| 13220 | |
| 13221 | /** |
| 13222 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 13223 | * @wmi_handle: wmi handle |
| 13224 | * @lphb_conf_req: configuration info |
| 13225 | * |
| 13226 | * Return: CDF status |
| 13227 | */ |
| 13228 | static QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle, |
| 13229 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 13230 | { |
| 13231 | QDF_STATUS status; |
| 13232 | wmi_buf_t buf = NULL; |
| 13233 | uint8_t *buf_ptr; |
| 13234 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 13235 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 13236 | |
| 13237 | |
| 13238 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13239 | if (!buf) { |
| 13240 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13241 | return QDF_STATUS_E_NOMEM; |
| 13242 | } |
| 13243 | |
| 13244 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13245 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 13246 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 13247 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 13248 | WMITLV_GET_STRUCT_TLVLEN |
| 13249 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 13250 | |
| 13251 | /* fill in values */ |
| 13252 | hb_enable_fp->vdev_id = params->session; |
| 13253 | hb_enable_fp->enable = params->enable; |
| 13254 | hb_enable_fp->item = params->item; |
| 13255 | hb_enable_fp->session = params->session; |
| 13256 | |
| 13257 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13258 | len, WMI_HB_SET_ENABLE_CMDID); |
| 13259 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13260 | WMI_LOGE("cmd_send WMI_HB_SET_ENABLE returned Error %d", |
| 13261 | status); |
| 13262 | wmi_buf_free(buf); |
| 13263 | } |
| 13264 | |
| 13265 | return status; |
| 13266 | } |
| 13267 | |
| 13268 | /** |
| 13269 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 13270 | * @wmi_handle: wmi handle |
| 13271 | * @lphb_conf_req: lphb config request |
| 13272 | * |
| 13273 | * Return: CDF status |
| 13274 | */ |
| 13275 | static QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 13276 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 13277 | { |
| 13278 | QDF_STATUS status; |
| 13279 | wmi_buf_t buf = NULL; |
| 13280 | uint8_t *buf_ptr; |
| 13281 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 13282 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 13283 | |
| 13284 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13285 | if (!buf) { |
| 13286 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13287 | return QDF_STATUS_E_NOMEM; |
| 13288 | } |
| 13289 | |
| 13290 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13291 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 13292 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 13293 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 13294 | WMITLV_GET_STRUCT_TLVLEN |
| 13295 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 13296 | |
| 13297 | /* fill in values */ |
| 13298 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 13299 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 13300 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 13301 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 13302 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 13303 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 13304 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 13305 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 13306 | hb_tcp_params_fp->session = lphb_conf_req->session; |
| 13307 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
| 13308 | &lphb_conf_req->gateway_mac, |
| 13309 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 13310 | |
| 13311 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13312 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
| 13313 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13314 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", |
| 13315 | status); |
| 13316 | wmi_buf_free(buf); |
| 13317 | } |
| 13318 | |
| 13319 | return status; |
| 13320 | } |
| 13321 | |
| 13322 | /** |
| 13323 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 13324 | * @wmi_handle: wmi handle |
| 13325 | * @lphb_conf_req: lphb config request |
| 13326 | * |
| 13327 | * Return: CDF status |
| 13328 | */ |
| 13329 | static |
| 13330 | QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13331 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 13332 | { |
| 13333 | QDF_STATUS status; |
| 13334 | wmi_buf_t buf = NULL; |
| 13335 | uint8_t *buf_ptr; |
| 13336 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 13337 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 13338 | |
| 13339 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13340 | if (!buf) { |
| 13341 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13342 | return QDF_STATUS_E_NOMEM; |
| 13343 | } |
| 13344 | |
| 13345 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13346 | hb_tcp_filter_fp = |
| 13347 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 13348 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 13349 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 13350 | WMITLV_GET_STRUCT_TLVLEN |
| 13351 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 13352 | |
| 13353 | /* fill in values */ |
| 13354 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 13355 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 13356 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 13357 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 13358 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 13359 | (void *)&g_hb_tcp_filter_fp->filter, |
| 13360 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 13361 | |
| 13362 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13363 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 13364 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13365 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", |
| 13366 | status); |
| 13367 | wmi_buf_free(buf); |
| 13368 | } |
| 13369 | |
| 13370 | return status; |
| 13371 | } |
| 13372 | |
| 13373 | /** |
| 13374 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 13375 | * @wmi_handle: wmi handle |
| 13376 | * @lphb_conf_req: lphb config request |
| 13377 | * |
| 13378 | * Return: CDF status |
| 13379 | */ |
| 13380 | static QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 13381 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 13382 | { |
| 13383 | QDF_STATUS status; |
| 13384 | wmi_buf_t buf = NULL; |
| 13385 | uint8_t *buf_ptr; |
| 13386 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 13387 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 13388 | |
| 13389 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13390 | if (!buf) { |
| 13391 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13392 | return QDF_STATUS_E_NOMEM; |
| 13393 | } |
| 13394 | |
| 13395 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13396 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 13397 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 13398 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 13399 | WMITLV_GET_STRUCT_TLVLEN |
| 13400 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 13401 | |
| 13402 | /* fill in values */ |
| 13403 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 13404 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 13405 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 13406 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 13407 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 13408 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 13409 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 13410 | hb_udp_params_fp->session = lphb_conf_req->session; |
| 13411 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
| 13412 | &lphb_conf_req->gateway_mac, |
| 13413 | sizeof(lphb_conf_req->gateway_mac)); |
| 13414 | |
| 13415 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13416 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
| 13417 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13418 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", |
| 13419 | status); |
| 13420 | wmi_buf_free(buf); |
| 13421 | } |
| 13422 | |
| 13423 | return status; |
| 13424 | } |
| 13425 | |
| 13426 | /** |
| 13427 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 13428 | * @wmi_handle: wmi handle |
| 13429 | * @lphb_conf_req: lphb config request |
| 13430 | * |
| 13431 | * Return: CDF status |
| 13432 | */ |
| 13433 | static |
| 13434 | QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13435 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 13436 | { |
| 13437 | QDF_STATUS status; |
| 13438 | wmi_buf_t buf = NULL; |
| 13439 | uint8_t *buf_ptr; |
| 13440 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 13441 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 13442 | |
| 13443 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13444 | if (!buf) { |
| 13445 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 13446 | return QDF_STATUS_E_NOMEM; |
| 13447 | } |
| 13448 | |
| 13449 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13450 | hb_udp_filter_fp = |
| 13451 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 13452 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 13453 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 13454 | WMITLV_GET_STRUCT_TLVLEN |
| 13455 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 13456 | |
| 13457 | /* fill in values */ |
| 13458 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 13459 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 13460 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 13461 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 13462 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 13463 | (void *)&lphb_conf_req->filter, |
| 13464 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 13465 | |
| 13466 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13467 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 13468 | if (QDF_IS_STATUS_ERROR(status)) { |
| 13469 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", |
| 13470 | status); |
| 13471 | wmi_buf_free(buf); |
| 13472 | } |
| 13473 | |
| 13474 | return status; |
| 13475 | } |
| 13476 | #endif /* FEATURE_WLAN_LPHB */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13477 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13478 | 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] | 13479 | uint8_t vdev_id, bool enable) |
| 13480 | { |
| 13481 | int32_t res; |
| 13482 | wmi_hw_data_filter_cmd_fixed_param *cmd; |
| 13483 | A_UINT8 *buf_ptr; |
| 13484 | wmi_buf_t buf; |
| 13485 | int32_t len; |
| 13486 | |
| 13487 | /* |
| 13488 | * TLV place holder size for array of ARP tuples |
| 13489 | */ |
| 13490 | len = sizeof(wmi_hw_data_filter_cmd_fixed_param); |
| 13491 | |
| 13492 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13493 | if (!buf) { |
| 13494 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13495 | return QDF_STATUS_E_NOMEM; |
| 13496 | } |
| 13497 | |
| 13498 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 13499 | cmd = (wmi_hw_data_filter_cmd_fixed_param *) buf_ptr; |
| 13500 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13501 | WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param, |
| 13502 | WMITLV_GET_STRUCT_TLVLEN |
| 13503 | (wmi_hw_data_filter_cmd_fixed_param)); |
| 13504 | cmd->vdev_id = vdev_id; |
| 13505 | cmd->enable = enable; |
| 13506 | cmd->hw_filter_bitmap = WMI_HW_DATA_FILTER_DROP_NON_ARP_BC; |
| 13507 | |
| 13508 | WMI_LOGD("HW Broadcast Filter vdev_id: %d", cmd->vdev_id); |
| 13509 | |
| 13510 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13511 | WMI_HW_DATA_FILTER_CMDID); |
| 13512 | if (res) { |
| 13513 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
| 13514 | wmi_buf_free(buf); |
| 13515 | return QDF_STATUS_E_FAILURE; |
| 13516 | } |
| 13517 | |
| 13518 | return QDF_STATUS_SUCCESS; |
| 13519 | } |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame^] | 13520 | |
| 13521 | /** |
| 13522 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter |
| 13523 | * @wmi_handle: wmi handle |
| 13524 | * @vdev_id: vdev id |
| 13525 | * @enable: Flag to enable/disable packet filter |
| 13526 | * |
| 13527 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13528 | */ |
| 13529 | static QDF_STATUS send_enable_disable_packet_filter_cmd_tlv( |
| 13530 | wmi_unified_t wmi_handle, uint8_t vdev_id, bool enable) |
| 13531 | { |
| 13532 | int32_t len; |
| 13533 | int ret = 0; |
| 13534 | wmi_buf_t buf; |
| 13535 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 13536 | |
| 13537 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 13538 | |
| 13539 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13540 | if (!buf) { |
| 13541 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13542 | return QDF_STATUS_E_NOMEM; |
| 13543 | } |
| 13544 | |
| 13545 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 13546 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13547 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 13548 | WMITLV_GET_STRUCT_TLVLEN( |
| 13549 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 13550 | |
| 13551 | cmd->vdev_id = vdev_id; |
| 13552 | if (enable) |
| 13553 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 13554 | else |
| 13555 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 13556 | |
| 13557 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
| 13558 | __func__, cmd->enable, vdev_id); |
| 13559 | |
| 13560 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13561 | WMI_PACKET_FILTER_ENABLE_CMDID); |
| 13562 | if (ret) { |
| 13563 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
| 13564 | wmi_buf_free(buf); |
| 13565 | } |
| 13566 | |
| 13567 | return ret; |
| 13568 | } |
| 13569 | |
| 13570 | /** |
| 13571 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 13572 | * @wmi_handle: wmi handle |
| 13573 | * @vdev_id: vdev id |
| 13574 | * @rcv_filter_param: Packet filter parameters |
| 13575 | * @filter_id: Filter id |
| 13576 | * @enable: Flag to add/delete packet filter configuration |
| 13577 | * |
| 13578 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13579 | */ |
| 13580 | static QDF_STATUS send_config_packet_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13581 | uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param, |
| 13582 | uint8_t filter_id, bool enable) |
| 13583 | { |
| 13584 | int len, i; |
| 13585 | int err = 0; |
| 13586 | wmi_buf_t buf; |
| 13587 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 13588 | |
| 13589 | |
| 13590 | /* allocate the memory */ |
| 13591 | len = sizeof(*cmd); |
| 13592 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13593 | if (!buf) { |
| 13594 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 13595 | return QDF_STATUS_E_NOMEM; |
| 13596 | } |
| 13597 | |
| 13598 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 13599 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13600 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 13601 | WMITLV_GET_STRUCT_TLVLEN |
| 13602 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 13603 | |
| 13604 | cmd->vdev_id = vdev_id; |
| 13605 | cmd->filter_id = filter_id; |
| 13606 | if (enable) |
| 13607 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 13608 | else |
| 13609 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 13610 | |
| 13611 | if (enable) { |
| 13612 | cmd->num_params = QDF_MIN( |
| 13613 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 13614 | rcv_filter_param->num_params); |
| 13615 | cmd->filter_type = rcv_filter_param->filter_type; |
| 13616 | cmd->coalesce_time = rcv_filter_param->coalesce_time; |
| 13617 | |
| 13618 | for (i = 0; i < cmd->num_params; i++) { |
| 13619 | cmd->paramsData[i].proto_type = |
| 13620 | rcv_filter_param->params_data[i].protocol_layer; |
| 13621 | cmd->paramsData[i].cmp_type = |
| 13622 | rcv_filter_param->params_data[i].compare_flag; |
| 13623 | cmd->paramsData[i].data_length = |
| 13624 | rcv_filter_param->params_data[i].data_length; |
| 13625 | cmd->paramsData[i].data_offset = |
| 13626 | rcv_filter_param->params_data[i].data_offset; |
| 13627 | memcpy(&cmd->paramsData[i].compareData, |
| 13628 | rcv_filter_param->params_data[i].compare_data, |
| 13629 | sizeof(cmd->paramsData[i].compareData)); |
| 13630 | memcpy(&cmd->paramsData[i].dataMask, |
| 13631 | rcv_filter_param->params_data[i].data_mask, |
| 13632 | sizeof(cmd->paramsData[i].dataMask)); |
| 13633 | } |
| 13634 | } |
| 13635 | |
| 13636 | WMI_LOGE("Packet filter action %d filter with id: %d, num_params=%d", |
| 13637 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 13638 | /* send the command along with data */ |
| 13639 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13640 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 13641 | if (err) { |
| 13642 | WMI_LOGE("Failed to send pkt_filter cmd"); |
| 13643 | wmi_buf_free(buf); |
| 13644 | return QDF_STATUS_E_FAILURE; |
| 13645 | } |
| 13646 | |
| 13647 | return QDF_STATUS_SUCCESS; |
| 13648 | } |
Ravi Kumar Bokka | 8f2c92f | 2017-03-23 15:22:51 +0530 | [diff] [blame] | 13649 | #endif /* End of WLAN_PMO_ENABLE */ |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 13650 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13651 | /** |
| 13652 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 13653 | * @wmi_handle: wmi handle |
| 13654 | * @request: SSID hotlist set request |
| 13655 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13656 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13657 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13658 | static QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13659 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 13660 | struct ssid_hotlist_request_params *request) |
| 13661 | { |
| 13662 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 13663 | wmi_buf_t wmi_buf; |
| 13664 | uint32_t len; |
| 13665 | uint32_t array_size; |
| 13666 | uint8_t *buf_ptr; |
| 13667 | |
| 13668 | /* length of fixed portion */ |
| 13669 | len = sizeof(*cmd); |
| 13670 | |
| 13671 | /* length of variable portion */ |
| 13672 | array_size = |
| 13673 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 13674 | len += WMI_TLV_HDR_SIZE + array_size; |
| 13675 | |
| 13676 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13677 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13678 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13679 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13680 | } |
| 13681 | |
| 13682 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 13683 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 13684 | buf_ptr; |
| 13685 | WMITLV_SET_HDR |
| 13686 | (&cmd->tlv_header, |
| 13687 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 13688 | WMITLV_GET_STRUCT_TLVLEN |
| 13689 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 13690 | |
| 13691 | cmd->request_id = request->request_id; |
| 13692 | cmd->requestor_id = 0; |
| 13693 | cmd->vdev_id = request->session_id; |
| 13694 | cmd->table_id = 0; |
| 13695 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 13696 | cmd->total_entries = request->ssid_count; |
| 13697 | cmd->num_entries_in_page = request->ssid_count; |
| 13698 | cmd->first_entry_index = 0; |
| 13699 | |
| 13700 | buf_ptr += sizeof(*cmd); |
| 13701 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 13702 | |
| 13703 | if (request->ssid_count) { |
| 13704 | wmi_extscan_hotlist_ssid_entry *entry; |
| 13705 | int i; |
| 13706 | |
| 13707 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13708 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 13709 | for (i = 0; i < request->ssid_count; i++) { |
| 13710 | WMITLV_SET_HDR |
| 13711 | (entry, |
| 13712 | WMITLV_TAG_ARRAY_STRUC, |
| 13713 | WMITLV_GET_STRUCT_TLVLEN |
| 13714 | (wmi_extscan_hotlist_ssid_entry)); |
| 13715 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13716 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13717 | request->ssids[i].ssid.mac_ssid, |
| 13718 | request->ssids[i].ssid.length); |
| 13719 | entry->band = request->ssids[i].band; |
| 13720 | entry->min_rssi = request->ssids[i].rssi_low; |
| 13721 | entry->max_rssi = request->ssids[i].rssi_high; |
| 13722 | entry++; |
| 13723 | } |
| 13724 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 13725 | } else { |
| 13726 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 13727 | } |
| 13728 | |
| 13729 | if (wmi_unified_cmd_send |
| 13730 | (wmi_handle, wmi_buf, len, |
| 13731 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13732 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13733 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13734 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13735 | } |
| 13736 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13737 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13738 | } |
| 13739 | |
| 13740 | /** |
| 13741 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 13742 | * @wmi_handle: wmi handle |
| 13743 | * @vdev_id: vdev id |
| 13744 | * |
| 13745 | * This function sends roam synch complete event to fw. |
| 13746 | * |
| 13747 | * Return: CDF STATUS |
| 13748 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13749 | 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] | 13750 | uint8_t vdev_id) |
| 13751 | { |
| 13752 | wmi_roam_synch_complete_fixed_param *cmd; |
| 13753 | wmi_buf_t wmi_buf; |
| 13754 | uint8_t *buf_ptr; |
| 13755 | uint16_t len; |
| 13756 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 13757 | |
| 13758 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13759 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13760 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13761 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13762 | } |
| 13763 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 13764 | buf_ptr = (uint8_t *) cmd; |
| 13765 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13766 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 13767 | WMITLV_GET_STRUCT_TLVLEN |
| 13768 | (wmi_roam_synch_complete_fixed_param)); |
| 13769 | cmd->vdev_id = vdev_id; |
| 13770 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13771 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13772 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13773 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13774 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13775 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13776 | } |
| 13777 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13778 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13779 | } |
| 13780 | |
| 13781 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 13782 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 13783 | * @wmi_handle: wmi handle |
| 13784 | * @wmi_fwtest: fw test command |
| 13785 | * |
| 13786 | * This function sends fw test command to fw. |
| 13787 | * |
| 13788 | * Return: CDF STATUS |
| 13789 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 13790 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 13791 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 13792 | struct set_fwtest_params *wmi_fwtest) |
| 13793 | { |
| 13794 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 13795 | wmi_buf_t wmi_buf; |
| 13796 | uint16_t len; |
| 13797 | |
| 13798 | len = sizeof(*cmd); |
| 13799 | |
| 13800 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13801 | if (!wmi_buf) { |
| 13802 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 13803 | return QDF_STATUS_E_NOMEM; |
| 13804 | } |
| 13805 | |
| 13806 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 13807 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13808 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 13809 | WMITLV_GET_STRUCT_TLVLEN( |
| 13810 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 13811 | cmd->param_id = wmi_fwtest->arg; |
| 13812 | cmd->param_value = wmi_fwtest->value; |
| 13813 | |
| 13814 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13815 | WMI_FWTEST_CMDID)) { |
| 13816 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 13817 | qdf_nbuf_free(wmi_buf); |
| 13818 | return QDF_STATUS_E_FAILURE; |
| 13819 | } |
| 13820 | |
| 13821 | return QDF_STATUS_SUCCESS; |
| 13822 | } |
| 13823 | |
| 13824 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13825 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 13826 | * @wmi_handle: wmi handle |
| 13827 | * @wmi_utest: unit test command |
| 13828 | * |
| 13829 | * This function send unit test command to fw. |
| 13830 | * |
| 13831 | * Return: CDF STATUS |
| 13832 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13833 | 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] | 13834 | struct wmi_unit_test_cmd *wmi_utest) |
| 13835 | { |
| 13836 | wmi_unit_test_cmd_fixed_param *cmd; |
| 13837 | wmi_buf_t wmi_buf; |
| 13838 | uint8_t *buf_ptr; |
| 13839 | int i; |
| 13840 | uint16_t len, args_tlv_len; |
| 13841 | A_UINT32 *unit_test_cmd_args; |
| 13842 | |
| 13843 | args_tlv_len = |
| 13844 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 13845 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 13846 | |
| 13847 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13848 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13849 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 13850 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13851 | } |
| 13852 | |
| 13853 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 13854 | buf_ptr = (uint8_t *) cmd; |
| 13855 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13856 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 13857 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 13858 | cmd->vdev_id = wmi_utest->vdev_id; |
| 13859 | cmd->module_id = wmi_utest->module_id; |
| 13860 | cmd->num_args = wmi_utest->num_args; |
| 13861 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 13862 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13863 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 13864 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13865 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13866 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 13867 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13868 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13869 | } |
| 13870 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13871 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13872 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13873 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13874 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13875 | } |
| 13876 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13877 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13878 | } |
| 13879 | |
| 13880 | /** |
| 13881 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 13882 | * @wmi_handle: wma handle |
| 13883 | * @roaminvoke: roam invoke command |
| 13884 | * |
| 13885 | * Send roam invoke command to fw for fastreassoc. |
| 13886 | * |
| 13887 | * Return: CDF STATUS |
| 13888 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13889 | 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] | 13890 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 13891 | uint32_t ch_hz) |
| 13892 | { |
| 13893 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 13894 | wmi_buf_t wmi_buf; |
| 13895 | u_int8_t *buf_ptr; |
| 13896 | u_int16_t len, args_tlv_len; |
| 13897 | A_UINT32 *channel_list; |
| 13898 | wmi_mac_addr *bssid_list; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13899 | wmi_tlv_buf_len_param *buf_len_tlv; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13900 | |
| 13901 | /* Host sends only one channel and one bssid */ |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13902 | args_tlv_len = (4 * WMI_TLV_HDR_SIZE) + sizeof(A_UINT32) + |
| 13903 | sizeof(wmi_mac_addr) + sizeof(wmi_tlv_buf_len_param) + |
| 13904 | roundup(roaminvoke->frame_len, sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13905 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 13906 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 13907 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13908 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 13909 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13910 | } |
| 13911 | |
| 13912 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 13913 | buf_ptr = (u_int8_t *) cmd; |
| 13914 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13915 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 13916 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 13917 | cmd->vdev_id = roaminvoke->vdev_id; |
| 13918 | cmd->flags = 0; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13919 | |
| 13920 | if (roaminvoke->frame_len) |
| 13921 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_SKIP; |
| 13922 | else |
| 13923 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_FIXED_CH; |
| 13924 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13925 | cmd->roam_ap_sel_mode = 0; |
| 13926 | cmd->roam_delay = 0; |
| 13927 | cmd->num_chan = 1; |
| 13928 | cmd->num_bssid = 1; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13929 | /* packing 1 beacon/probe_rsp frame with WMI cmd */ |
| 13930 | cmd->num_buf = 1; |
| 13931 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13932 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 13933 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 13934 | (sizeof(u_int32_t))); |
| 13935 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13936 | *channel_list = ch_hz; |
| 13937 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 13938 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 13939 | (sizeof(wmi_mac_addr))); |
| 13940 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13941 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 13942 | |
| 13943 | /* move to next tlv i.e. bcn_prb_buf_list */ |
| 13944 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_mac_addr); |
| 13945 | |
| 13946 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 13947 | sizeof(wmi_tlv_buf_len_param)); |
| 13948 | |
| 13949 | buf_len_tlv = (wmi_tlv_buf_len_param *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 13950 | buf_len_tlv->buf_len = roaminvoke->frame_len; |
| 13951 | |
| 13952 | /* move to next tlv i.e. bcn_prb_frm */ |
| 13953 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_tlv_buf_len_param); |
| 13954 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 13955 | roundup(roaminvoke->frame_len, sizeof(uint32_t))); |
| 13956 | |
| 13957 | /* copy frame after the header */ |
| 13958 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
| 13959 | roaminvoke->frame_buf, |
| 13960 | roaminvoke->frame_len); |
| 13961 | |
| 13962 | WMI_LOGD(FL("bcn/prb_rsp frame, length: %d"), roaminvoke->frame_len); |
| 13963 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 13964 | buf_ptr + WMI_TLV_HDR_SIZE, |
| 13965 | roaminvoke->frame_len); |
| 13966 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13967 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 13968 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13969 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13970 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13971 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13972 | } |
| 13973 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13974 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13975 | } |
| 13976 | |
| 13977 | /** |
| 13978 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 13979 | * @wmi_handle: wmi handle |
| 13980 | * @command: command |
| 13981 | * @vdev_id: vdev id |
| 13982 | * |
| 13983 | * This function set roam offload command to fw. |
| 13984 | * |
| 13985 | * Return: CDF status |
| 13986 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13987 | 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] | 13988 | uint32_t command, uint32_t vdev_id) |
| 13989 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13990 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13991 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 13992 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13993 | int len; |
| 13994 | uint8_t *buf_ptr; |
| 13995 | |
| 13996 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 13997 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13998 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13999 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14000 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14001 | } |
| 14002 | |
| 14003 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14004 | |
| 14005 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 14006 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 14007 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 14008 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 14009 | cmd_fp->vdev_id = vdev_id; |
| 14010 | cmd_fp->command_arg = command; |
| 14011 | |
| 14012 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14013 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14014 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14015 | 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] | 14016 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14017 | goto error; |
| 14018 | } |
| 14019 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14020 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 14021 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14022 | |
| 14023 | error: |
| 14024 | wmi_buf_free(buf); |
| 14025 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14026 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14027 | } |
| 14028 | |
| 14029 | /** |
| 14030 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 14031 | * @wmi_handle: wmi handle |
| 14032 | * @ap_profile_p: ap profile |
| 14033 | * @vdev_id: vdev id |
| 14034 | * |
| 14035 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 14036 | * |
| 14037 | * Return: CDF status |
| 14038 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14039 | 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] | 14040 | wmi_ap_profile *ap_profile_p, |
| 14041 | uint32_t vdev_id) |
| 14042 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14043 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14044 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14045 | int len; |
| 14046 | uint8_t *buf_ptr; |
| 14047 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
| 14048 | |
| 14049 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
| 14050 | |
| 14051 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14052 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14053 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14054 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14055 | } |
| 14056 | |
| 14057 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14058 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 14059 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 14060 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 14061 | WMITLV_GET_STRUCT_TLVLEN |
| 14062 | (wmi_roam_ap_profile_fixed_param)); |
| 14063 | /* fill in threshold values */ |
| 14064 | roam_ap_profile_fp->vdev_id = vdev_id; |
| 14065 | roam_ap_profile_fp->id = 0; |
| 14066 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 14067 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14068 | qdf_mem_copy(buf_ptr, ap_profile_p, sizeof(wmi_ap_profile)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14069 | WMITLV_SET_HDR(buf_ptr, |
| 14070 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 14071 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
| 14072 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14073 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14074 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14075 | 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] | 14076 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14077 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14078 | } |
| 14079 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14080 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14081 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14082 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14083 | } |
| 14084 | |
| 14085 | /** |
| 14086 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 14087 | * @wmi_handle: wmi handle |
| 14088 | * @scan_period: scan period |
| 14089 | * @scan_age: scan age |
| 14090 | * @vdev_id: vdev id |
| 14091 | * |
| 14092 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 14093 | * |
| 14094 | * Return: CDF status |
| 14095 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14096 | 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] | 14097 | uint32_t scan_period, |
| 14098 | uint32_t scan_age, |
| 14099 | uint32_t vdev_id) |
| 14100 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14101 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14102 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14103 | int len; |
| 14104 | uint8_t *buf_ptr; |
| 14105 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 14106 | |
| 14107 | /* Send scan period values */ |
| 14108 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 14109 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14110 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14111 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14112 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14113 | } |
| 14114 | |
| 14115 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14116 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 14117 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 14118 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 14119 | WMITLV_GET_STRUCT_TLVLEN |
| 14120 | (wmi_roam_scan_period_fixed_param)); |
| 14121 | /* fill in scan period values */ |
| 14122 | scan_period_fp->vdev_id = vdev_id; |
| 14123 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 14124 | scan_period_fp->roam_scan_age = scan_age; |
| 14125 | |
| 14126 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14127 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14128 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14129 | 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] | 14130 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14131 | goto error; |
| 14132 | } |
| 14133 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14134 | 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] | 14135 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14136 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14137 | error: |
| 14138 | wmi_buf_free(buf); |
| 14139 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14140 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14141 | } |
| 14142 | |
| 14143 | /** |
| 14144 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 14145 | * @wmi_handle: wmi handle |
| 14146 | * @chan_count: channel count |
| 14147 | * @chan_list: channel list |
| 14148 | * @list_type: list type |
| 14149 | * @vdev_id: vdev id |
| 14150 | * |
| 14151 | * Set roam offload channel list. |
| 14152 | * |
| 14153 | * Return: CDF status |
| 14154 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14155 | 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] | 14156 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 14157 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14158 | uint8_t list_type, uint32_t vdev_id) |
| 14159 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14160 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14161 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14162 | int len, list_tlv_len; |
| 14163 | int i; |
| 14164 | uint8_t *buf_ptr; |
| 14165 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 14166 | A_UINT32 *roam_chan_list_array; |
| 14167 | |
| 14168 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14169 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14170 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14171 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14172 | } |
| 14173 | /* Channel list is a table of 2 TLV's */ |
| 14174 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 14175 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 14176 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14177 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14178 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14179 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14180 | } |
| 14181 | |
| 14182 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14183 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 14184 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 14185 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 14186 | WMITLV_GET_STRUCT_TLVLEN |
| 14187 | (wmi_roam_chan_list_fixed_param)); |
| 14188 | chan_list_fp->vdev_id = vdev_id; |
| 14189 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 14190 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14191 | /* external app is controlling channel list */ |
| 14192 | chan_list_fp->chan_list_type = |
| 14193 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 14194 | } else { |
| 14195 | /* umac supplied occupied channel list in LFR */ |
| 14196 | chan_list_fp->chan_list_type = |
| 14197 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 14198 | } |
| 14199 | |
| 14200 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 14201 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14202 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 14203 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14204 | WMI_LOGI("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14205 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 14206 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 14207 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14208 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14209 | } |
| 14210 | |
| 14211 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14212 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14213 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14214 | 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] | 14215 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14216 | goto error; |
| 14217 | } |
| 14218 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14219 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
| 14220 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14221 | error: |
| 14222 | wmi_buf_free(buf); |
| 14223 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14224 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14225 | } |
| 14226 | |
| 14227 | /** |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 14228 | * send_per_roam_config_cmd_tlv() - set per roaming config to FW |
| 14229 | * @wmi_handle: wmi handle |
| 14230 | * @req_buf: per roam config buffer |
| 14231 | * |
| 14232 | * Return: QDF status |
| 14233 | */ |
| 14234 | static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 14235 | struct wmi_per_roam_config_req *req_buf) |
| 14236 | { |
| 14237 | wmi_buf_t buf = NULL; |
| 14238 | QDF_STATUS status; |
| 14239 | int len; |
| 14240 | uint8_t *buf_ptr; |
| 14241 | wmi_roam_per_config_fixed_param *wmi_per_config; |
| 14242 | |
| 14243 | len = sizeof(wmi_roam_per_config_fixed_param); |
| 14244 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14245 | if (!buf) { |
| 14246 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14247 | return QDF_STATUS_E_NOMEM; |
| 14248 | } |
| 14249 | |
| 14250 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14251 | wmi_per_config = |
| 14252 | (wmi_roam_per_config_fixed_param *) buf_ptr; |
| 14253 | WMITLV_SET_HDR(&wmi_per_config->tlv_header, |
| 14254 | WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param, |
| 14255 | WMITLV_GET_STRUCT_TLVLEN |
| 14256 | (wmi_roam_per_config_fixed_param)); |
| 14257 | |
| 14258 | /* fill in per roam config values */ |
| 14259 | wmi_per_config->vdev_id = req_buf->vdev_id; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 14260 | |
| 14261 | wmi_per_config->enable = req_buf->per_config.enable; |
| 14262 | wmi_per_config->high_rate_thresh = |
| 14263 | (req_buf->per_config.tx_high_rate_thresh << 16) | |
| 14264 | (req_buf->per_config.rx_high_rate_thresh & 0x0000ffff); |
| 14265 | wmi_per_config->low_rate_thresh = |
| 14266 | (req_buf->per_config.tx_low_rate_thresh << 16) | |
| 14267 | (req_buf->per_config.rx_low_rate_thresh & 0x0000ffff); |
| 14268 | wmi_per_config->pkt_err_rate_thresh_pct = |
| 14269 | (req_buf->per_config.tx_rate_thresh_percnt << 16) | |
| 14270 | (req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff); |
| 14271 | 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] | 14272 | wmi_per_config->pkt_err_rate_mon_time = |
| 14273 | (req_buf->per_config.tx_per_mon_time << 16) | |
| 14274 | (req_buf->per_config.rx_per_mon_time & 0x0000ffff); |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 14275 | |
| 14276 | /* Send per roam config parameters */ |
| 14277 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14278 | len, WMI_ROAM_PER_CONFIG_CMDID); |
| 14279 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14280 | WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d", |
| 14281 | status); |
| 14282 | wmi_buf_free(buf); |
| 14283 | return status; |
| 14284 | } |
| 14285 | |
| 14286 | WMI_LOGI(FL("per roam enable=%d, vdev=%d"), |
| 14287 | req_buf->per_config.enable, req_buf->vdev_id); |
| 14288 | return QDF_STATUS_SUCCESS; |
| 14289 | } |
| 14290 | |
| 14291 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14292 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 14293 | * @wmi_handle: wmi handle |
| 14294 | * @rssi_change_thresh: RSSI Change threshold |
| 14295 | * @bcn_rssi_weight: beacon RSSI weight |
| 14296 | * @vdev_id: vdev id |
| 14297 | * |
| 14298 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 14299 | * |
| 14300 | * Return: CDF status |
| 14301 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14302 | 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] | 14303 | uint32_t vdev_id, |
| 14304 | int32_t rssi_change_thresh, |
| 14305 | uint32_t bcn_rssi_weight, |
| 14306 | uint32_t hirssi_delay_btw_scans) |
| 14307 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14308 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14309 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14310 | int len; |
| 14311 | uint8_t *buf_ptr; |
| 14312 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 14313 | |
| 14314 | /* Send rssi change parameters */ |
| 14315 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 14316 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14317 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14318 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14319 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14320 | } |
| 14321 | |
| 14322 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14323 | rssi_change_fp = |
| 14324 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 14325 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 14326 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 14327 | WMITLV_GET_STRUCT_TLVLEN |
| 14328 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 14329 | /* fill in rssi change threshold (hysteresis) values */ |
| 14330 | rssi_change_fp->vdev_id = vdev_id; |
| 14331 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 14332 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 14333 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 14334 | |
| 14335 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14336 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14337 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14338 | 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] | 14339 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14340 | goto error; |
| 14341 | } |
| 14342 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14343 | 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] | 14344 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14345 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 14346 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14347 | error: |
| 14348 | wmi_buf_free(buf); |
| 14349 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14350 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14351 | } |
| 14352 | |
| 14353 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 14354 | * @wmi_handle: wmi handle. |
| 14355 | * @cmd: size of command structure. |
| 14356 | * @per_entry_size: per entry size. |
| 14357 | * |
| 14358 | * This utility function calculates how many hotlist entries can |
| 14359 | * fit in one page. |
| 14360 | * |
| 14361 | * Return: number of entries |
| 14362 | */ |
| 14363 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 14364 | size_t cmd_size, |
| 14365 | size_t per_entry_size) |
| 14366 | { |
| 14367 | uint32_t avail_space = 0; |
| 14368 | int num_entries = 0; |
| 14369 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 14370 | |
| 14371 | /* Calculate number of hotlist entries that can |
| 14372 | * be passed in wma message request. |
| 14373 | */ |
| 14374 | avail_space = max_msg_len - cmd_size; |
| 14375 | num_entries = avail_space / per_entry_size; |
| 14376 | return num_entries; |
| 14377 | } |
| 14378 | |
| 14379 | /** |
| 14380 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 14381 | * @wmi_handle: wmi handle |
| 14382 | * @photlist: hotlist command params |
| 14383 | * @buf_len: buffer length |
| 14384 | * |
| 14385 | * This function fills individual elements for hotlist request and |
| 14386 | * TLV for bssid entries |
| 14387 | * |
| 14388 | * Return: CDF Status. |
| 14389 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14390 | 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] | 14391 | struct ext_scan_setbssi_hotlist_params * |
| 14392 | photlist, int *buf_len) |
| 14393 | { |
| 14394 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 14395 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 14396 | struct ap_threshold_params *src_ap = photlist->ap; |
| 14397 | wmi_buf_t buf; |
| 14398 | uint8_t *buf_ptr; |
| 14399 | |
| 14400 | int j, index = 0; |
| 14401 | int cmd_len = 0; |
| 14402 | int num_entries; |
| 14403 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 14404 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14405 | int len = sizeof(*cmd); |
| 14406 | |
| 14407 | len += WMI_TLV_HDR_SIZE; |
| 14408 | cmd_len = len; |
| 14409 | |
| 14410 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 14411 | cmd_len, |
| 14412 | sizeof(*dest_hotlist)); |
| 14413 | /* setbssid hotlist expects the bssid list |
| 14414 | * to be non zero value |
| 14415 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 14416 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 14417 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14418 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14419 | } |
| 14420 | |
| 14421 | /* Split the hot list entry pages and send multiple command |
| 14422 | * requests if the buffer reaches the maximum request size |
| 14423 | */ |
| 14424 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14425 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14426 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 14427 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14428 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14429 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 14430 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14431 | } |
| 14432 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14433 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 14434 | buf_ptr; |
| 14435 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14436 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 14437 | WMITLV_GET_STRUCT_TLVLEN |
| 14438 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 14439 | |
| 14440 | /* Multiple requests are sent until the num_entries_in_page |
| 14441 | * matches the total_entries |
| 14442 | */ |
| 14443 | cmd->request_id = photlist->requestId; |
| 14444 | cmd->vdev_id = photlist->sessionId; |
| 14445 | cmd->total_entries = numap; |
| 14446 | cmd->mode = 1; |
| 14447 | cmd->num_entries_in_page = min_entries; |
| 14448 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 14449 | cmd->first_entry_index = index; |
| 14450 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14451 | 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] | 14452 | __func__, cmd->vdev_id, cmd->total_entries, |
| 14453 | cmd->num_entries_in_page, |
| 14454 | cmd->lost_ap_scan_count); |
| 14455 | |
| 14456 | buf_ptr += sizeof(*cmd); |
| 14457 | WMITLV_SET_HDR(buf_ptr, |
| 14458 | WMITLV_TAG_ARRAY_STRUC, |
| 14459 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 14460 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 14461 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 14462 | |
| 14463 | /* Populate bssid, channel info and rssi |
| 14464 | * for the bssid's that are sent as hotlists. |
| 14465 | */ |
| 14466 | for (j = 0; j < min_entries; j++) { |
| 14467 | WMITLV_SET_HDR(dest_hotlist, |
| 14468 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 14469 | WMITLV_GET_STRUCT_TLVLEN |
| 14470 | (wmi_extscan_hotlist_entry)); |
| 14471 | |
| 14472 | dest_hotlist->min_rssi = src_ap->low; |
| 14473 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 14474 | &dest_hotlist->bssid); |
| 14475 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14476 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14477 | __func__, dest_hotlist->channel, |
| 14478 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14479 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14480 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 14481 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 14482 | dest_hotlist->bssid.mac_addr47to32); |
| 14483 | dest_hotlist++; |
| 14484 | src_ap++; |
| 14485 | } |
| 14486 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 14487 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 14488 | |
| 14489 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14490 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14491 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14492 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14493 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14494 | } |
| 14495 | index = index + min_entries; |
| 14496 | num_entries = numap - min_entries; |
| 14497 | len = cmd_len; |
| 14498 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14499 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14500 | } |
| 14501 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 14502 | /** |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 14503 | * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW |
| 14504 | * @wmi_handle: the WMI handle |
| 14505 | * @vdev_id: the Id of the vdev to apply the configuration to |
| 14506 | * @ucast_mode: the active BPF mode to configure for unicast packets |
| 14507 | * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast |
| 14508 | * packets |
| 14509 | * |
| 14510 | * Return: QDF status |
| 14511 | */ |
| 14512 | static QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 14513 | uint8_t vdev_id, |
| 14514 | enum wmi_host_active_bpf_mode ucast_mode, |
| 14515 | enum wmi_host_active_bpf_mode mcast_bcast_mode) |
| 14516 | { |
| 14517 | const WMITLV_TAG_ID tag_id = |
| 14518 | WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; |
| 14519 | const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( |
| 14520 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param); |
| 14521 | QDF_STATUS status; |
| 14522 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; |
| 14523 | wmi_buf_t buf; |
| 14524 | |
| 14525 | WMI_LOGI("Sending WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)", |
| 14526 | vdev_id, ucast_mode, mcast_bcast_mode); |
| 14527 | |
| 14528 | /* allocate command buffer */ |
| 14529 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 14530 | if (!buf) { |
| 14531 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 14532 | return QDF_STATUS_E_NOMEM; |
| 14533 | } |
| 14534 | |
| 14535 | /* set TLV header */ |
| 14536 | cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); |
| 14537 | WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); |
| 14538 | |
| 14539 | /* populate data */ |
| 14540 | cmd->vdev_id = vdev_id; |
| 14541 | cmd->uc_mode = ucast_mode; |
| 14542 | cmd->mcbc_mode = mcast_bcast_mode; |
| 14543 | |
| 14544 | /* send to FW */ |
| 14545 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 14546 | WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); |
| 14547 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14548 | WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", |
| 14549 | status); |
| 14550 | wmi_buf_free(buf); |
| 14551 | return status; |
| 14552 | } |
| 14553 | |
| 14554 | WMI_LOGI("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); |
| 14555 | |
| 14556 | return QDF_STATUS_SUCCESS; |
| 14557 | } |
| 14558 | |
| 14559 | /** |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 14560 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 14561 | * @wmi_handle: wmi handle |
| 14562 | * @param: wmi power debug parameter |
| 14563 | * |
| 14564 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 14565 | * |
| 14566 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 14567 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14568 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 14569 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 14570 | { |
| 14571 | wmi_buf_t buf = NULL; |
| 14572 | QDF_STATUS status; |
| 14573 | int len, args_tlv_len; |
| 14574 | uint8_t *buf_ptr; |
| 14575 | uint8_t i; |
| 14576 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 14577 | uint32_t *cmd_args; |
| 14578 | |
| 14579 | /* Prepare and send power debug cmd parameters */ |
| 14580 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 14581 | len = sizeof(*cmd) + args_tlv_len; |
| 14582 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14583 | if (!buf) { |
| 14584 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14585 | return QDF_STATUS_E_NOMEM; |
| 14586 | } |
| 14587 | |
| 14588 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14589 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 14590 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14591 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 14592 | WMITLV_GET_STRUCT_TLVLEN |
| 14593 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 14594 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14595 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 14596 | param->pdev_id); |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 14597 | cmd->module_id = param->module_id; |
| 14598 | cmd->num_args = param->num_args; |
| 14599 | buf_ptr += sizeof(*cmd); |
| 14600 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14601 | (param->num_args * sizeof(uint32_t))); |
| 14602 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 14603 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 14604 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 14605 | cmd_args[i] = param->args[i]; |
| 14606 | WMI_LOGI("%d,", param->args[i]); |
| 14607 | } |
| 14608 | |
| 14609 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14610 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 14611 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14612 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 14613 | status); |
| 14614 | goto error; |
| 14615 | } |
| 14616 | |
| 14617 | return QDF_STATUS_SUCCESS; |
| 14618 | error: |
| 14619 | wmi_buf_free(buf); |
| 14620 | |
| 14621 | return status; |
| 14622 | } |
| 14623 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14624 | /* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14625 | * @wmi_handle: pointer to wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14626 | * @buf_ptr: pointer to current position in init command buffer |
| 14627 | * @len: pointer to length. This will be updated with current lenght of cmd |
| 14628 | * @param: point host parameters for init command |
| 14629 | * |
| 14630 | * Return: Updated pointer of buf_ptr. |
| 14631 | */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14632 | static inline uint8_t *copy_hw_mode_in_init_cmd(struct wmi_unified *wmi_handle, |
| 14633 | uint8_t *buf_ptr, int *len, struct wmi_init_cmd_param *param) |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14634 | { |
| 14635 | uint16_t idx; |
| 14636 | |
| 14637 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { |
| 14638 | wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode; |
| 14639 | wmi_pdev_band_to_mac *band_to_mac; |
| 14640 | |
| 14641 | hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *) |
| 14642 | (buf_ptr + sizeof(wmi_init_cmd_fixed_param) + |
| 14643 | sizeof(wmi_resource_config) + |
| 14644 | WMI_TLV_HDR_SIZE + (param->num_mem_chunks * |
| 14645 | sizeof(wlan_host_memory_chunk))); |
| 14646 | |
| 14647 | WMITLV_SET_HDR(&hw_mode->tlv_header, |
| 14648 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 14649 | (WMITLV_GET_STRUCT_TLVLEN |
| 14650 | (wmi_pdev_set_hw_mode_cmd_fixed_param))); |
| 14651 | |
| 14652 | hw_mode->hw_mode_index = param->hw_mode_id; |
| 14653 | hw_mode->num_band_to_mac = param->num_band_to_mac; |
| 14654 | |
| 14655 | buf_ptr = (uint8_t *) (hw_mode + 1); |
| 14656 | band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr + |
| 14657 | WMI_TLV_HDR_SIZE); |
| 14658 | for (idx = 0; idx < param->num_band_to_mac; idx++) { |
| 14659 | WMITLV_SET_HDR(&band_to_mac[idx].tlv_header, |
| 14660 | WMITLV_TAG_STRUC_wmi_pdev_band_to_mac, |
| 14661 | WMITLV_GET_STRUCT_TLVLEN |
| 14662 | (wmi_pdev_band_to_mac)); |
| 14663 | band_to_mac[idx].pdev_id = |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14664 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 14665 | param->band_to_mac[idx].pdev_id); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14666 | band_to_mac[idx].start_freq = |
| 14667 | param->band_to_mac[idx].start_freq; |
| 14668 | band_to_mac[idx].end_freq = |
| 14669 | param->band_to_mac[idx].end_freq; |
| 14670 | } |
| 14671 | *len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 14672 | (param->num_band_to_mac * |
| 14673 | sizeof(wmi_pdev_band_to_mac)) + |
| 14674 | WMI_TLV_HDR_SIZE; |
| 14675 | |
| 14676 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 14677 | (param->num_band_to_mac * |
| 14678 | sizeof(wmi_pdev_band_to_mac))); |
| 14679 | } |
| 14680 | |
| 14681 | return buf_ptr; |
| 14682 | } |
| 14683 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14684 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 14685 | * send_multiple_vdev_restart_req_cmd_tlv() - send multiple vdev restart req |
| 14686 | * @wmi_handle: wmi handle |
| 14687 | * @param: wmi multiple vdev restart req param |
| 14688 | * |
| 14689 | * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw. |
| 14690 | * |
| 14691 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 14692 | */ |
| 14693 | static QDF_STATUS send_multiple_vdev_restart_req_cmd_tlv( |
| 14694 | wmi_unified_t wmi_handle, |
| 14695 | struct multiple_vdev_restart_params *param) |
| 14696 | { |
| 14697 | wmi_buf_t buf; |
| 14698 | QDF_STATUS qdf_status; |
| 14699 | wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *cmd; |
| 14700 | int i; |
| 14701 | uint8_t *buf_ptr; |
| 14702 | uint32_t *vdev_ids; |
| 14703 | wmi_channel *chan_info; |
| 14704 | struct channel_param *tchan_info; |
| 14705 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 14706 | |
| 14707 | len += sizeof(wmi_channel); |
| 14708 | if (param->num_vdevs) |
| 14709 | len += sizeof(uint32_t) * param->num_vdevs; |
| 14710 | |
| 14711 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14712 | if (!buf) { |
| 14713 | WMI_LOGE("Failed to allocate memory\n"); |
| 14714 | qdf_status = QDF_STATUS_E_NOMEM; |
| 14715 | goto end; |
| 14716 | } |
| 14717 | |
| 14718 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 14719 | cmd = (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *) |
| 14720 | buf_ptr; |
| 14721 | |
| 14722 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14723 | WMITLV_TAG_STRUC_wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param, |
| 14724 | WMITLV_GET_STRUCT_TLVLEN |
| 14725 | (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14726 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 14727 | param->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 14728 | cmd->requestor_id = param->requestor_id; |
| 14729 | cmd->disable_hw_ack = param->disable_hw_ack; |
| 14730 | cmd->cac_duration_ms = param->cac_duration_ms; |
| 14731 | cmd->num_vdevs = param->num_vdevs; |
| 14732 | |
| 14733 | buf_ptr += sizeof(*cmd); |
| 14734 | |
| 14735 | WMITLV_SET_HDR(buf_ptr, |
| 14736 | WMITLV_TAG_ARRAY_UINT32, |
| 14737 | sizeof(A_UINT32) * param->num_vdevs); |
| 14738 | vdev_ids = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 14739 | for (i = 0; i < param->num_vdevs; i++) { |
| 14740 | vdev_ids[i] = param->vdev_ids[i]; |
| 14741 | } |
| 14742 | |
| 14743 | buf_ptr += (sizeof(A_UINT32) * param->num_vdevs) + WMI_TLV_HDR_SIZE; |
| 14744 | |
| 14745 | WMITLV_SET_HDR(buf_ptr, |
| 14746 | WMITLV_TAG_STRUC_wmi_channel, |
| 14747 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
Sathish Kumar | 3e28e00 | 2017-03-07 15:53:04 +0530 | [diff] [blame] | 14748 | chan_info = (wmi_channel *)buf_ptr; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 14749 | tchan_info = &(param->ch_param); |
| 14750 | chan_info->mhz = tchan_info->mhz; |
| 14751 | chan_info->band_center_freq1 = tchan_info->cfreq1; |
| 14752 | chan_info->band_center_freq2 = tchan_info->cfreq2; |
| 14753 | if (tchan_info->is_chan_passive) |
| 14754 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 14755 | WMI_CHAN_FLAG_PASSIVE); |
| 14756 | if (tchan_info->allow_vht) |
| 14757 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 14758 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 14759 | else if (tchan_info->allow_ht) |
| 14760 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 14761 | WMI_CHAN_FLAG_ALLOW_HT); |
| 14762 | WMI_SET_CHANNEL_MODE(chan_info, tchan_info->phy_mode); |
| 14763 | WMI_SET_CHANNEL_MIN_POWER(chan_info, tchan_info->minpower); |
| 14764 | WMI_SET_CHANNEL_MAX_POWER(chan_info, tchan_info->maxpower); |
| 14765 | WMI_SET_CHANNEL_REG_POWER(chan_info, tchan_info->maxregpower); |
| 14766 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, tchan_info->antennamax); |
| 14767 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, tchan_info->reg_class_id); |
| 14768 | |
| 14769 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14770 | WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID); |
| 14771 | |
| 14772 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 14773 | WMI_LOGE("%s: Failed to send\n", __func__); |
| 14774 | wmi_buf_free(buf); |
| 14775 | } |
| 14776 | |
| 14777 | end: |
| 14778 | return qdf_status; |
| 14779 | } |
| 14780 | |
| 14781 | /** |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 14782 | * send_dfs_phyerr_offload_en_cmd_tlv() - send dfs phyerr offload enable cmd |
| 14783 | * @wmi_handle: wmi handle |
| 14784 | * @pdev_id: pdev id |
| 14785 | * |
| 14786 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID command to firmware. |
| 14787 | * |
| 14788 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 14789 | */ |
| 14790 | static QDF_STATUS send_dfs_phyerr_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 14791 | uint32_t pdev_id) |
| 14792 | { |
| 14793 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *cmd; |
| 14794 | wmi_buf_t buf; |
| 14795 | uint16_t len; |
| 14796 | QDF_STATUS ret; |
| 14797 | |
| 14798 | len = sizeof(*cmd); |
| 14799 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14800 | |
| 14801 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 14802 | |
| 14803 | if (!buf) { |
| 14804 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14805 | return QDF_STATUS_E_NOMEM; |
| 14806 | } |
| 14807 | |
| 14808 | cmd = (wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *) |
| 14809 | wmi_buf_data(buf); |
| 14810 | |
| 14811 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14812 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param, |
| 14813 | WMITLV_GET_STRUCT_TLVLEN( |
| 14814 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param)); |
| 14815 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14816 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 14817 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14818 | WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 14819 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 14820 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 14821 | __func__, ret, pdev_id); |
| 14822 | wmi_buf_free(buf); |
| 14823 | return QDF_STATUS_E_FAILURE; |
| 14824 | } |
| 14825 | |
| 14826 | return QDF_STATUS_SUCCESS; |
| 14827 | } |
| 14828 | |
| 14829 | /** |
| 14830 | * send_dfs_phyerr_offload_dis_cmd_tlv() - send dfs phyerr offload disable cmd |
| 14831 | * @wmi_handle: wmi handle |
| 14832 | * @pdev_id: pdev id |
| 14833 | * |
| 14834 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID command to firmware. |
| 14835 | * |
| 14836 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 14837 | */ |
| 14838 | static QDF_STATUS send_dfs_phyerr_offload_dis_cmd_tlv(wmi_unified_t wmi_handle, |
| 14839 | uint32_t pdev_id) |
| 14840 | { |
| 14841 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *cmd; |
| 14842 | wmi_buf_t buf; |
| 14843 | uint16_t len; |
| 14844 | QDF_STATUS ret; |
| 14845 | |
| 14846 | len = sizeof(*cmd); |
| 14847 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14848 | |
| 14849 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 14850 | |
| 14851 | if (!buf) { |
| 14852 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14853 | return QDF_STATUS_E_NOMEM; |
| 14854 | } |
| 14855 | |
| 14856 | cmd = (wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *) |
| 14857 | wmi_buf_data(buf); |
| 14858 | |
| 14859 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14860 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param, |
| 14861 | WMITLV_GET_STRUCT_TLVLEN( |
| 14862 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param)); |
| 14863 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14864 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 14865 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14866 | WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 14867 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 14868 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 14869 | __func__, ret, pdev_id); |
| 14870 | wmi_buf_free(buf); |
| 14871 | return QDF_STATUS_E_FAILURE; |
| 14872 | } |
| 14873 | |
| 14874 | return QDF_STATUS_SUCCESS; |
| 14875 | } |
| 14876 | |
| 14877 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14878 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 14879 | * @wmi_handle: wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14880 | * @param param: pointer to wmi init param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14881 | * |
| 14882 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14883 | */ |
| 14884 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14885 | struct wmi_init_cmd_param *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14886 | { |
| 14887 | wmi_buf_t buf; |
| 14888 | wmi_init_cmd_fixed_param *cmd; |
| 14889 | wmi_abi_version my_vers; |
| 14890 | int num_whitelist; |
| 14891 | uint8_t *buf_ptr; |
| 14892 | wmi_resource_config *resource_cfg; |
| 14893 | wlan_host_memory_chunk *host_mem_chunks; |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14894 | uint32_t mem_chunk_len = 0, hw_mode_len = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14895 | uint16_t idx; |
| 14896 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14897 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14898 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14899 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + |
| 14900 | WMI_TLV_HDR_SIZE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14901 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14902 | |
| 14903 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) |
| 14904 | hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 14905 | WMI_TLV_HDR_SIZE + |
| 14906 | (param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac)); |
| 14907 | |
| 14908 | 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] | 14909 | if (!buf) { |
| 14910 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 14911 | return QDF_STATUS_E_FAILURE; |
| 14912 | } |
| 14913 | |
| 14914 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14915 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 14916 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 14917 | |
| 14918 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 14919 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 14920 | + WMI_TLV_HDR_SIZE); |
| 14921 | |
| 14922 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14923 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 14924 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 14925 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14926 | wmi_copy_resource_config(resource_cfg, param->res_cfg); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14927 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 14928 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 14929 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 14930 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14931 | for (idx = 0; idx < param->num_mem_chunks; ++idx) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14932 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 14933 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 14934 | WMITLV_GET_STRUCT_TLVLEN |
| 14935 | (wlan_host_memory_chunk)); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14936 | host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr; |
| 14937 | host_mem_chunks[idx].size = param->mem_chunks[idx].len; |
| 14938 | host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14939 | qdf_print("chunk %d len %d requested ,ptr 0x%x ", |
| 14940 | idx, host_mem_chunks[idx].size, |
| 14941 | host_mem_chunks[idx].ptr); |
| 14942 | } |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14943 | cmd->num_host_mem_chunks = param->num_mem_chunks; |
| 14944 | len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 14945 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14946 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 14947 | WMITLV_TAG_ARRAY_STRUC, |
| 14948 | (sizeof(wlan_host_memory_chunk) * |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 14949 | param->num_mem_chunks)); |
| 14950 | |
| 14951 | /* Fill hw mode id config */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 14952 | buf_ptr = copy_hw_mode_in_init_cmd(wmi_handle, buf_ptr, &len, param); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14953 | |
| 14954 | num_whitelist = sizeof(version_whitelist) / |
| 14955 | sizeof(wmi_whitelist_version_info); |
| 14956 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 14957 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 14958 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 14959 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 14960 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 14961 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 14962 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14963 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14964 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 14965 | &my_vers, |
| 14966 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 14967 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14968 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14969 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 14970 | __func__, |
| 14971 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 14972 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 14973 | cmd->host_abi_vers.abi_version_ns_0, |
| 14974 | cmd->host_abi_vers.abi_version_ns_1, |
| 14975 | cmd->host_abi_vers.abi_version_ns_2, |
| 14976 | cmd->host_abi_vers.abi_version_ns_3); |
| 14977 | |
| 14978 | /* Save version sent from host - |
| 14979 | * Will be used to check ready event |
| 14980 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14981 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14982 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 14983 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 14984 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14985 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 14986 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 14987 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 14988 | ret); |
| 14989 | wmi_buf_free(buf); |
| 14990 | } |
| 14991 | return ret; |
| 14992 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 14993 | } |
| 14994 | |
| 14995 | /** |
| 14996 | * save_service_bitmap_tlv() - save service bitmap |
| 14997 | * @wmi_handle: wmi handle |
| 14998 | * @param evt_buf: pointer to event buffer |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 14999 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15000 | * |
| 15001 | * Return: None |
| 15002 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 15003 | #ifndef CONFIG_MCL |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 15004 | static |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15005 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 15006 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15007 | { |
| 15008 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15009 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 15010 | |
| 15011 | qdf_mem_copy(wmi_handle->wmi_service_bitmap, |
| 15012 | param_buf->wmi_service_bitmap, |
| 15013 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15014 | |
| 15015 | if (bitmap_buf) |
| 15016 | qdf_mem_copy(bitmap_buf, |
| 15017 | param_buf->wmi_service_bitmap, |
| 15018 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15019 | } |
| 15020 | #else |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 15021 | static |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15022 | void save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
| 15023 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15024 | { |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15025 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15026 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15027 | |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 15028 | if (bitmap_buf) |
| 15029 | qdf_mem_copy(bitmap_buf, |
| 15030 | param_buf->wmi_service_bitmap, |
| 15031 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
| 15032 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15033 | #endif |
| 15034 | |
| 15035 | /** |
| 15036 | * is_service_enabled_tlv() - Check if service enabled |
| 15037 | * @param wmi_handle: wmi handle |
| 15038 | * @param service_id: service identifier |
| 15039 | * |
| 15040 | * Return: 1 enabled, 0 disabled |
| 15041 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 15042 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15043 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 15044 | uint32_t service_id) |
| 15045 | { |
| 15046 | return WMI_SERVICE_IS_ENABLED(wmi_handle->wmi_service_bitmap, |
| 15047 | service_id); |
| 15048 | } |
| 15049 | #else |
| 15050 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 15051 | uint32_t service_id) |
| 15052 | { |
| 15053 | return false; |
| 15054 | } |
| 15055 | #endif |
| 15056 | |
| 15057 | /** |
| 15058 | * extract_service_ready_tlv() - extract service ready event |
| 15059 | * @wmi_handle: wmi handle |
| 15060 | * @param evt_buf: pointer to received event buffer |
| 15061 | * @param cap: pointer to hold target capability information extracted from even |
| 15062 | * |
| 15063 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15064 | */ |
| 15065 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15066 | void *evt_buf, struct wlan_psoc_target_capability_info *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15067 | { |
| 15068 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15069 | wmi_service_ready_event_fixed_param *ev; |
| 15070 | |
| 15071 | |
| 15072 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 15073 | |
| 15074 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 15075 | if (!ev) { |
| 15076 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 15077 | return QDF_STATUS_E_FAILURE; |
| 15078 | } |
| 15079 | |
| 15080 | cap->phy_capability = ev->phy_capability; |
| 15081 | cap->max_frag_entry = ev->max_frag_entry; |
| 15082 | cap->num_rf_chains = ev->num_rf_chains; |
| 15083 | cap->ht_cap_info = ev->ht_cap_info; |
| 15084 | cap->vht_cap_info = ev->vht_cap_info; |
| 15085 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 15086 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 15087 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 15088 | cap->sys_cap_info = ev->sys_cap_info; |
| 15089 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 15090 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 15091 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 15092 | cap->max_supported_macs = ev->max_supported_macs; |
| 15093 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 15094 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 15095 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 15096 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 15097 | |
| 15098 | return QDF_STATUS_SUCCESS; |
| 15099 | } |
| 15100 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 15101 | /* convert_wireless_modes_tlv() - Convert REGDMN_MODE values sent by target |
| 15102 | * to host internal WMI_HOST_REGDMN_MODE values. |
| 15103 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 15104 | * host currently. Add this in the future if required. |
| 15105 | * 11AX (Phase II) : 11ax related values are not currently |
| 15106 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 15107 | * finalize the advertisement mechanism. |
| 15108 | * @target_wireless_mode: target wireless mode received in message |
| 15109 | * |
| 15110 | * Return: returns the host internal wireless mode. |
| 15111 | */ |
| 15112 | static inline uint32_t convert_wireless_modes_tlv(uint32_t target_wireless_mode) |
| 15113 | { |
| 15114 | |
| 15115 | uint32_t wireless_modes = 0; |
| 15116 | |
| 15117 | if (target_wireless_mode & REGDMN_MODE_11A) |
| 15118 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 15119 | |
| 15120 | if (target_wireless_mode & REGDMN_MODE_TURBO) |
| 15121 | wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 15122 | |
| 15123 | if (target_wireless_mode & REGDMN_MODE_11B) |
| 15124 | wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 15125 | |
| 15126 | if (target_wireless_mode & REGDMN_MODE_PUREG) |
| 15127 | wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 15128 | |
| 15129 | if (target_wireless_mode & REGDMN_MODE_11G) |
| 15130 | wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 15131 | |
| 15132 | if (target_wireless_mode & REGDMN_MODE_108G) |
| 15133 | wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 15134 | |
| 15135 | if (target_wireless_mode & REGDMN_MODE_108A) |
| 15136 | wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 15137 | |
| 15138 | if (target_wireless_mode & REGDMN_MODE_XR) |
| 15139 | wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 15140 | |
| 15141 | if (target_wireless_mode & REGDMN_MODE_11A_HALF_RATE) |
| 15142 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 15143 | |
| 15144 | if (target_wireless_mode & REGDMN_MODE_11A_QUARTER_RATE) |
| 15145 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 15146 | |
| 15147 | if (target_wireless_mode & REGDMN_MODE_11NG_HT20) |
| 15148 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 15149 | |
| 15150 | if (target_wireless_mode & REGDMN_MODE_11NA_HT20) |
| 15151 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 15152 | |
| 15153 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40PLUS) |
| 15154 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 15155 | |
| 15156 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40MINUS) |
| 15157 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 15158 | |
| 15159 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40PLUS) |
| 15160 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 15161 | |
| 15162 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40MINUS) |
| 15163 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 15164 | |
| 15165 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT20) |
| 15166 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 15167 | |
| 15168 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40PLUS) |
| 15169 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 15170 | |
| 15171 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40MINUS) |
| 15172 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 15173 | |
| 15174 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80) |
| 15175 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 15176 | |
| 15177 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT160) |
| 15178 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 15179 | |
| 15180 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80_80) |
| 15181 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 15182 | |
| 15183 | return wireless_modes; |
| 15184 | } |
| 15185 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15186 | /** |
| 15187 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 15188 | * @wmi_handle: wmi handle |
| 15189 | * @param evt_buf: Pointer to event buffer |
| 15190 | * @param cap: pointer to hold HAL reg capabilities |
| 15191 | * |
| 15192 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15193 | */ |
| 15194 | 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] | 15195 | void *evt_buf, struct wlan_psoc_hal_reg_capability *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15196 | { |
| 15197 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15198 | |
| 15199 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 15200 | |
| 15201 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 15202 | sizeof(uint32_t)), |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 15203 | sizeof(struct wlan_psoc_hal_reg_capability)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15204 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 15205 | cap->wireless_modes = convert_wireless_modes_tlv( |
| 15206 | param_buf->hal_reg_capabilities->wireless_modes); |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 15207 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15208 | return QDF_STATUS_SUCCESS; |
| 15209 | } |
| 15210 | |
| 15211 | /** |
| 15212 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 15213 | * @wmi_handle: wmi handle |
| 15214 | * @param evt_buf: pointer to event buffer |
| 15215 | * @param num_entries: pointer to hold number of entries requested |
| 15216 | * |
| 15217 | * Return: Number of entries requested |
| 15218 | */ |
| 15219 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 15220 | void *evt_buf, uint8_t *num_entries) |
| 15221 | { |
| 15222 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15223 | wmi_service_ready_event_fixed_param *ev; |
| 15224 | |
| 15225 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 15226 | |
| 15227 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 15228 | if (!ev) { |
| 15229 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 15230 | return NULL; |
| 15231 | } |
| 15232 | |
| 15233 | *num_entries = ev->num_mem_reqs; |
| 15234 | |
| 15235 | return (host_mem_req *)param_buf->mem_reqs; |
| 15236 | } |
| 15237 | |
| 15238 | /** |
| 15239 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 15240 | * ready function |
| 15241 | * @wmi_handle: wmi handle |
| 15242 | * @param evt_buf: pointer to event buffer |
| 15243 | * |
| 15244 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15245 | */ |
| 15246 | static QDF_STATUS |
| 15247 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 15248 | { |
| 15249 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 15250 | wmi_service_ready_event_fixed_param *ev; |
| 15251 | |
| 15252 | |
| 15253 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 15254 | |
| 15255 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 15256 | if (!ev) { |
| 15257 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 15258 | return QDF_STATUS_E_FAILURE; |
| 15259 | } |
| 15260 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 15261 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15262 | /*Save fw version from service ready message */ |
| 15263 | /*This will be used while sending INIT message */ |
| 15264 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 15265 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 15266 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15267 | return QDF_STATUS_SUCCESS; |
| 15268 | } |
| 15269 | |
| 15270 | /** |
| 15271 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 15272 | * @wmi_handle: wmi handle |
| 15273 | * @param evt_buf: Pointer to event buffer |
| 15274 | * |
| 15275 | * Return: ready status |
| 15276 | */ |
| 15277 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 15278 | void *evt_buf) |
| 15279 | { |
| 15280 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 15281 | wmi_ready_event_fixed_param *ev = NULL; |
| 15282 | |
| 15283 | |
| 15284 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 15285 | ev = param_buf->fixed_param; |
| 15286 | |
| 15287 | qdf_print("%s:%d\n", __func__, ev->status); |
| 15288 | |
| 15289 | return ev->status; |
| 15290 | } |
| 15291 | |
| 15292 | /** |
| 15293 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 15294 | * @wmi_handle: wmi handle |
| 15295 | * @param evt_buf: pointer to event buffer |
| 15296 | * @param macaddr: Pointer to hold MAC address |
| 15297 | * |
| 15298 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15299 | */ |
| 15300 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 15301 | void *evt_buf, uint8_t *macaddr) |
| 15302 | { |
| 15303 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 15304 | wmi_ready_event_fixed_param *ev = NULL; |
| 15305 | |
| 15306 | |
| 15307 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 15308 | ev = param_buf->fixed_param; |
| 15309 | |
| 15310 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 15311 | |
| 15312 | return QDF_STATUS_SUCCESS; |
| 15313 | } |
| 15314 | |
| 15315 | /** |
| 15316 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 15317 | * @wmi_handle: wmi handle |
| 15318 | * @param evt_buf: pointer to event buffer |
| 15319 | * |
| 15320 | * Return: length |
| 15321 | */ |
| 15322 | 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] | 15323 | void *evt_buf, uint32_t *len) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15324 | { |
| 15325 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 15326 | |
| 15327 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 15328 | |
| 15329 | *len = param_buf->num_bufp; |
| 15330 | |
| 15331 | return param_buf->bufp; |
| 15332 | } |
| 15333 | |
| 15334 | /** |
| 15335 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 15336 | * @wmi_handle: wmi handle |
| 15337 | * @param evt_buf: pointer to event buffer |
| 15338 | * @param vdev_rsp: Pointer to hold vdev response |
| 15339 | * |
| 15340 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15341 | */ |
| 15342 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 15343 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 15344 | { |
| 15345 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 15346 | wmi_vdev_start_response_event_fixed_param *ev; |
| 15347 | |
| 15348 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 15349 | if (!param_buf) { |
| 15350 | qdf_print("Invalid start response event buffer\n"); |
| 15351 | return QDF_STATUS_E_INVAL; |
| 15352 | } |
| 15353 | |
| 15354 | ev = param_buf->fixed_param; |
| 15355 | if (!ev) { |
| 15356 | qdf_print("Invalid start response event buffer\n"); |
| 15357 | return QDF_STATUS_E_INVAL; |
| 15358 | } |
| 15359 | |
| 15360 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 15361 | |
| 15362 | vdev_rsp->vdev_id = ev->vdev_id; |
| 15363 | vdev_rsp->requestor_id = ev->requestor_id; |
| 15364 | vdev_rsp->resp_type = ev->resp_type; |
| 15365 | vdev_rsp->status = ev->status; |
| 15366 | vdev_rsp->chain_mask = ev->chain_mask; |
| 15367 | vdev_rsp->smps_mode = ev->smps_mode; |
| 15368 | vdev_rsp->mac_id = ev->mac_id; |
| 15369 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 15370 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 15371 | |
| 15372 | return QDF_STATUS_SUCCESS; |
| 15373 | } |
| 15374 | |
| 15375 | /** |
| 15376 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset update param |
| 15377 | * @wmi_handle: wmi handle |
| 15378 | * @param evt_buf: pointer to event buffer |
| 15379 | * @param vdev_map: Pointer to hold vdev map |
| 15380 | * @param tbttoffset_list: Pointer to tbtt offset list |
| 15381 | * |
| 15382 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15383 | */ |
| 15384 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 15385 | void *evt_buf, uint32_t *vdev_map, uint32_t **tbttoffset_list) |
| 15386 | { |
| 15387 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 15388 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 15389 | |
| 15390 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 15391 | if (!param_buf) { |
| 15392 | qdf_print("Invalid tbtt update event buffer\n"); |
| 15393 | return QDF_STATUS_E_INVAL; |
| 15394 | } |
| 15395 | tbtt_offset_event = param_buf->fixed_param; |
| 15396 | |
| 15397 | *vdev_map = tbtt_offset_event->vdev_map; |
| 15398 | *tbttoffset_list = param_buf->tbttoffset_list; |
| 15399 | |
| 15400 | return QDF_STATUS_SUCCESS; |
| 15401 | } |
| 15402 | |
| 15403 | /** |
| 15404 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 15405 | * @wmi_handle: wmi handle |
| 15406 | * @param evt_buf: pointer to event buffer |
| 15407 | * @param hdr: Pointer to hold header |
| 15408 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 15409 | * |
| 15410 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15411 | */ |
| 15412 | 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] | 15413 | void *evt_buf, struct mgmt_rx_event_params *hdr, |
| 15414 | uint8_t **bufp) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15415 | { |
| 15416 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 15417 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 15418 | |
| 15419 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 15420 | if (!param_tlvs) { |
| 15421 | WMI_LOGE("Get NULL point message from FW"); |
| 15422 | return QDF_STATUS_E_INVAL; |
| 15423 | } |
| 15424 | |
| 15425 | ev_hdr = param_tlvs->hdr; |
| 15426 | if (!hdr) { |
| 15427 | WMI_LOGE("Rx event is NULL"); |
| 15428 | return QDF_STATUS_E_INVAL; |
| 15429 | } |
| 15430 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15431 | hdr->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 15432 | ev_hdr->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15433 | |
| 15434 | hdr->channel = ev_hdr->channel; |
| 15435 | hdr->snr = ev_hdr->snr; |
| 15436 | hdr->rate = ev_hdr->rate; |
| 15437 | hdr->phy_mode = ev_hdr->phy_mode; |
| 15438 | hdr->buf_len = ev_hdr->buf_len; |
| 15439 | hdr->status = ev_hdr->status; |
| 15440 | hdr->flags = ev_hdr->flags; |
| 15441 | hdr->rssi = ev_hdr->rssi; |
| 15442 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 15443 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 15444 | |
| 15445 | *bufp = param_tlvs->bufp; |
| 15446 | |
| 15447 | return QDF_STATUS_SUCCESS; |
| 15448 | } |
| 15449 | |
| 15450 | /** |
| 15451 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 15452 | * @wmi_handle: wmi handle |
| 15453 | * @param evt_buf: pointer to event buffer |
| 15454 | * @param vdev_id: Pointer to hold vdev identifier |
| 15455 | * |
| 15456 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15457 | */ |
| 15458 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 15459 | void *evt_buf, uint32_t *vdev_id) |
| 15460 | { |
| 15461 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 15462 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 15463 | |
| 15464 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 15465 | if (!param_buf) { |
| 15466 | WMI_LOGE("Invalid event buffer"); |
| 15467 | return QDF_STATUS_E_INVAL; |
| 15468 | } |
| 15469 | resp_event = param_buf->fixed_param; |
| 15470 | *vdev_id = resp_event->vdev_id; |
| 15471 | |
| 15472 | return QDF_STATUS_SUCCESS; |
| 15473 | } |
| 15474 | |
| 15475 | /** |
| 15476 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 15477 | * @wmi_handle: wmi handle |
| 15478 | * @param evt_buf: pointer to event buffer |
| 15479 | * @param param: Pointer to hold roam param |
| 15480 | * |
| 15481 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15482 | */ |
| 15483 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 15484 | void *evt_buf, wmi_host_roam_event *param) |
| 15485 | { |
| 15486 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 15487 | wmi_roam_event_fixed_param *evt; |
| 15488 | |
| 15489 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 15490 | if (!param_buf) { |
| 15491 | WMI_LOGE("Invalid roam event buffer"); |
| 15492 | return QDF_STATUS_E_INVAL; |
| 15493 | } |
| 15494 | |
| 15495 | evt = param_buf->fixed_param; |
| 15496 | qdf_mem_zero(param, sizeof(*param)); |
| 15497 | |
| 15498 | param->vdev_id = evt->vdev_id; |
| 15499 | param->reason = evt->reason; |
| 15500 | param->rssi = evt->rssi; |
| 15501 | |
| 15502 | return QDF_STATUS_SUCCESS; |
| 15503 | } |
| 15504 | |
| 15505 | /** |
| 15506 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 15507 | * @wmi_handle: wmi handle |
| 15508 | * @param evt_buf: pointer to event buffer |
| 15509 | * @param param: Pointer to hold vdev scan param |
| 15510 | * |
| 15511 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15512 | */ |
| 15513 | 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] | 15514 | void *evt_buf, struct scan_event *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15515 | { |
| 15516 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 15517 | wmi_scan_event_fixed_param *evt = NULL; |
| 15518 | |
| 15519 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 15520 | evt = param_buf->fixed_param; |
| 15521 | |
| 15522 | qdf_mem_zero(param, sizeof(*param)); |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 15523 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15524 | switch (evt->event) { |
| 15525 | case WMI_SCAN_EVENT_STARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15526 | param->type = SCAN_EVENT_TYPE_STARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15527 | break; |
| 15528 | case WMI_SCAN_EVENT_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15529 | param->type = SCAN_EVENT_TYPE_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15530 | break; |
| 15531 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15532 | param->type = SCAN_EVENT_TYPE_BSS_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15533 | break; |
| 15534 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15535 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15536 | break; |
| 15537 | case WMI_SCAN_EVENT_DEQUEUED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15538 | param->type = SCAN_EVENT_TYPE_DEQUEUED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15539 | break; |
| 15540 | case WMI_SCAN_EVENT_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15541 | param->type = SCAN_EVENT_TYPE_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15542 | break; |
| 15543 | case WMI_SCAN_EVENT_START_FAILED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15544 | param->type = SCAN_EVENT_TYPE_START_FAILED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15545 | break; |
| 15546 | case WMI_SCAN_EVENT_RESTARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15547 | param->type = SCAN_EVENT_TYPE_RESTARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15548 | break; |
| 15549 | case WMI_HOST_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15550 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15551 | break; |
| 15552 | case WMI_SCAN_EVENT_MAX: |
| 15553 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15554 | param->type = SCAN_EVENT_TYPE_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15555 | break; |
| 15556 | }; |
| 15557 | |
| 15558 | switch (evt->reason) { |
| 15559 | case WMI_SCAN_REASON_NONE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15560 | param->reason = SCAN_REASON_NONE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15561 | break; |
| 15562 | case WMI_SCAN_REASON_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15563 | param->reason = SCAN_REASON_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15564 | break; |
| 15565 | case WMI_SCAN_REASON_CANCELLED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15566 | param->reason = SCAN_REASON_CANCELLED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15567 | break; |
| 15568 | case WMI_SCAN_REASON_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15569 | param->reason = SCAN_REASON_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15570 | break; |
| 15571 | case WMI_SCAN_REASON_TIMEDOUT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15572 | param->reason = SCAN_REASON_TIMEDOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15573 | break; |
| 15574 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15575 | param->reason = SCAN_REASON_INTERNAL_FAILURE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15576 | break; |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 15577 | case WMI_SCAN_REASON_SUSPENDED: |
| 15578 | param->reason = SCAN_REASON_SUSPENDED; |
| 15579 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15580 | case WMI_SCAN_REASON_MAX: |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 15581 | param->reason = SCAN_REASON_MAX; |
| 15582 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15583 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15584 | param->reason = SCAN_REASON_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15585 | break; |
| 15586 | }; |
| 15587 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 15588 | param->chan_freq = evt->channel_freq; |
| 15589 | param->requester = evt->requestor; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15590 | param->scan_id = evt->scan_id; |
| 15591 | param->vdev_id = evt->vdev_id; |
| 15592 | |
| 15593 | return QDF_STATUS_SUCCESS; |
| 15594 | } |
| 15595 | |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 15596 | #ifdef CONVERGED_TDLS_ENABLE |
| 15597 | /** |
| 15598 | * extract_vdev_tdls_ev_param_tlv() - extract vdev tdls param from event |
| 15599 | * @wmi_handle: wmi handle |
| 15600 | * @param evt_buf: pointer to event buffer |
| 15601 | * @param param: Pointer to hold vdev tdls param |
| 15602 | * |
| 15603 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15604 | */ |
| 15605 | static QDF_STATUS extract_vdev_tdls_ev_param_tlv(wmi_unified_t wmi_handle, |
| 15606 | void *evt_buf, struct tdls_event_info *param) |
| 15607 | { |
| 15608 | WMI_TDLS_PEER_EVENTID_param_tlvs *param_buf; |
| 15609 | wmi_tdls_peer_event_fixed_param *evt; |
| 15610 | |
| 15611 | param_buf = (WMI_TDLS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 15612 | if (!param_buf) { |
| 15613 | WMI_LOGE("%s: NULL param_buf", __func__); |
| 15614 | return QDF_STATUS_E_NULL_VALUE; |
| 15615 | } |
| 15616 | |
| 15617 | evt = param_buf->fixed_param; |
| 15618 | |
| 15619 | qdf_mem_zero(param, sizeof(*param)); |
| 15620 | |
| 15621 | param->vdev_id = evt->vdev_id; |
| 15622 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&evt->peer_macaddr, |
| 15623 | param->peermac.bytes); |
| 15624 | switch (evt->peer_status) { |
| 15625 | case WMI_TDLS_SHOULD_DISCOVER: |
| 15626 | param->message_type = TDLS_SHOULD_DISCOVER; |
| 15627 | break; |
| 15628 | case WMI_TDLS_SHOULD_TEARDOWN: |
| 15629 | param->message_type = TDLS_SHOULD_TEARDOWN; |
| 15630 | break; |
| 15631 | case WMI_TDLS_PEER_DISCONNECTED: |
| 15632 | param->message_type = TDLS_PEER_DISCONNECTED; |
| 15633 | break; |
| 15634 | case WMI_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
| 15635 | param->message_type = TDLS_CONNECTION_TRACKER_NOTIFY; |
| 15636 | break; |
| 15637 | default: |
| 15638 | WMI_LOGE("%s: Discarding unknown tdls event %d from target", |
| 15639 | __func__, evt->peer_status); |
| 15640 | return QDF_STATUS_E_INVAL; |
| 15641 | }; |
| 15642 | |
| 15643 | switch (evt->peer_reason) { |
| 15644 | case WMI_TDLS_TEARDOWN_REASON_TX: |
| 15645 | param->peer_reason = TDLS_TEARDOWN_TX; |
| 15646 | break; |
| 15647 | case WMI_TDLS_TEARDOWN_REASON_RSSI: |
| 15648 | param->peer_reason = TDLS_TEARDOWN_RSSI; |
| 15649 | break; |
| 15650 | case WMI_TDLS_TEARDOWN_REASON_SCAN: |
| 15651 | param->peer_reason = TDLS_TEARDOWN_SCAN; |
| 15652 | break; |
| 15653 | case WMI_TDLS_DISCONNECTED_REASON_PEER_DELETE: |
| 15654 | param->peer_reason = TDLS_DISCONNECTED_PEER_DELETE; |
| 15655 | break; |
| 15656 | case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: |
| 15657 | param->peer_reason = TDLS_TEARDOWN_PTR_TIMEOUT; |
| 15658 | break; |
| 15659 | case WMI_TDLS_TEARDOWN_REASON_BAD_PTR: |
| 15660 | param->peer_reason = TDLS_TEARDOWN_BAD_PTR; |
| 15661 | break; |
| 15662 | case WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE: |
| 15663 | param->peer_reason = TDLS_TEARDOWN_NO_RSP; |
| 15664 | break; |
| 15665 | case WMI_TDLS_ENTER_BUF_STA: |
| 15666 | param->peer_reason = TDLS_PEER_ENTER_BUF_STA; |
| 15667 | break; |
| 15668 | case WMI_TDLS_EXIT_BUF_STA: |
| 15669 | param->peer_reason = TDLS_PEER_EXIT_BUF_STA; |
| 15670 | break; |
| 15671 | case WMI_TDLS_ENTER_BT_BUSY_MODE: |
| 15672 | param->peer_reason = TDLS_ENTER_BT_BUSY; |
| 15673 | break; |
| 15674 | case WMI_TDLS_EXIT_BT_BUSY_MODE: |
| 15675 | param->peer_reason = TDLS_EXIT_BT_BUSY; |
| 15676 | break; |
| 15677 | case WMI_TDLS_SCAN_STARTED_EVENT: |
| 15678 | param->peer_reason = TDLS_SCAN_STARTED; |
| 15679 | break; |
| 15680 | case WMI_TDLS_SCAN_COMPLETED_EVENT: |
| 15681 | param->peer_reason = TDLS_SCAN_COMPLETED; |
| 15682 | break; |
| 15683 | |
| 15684 | default: |
| 15685 | WMI_LOGE("%s: unknown reason %d in tdls event %d from target", |
| 15686 | __func__, evt->peer_reason, evt->peer_status); |
| 15687 | return QDF_STATUS_E_INVAL; |
| 15688 | }; |
| 15689 | |
| 15690 | WMI_LOGD("%s: tdls event, peer: %pM, type: 0x%x, reason: %d, vdev: %d", |
| 15691 | __func__, param->peermac.bytes, param->message_type, |
| 15692 | param->peer_reason, param->vdev_id); |
| 15693 | |
| 15694 | return QDF_STATUS_SUCCESS; |
| 15695 | } |
| 15696 | #endif |
| 15697 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15698 | /** |
| 15699 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 15700 | * @wmi_handle: wmi handle |
| 15701 | * @param evt_buf: pointer to event buffer |
| 15702 | * @param param: Pointer to hold MGMT TX completion params |
| 15703 | * |
| 15704 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15705 | */ |
| 15706 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 15707 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 15708 | { |
| 15709 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 15710 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 15711 | |
| 15712 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 15713 | evt_buf; |
| 15714 | if (!param_buf) { |
| 15715 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 15716 | return QDF_STATUS_E_INVAL; |
| 15717 | } |
| 15718 | cmpl_params = param_buf->fixed_param; |
| 15719 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15720 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 15721 | cmpl_params->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15722 | param->desc_id = cmpl_params->desc_id; |
| 15723 | param->status = cmpl_params->status; |
| 15724 | |
| 15725 | return QDF_STATUS_SUCCESS; |
| 15726 | } |
| 15727 | |
| 15728 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 15729 | * extract_offchan_data_tx_compl_param_tlv() - |
| 15730 | * extract Offchan data tx completion event params |
| 15731 | * @wmi_handle: wmi handle |
| 15732 | * @param evt_buf: pointer to event buffer |
| 15733 | * @param param: Pointer to hold offchan data TX completion params |
| 15734 | * |
| 15735 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15736 | */ |
| 15737 | static QDF_STATUS extract_offchan_data_tx_compl_param_tlv( |
| 15738 | wmi_unified_t wmi_handle, void *evt_buf, |
| 15739 | struct wmi_host_offchan_data_tx_compl_event *param) |
| 15740 | { |
| 15741 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 15742 | wmi_offchan_data_tx_compl_event_fixed_param *cmpl_params; |
| 15743 | |
| 15744 | param_buf = (WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *) |
| 15745 | evt_buf; |
| 15746 | if (!param_buf) { |
| 15747 | WMI_LOGE("%s: Invalid offchan data Tx compl event", __func__); |
| 15748 | return QDF_STATUS_E_INVAL; |
| 15749 | } |
| 15750 | cmpl_params = param_buf->fixed_param; |
| 15751 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15752 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 15753 | cmpl_params->pdev_id); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 15754 | param->desc_id = cmpl_params->desc_id; |
| 15755 | param->status = cmpl_params->status; |
| 15756 | |
| 15757 | return QDF_STATUS_SUCCESS; |
| 15758 | } |
| 15759 | |
| 15760 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15761 | * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count |
| 15762 | * status tlv |
| 15763 | * @wmi_handle: wmi handle |
| 15764 | * @param evt_buf: pointer to event buffer |
| 15765 | * @param param: Pointer to hold csa switch count status event param |
| 15766 | * |
| 15767 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15768 | */ |
| 15769 | static QDF_STATUS extract_pdev_csa_switch_count_status_tlv( |
| 15770 | wmi_unified_t wmi_handle, |
| 15771 | void *evt_buf, |
| 15772 | struct pdev_csa_switch_count_status *param) |
| 15773 | { |
| 15774 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *param_buf; |
| 15775 | wmi_pdev_csa_switch_count_status_event_fixed_param *csa_status; |
| 15776 | |
| 15777 | param_buf = (WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *) |
| 15778 | evt_buf; |
| 15779 | if (!param_buf) { |
| 15780 | WMI_LOGE("%s: Invalid CSA status event\n", __func__); |
| 15781 | return QDF_STATUS_E_INVAL; |
| 15782 | } |
| 15783 | |
| 15784 | csa_status = param_buf->fixed_param; |
| 15785 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15786 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 15787 | csa_status->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15788 | param->current_switch_count = csa_status->current_switch_count; |
| 15789 | param->num_vdevs = csa_status->num_vdevs; |
| 15790 | param->vdev_ids = param_buf->vdev_ids; |
| 15791 | |
| 15792 | return QDF_STATUS_SUCCESS; |
| 15793 | } |
| 15794 | |
| 15795 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15796 | * extract_swba_vdev_map_tlv() - extract swba vdev map from event |
| 15797 | * @wmi_handle: wmi handle |
| 15798 | * @param evt_buf: pointer to event buffer |
| 15799 | * @param vdev_map: Pointer to hold vdev map |
| 15800 | * |
| 15801 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15802 | */ |
| 15803 | static QDF_STATUS extract_swba_vdev_map_tlv(wmi_unified_t wmi_handle, |
| 15804 | void *evt_buf, uint32_t *vdev_map) |
| 15805 | { |
| 15806 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 15807 | wmi_host_swba_event_fixed_param *swba_event; |
| 15808 | |
| 15809 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 15810 | if (!param_buf) { |
| 15811 | WMI_LOGE("Invalid swba event buffer"); |
| 15812 | return QDF_STATUS_E_INVAL; |
| 15813 | } |
| 15814 | swba_event = param_buf->fixed_param; |
| 15815 | *vdev_map = swba_event->vdev_map; |
| 15816 | |
| 15817 | return QDF_STATUS_SUCCESS; |
| 15818 | } |
| 15819 | |
| 15820 | /** |
| 15821 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 15822 | * @wmi_handle: wmi handle |
| 15823 | * @param evt_buf: pointer to event buffer |
| 15824 | * @param idx: Index to bcn info |
| 15825 | * @param tim_info: Pointer to hold tim info |
| 15826 | * |
| 15827 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15828 | */ |
| 15829 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 15830 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 15831 | { |
| 15832 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 15833 | wmi_tim_info *tim_info_ev; |
| 15834 | |
| 15835 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 15836 | if (!param_buf) { |
| 15837 | WMI_LOGE("Invalid swba event buffer"); |
| 15838 | return QDF_STATUS_E_INVAL; |
| 15839 | } |
| 15840 | |
| 15841 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 15842 | |
| 15843 | tim_info->tim_len = tim_info_ev->tim_len; |
| 15844 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 15845 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 15846 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 15847 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 15848 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
| 15849 | |
| 15850 | return QDF_STATUS_SUCCESS; |
| 15851 | } |
| 15852 | |
| 15853 | /** |
| 15854 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 15855 | * @wmi_handle: wmi handle |
| 15856 | * @param evt_buf: pointer to event buffer |
| 15857 | * @param idx: Index to bcn info |
| 15858 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 15859 | * |
| 15860 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15861 | */ |
| 15862 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 15863 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 15864 | { |
| 15865 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 15866 | wmi_p2p_noa_info *p2p_noa_info; |
| 15867 | uint8_t i = 0; |
| 15868 | |
| 15869 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 15870 | if (!param_buf) { |
| 15871 | WMI_LOGE("Invalid swba event buffer"); |
| 15872 | return QDF_STATUS_E_INVAL; |
| 15873 | } |
| 15874 | |
| 15875 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 15876 | |
| 15877 | p2p_desc->modified = false; |
| 15878 | p2p_desc->num_descriptors = 0; |
| 15879 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 15880 | p2p_desc->modified = true; |
| 15881 | p2p_desc->index = |
| 15882 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 15883 | p2p_desc->oppPS = |
| 15884 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 15885 | p2p_desc->ctwindow = |
| 15886 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 15887 | p2p_desc->num_descriptors = |
| 15888 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 15889 | (p2p_noa_info); |
| 15890 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 15891 | p2p_desc->noa_descriptors[i].type_count = |
| 15892 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 15893 | type_count; |
| 15894 | p2p_desc->noa_descriptors[i].duration = |
| 15895 | p2p_noa_info->noa_descriptors[i].duration; |
| 15896 | p2p_desc->noa_descriptors[i].interval = |
| 15897 | p2p_noa_info->noa_descriptors[i].interval; |
| 15898 | p2p_desc->noa_descriptors[i].start_time = |
| 15899 | p2p_noa_info->noa_descriptors[i].start_time; |
| 15900 | } |
| 15901 | } |
| 15902 | |
| 15903 | return QDF_STATUS_SUCCESS; |
| 15904 | } |
| 15905 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 15906 | #ifdef CONVERGED_P2P_ENABLE |
| 15907 | /** |
| 15908 | * extract_p2p_noa_ev_param_tlv() - extract p2p noa information from event |
| 15909 | * @wmi_handle: wmi handle |
| 15910 | * @param evt_buf: pointer to event buffer |
| 15911 | * @param param: Pointer to hold p2p noa info |
| 15912 | * |
| 15913 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15914 | */ |
| 15915 | static QDF_STATUS extract_p2p_noa_ev_param_tlv( |
| 15916 | wmi_unified_t wmi_handle, void *evt_buf, |
| 15917 | struct p2p_noa_info *param) |
| 15918 | { |
| 15919 | WMI_P2P_NOA_EVENTID_param_tlvs *param_tlvs; |
| 15920 | wmi_p2p_noa_event_fixed_param *fixed_param; |
| 15921 | uint8_t i; |
| 15922 | wmi_p2p_noa_info *wmi_noa_info; |
| 15923 | uint8_t *buf_ptr; |
| 15924 | uint32_t descriptors; |
| 15925 | |
| 15926 | param_tlvs = (WMI_P2P_NOA_EVENTID_param_tlvs *) evt_buf; |
| 15927 | if (!param_tlvs) { |
| 15928 | WMI_LOGE("%s: Invalid P2P NoA event buffer", __func__); |
| 15929 | return QDF_STATUS_E_INVAL; |
| 15930 | } |
| 15931 | |
| 15932 | if (!param) { |
| 15933 | WMI_LOGE("noa information param is null"); |
| 15934 | return QDF_STATUS_E_INVAL; |
| 15935 | } |
| 15936 | |
| 15937 | fixed_param = param_tlvs->fixed_param; |
| 15938 | buf_ptr = (uint8_t *) fixed_param; |
| 15939 | buf_ptr += sizeof(wmi_p2p_noa_event_fixed_param); |
| 15940 | wmi_noa_info = (wmi_p2p_noa_info *) (buf_ptr); |
| 15941 | |
| 15942 | if (!WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(wmi_noa_info)) { |
| 15943 | WMI_LOGE("%s: noa attr is not modified", __func__); |
| 15944 | return QDF_STATUS_E_INVAL; |
| 15945 | } |
| 15946 | |
| 15947 | param->vdev_id = fixed_param->vdev_id; |
| 15948 | param->index = |
| 15949 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(wmi_noa_info); |
| 15950 | param->opps_ps = |
| 15951 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(wmi_noa_info); |
| 15952 | param->ct_window = |
| 15953 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(wmi_noa_info); |
| 15954 | descriptors = WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET(wmi_noa_info); |
| 15955 | param->num_desc = (uint8_t) descriptors; |
| 15956 | |
| 15957 | WMI_LOGD("%s:index %u, opps_ps %u, ct_window %u, num_descriptors = %u", __func__, |
| 15958 | param->index, param->opps_ps, param->ct_window, |
| 15959 | param->num_desc); |
| 15960 | for (i = 0; i < param->num_desc; i++) { |
| 15961 | param->noa_desc[i].type_count = |
| 15962 | (uint8_t) wmi_noa_info->noa_descriptors[i]. |
| 15963 | type_count; |
| 15964 | param->noa_desc[i].duration = |
| 15965 | wmi_noa_info->noa_descriptors[i].duration; |
| 15966 | param->noa_desc[i].interval = |
| 15967 | wmi_noa_info->noa_descriptors[i].interval; |
| 15968 | param->noa_desc[i].start_time = |
| 15969 | wmi_noa_info->noa_descriptors[i].start_time; |
| 15970 | WMI_LOGD("%s:NoA descriptor[%d] type_count %u, duration %u, interval %u, start_time = %u", |
| 15971 | __func__, i, param->noa_desc[i].type_count, |
| 15972 | param->noa_desc[i].duration, |
| 15973 | param->noa_desc[i].interval, |
| 15974 | param->noa_desc[i].start_time); |
| 15975 | } |
| 15976 | |
| 15977 | return QDF_STATUS_SUCCESS; |
| 15978 | } |
| 15979 | |
| 15980 | /** |
| 15981 | * extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop |
| 15982 | * information from event |
| 15983 | * @wmi_handle: wmi handle |
| 15984 | * @param evt_buf: pointer to event buffer |
| 15985 | * @param param: Pointer to hold p2p lo stop event information |
| 15986 | * |
| 15987 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15988 | */ |
| 15989 | static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv( |
| 15990 | wmi_unified_t wmi_handle, void *evt_buf, |
| 15991 | struct p2p_lo_event *param) |
| 15992 | { |
| 15993 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *param_tlvs; |
| 15994 | wmi_p2p_lo_stopped_event_fixed_param *lo_param; |
| 15995 | |
| 15996 | param_tlvs = (WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *) |
| 15997 | evt_buf; |
| 15998 | if (!param_tlvs) { |
| 15999 | WMI_LOGE("%s: Invalid P2P lo stop event buffer", __func__); |
| 16000 | return QDF_STATUS_E_INVAL; |
| 16001 | } |
| 16002 | |
| 16003 | if (!param) { |
| 16004 | WMI_LOGE("lo stop event param is null"); |
| 16005 | return QDF_STATUS_E_INVAL; |
| 16006 | } |
| 16007 | |
| 16008 | lo_param = param_tlvs->fixed_param; |
| 16009 | param->vdev_id = lo_param->vdev_id; |
| 16010 | param->reason_code = lo_param->reason; |
| 16011 | WMI_LOGD("%s: vdev_id:%d, reason:%d", __func__, |
| 16012 | param->vdev_id, param->reason_code); |
| 16013 | |
| 16014 | return QDF_STATUS_SUCCESS; |
| 16015 | } |
| 16016 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 16017 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16018 | /** |
| 16019 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 16020 | * @wmi_handle: wmi handle |
| 16021 | * @param evt_buf: pointer to event buffer |
| 16022 | * @param ev: Pointer to hold peer param |
| 16023 | * |
| 16024 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16025 | */ |
| 16026 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 16027 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 16028 | { |
| 16029 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 16030 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 16031 | |
| 16032 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 16033 | kickout_event = param_buf->fixed_param; |
| 16034 | |
| 16035 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 16036 | ev->peer_macaddr); |
| 16037 | |
| 16038 | ev->reason = kickout_event->reason; |
| 16039 | ev->rssi = kickout_event->rssi; |
| 16040 | |
| 16041 | return QDF_STATUS_SUCCESS; |
| 16042 | } |
| 16043 | |
| 16044 | /** |
| 16045 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 16046 | * @wmi_handle: wmi handle |
| 16047 | * @param evt_buf: pointer to event buffer |
| 16048 | * @param stats_param: Pointer to hold stats count |
| 16049 | * |
| 16050 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16051 | */ |
| 16052 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 16053 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 16054 | { |
| 16055 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 16056 | wmi_stats_event_fixed_param *ev; |
| 16057 | |
| 16058 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 16059 | |
| 16060 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 16061 | if (!ev) { |
| 16062 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 16063 | return QDF_STATUS_E_FAILURE; |
| 16064 | } |
| 16065 | |
| 16066 | switch (ev->stats_id) { |
| 16067 | case WMI_REQUEST_PEER_STAT: |
| 16068 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 16069 | break; |
| 16070 | |
| 16071 | case WMI_REQUEST_AP_STAT: |
| 16072 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 16073 | break; |
| 16074 | |
| 16075 | case WMI_REQUEST_PDEV_STAT: |
| 16076 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 16077 | break; |
| 16078 | |
| 16079 | case WMI_REQUEST_VDEV_STAT: |
| 16080 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 16081 | break; |
| 16082 | |
| 16083 | case WMI_REQUEST_BCNFLT_STAT: |
| 16084 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 16085 | break; |
| 16086 | |
| 16087 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 16088 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 16089 | break; |
| 16090 | |
| 16091 | default: |
| 16092 | stats_param->stats_id = 0; |
| 16093 | break; |
| 16094 | |
| 16095 | } |
| 16096 | |
| 16097 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 16098 | stats_param->num_pdev_ext_stats = 0; |
| 16099 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 16100 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 16101 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 16102 | stats_param->num_chan_stats = ev->num_chan_stats; |
| 16103 | |
| 16104 | return QDF_STATUS_SUCCESS; |
| 16105 | } |
| 16106 | |
| 16107 | /** |
| 16108 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 16109 | * @wmi_handle: wmi handle |
| 16110 | * @param evt_buf: pointer to event buffer |
| 16111 | * @param index: Index into pdev stats |
| 16112 | * @param pdev_stats: Pointer to hold pdev stats |
| 16113 | * |
| 16114 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16115 | */ |
| 16116 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 16117 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 16118 | { |
| 16119 | return QDF_STATUS_SUCCESS; |
| 16120 | } |
| 16121 | |
| 16122 | /** |
| 16123 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 16124 | * @wmi_handle: wmi handle |
| 16125 | * @param evt_buf: pointer to event buffer |
| 16126 | * @param index: Index into extended pdev stats |
| 16127 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 16128 | * |
| 16129 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16130 | */ |
| 16131 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 16132 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 16133 | { |
| 16134 | return QDF_STATUS_SUCCESS; |
| 16135 | } |
| 16136 | |
| 16137 | /** |
| 16138 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 16139 | * @wmi_handle: wmi handle |
| 16140 | * @param evt_buf: pointer to event buffer |
| 16141 | * @param index: Index into vdev stats |
| 16142 | * @param vdev_stats: Pointer to hold vdev stats |
| 16143 | * |
| 16144 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16145 | */ |
| 16146 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 16147 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 16148 | { |
| 16149 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 16150 | wmi_stats_event_fixed_param *ev_param; |
| 16151 | uint8_t *data; |
| 16152 | |
| 16153 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 16154 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 16155 | data = (uint8_t *) param_buf->data; |
| 16156 | |
| 16157 | if (index < ev_param->num_vdev_stats) { |
| 16158 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 16159 | ((ev_param->num_pdev_stats) * |
| 16160 | sizeof(wmi_pdev_stats)) + |
| 16161 | (index * sizeof(wmi_vdev_stats))); |
| 16162 | |
| 16163 | vdev_stats->vdev_id = ev->vdev_id; |
| 16164 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 16165 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 16166 | |
| 16167 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 16168 | sizeof(ev->tx_frm_cnt)); |
| 16169 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 16170 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 16171 | ev->multiple_retry_cnt, |
| 16172 | sizeof(ev->multiple_retry_cnt)); |
| 16173 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 16174 | sizeof(ev->fail_cnt)); |
| 16175 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 16176 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 16177 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 16178 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 16179 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 16180 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 16181 | sizeof(ev->tx_rate_history)); |
| 16182 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 16183 | sizeof(ev->bcn_rssi_history)); |
| 16184 | |
| 16185 | } |
| 16186 | |
| 16187 | return QDF_STATUS_SUCCESS; |
| 16188 | } |
| 16189 | |
| 16190 | /** |
| 16191 | * extract_peer_stats_tlv() - extract peer stats from event |
| 16192 | * @wmi_handle: wmi handle |
| 16193 | * @param evt_buf: pointer to event buffer |
| 16194 | * @param index: Index into peer stats |
| 16195 | * @param peer_stats: Pointer to hold peer stats |
| 16196 | * |
| 16197 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16198 | */ |
| 16199 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 16200 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 16201 | { |
| 16202 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 16203 | wmi_stats_event_fixed_param *ev_param; |
| 16204 | uint8_t *data; |
| 16205 | |
| 16206 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 16207 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 16208 | data = (uint8_t *) param_buf->data; |
| 16209 | |
| 16210 | if (index < ev_param->num_peer_stats) { |
| 16211 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 16212 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 16213 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 16214 | (index * sizeof(wmi_peer_stats))); |
| 16215 | |
| 16216 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 16217 | |
| 16218 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 16219 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 16220 | |
| 16221 | peer_stats->peer_rssi = ev->peer_rssi; |
| 16222 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 16223 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 16224 | } |
| 16225 | |
| 16226 | return QDF_STATUS_SUCCESS; |
| 16227 | } |
| 16228 | |
| 16229 | /** |
| 16230 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 16231 | * @wmi_handle: wmi handle |
| 16232 | * @param evt_buf: pointer to event buffer |
| 16233 | * @param index: Index into bcn fault stats |
| 16234 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 16235 | * |
| 16236 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16237 | */ |
| 16238 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 16239 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 16240 | { |
| 16241 | return QDF_STATUS_SUCCESS; |
| 16242 | } |
| 16243 | |
| 16244 | /** |
| 16245 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 16246 | * @wmi_handle: wmi handle |
| 16247 | * @param evt_buf: pointer to event buffer |
| 16248 | * @param index: Index into extended peer stats |
| 16249 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 16250 | * |
| 16251 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16252 | */ |
| 16253 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 16254 | void *evt_buf, uint32_t index, |
| 16255 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 16256 | { |
| 16257 | return QDF_STATUS_SUCCESS; |
| 16258 | } |
| 16259 | |
| 16260 | /** |
| 16261 | * extract_chan_stats_tlv() - extract chan stats from event |
| 16262 | * @wmi_handle: wmi handle |
| 16263 | * @param evt_buf: pointer to event buffer |
| 16264 | * @param index: Index into chan stats |
| 16265 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 16266 | * |
| 16267 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16268 | */ |
| 16269 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 16270 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 16271 | { |
| 16272 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 16273 | wmi_stats_event_fixed_param *ev_param; |
| 16274 | uint8_t *data; |
| 16275 | |
| 16276 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 16277 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 16278 | data = (uint8_t *) param_buf->data; |
| 16279 | |
| 16280 | if (index < ev_param->num_chan_stats) { |
| 16281 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 16282 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 16283 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 16284 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 16285 | (index * sizeof(wmi_chan_stats))); |
| 16286 | |
| 16287 | |
| 16288 | /* Non-TLV doesnt have num_chan_stats */ |
| 16289 | chan_stats->chan_mhz = ev->chan_mhz; |
| 16290 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 16291 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 16292 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 16293 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 16294 | } |
| 16295 | |
| 16296 | return QDF_STATUS_SUCCESS; |
| 16297 | } |
| 16298 | |
| 16299 | /** |
| 16300 | * extract_profile_ctx_tlv() - extract profile context from event |
| 16301 | * @wmi_handle: wmi handle |
| 16302 | * @param evt_buf: pointer to event buffer |
| 16303 | * @idx: profile stats index to extract |
| 16304 | * @param profile_ctx: Pointer to hold profile context |
| 16305 | * |
| 16306 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16307 | */ |
| 16308 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 16309 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 16310 | { |
| 16311 | return QDF_STATUS_SUCCESS; |
| 16312 | } |
| 16313 | |
| 16314 | /** |
| 16315 | * extract_profile_data_tlv() - extract profile data from event |
| 16316 | * @wmi_handle: wmi handle |
| 16317 | * @param evt_buf: pointer to event buffer |
| 16318 | * @param profile_data: Pointer to hold profile data |
| 16319 | * |
| 16320 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16321 | */ |
| 16322 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 16323 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 16324 | { |
| 16325 | |
| 16326 | return QDF_STATUS_SUCCESS; |
| 16327 | } |
| 16328 | |
| 16329 | /** |
| 16330 | * extract_chan_info_event_tlv() - extract chan information from event |
| 16331 | * @wmi_handle: wmi handle |
| 16332 | * @param evt_buf: pointer to event buffer |
| 16333 | * @param chan_info: Pointer to hold chan information |
| 16334 | * |
| 16335 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16336 | */ |
| 16337 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 16338 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 16339 | { |
| 16340 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 16341 | wmi_chan_info_event_fixed_param *ev; |
| 16342 | |
| 16343 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 16344 | |
| 16345 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 16346 | if (!ev) { |
| 16347 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 16348 | return QDF_STATUS_E_FAILURE; |
| 16349 | } |
| 16350 | |
| 16351 | chan_info->err_code = ev->err_code; |
| 16352 | chan_info->freq = ev->freq; |
| 16353 | chan_info->cmd_flags = ev->cmd_flags; |
| 16354 | chan_info->noise_floor = ev->noise_floor; |
| 16355 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 16356 | chan_info->cycle_count = ev->cycle_count; |
Sathish Kumar | 87db1bd | 2017-05-08 12:35:55 +0530 | [diff] [blame] | 16357 | chan_info->pdev_id = wlan_get_pdev_id_from_vdev_id( |
| 16358 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 16359 | ev->vdev_id, WLAN_SCAN_ID); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16360 | |
| 16361 | return QDF_STATUS_SUCCESS; |
| 16362 | } |
| 16363 | |
| 16364 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 16365 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 16366 | * @wmi_handle: WMI handle |
| 16367 | * @param evt_buf: Pointer to event buffer |
| 16368 | * @param param: Pointer to hold data |
| 16369 | * |
| 16370 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 16371 | */ |
| 16372 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 16373 | uint8_t *evt_buf, |
| 16374 | struct wmi_host_pdev_utf_event *event) |
| 16375 | { |
| 16376 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
| 16377 | |
| 16378 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 16379 | event->data = param_buf->data; |
| 16380 | event->datalen = param_buf->num_data; |
Kiran Venkatappa | 15978c6 | 2017-02-28 12:42:36 +0530 | [diff] [blame] | 16381 | /* Set pdev_id=1 until FW adds support to include pdev_id */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16382 | event->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16383 | WMI_PDEV_ID_1ST); |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 16384 | |
| 16385 | return QDF_STATUS_SUCCESS; |
| 16386 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16387 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16388 | /** |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 16389 | * extract_chainmask_tables_tlv() - extract chain mask tables from event |
| 16390 | * @wmi_handle: wmi handle |
| 16391 | * @param evt_buf: pointer to event buffer |
| 16392 | * @param param: Pointer to hold evt buf |
| 16393 | * |
| 16394 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16395 | */ |
| 16396 | static QDF_STATUS extract_chainmask_tables_tlv(wmi_unified_t wmi_handle, |
| 16397 | uint8_t *event, struct wlan_psoc_host_chainmask_table *chainmask_table) |
| 16398 | { |
| 16399 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 16400 | WMI_MAC_PHY_CHAINMASK_CAPABILITY *chainmask_caps; |
| 16401 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 16402 | uint8_t i = 0, j = 0; |
| 16403 | |
| 16404 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 16405 | if (!param_buf) |
| 16406 | return QDF_STATUS_E_INVAL; |
| 16407 | |
| 16408 | hw_caps = param_buf->soc_hw_mode_caps; |
| 16409 | if (!hw_caps) |
| 16410 | return QDF_STATUS_E_INVAL; |
| 16411 | |
| 16412 | if (!hw_caps->num_chainmask_tables) |
| 16413 | return QDF_STATUS_E_INVAL; |
| 16414 | |
| 16415 | chainmask_caps = param_buf->mac_phy_chainmask_caps; |
| 16416 | |
| 16417 | if (chainmask_caps == NULL) |
| 16418 | return QDF_STATUS_E_INVAL; |
| 16419 | |
| 16420 | for (i = 0; i < hw_caps->num_chainmask_tables; i++) { |
| 16421 | |
| 16422 | qdf_print("Dumping chain mask combo data for table : %d\n", i); |
| 16423 | for (j = 0; j < chainmask_table[i].num_valid_chainmasks; j++) { |
| 16424 | |
| 16425 | chainmask_table[i].cap_list[j].chainmask = |
| 16426 | chainmask_caps->chainmask; |
| 16427 | |
| 16428 | chainmask_table[i].cap_list[j].supports_chan_width_20 = |
| 16429 | WMI_SUPPORT_CHAN_WIDTH_20_GET(chainmask_caps->supported_flags); |
| 16430 | |
| 16431 | chainmask_table[i].cap_list[j].supports_chan_width_40 = |
| 16432 | WMI_SUPPORT_CHAN_WIDTH_40_GET(chainmask_caps->supported_flags); |
| 16433 | |
| 16434 | chainmask_table[i].cap_list[j].supports_chan_width_80 = |
| 16435 | WMI_SUPPORT_CHAN_WIDTH_80_GET(chainmask_caps->supported_flags); |
| 16436 | |
| 16437 | chainmask_table[i].cap_list[j].supports_chan_width_160 = |
| 16438 | WMI_SUPPORT_CHAN_WIDTH_160_GET(chainmask_caps->supported_flags); |
| 16439 | |
| 16440 | chainmask_table[i].cap_list[j].supports_chan_width_80P80 = |
| 16441 | WMI_SUPPORT_CHAN_WIDTH_80P80_GET(chainmask_caps->supported_flags); |
| 16442 | |
| 16443 | chainmask_table[i].cap_list[j].chain_mask_2G = |
| 16444 | WMI_SUPPORT_CHAIN_MASK_2G_GET(chainmask_caps->supported_flags); |
| 16445 | |
| 16446 | chainmask_table[i].cap_list[j].chain_mask_5G = |
| 16447 | WMI_SUPPORT_CHAIN_MASK_5G_GET(chainmask_caps->supported_flags); |
| 16448 | |
| 16449 | chainmask_table[i].cap_list[j].chain_mask_tx = |
| 16450 | WMI_SUPPORT_CHAIN_MASK_TX_GET(chainmask_caps->supported_flags); |
| 16451 | |
| 16452 | chainmask_table[i].cap_list[j].chain_mask_rx = |
| 16453 | WMI_SUPPORT_CHAIN_MASK_RX_GET(chainmask_caps->supported_flags); |
| 16454 | |
| 16455 | chainmask_table[i].cap_list[j].supports_aDFS = |
| 16456 | WMI_SUPPORT_CHAIN_MASK_ADFS_GET(chainmask_caps->supported_flags); |
| 16457 | |
| 16458 | qdf_print("supported_flags: 0x%08x chainmasks: 0x%08x\n", |
| 16459 | chainmask_caps->supported_flags, |
| 16460 | chainmask_caps->chainmask |
| 16461 | ); |
| 16462 | chainmask_caps++; |
| 16463 | } |
| 16464 | } |
| 16465 | |
| 16466 | return QDF_STATUS_SUCCESS; |
| 16467 | } |
| 16468 | |
| 16469 | /** |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16470 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 16471 | * from event |
| 16472 | * @wmi_handle: wmi handle |
| 16473 | * @param evt_buf: pointer to event buffer |
| 16474 | * @param param: Pointer to hold evt buf |
| 16475 | * |
| 16476 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16477 | */ |
| 16478 | 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] | 16479 | uint8_t *event, struct wlan_psoc_host_service_ext_param *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16480 | { |
| 16481 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 16482 | wmi_service_ready_ext_event_fixed_param *ev; |
| 16483 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 16484 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 16485 | WMI_MAC_PHY_CHAINMASK_COMBO *chain_mask_combo; |
| 16486 | uint8_t i = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16487 | |
| 16488 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 16489 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16490 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16491 | |
| 16492 | ev = param_buf->fixed_param; |
| 16493 | if (!ev) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16494 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16495 | |
| 16496 | /* Move this to host based bitmap */ |
| 16497 | param->default_conc_scan_config_bits = |
| 16498 | ev->default_conc_scan_config_bits; |
| 16499 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 16500 | param->he_cap_info = ev->he_cap_info; |
| 16501 | param->mpdu_density = ev->mpdu_density; |
| 16502 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 16503 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 16504 | |
| 16505 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16506 | if (hw_caps) |
| 16507 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 16508 | else |
| 16509 | param->num_hw_modes = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16510 | |
| 16511 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16512 | if (reg_caps) |
| 16513 | param->num_phy = reg_caps->num_phy; |
| 16514 | else |
| 16515 | param->num_phy = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16516 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 16517 | if (hw_caps) { |
| 16518 | param->num_chainmask_tables = hw_caps->num_chainmask_tables; |
| 16519 | qdf_print("Num chain mask tables: %d\n", hw_caps->num_chainmask_tables); |
| 16520 | } else |
| 16521 | param->num_chainmask_tables = 0; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 16522 | |
| 16523 | chain_mask_combo = param_buf->mac_phy_chainmask_combo; |
| 16524 | |
| 16525 | if (chain_mask_combo == NULL) |
| 16526 | return QDF_STATUS_SUCCESS; |
| 16527 | |
| 16528 | qdf_print("Dumping chain mask combo data\n"); |
| 16529 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 16530 | for (i = 0; i < param->num_chainmask_tables; i++) { |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 16531 | |
| 16532 | qdf_print("table_id : %d Num valid chainmasks: %d\n", |
| 16533 | chain_mask_combo->chainmask_table_id, |
| 16534 | chain_mask_combo->num_valid_chainmask |
| 16535 | ); |
| 16536 | |
| 16537 | param->chainmask_table[i].table_id = |
| 16538 | chain_mask_combo->chainmask_table_id; |
| 16539 | param->chainmask_table[i].num_valid_chainmasks = |
| 16540 | chain_mask_combo->num_valid_chainmask; |
| 16541 | chain_mask_combo++; |
| 16542 | } |
| 16543 | qdf_print("chain mask combo end\n"); |
| 16544 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16545 | return QDF_STATUS_SUCCESS; |
| 16546 | } |
| 16547 | |
| 16548 | /** |
| 16549 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 16550 | * extract HW mode cap from service ready event |
| 16551 | * @wmi_handle: wmi handle |
| 16552 | * @param evt_buf: pointer to event buffer |
| 16553 | * @param param: Pointer to hold evt buf |
| 16554 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 16555 | * |
| 16556 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16557 | */ |
| 16558 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 16559 | wmi_unified_t wmi_handle, |
| 16560 | uint8_t *event, uint8_t hw_mode_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16561 | struct wlan_psoc_host_hw_mode_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16562 | { |
| 16563 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 16564 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 16565 | |
| 16566 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 16567 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16568 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16569 | |
| 16570 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16571 | if (!hw_caps) |
| 16572 | return QDF_STATUS_E_INVAL; |
| 16573 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16574 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16575 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16576 | |
| 16577 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 16578 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 16579 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16580 | param->hw_mode_config_type = |
| 16581 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 16582 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16583 | return QDF_STATUS_SUCCESS; |
| 16584 | } |
| 16585 | |
| 16586 | /** |
| 16587 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 16588 | * extract MAC phy cap from service ready event |
| 16589 | * @wmi_handle: wmi handle |
| 16590 | * @param evt_buf: pointer to event buffer |
| 16591 | * @param param: Pointer to hold evt buf |
| 16592 | * @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] | 16593 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16594 | * |
| 16595 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16596 | */ |
| 16597 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 16598 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16599 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16600 | struct wlan_psoc_host_mac_phy_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16601 | { |
| 16602 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16603 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16604 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 16605 | uint32_t phy_map; |
| 16606 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16607 | |
| 16608 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 16609 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16610 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16611 | |
| 16612 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16613 | if (!hw_caps) |
| 16614 | return QDF_STATUS_E_INVAL; |
| 16615 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16616 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 16617 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 16618 | break; |
| 16619 | |
| 16620 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 16621 | while (phy_map) { |
| 16622 | phy_map >>= 1; |
| 16623 | phy_idx++; |
| 16624 | } |
| 16625 | } |
| 16626 | |
| 16627 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16628 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16629 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16630 | phy_idx += phy_id; |
| 16631 | if (phy_idx >= param_buf->num_mac_phy_caps) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16632 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16633 | |
| 16634 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16635 | |
| 16636 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16637 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16638 | mac_phy_caps->pdev_id); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16639 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 16640 | param->supports_11b = |
| 16641 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 16642 | param->supports_11g = |
| 16643 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 16644 | param->supports_11a = |
| 16645 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 16646 | param->supports_11n = |
| 16647 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 16648 | param->supports_11ac = |
| 16649 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 16650 | param->supports_11ax = |
| 16651 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16652 | |
| 16653 | param->supported_bands = mac_phy_caps->supported_bands; |
| 16654 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 16655 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 16656 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 16657 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 16658 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 16659 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 16660 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 16661 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 16662 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 16663 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 16664 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 16665 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 16666 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 16667 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 16668 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 16669 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 16670 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
Kris Muthusamy | 61fe369 | 2017-02-20 02:35:47 -0800 | [diff] [blame] | 16671 | qdf_mem_copy(¶m->he_cap_phy_info_2G, |
| 16672 | &mac_phy_caps->he_cap_phy_info_2G, |
| 16673 | sizeof(param->he_cap_phy_info_2G)); |
| 16674 | qdf_mem_copy(¶m->he_cap_phy_info_5G, |
| 16675 | &mac_phy_caps->he_cap_phy_info_5G, |
| 16676 | sizeof(param->he_cap_phy_info_5G)); |
| 16677 | qdf_mem_copy(¶m->he_ppet2G, &mac_phy_caps->he_ppet2G, |
| 16678 | sizeof(param->he_ppet2G)); |
| 16679 | qdf_mem_copy(¶m->he_ppet5G, &mac_phy_caps->he_ppet5G, |
| 16680 | sizeof(param->he_ppet5G)); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 16681 | param->chainmask_table_id = mac_phy_caps->chainmask_table_id; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16682 | |
| 16683 | return QDF_STATUS_SUCCESS; |
| 16684 | } |
| 16685 | |
| 16686 | /** |
| 16687 | * extract_reg_cap_service_ready_ext_tlv() - |
| 16688 | * extract REG cap from service ready event |
| 16689 | * @wmi_handle: wmi handle |
| 16690 | * @param evt_buf: pointer to event buffer |
| 16691 | * @param param: Pointer to hold evt buf |
| 16692 | * @param phy_idx: phy idx should be less than num_mode |
| 16693 | * |
| 16694 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16695 | */ |
| 16696 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 16697 | wmi_unified_t wmi_handle, |
| 16698 | uint8_t *event, uint8_t phy_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16699 | struct wlan_psoc_host_hal_reg_capabilities_ext *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16700 | { |
| 16701 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 16702 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 16703 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 16704 | |
| 16705 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 16706 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16707 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16708 | |
| 16709 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16710 | if (!reg_caps) |
| 16711 | return QDF_STATUS_E_INVAL; |
| 16712 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16713 | if (phy_idx >= reg_caps->num_phy) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16714 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16715 | |
| 16716 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 16717 | |
| 16718 | param->phy_id = ext_reg_cap->phy_id; |
| 16719 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 16720 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 16721 | param->regcap1 = ext_reg_cap->regcap1; |
| 16722 | param->regcap2 = ext_reg_cap->regcap2; |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 16723 | param->wireless_modes = convert_wireless_modes_tlv( |
| 16724 | ext_reg_cap->wireless_modes); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 16725 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 16726 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 16727 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 16728 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 16729 | |
| 16730 | return QDF_STATUS_SUCCESS; |
| 16731 | } |
| 16732 | |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16733 | /** |
| 16734 | * extract_dcs_interference_type_tlv() - extract dcs interference type |
| 16735 | * from event |
| 16736 | * @wmi_handle: wmi handle |
| 16737 | * @param evt_buf: pointer to event buffer |
| 16738 | * @param param: Pointer to hold dcs interference param |
| 16739 | * |
| 16740 | * Return: 0 for success or error code |
| 16741 | */ |
| 16742 | static QDF_STATUS extract_dcs_interference_type_tlv( |
| 16743 | wmi_unified_t wmi_handle, |
| 16744 | void *evt_buf, struct wmi_host_dcs_interference_param *param) |
| 16745 | { |
| 16746 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 16747 | |
| 16748 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 16749 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16750 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16751 | |
| 16752 | param->interference_type = param_buf->fixed_param->interference_type; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16753 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16754 | param_buf->fixed_param->pdev_id); |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16755 | |
| 16756 | return QDF_STATUS_SUCCESS; |
| 16757 | } |
| 16758 | |
| 16759 | /* |
| 16760 | * extract_dcs_cw_int_tlv() - extract dcs cw interference from event |
| 16761 | * @wmi_handle: wmi handle |
| 16762 | * @param evt_buf: pointer to event buffer |
| 16763 | * @param cw_int: Pointer to hold cw interference |
| 16764 | * |
| 16765 | * Return: 0 for success or error code |
| 16766 | */ |
| 16767 | static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle, |
| 16768 | void *evt_buf, |
| 16769 | wmi_host_ath_dcs_cw_int *cw_int) |
| 16770 | { |
| 16771 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 16772 | wlan_dcs_cw_int *ev; |
| 16773 | |
| 16774 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 16775 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16776 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16777 | |
| 16778 | ev = param_buf->cw_int; |
| 16779 | |
| 16780 | cw_int->channel = ev->channel; |
| 16781 | |
| 16782 | return QDF_STATUS_SUCCESS; |
| 16783 | } |
| 16784 | |
| 16785 | /** |
| 16786 | * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event |
| 16787 | * @wmi_handle: wmi handle |
| 16788 | * @param evt_buf: pointer to event buffer |
| 16789 | * @param wlan_stat: Pointer to hold wlan stats |
| 16790 | * |
| 16791 | * Return: 0 for success or error code |
| 16792 | */ |
| 16793 | static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle, |
| 16794 | void *evt_buf, |
| 16795 | wmi_host_dcs_im_tgt_stats_t *wlan_stat) |
| 16796 | { |
| 16797 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 16798 | wlan_dcs_im_tgt_stats_t *ev; |
| 16799 | |
| 16800 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 16801 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 16802 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 16803 | |
| 16804 | ev = param_buf->wlan_stat; |
| 16805 | wlan_stat->reg_tsf32 = ev->reg_tsf32; |
| 16806 | wlan_stat->last_ack_rssi = ev->last_ack_rssi; |
| 16807 | wlan_stat->tx_waste_time = ev->tx_waste_time; |
| 16808 | wlan_stat->rx_time = ev->rx_time; |
| 16809 | wlan_stat->phyerr_cnt = ev->phyerr_cnt; |
| 16810 | wlan_stat->mib_stats.listen_time = ev->listen_time; |
| 16811 | wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt; |
| 16812 | wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt; |
| 16813 | wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt; |
| 16814 | wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt; |
| 16815 | wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt; |
| 16816 | wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt; |
| 16817 | wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt; |
| 16818 | wlan_stat->chan_nf = ev->chan_nf; |
| 16819 | wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 16820 | |
| 16821 | return QDF_STATUS_SUCCESS; |
| 16822 | } |
| 16823 | |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 16824 | /** |
| 16825 | * extract_thermal_stats_tlv() - extract thermal stats from event |
| 16826 | * @wmi_handle: wmi handle |
| 16827 | * @param evt_buf: Pointer to event buffer |
| 16828 | * @param temp: Pointer to hold extracted temperature |
| 16829 | * @param level: Pointer to hold extracted level |
| 16830 | * |
| 16831 | * Return: 0 for success or error code |
| 16832 | */ |
| 16833 | static QDF_STATUS |
| 16834 | extract_thermal_stats_tlv(wmi_unified_t wmi_handle, |
| 16835 | void *evt_buf, uint32_t *temp, |
| 16836 | uint32_t *level, uint32_t *pdev_id) |
| 16837 | { |
| 16838 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 16839 | wmi_therm_throt_stats_event_fixed_param *tt_stats_event; |
| 16840 | |
| 16841 | param_buf = |
| 16842 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 16843 | if (!param_buf) |
| 16844 | return QDF_STATUS_E_INVAL; |
| 16845 | |
| 16846 | tt_stats_event = param_buf->fixed_param; |
| 16847 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16848 | *pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16849 | tt_stats_event->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 16850 | *temp = tt_stats_event->temp; |
| 16851 | *level = tt_stats_event->level; |
| 16852 | |
| 16853 | return QDF_STATUS_SUCCESS; |
| 16854 | } |
| 16855 | |
| 16856 | /** |
| 16857 | * extract_thermal_level_stats_tlv() - extract thermal level stats from event |
| 16858 | * @wmi_handle: wmi handle |
| 16859 | * @param evt_buf: pointer to event buffer |
| 16860 | * @param idx: Index to level stats |
| 16861 | * @param levelcount: Pointer to hold levelcount |
| 16862 | * @param dccount: Pointer to hold dccount |
| 16863 | * |
| 16864 | * Return: 0 for success or error code |
| 16865 | */ |
| 16866 | static QDF_STATUS |
| 16867 | extract_thermal_level_stats_tlv(wmi_unified_t wmi_handle, |
| 16868 | void *evt_buf, uint8_t idx, uint32_t *levelcount, |
| 16869 | uint32_t *dccount) |
| 16870 | { |
| 16871 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 16872 | wmi_therm_throt_level_stats_info *tt_level_info; |
| 16873 | |
| 16874 | param_buf = |
| 16875 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 16876 | if (!param_buf) |
| 16877 | return QDF_STATUS_E_INVAL; |
| 16878 | |
| 16879 | tt_level_info = param_buf->therm_throt_level_stats_info; |
| 16880 | |
| 16881 | if (idx < THERMAL_LEVELS) { |
| 16882 | *levelcount = tt_level_info[idx].level_count; |
| 16883 | *dccount = tt_level_info[idx].dc_count; |
| 16884 | return QDF_STATUS_SUCCESS; |
| 16885 | } |
| 16886 | |
| 16887 | return QDF_STATUS_E_FAILURE; |
| 16888 | } |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 16889 | #ifdef BIG_ENDIAN_HOST |
| 16890 | /** |
| 16891 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 16892 | * @param data_len - data length |
| 16893 | * @param data - pointer to data |
| 16894 | * |
| 16895 | * Return: QDF_STATUS - success or error status |
| 16896 | */ |
| 16897 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 16898 | { |
| 16899 | uint8_t *data_aligned = NULL; |
| 16900 | int c; |
| 16901 | unsigned char *data_unaligned; |
| 16902 | |
| 16903 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 16904 | FIPS_ALIGN)); |
| 16905 | /* Assigning unaligned space to copy the data */ |
| 16906 | /* Checking if kmalloc does succesful allocation */ |
| 16907 | if (data_unaligned == NULL) |
| 16908 | return QDF_STATUS_E_FAILURE; |
| 16909 | |
| 16910 | /* Checking if space is alligned */ |
| 16911 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 16912 | /* align the data space */ |
| 16913 | data_aligned = |
| 16914 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 16915 | } else { |
| 16916 | data_aligned = (u_int8_t *)data_unaligned; |
| 16917 | } |
| 16918 | |
| 16919 | /* memset and copy content from data to data aligned */ |
| 16920 | OS_MEMSET(data_aligned, 0, data_len); |
| 16921 | OS_MEMCPY(data_aligned, data, data_len); |
| 16922 | /* Endianness to LE */ |
| 16923 | for (c = 0; c < data_len/4; c++) { |
| 16924 | *((u_int32_t *)data_aligned + c) = |
| 16925 | qdf_os_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
| 16926 | } |
| 16927 | |
| 16928 | /* Copy content to event->data */ |
| 16929 | OS_MEMCPY(data, data_aligned, data_len); |
| 16930 | |
| 16931 | /* clean up allocated space */ |
| 16932 | qdf_mem_free(data_unaligned); |
| 16933 | data_aligned = NULL; |
| 16934 | data_unaligned = NULL; |
| 16935 | |
| 16936 | /*************************************************************/ |
| 16937 | |
| 16938 | return QDF_STATUS_SUCCESS; |
| 16939 | } |
| 16940 | #else |
| 16941 | /** |
| 16942 | * fips_conv_data_be() - DUMMY for LE platform |
| 16943 | * |
| 16944 | * Return: QDF_STATUS - success |
| 16945 | */ |
| 16946 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 16947 | { |
| 16948 | return QDF_STATUS_SUCCESS; |
| 16949 | } |
| 16950 | #endif |
| 16951 | |
| 16952 | /** |
| 16953 | * extract_fips_event_data_tlv() - extract fips event data |
| 16954 | * @wmi_handle: wmi handle |
| 16955 | * @param evt_buf: pointer to event buffer |
| 16956 | * @param param: pointer FIPS event params |
| 16957 | * |
| 16958 | * Return: 0 for success or error code |
| 16959 | */ |
| 16960 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 16961 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 16962 | { |
| 16963 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 16964 | wmi_pdev_fips_event_fixed_param *event; |
| 16965 | |
| 16966 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 16967 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 16968 | |
| 16969 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 16970 | QDF_STATUS_SUCCESS) |
| 16971 | return QDF_STATUS_E_FAILURE; |
| 16972 | |
| 16973 | param->data = (uint32_t *)param_buf->data; |
| 16974 | param->data_len = event->data_len; |
| 16975 | param->error_status = event->error_status; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16976 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16977 | event->pdev_id); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 16978 | |
| 16979 | return QDF_STATUS_SUCCESS; |
| 16980 | } |
| 16981 | |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 16982 | /* |
| 16983 | * extract_peer_delete_response_event_tlv() - extract peer delete response event |
| 16984 | * @wmi_handle: wmi handle |
| 16985 | * @param evt_buf: pointer to event buffer |
| 16986 | * @param vdev_id: Pointer to hold vdev_id |
| 16987 | * @param mac_addr: Pointer to hold peer mac address |
| 16988 | * |
| 16989 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16990 | */ |
| 16991 | static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl, |
| 16992 | void *evt_buf, struct wmi_host_peer_delete_response_event *param) |
| 16993 | { |
| 16994 | WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 16995 | wmi_peer_delete_resp_event_fixed_param *ev; |
| 16996 | |
| 16997 | param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf; |
| 16998 | |
| 16999 | ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param; |
| 17000 | if (!ev) { |
| 17001 | WMI_LOGE("%s: Invalid peer_delete response\n", __func__); |
| 17002 | return QDF_STATUS_E_FAILURE; |
| 17003 | } |
| 17004 | |
| 17005 | param->vdev_id = ev->vdev_id; |
| 17006 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr, |
| 17007 | ¶m->mac_address.bytes[0]); |
| 17008 | |
| 17009 | return QDF_STATUS_SUCCESS; |
| 17010 | } |
| 17011 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 17012 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 17013 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 17014 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 17015 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17016 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 17017 | return false; |
| 17018 | } |
| 17019 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 17020 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 17021 | { |
| 17022 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 17023 | |
| 17024 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 17025 | |
| 17026 | switch (set_cmd->param_id) { |
| 17027 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 17028 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 17029 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 17030 | default: |
| 17031 | break; |
| 17032 | } |
| 17033 | |
| 17034 | return 0; |
| 17035 | } |
| 17036 | |
| 17037 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 17038 | { |
| 17039 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 17040 | |
| 17041 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 17042 | |
| 17043 | switch (ps_cmd->param) { |
| 17044 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 17045 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 17046 | case WMI_STA_PS_ENABLE_QPOWER: |
| 17047 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 17048 | default: |
| 17049 | break; |
| 17050 | } |
| 17051 | |
| 17052 | return 0; |
| 17053 | } |
| 17054 | |
| 17055 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 17056 | uint32_t cmd_id) |
| 17057 | { |
| 17058 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 17059 | return 0; |
| 17060 | |
| 17061 | switch (cmd_id) { |
| 17062 | case WMI_VDEV_SET_PARAM_CMDID: |
| 17063 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 17064 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 17065 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 17066 | default: |
| 17067 | break; |
| 17068 | } |
| 17069 | |
| 17070 | return 0; |
| 17071 | } |
| 17072 | |
| 17073 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 17074 | { |
| 17075 | uint16_t tag = 0; |
| 17076 | |
| 17077 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
| 17078 | pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", |
| 17079 | __func__); |
| 17080 | return tag; |
| 17081 | } |
| 17082 | |
| 17083 | if (wmi_handle->tag_crash_inject) |
| 17084 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 17085 | |
| 17086 | wmi_handle->tag_crash_inject = false; |
| 17087 | return tag; |
| 17088 | } |
| 17089 | |
| 17090 | /** |
| 17091 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 17092 | * @wmi_handle: WMI handle |
| 17093 | * @buf: WMI buffer |
| 17094 | * @cmd_id: WMI command Id |
| 17095 | * |
| 17096 | * Return htc_tx_tag |
| 17097 | */ |
| 17098 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 17099 | wmi_buf_t buf, |
| 17100 | uint32_t cmd_id) |
| 17101 | { |
| 17102 | uint16_t htc_tx_tag = 0; |
| 17103 | |
| 17104 | switch (cmd_id) { |
| 17105 | case WMI_WOW_ENABLE_CMDID: |
| 17106 | case WMI_PDEV_SUSPEND_CMDID: |
| 17107 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 17108 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 17109 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 17110 | case WMI_PDEV_RESUME_CMDID: |
| 17111 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 17112 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 17113 | #ifdef FEATURE_WLAN_D0WOW |
| 17114 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 17115 | #endif |
| 17116 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 17117 | break; |
| 17118 | case WMI_FORCE_FW_HANG_CMDID: |
| 17119 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 17120 | break; |
| 17121 | case WMI_VDEV_SET_PARAM_CMDID: |
| 17122 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 17123 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 17124 | default: |
| 17125 | break; |
| 17126 | } |
| 17127 | |
| 17128 | return htc_tx_tag; |
| 17129 | } |
| 17130 | |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 17131 | /** |
| 17132 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 17133 | * from event |
| 17134 | * @wmi_handle: wmi handle |
| 17135 | * @param evt_buf: pointer to event buffer |
| 17136 | * @param ch_hopping: Pointer to hold channel hopping param |
| 17137 | * |
| 17138 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 17139 | */ |
| 17140 | static QDF_STATUS extract_channel_hopping_event_tlv( |
| 17141 | wmi_unified_t wmi_handle, void *evt_buf, |
| 17142 | wmi_host_pdev_channel_hopping_event *ch_hopping) |
| 17143 | { |
| 17144 | WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *param_buf; |
| 17145 | wmi_pdev_channel_hopping_event_fixed_param *event; |
| 17146 | |
| 17147 | param_buf = (WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *)evt_buf; |
| 17148 | event = (wmi_pdev_channel_hopping_event_fixed_param *) |
| 17149 | param_buf->fixed_param; |
| 17150 | |
| 17151 | ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter; |
| 17152 | ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17153 | ch_hopping->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17154 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 17155 | |
| 17156 | return QDF_STATUS_SUCCESS; |
| 17157 | } |
| 17158 | |
| 17159 | /** |
| 17160 | * extract_pdev_tpc_ev_param_tlv() - extract tpc param from event |
| 17161 | * @wmi_handle: wmi handle |
| 17162 | * @param evt_buf: pointer to event buffer |
| 17163 | * @param param: Pointer to hold tpc param |
| 17164 | * |
| 17165 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 17166 | */ |
| 17167 | static QDF_STATUS extract_pdev_tpc_ev_param_tlv(wmi_unified_t wmi_handle, |
| 17168 | void *evt_buf, |
| 17169 | wmi_host_pdev_tpc_event *param) |
| 17170 | { |
| 17171 | WMI_PDEV_TPC_EVENTID_param_tlvs *param_buf; |
| 17172 | wmi_pdev_tpc_event_fixed_param *event; |
| 17173 | |
| 17174 | param_buf = (WMI_PDEV_TPC_EVENTID_param_tlvs *)evt_buf; |
| 17175 | event = (wmi_pdev_tpc_event_fixed_param *)param_buf->fixed_param; |
| 17176 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17177 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17178 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 17179 | qdf_mem_copy(param->tpc, param_buf->tpc, sizeof(param->tpc)); |
| 17180 | |
| 17181 | return QDF_STATUS_SUCCESS; |
| 17182 | } |
| 17183 | |
| 17184 | |
| 17185 | #ifdef BIG_ENDIAN_HOST |
| 17186 | /** |
| 17187 | * wds_addr_ev_conv_data_be() - LE to BE conversion of wds addr event |
| 17188 | * @param data_len - data length |
| 17189 | * @param data - pointer to data |
| 17190 | * |
| 17191 | * Return: QDF_STATUS - success or error status |
| 17192 | */ |
| 17193 | static QDF_STATUS wds_addr_ev_conv_data_be(uint16_t data_len, uint8_t *ev) |
| 17194 | { |
| 17195 | uint8_t *datap = (uint8_t *)ev; |
| 17196 | /* Skip swapping the first word */ |
| 17197 | datap += sizeof(uint32_t); |
| 17198 | for (i = 0; i < ((data_len / sizeof(uint32_t))-1); |
| 17199 | i++, datap += sizeof(uint32_t)) { |
| 17200 | *(uint32_t *)datap = qdf_le32_to_cpu(*(uint32_t *)datap); |
| 17201 | } |
| 17202 | |
| 17203 | return QDF_STATUS_SUCCESS; |
| 17204 | } |
| 17205 | #else |
| 17206 | /** |
| 17207 | * wds_addr_ev_conv_data_be() - Dummy operation for LE platforms |
| 17208 | * @param data_len - data length |
| 17209 | * @param data - pointer to data |
| 17210 | * |
| 17211 | * Return: QDF_STATUS - success or error status |
| 17212 | */ |
| 17213 | static QDF_STATUS wds_addr_ev_conv_data_be(uint32_t data_len, uint8_t *ev) |
| 17214 | { |
| 17215 | return QDF_STATUS_SUCCESS; |
| 17216 | } |
| 17217 | #endif |
| 17218 | |
| 17219 | /** |
| 17220 | * extract_wds_addr_event_tlv() - extract wds address from event |
| 17221 | * @wmi_handle: wmi handle |
| 17222 | * @param evt_buf: pointer to event buffer |
| 17223 | * @param wds_ev: Pointer to hold wds address |
| 17224 | * |
| 17225 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 17226 | */ |
| 17227 | static QDF_STATUS extract_wds_addr_event_tlv(wmi_unified_t wmi_handle, |
| 17228 | void *evt_buf, |
| 17229 | uint16_t len, wds_addr_event_t *wds_ev) |
| 17230 | { |
| 17231 | WMI_WDS_PEER_EVENTID_param_tlvs *param_buf; |
| 17232 | wmi_wds_addr_event_fixed_param *ev; |
| 17233 | int i; |
| 17234 | |
| 17235 | param_buf = (WMI_WDS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 17236 | ev = (wmi_wds_addr_event_fixed_param *)param_buf->fixed_param; |
| 17237 | |
| 17238 | if (wds_addr_ev_conv_data_be(len, (uint8_t *)ev) != QDF_STATUS_SUCCESS) |
| 17239 | return QDF_STATUS_E_FAILURE; |
| 17240 | |
| 17241 | qdf_mem_copy(wds_ev->event_type, ev->event_type, |
| 17242 | sizeof(wds_ev->event_type)); |
| 17243 | for (i = 0; i < 4; i++) { |
| 17244 | wds_ev->peer_mac[i] = |
| 17245 | ((u_int8_t *)&(ev->peer_mac.mac_addr31to0))[i]; |
| 17246 | wds_ev->dest_mac[i] = |
| 17247 | ((u_int8_t *)&(ev->dest_mac.mac_addr31to0))[i]; |
| 17248 | } |
| 17249 | for (i = 0; i < 2; i++) { |
| 17250 | wds_ev->peer_mac[4+i] = |
| 17251 | ((u_int8_t *)&(ev->peer_mac.mac_addr47to32))[i]; |
| 17252 | wds_ev->dest_mac[4+i] = |
| 17253 | ((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i]; |
| 17254 | } |
| 17255 | return QDF_STATUS_SUCCESS; |
| 17256 | } |
| 17257 | |
| 17258 | /** |
| 17259 | * extract_peer_sta_ps_statechange_ev_tlv() - extract peer sta ps state |
| 17260 | * from event |
| 17261 | * @wmi_handle: wmi handle |
| 17262 | * @param evt_buf: pointer to event buffer |
| 17263 | * @param ev: Pointer to hold peer param and ps state |
| 17264 | * |
| 17265 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 17266 | */ |
| 17267 | static QDF_STATUS extract_peer_sta_ps_statechange_ev_tlv(wmi_unified_t wmi_handle, |
| 17268 | void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev) |
| 17269 | { |
| 17270 | WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf; |
| 17271 | wmi_peer_sta_ps_statechange_event_fixed_param *event; |
| 17272 | |
| 17273 | param_buf = (WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *)evt_buf; |
| 17274 | event = (wmi_peer_sta_ps_statechange_event_fixed_param *) |
| 17275 | param_buf->fixed_param; |
| 17276 | |
| 17277 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, ev->peer_macaddr); |
| 17278 | ev->peer_ps_state = event->peer_ps_state; |
| 17279 | |
| 17280 | return QDF_STATUS_SUCCESS; |
| 17281 | } |
| 17282 | |
| 17283 | /** |
| 17284 | * extract_inst_rssi_stats_event_tlv() - extract inst rssi stats from event |
| 17285 | * @wmi_handle: wmi handle |
| 17286 | * @param evt_buf: pointer to event buffer |
| 17287 | * @param inst_rssi_resp: Pointer to hold inst rssi response |
| 17288 | * |
| 17289 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 17290 | */ |
| 17291 | static QDF_STATUS extract_inst_rssi_stats_event_tlv( |
| 17292 | wmi_unified_t wmi_handle, void *evt_buf, |
| 17293 | wmi_host_inst_stats_resp *inst_rssi_resp) |
| 17294 | { |
| 17295 | WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf; |
| 17296 | wmi_inst_rssi_stats_resp_fixed_param *event; |
| 17297 | |
| 17298 | param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf; |
| 17299 | event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param; |
| 17300 | |
| 17301 | qdf_mem_copy(&(inst_rssi_resp->peer_macaddr), |
| 17302 | &(event->peer_macaddr), sizeof(wmi_mac_addr)); |
| 17303 | inst_rssi_resp->iRSSI = event->iRSSI; |
| 17304 | |
| 17305 | return QDF_STATUS_SUCCESS; |
| 17306 | } |
| 17307 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17308 | static struct cur_reg_rule |
| 17309 | *create_reg_rules_from_wmi(uint32_t num_reg_rules, |
| 17310 | wmi_regulatory_rule_struct *wmi_reg_rule) |
| 17311 | { |
| 17312 | struct cur_reg_rule *reg_rule_ptr; |
| 17313 | uint32_t count; |
| 17314 | |
| 17315 | reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); |
| 17316 | |
| 17317 | if (NULL == reg_rule_ptr) { |
| 17318 | WMI_LOGE("memory allocation failure"); |
| 17319 | return NULL; |
| 17320 | } |
| 17321 | |
| 17322 | for (count = 0; count < num_reg_rules; count++) { |
| 17323 | reg_rule_ptr[count].start_freq = |
| 17324 | WMI_REG_RULE_START_FREQ_GET( |
| 17325 | wmi_reg_rule[count].freq_info); |
| 17326 | reg_rule_ptr[count].end_freq = |
| 17327 | WMI_REG_RULE_END_FREQ_GET( |
| 17328 | wmi_reg_rule[count].freq_info); |
| 17329 | reg_rule_ptr[count].max_bw = |
| 17330 | WMI_REG_RULE_MAX_BW_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 17331 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17332 | reg_rule_ptr[count].reg_power = |
| 17333 | WMI_REG_RULE_REG_POWER_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 17334 | wmi_reg_rule[count].bw_pwr_info); |
Abhijit Pradhan | b5a1d24 | 2017-04-27 20:36:31 +0530 | [diff] [blame] | 17335 | reg_rule_ptr[count].ant_gain = |
| 17336 | WMI_REG_RULE_ANTENNA_GAIN_GET( |
| 17337 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17338 | reg_rule_ptr[count].flags = |
| 17339 | WMI_REG_RULE_FLAGS_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 17340 | wmi_reg_rule[count].flag_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17341 | } |
| 17342 | |
| 17343 | return reg_rule_ptr; |
| 17344 | } |
| 17345 | |
| 17346 | static QDF_STATUS extract_reg_chan_list_update_event_tlv( |
| 17347 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 17348 | struct cur_regulatory_info *reg_info, uint32_t len) |
| 17349 | { |
| 17350 | WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *param_buf; |
| 17351 | wmi_reg_chan_list_cc_event_fixed_param *chan_list_event_hdr; |
| 17352 | wmi_regulatory_rule_struct *wmi_reg_rule; |
| 17353 | uint32_t num_2g_reg_rules, num_5g_reg_rules; |
| 17354 | |
| 17355 | WMI_LOGD("processing regulatory channel list"); |
| 17356 | |
| 17357 | param_buf = (WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *)evt_buf; |
| 17358 | if (!param_buf) { |
| 17359 | WMI_LOGE("invalid channel list event buf"); |
| 17360 | return QDF_STATUS_E_FAILURE; |
| 17361 | } |
| 17362 | |
| 17363 | chan_list_event_hdr = param_buf->fixed_param; |
| 17364 | |
| 17365 | reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; |
| 17366 | reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; |
| 17367 | qdf_mem_copy(reg_info->alpha2, &(chan_list_event_hdr->alpha2), |
| 17368 | REG_ALPHA2_LEN); |
| 17369 | reg_info->dfs_region = chan_list_event_hdr->dfs_region; |
| 17370 | reg_info->phybitmap = chan_list_event_hdr->phybitmap; |
Amar Singhal | a2d575f | 2017-05-04 17:12:34 -0700 | [diff] [blame] | 17371 | reg_info->offload_enabled = true; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 17372 | reg_info->num_phy = chan_list_event_hdr->num_phy; |
| 17373 | reg_info->ctry_code = chan_list_event_hdr->country_id; |
| 17374 | reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; |
| 17375 | if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS) |
| 17376 | reg_info->status_code = REG_SET_CC_STATUS_PASS; |
| 17377 | else if (chan_list_event_hdr->status_code == |
| 17378 | WMI_REG_CURRENT_ALPHA2_NOT_FOUND) |
| 17379 | reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND; |
| 17380 | else if (chan_list_event_hdr->status_code == |
| 17381 | WMI_REG_INIT_ALPHA2_NOT_FOUND) |
| 17382 | reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND; |
| 17383 | else if (chan_list_event_hdr->status_code == |
| 17384 | WMI_REG_SET_CC_CHANGE_NOT_ALLOWED) |
| 17385 | reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED; |
| 17386 | else if (chan_list_event_hdr->status_code == |
| 17387 | WMI_REG_SET_CC_STATUS_NO_MEMORY) |
| 17388 | reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY; |
| 17389 | else if (chan_list_event_hdr->status_code == |
| 17390 | WMI_REG_SET_CC_STATUS_FAIL) |
| 17391 | reg_info->status_code = REG_SET_CC_STATUS_FAIL; |
| 17392 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17393 | reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; |
| 17394 | reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; |
| 17395 | reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; |
| 17396 | reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; |
| 17397 | |
| 17398 | num_2g_reg_rules = reg_info->num_2g_reg_rules; |
| 17399 | num_5g_reg_rules = reg_info->num_5g_reg_rules; |
| 17400 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 17401 | WMI_LOGD("%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", |
| 17402 | __func__, reg_info->alpha2, reg_info->dfs_region, |
| 17403 | reg_info->min_bw_2g, reg_info->max_bw_2g, |
| 17404 | reg_info->min_bw_5g, reg_info->max_bw_5g); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17405 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 17406 | WMI_LOGD("%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__, |
| 17407 | num_2g_reg_rules, num_5g_reg_rules); |
Kiran Kumar Lokere | dd64e04 | 2017-03-31 15:50:26 -0700 | [diff] [blame] | 17408 | wmi_reg_rule = |
| 17409 | (wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr |
| 17410 | + sizeof(wmi_reg_chan_list_cc_event_fixed_param) |
| 17411 | + WMI_TLV_HDR_SIZE); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 17412 | reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, |
| 17413 | wmi_reg_rule); |
| 17414 | wmi_reg_rule += num_2g_reg_rules; |
| 17415 | |
| 17416 | reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, |
| 17417 | wmi_reg_rule); |
| 17418 | |
| 17419 | WMI_LOGD("processed regulatory channel list"); |
| 17420 | |
| 17421 | return QDF_STATUS_SUCCESS; |
| 17422 | } |
| 17423 | |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 17424 | #ifdef DFS_COMPONENT_ENABLE |
| 17425 | /** |
| 17426 | * extract_dfs_cac_complete_event_tlv() - extract cac complete event |
| 17427 | * @wmi_handle: wma handle |
| 17428 | * @evt_buf: event buffer |
| 17429 | * @vdev_id: vdev id |
| 17430 | * @len: length of buffer |
| 17431 | * |
| 17432 | * Return: 0 for success or error code |
| 17433 | */ |
| 17434 | static QDF_STATUS extract_dfs_cac_complete_event_tlv(wmi_unified_t wmi_handle, |
| 17435 | uint8_t *evt_buf, |
| 17436 | uint32_t *vdev_id, |
| 17437 | uint32_t len) |
| 17438 | { |
| 17439 | WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *param_tlvs; |
| 17440 | wmi_vdev_dfs_cac_complete_event_fixed_param *cac_event; |
| 17441 | |
| 17442 | param_tlvs = (WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *) evt_buf; |
| 17443 | if (!param_tlvs) { |
| 17444 | WMI_LOGE("invalid cac complete event buf"); |
| 17445 | return QDF_STATUS_E_FAILURE; |
| 17446 | } |
| 17447 | |
| 17448 | cac_event = param_tlvs->fixed_param; |
| 17449 | *vdev_id = cac_event->vdev_id; |
| 17450 | WMI_LOGD("processed cac complete event vdev %d", *vdev_id); |
| 17451 | |
| 17452 | return QDF_STATUS_SUCCESS; |
| 17453 | } |
| 17454 | |
| 17455 | /** |
| 17456 | * extract_dfs_radar_detection_event_tlv() - extract radar found event |
| 17457 | * @wmi_handle: wma handle |
| 17458 | * @evt_buf: event buffer |
| 17459 | * @radar_found: radar found event info |
| 17460 | * @len: length of buffer |
| 17461 | * |
| 17462 | * Return: 0 for success or error code |
| 17463 | */ |
| 17464 | static QDF_STATUS extract_dfs_radar_detection_event_tlv( |
| 17465 | wmi_unified_t wmi_handle, |
| 17466 | uint8_t *evt_buf, |
| 17467 | struct radar_found_info *radar_found, |
| 17468 | uint32_t len) |
| 17469 | { |
| 17470 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *param_tlv; |
| 17471 | wmi_pdev_dfs_radar_detection_event_fixed_param *radar_event; |
| 17472 | |
| 17473 | param_tlv = (WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *) evt_buf; |
| 17474 | if (!param_tlv) { |
| 17475 | WMI_LOGE("invalid radar detection event buf"); |
| 17476 | return QDF_STATUS_E_FAILURE; |
| 17477 | } |
| 17478 | |
| 17479 | radar_event = param_tlv->fixed_param; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17480 | radar_found->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17481 | radar_event->pdev_id); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 17482 | radar_found->detection_mode = radar_event->detection_mode; |
| 17483 | radar_found->freq_offset = radar_event->chan_freq; |
| 17484 | radar_found->chan_width = radar_event->chan_width; |
| 17485 | radar_found->detector_id = radar_event->detector_id; |
| 17486 | radar_found->segment_id = radar_event->segment_id; |
| 17487 | radar_found->timestamp = radar_event->timestamp; |
| 17488 | radar_found->is_chirp = radar_event->is_chirp; |
| 17489 | |
| 17490 | WMI_LOGD("processed radar found event pdev %d", radar_event->pdev_id); |
| 17491 | |
| 17492 | return QDF_STATUS_SUCCESS; |
| 17493 | } |
| 17494 | #endif |
| 17495 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 17496 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17497 | * convert_host_pdev_id_to_target_pdev_id_legacy() - Convert pdev_id from |
| 17498 | * host to target defines. For legacy there is not conversion |
| 17499 | * required. Just return pdev_id as it is. |
| 17500 | * @param pdev_id: host pdev_id to be converted. |
| 17501 | * Return: target pdev_id after conversion. |
| 17502 | */ |
| 17503 | static uint32_t convert_host_pdev_id_to_target_pdev_id_legacy( |
| 17504 | uint32_t pdev_id) |
| 17505 | { |
| 17506 | if (pdev_id == WMI_HOST_PDEV_ID_SOC) |
| 17507 | return WMI_PDEV_ID_SOC; |
| 17508 | |
| 17509 | /*No conversion required*/ |
| 17510 | return pdev_id; |
| 17511 | } |
| 17512 | |
| 17513 | /** |
| 17514 | * convert_target_pdev_id_to_host_pdev_id_legacy() - Convert pdev_id from |
| 17515 | * target to host defines. For legacy there is not conversion |
| 17516 | * required. Just return pdev_id as it is. |
| 17517 | * @param pdev_id: target pdev_id to be converted. |
| 17518 | * Return: host pdev_id after conversion. |
| 17519 | */ |
| 17520 | static uint32_t convert_target_pdev_id_to_host_pdev_id_legacy( |
| 17521 | uint32_t pdev_id) |
| 17522 | { |
| 17523 | /*No conversion required*/ |
| 17524 | return pdev_id; |
| 17525 | } |
| 17526 | |
| 17527 | /** |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 17528 | * send_set_country_cmd_tlv() - WMI scan channel list function |
| 17529 | * @param wmi_handle : handle to WMI. |
| 17530 | * @param param : pointer to hold scan channel list parameter |
| 17531 | * |
| 17532 | * Return: 0 on success and -ve on failure. |
| 17533 | */ |
| 17534 | static QDF_STATUS send_set_country_cmd_tlv(wmi_unified_t wmi_handle, |
| 17535 | struct set_country *params) |
| 17536 | { |
| 17537 | wmi_buf_t buf; |
| 17538 | QDF_STATUS qdf_status; |
| 17539 | wmi_set_current_country_cmd_fixed_param *cmd; |
| 17540 | uint16_t len = sizeof(*cmd); |
| 17541 | |
| 17542 | buf = wmi_buf_alloc(wmi_handle, len); |
| 17543 | if (!buf) { |
| 17544 | WMI_LOGE("Failed to allocate memory"); |
| 17545 | qdf_status = QDF_STATUS_E_NOMEM; |
| 17546 | goto end; |
| 17547 | } |
| 17548 | |
| 17549 | cmd = (wmi_set_current_country_cmd_fixed_param *)wmi_buf_data(buf); |
| 17550 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 17551 | WMITLV_TAG_STRUC_wmi_set_current_country_cmd_fixed_param, |
| 17552 | WMITLV_GET_STRUCT_TLVLEN |
| 17553 | (wmi_set_current_country_cmd_fixed_param)); |
| 17554 | |
| 17555 | WMI_LOGD("setting cuurnet country to %s", params->country); |
| 17556 | |
| 17557 | qdf_mem_copy((uint8_t *)&cmd->new_alpha2, params->country, 3); |
| 17558 | |
| 17559 | cmd->pdev_id = params->pdev_id; |
| 17560 | |
| 17561 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 17562 | buf, len, WMI_SET_CURRENT_COUNTRY_CMDID); |
| 17563 | |
| 17564 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 17565 | WMI_LOGE("Failed to send WMI_SET_CURRENT_COUNTRY_CMDID"); |
| 17566 | wmi_buf_free(buf); |
| 17567 | } |
| 17568 | |
| 17569 | end: |
| 17570 | return qdf_status; |
| 17571 | } |
| 17572 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17573 | struct wmi_ops tlv_ops = { |
| 17574 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 17575 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 17576 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 17577 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 17578 | .send_hidden_ssid_vdev_restart_cmd = |
| 17579 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17580 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 17581 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 17582 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 17583 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17584 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 17585 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 17586 | .send_peer_rx_reorder_queue_setup_cmd = |
| 17587 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 17588 | .send_peer_rx_reorder_queue_remove_cmd = |
| 17589 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 17590 | .send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv, |
| 17591 | .send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv, |
| 17592 | .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] | 17593 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 17594 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 17595 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 17596 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 17597 | .send_resume_cmd = send_resume_cmd_tlv, |
| 17598 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 17599 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 17600 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 17601 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 17602 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 17603 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 17604 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 17605 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
| 17606 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 17607 | #ifndef CONFIG_MCL |
| 17608 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
| 17609 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17610 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 17611 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 17612 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 17613 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 17614 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 17615 | .send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 17616 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 17617 | .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] | 17618 | .send_set_sta_uapsd_auto_trig_cmd = |
| 17619 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 17620 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 17621 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 17622 | .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] | 17623 | #ifdef CONVERGED_P2P_ENABLE |
| 17624 | .send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv, |
| 17625 | .send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv, |
| 17626 | #endif |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 17627 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 17628 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 17629 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 17630 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 17631 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 17632 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 17633 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 17634 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 17635 | .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] | 17636 | .send_ocb_start_timing_advert_cmd = |
| 17637 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 17638 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 17639 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 17640 | .send_set_mcc_channel_time_latency_cmd = |
| 17641 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 17642 | .send_set_mcc_channel_time_quota_cmd = |
| 17643 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 17644 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 17645 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 17646 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 17647 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 17648 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 17649 | .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] | 17650 | .send_probe_rsp_tmpl_send_cmd = |
| 17651 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 17652 | .send_p2p_go_set_beacon_ie_cmd = |
| 17653 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 17654 | .send_setup_install_key_cmd = |
| 17655 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 17656 | .send_set_gateway_params_cmd = |
| 17657 | send_set_gateway_params_cmd_tlv, |
| 17658 | .send_set_rssi_monitoring_cmd = |
| 17659 | send_set_rssi_monitoring_cmd_tlv, |
| 17660 | .send_scan_probe_setoui_cmd = |
| 17661 | send_scan_probe_setoui_cmd_tlv, |
| 17662 | .send_reset_passpoint_network_list_cmd = |
| 17663 | send_reset_passpoint_network_list_cmd_tlv, |
| 17664 | .send_set_passpoint_network_list_cmd = |
| 17665 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 17666 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 17667 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
| 17668 | .send_roam_scan_filter_cmd = |
| 17669 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 17670 | .send_set_epno_network_list_cmd = |
| 17671 | send_set_epno_network_list_cmd_tlv, |
| 17672 | .send_ipa_offload_control_cmd = |
| 17673 | send_ipa_offload_control_cmd_tlv, |
| 17674 | .send_extscan_get_capabilities_cmd = |
| 17675 | send_extscan_get_capabilities_cmd_tlv, |
| 17676 | .send_extscan_get_cached_results_cmd = |
| 17677 | send_extscan_get_cached_results_cmd_tlv, |
| 17678 | .send_extscan_stop_change_monitor_cmd = |
| 17679 | send_extscan_stop_change_monitor_cmd_tlv, |
| 17680 | .send_extscan_start_change_monitor_cmd = |
| 17681 | send_extscan_start_change_monitor_cmd_tlv, |
| 17682 | .send_extscan_stop_hotlist_monitor_cmd = |
| 17683 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 17684 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 17685 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 17686 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 17687 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 17688 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
| 17689 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
| 17690 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 17691 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 17692 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 17693 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
| 17694 | .send_get_stats_cmd = send_get_stats_cmd_tlv, |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 17695 | .send_congestion_cmd = send_congestion_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17696 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 17697 | .send_snr_cmd = send_snr_cmd_tlv, |
| 17698 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 17699 | #ifdef WLAN_PMO_ENABLE |
| 17700 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 17701 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 17702 | .send_enable_arp_ns_offload_cmd = send_enable_arp_ns_offload_cmd_tlv, |
| 17703 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
Ravi Kumar Bokka | 8f2c92f | 2017-03-23 15:22:51 +0530 | [diff] [blame] | 17704 | .send_enable_broadcast_filter_cmd = |
| 17705 | send_enable_broadcast_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 17706 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 17707 | .send_process_gtk_offload_getinfo_cmd = |
| 17708 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 17709 | .send_enable_enhance_multicast_offload_cmd = |
| 17710 | send_enable_enhance_multicast_offload_tlv, |
| 17711 | .extract_gtk_rsp_event = extract_gtk_rsp_event_tlv, |
| 17712 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 17713 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
| 17714 | #endif |
| 17715 | .send_action_frame_patterns_cmd = send_action_frame_patterns_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17716 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 17717 | .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] | 17718 | .send_lphb_config_tcp_pkt_filter_cmd = |
| 17719 | send_lphb_config_tcp_pkt_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17720 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 17721 | .send_lphb_config_udp_pkt_filter_cmd = |
| 17722 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame^] | 17723 | .send_enable_disable_packet_filter_cmd = |
| 17724 | send_enable_disable_packet_filter_cmd_tlv, |
| 17725 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 17726 | #endif /* End of WLAN_PMO_ENABLE */ |
| 17727 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17728 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 17729 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 17730 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 17731 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
| 17732 | .send_process_update_edca_param_cmd = |
| 17733 | send_process_update_edca_param_cmd_tlv, |
| 17734 | .send_roam_scan_offload_mode_cmd = |
| 17735 | send_roam_scan_offload_mode_cmd_tlv, |
| 17736 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 17737 | .send_roam_scan_offload_ap_profile_cmd = |
| 17738 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 17739 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17740 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 17741 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17742 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 17743 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
| 17744 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 17745 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17746 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 17747 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 17748 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 17749 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 17750 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17751 | .send_process_add_periodic_tx_ptrn_cmd = |
| 17752 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 17753 | .send_process_del_periodic_tx_ptrn_cmd = |
| 17754 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 17755 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 17756 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 17757 | .send_set_app_type2_params_in_fw_cmd = |
| 17758 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 17759 | .send_set_auto_shutdown_timer_cmd = |
| 17760 | send_set_auto_shutdown_timer_cmd_tlv, |
| 17761 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 17762 | .send_process_dhcpserver_offload_cmd = |
| 17763 | send_process_dhcpserver_offload_cmd_tlv, |
| 17764 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 17765 | .send_process_ch_avoid_update_cmd = |
| 17766 | send_process_ch_avoid_update_cmd_tlv, |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 17767 | .send_pdev_set_regdomain_cmd = |
| 17768 | send_pdev_set_regdomain_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 17769 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 17770 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 17771 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 17772 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 17773 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 17774 | .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] | 17775 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 17776 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 17777 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 17778 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17779 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 17780 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 17781 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 17782 | .send_set_base_macaddr_indicate_cmd = |
| 17783 | send_set_base_macaddr_indicate_cmd_tlv, |
| 17784 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 17785 | .send_enable_specific_fw_logs_cmd = |
| 17786 | send_enable_specific_fw_logs_cmd_tlv, |
| 17787 | .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] | 17788 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 17789 | .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] | 17790 | .send_pdev_set_dual_mac_config_cmd = |
| 17791 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 17792 | .send_app_type1_params_in_fw_cmd = |
| 17793 | send_app_type1_params_in_fw_cmd_tlv, |
| 17794 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 17795 | .send_process_roam_synch_complete_cmd = |
| 17796 | send_process_roam_synch_complete_cmd_tlv, |
| 17797 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 17798 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 17799 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 17800 | .send_roam_scan_offload_scan_period_cmd = |
| 17801 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 17802 | .send_roam_scan_offload_chan_list_cmd = |
| 17803 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 17804 | .send_roam_scan_offload_rssi_change_cmd = |
| 17805 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 17806 | .send_get_buf_extscan_hotlist_cmd = |
| 17807 | send_get_buf_extscan_hotlist_cmd_tlv, |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 17808 | .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] | 17809 | .send_adapt_dwelltime_params_cmd = |
| 17810 | send_adapt_dwelltime_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17811 | .init_cmd_send = init_cmd_send_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 17812 | .send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv, |
| 17813 | .send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv, |
| 17814 | .send_set_ctl_table_cmd = send_set_ctl_table_cmd_tlv, |
| 17815 | .send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv, |
| 17816 | .send_packet_power_info_get_cmd = send_packet_power_info_get_cmd_tlv, |
| 17817 | .send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv, |
| 17818 | .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, |
| 17819 | .send_vdev_set_neighbour_rx_cmd = send_vdev_set_neighbour_rx_cmd_tlv, |
| 17820 | .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] | 17821 | .send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv, |
| 17822 | .send_smart_ant_set_training_info_cmd = |
| 17823 | send_smart_ant_set_training_info_cmd_tlv, |
| 17824 | .send_smart_ant_set_node_config_cmd = |
| 17825 | send_smart_ant_set_node_config_cmd_tlv, |
| 17826 | .send_set_atf_cmd = send_set_atf_cmd_tlv, |
| 17827 | .send_vdev_set_fwtest_param_cmd = send_vdev_set_fwtest_param_cmd_tlv, |
| 17828 | .send_set_qboost_param_cmd = send_set_qboost_param_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 17829 | .send_gpio_config_cmd = send_gpio_config_cmd_tlv, |
| 17830 | .send_gpio_output_cmd = send_gpio_output_cmd_tlv, |
| 17831 | .send_phyerr_disable_cmd = send_phyerr_disable_cmd_tlv, |
| 17832 | .send_phyerr_enable_cmd = send_phyerr_enable_cmd_tlv, |
| 17833 | .send_nf_dbr_dbm_info_get_cmd = send_nf_dbr_dbm_info_get_cmd_tlv, |
| 17834 | .send_set_ht_ie_cmd = send_set_ht_ie_cmd_tlv, |
| 17835 | .send_set_vht_ie_cmd = send_set_vht_ie_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 17836 | .send_set_quiet_mode_cmd = send_set_quiet_mode_cmd_tlv, |
| 17837 | .send_set_bwf_cmd = send_set_bwf_cmd_tlv, |
| 17838 | .send_mcast_group_update_cmd = send_mcast_group_update_cmd_tlv, |
| 17839 | .send_vdev_spectral_configure_cmd = |
| 17840 | send_vdev_spectral_configure_cmd_tlv, |
| 17841 | .send_vdev_spectral_enable_cmd = |
| 17842 | send_vdev_spectral_enable_cmd_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 17843 | .send_thermal_mitigation_param_cmd = |
| 17844 | send_thermal_mitigation_param_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 17845 | .send_pdev_qvit_cmd = send_pdev_qvit_cmd_tlv, |
| 17846 | .send_wmm_update_cmd = send_wmm_update_cmd_tlv, |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 17847 | .send_coex_config_cmd = send_coex_config_cmd_tlv, |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 17848 | .send_set_country_cmd = send_set_country_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17849 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 17850 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 17851 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 17852 | .save_service_bitmap = save_service_bitmap_tlv, |
| 17853 | .is_service_enabled = is_service_enabled_tlv, |
| 17854 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 17855 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 17856 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
| 17857 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 17858 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 17859 | .extract_tbttoffset_update_params = |
| 17860 | extract_tbttoffset_update_params_tlv, |
| 17861 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 17862 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 17863 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 17864 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 17865 | #ifdef CONVERGED_TDLS_ENABLE |
| 17866 | .extract_vdev_tdls_ev_param = extract_vdev_tdls_ev_param_tlv, |
| 17867 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17868 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
| 17869 | .extract_swba_vdev_map = extract_swba_vdev_map_tlv, |
| 17870 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 17871 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 17872 | #ifdef CONVERGED_P2P_ENABLE |
| 17873 | .extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv, |
| 17874 | .extract_p2p_lo_stop_ev_param = |
| 17875 | extract_p2p_lo_stop_ev_param_tlv, |
| 17876 | #endif |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 17877 | .extract_offchan_data_tx_compl_param = |
| 17878 | extract_offchan_data_tx_compl_param_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17879 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 17880 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 17881 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 17882 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 17883 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 17884 | .extract_peer_stats = extract_peer_stats_tlv, |
| 17885 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 17886 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 17887 | .extract_chan_stats = extract_chan_stats_tlv, |
| 17888 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 17889 | .extract_profile_data = extract_profile_data_tlv, |
| 17890 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 17891 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 17892 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 17893 | .send_encrypt_decrypt_send_cmd = |
| 17894 | send_encrypt_decrypt_send_cmd_tlv, |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 17895 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 17896 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17897 | .send_multiple_vdev_restart_req_cmd = |
| 17898 | send_multiple_vdev_restart_req_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17899 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 17900 | .extract_hw_mode_cap_service_ready_ext = |
| 17901 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 17902 | .extract_mac_phy_cap_service_ready_ext = |
| 17903 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 17904 | .extract_reg_cap_service_ready_ext = |
| 17905 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17906 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 17907 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 17908 | .extract_dcs_interference_type = extract_dcs_interference_type_tlv, |
| 17909 | .extract_dcs_cw_int = extract_dcs_cw_int_tlv, |
| 17910 | .extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 17911 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 17912 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 17913 | .extract_peer_delete_response_event = |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 17914 | extract_peer_delete_response_event_tlv, |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 17915 | .is_management_record = is_management_record_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17916 | .extract_pdev_csa_switch_count_status = |
| 17917 | extract_pdev_csa_switch_count_status_tlv, |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 17918 | .extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv, |
| 17919 | .extract_wds_addr_event = extract_wds_addr_event_tlv, |
| 17920 | .extract_peer_sta_ps_statechange_ev = |
| 17921 | extract_peer_sta_ps_statechange_ev_tlv, |
| 17922 | .extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv, |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 17923 | .send_per_roam_config_cmd = send_per_roam_config_cmd_tlv, |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 17924 | .send_dfs_phyerr_offload_en_cmd = send_dfs_phyerr_offload_en_cmd_tlv, |
| 17925 | .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] | 17926 | .extract_reg_chan_list_update_event = |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17927 | extract_reg_chan_list_update_event_tlv, |
| 17928 | .extract_chainmask_tables = |
| 17929 | extract_chainmask_tables_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 17930 | .extract_thermal_stats = extract_thermal_stats_tlv, |
| 17931 | .extract_thermal_level_stats = extract_thermal_level_stats_tlv, |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 17932 | #ifdef DFS_COMPONENT_ENABLE |
| 17933 | .extract_dfs_cac_complete_event = extract_dfs_cac_complete_event_tlv, |
| 17934 | .extract_dfs_radar_detection_event = |
| 17935 | extract_dfs_radar_detection_event_tlv, |
| 17936 | #endif |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17937 | .convert_pdev_id_host_to_target = |
| 17938 | convert_host_pdev_id_to_target_pdev_id_legacy, |
| 17939 | .convert_pdev_id_target_to_host = |
| 17940 | convert_target_pdev_id_to_host_pdev_id_legacy, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 17941 | }; |
| 17942 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17943 | /** |
| 17944 | * populate_tlv_event_id() - populates wmi event ids |
| 17945 | * |
| 17946 | * @param event_ids: Pointer to hold event ids |
| 17947 | * Return: None |
| 17948 | */ |
| 17949 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 17950 | { |
| 17951 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 17952 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 17953 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 17954 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 17955 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 17956 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 17957 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 17958 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 17959 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 17960 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 17961 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 17962 | event_ids[wmi_service_ready_ext_event_id] = |
| 17963 | WMI_SERVICE_READY_EXT_EVENTID; |
| 17964 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 17965 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 17966 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 17967 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 17968 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 17969 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 17970 | |
| 17971 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 17972 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 17973 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 17974 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 17975 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 17976 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 17977 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 17978 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 17979 | event_ids[wmi_peer_delete_response_event_id] = |
| 17980 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17981 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 17982 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 17983 | event_ids[wmi_tbttoffset_update_event_id] = |
| 17984 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
| 17985 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 17986 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 17987 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 17988 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 17989 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 17990 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 17991 | |
| 17992 | event_ids[wmi_tx_delba_complete_event_id] = |
| 17993 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 17994 | event_ids[wmi_tx_addba_complete_event_id] = |
| 17995 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 17996 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 17997 | |
| 17998 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 17999 | |
| 18000 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 18001 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 18002 | |
| 18003 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 18004 | |
| 18005 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 18006 | |
| 18007 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
Wu Gao | 84ed340 | 2017-03-15 19:12:20 +0800 | [diff] [blame] | 18008 | event_ids[wmi_p2p_lo_stop_event_id] = |
| 18009 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18010 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 18011 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 18012 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 18013 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 18014 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 18015 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 18016 | |
| 18017 | event_ids[wmi_rtt_meas_report_event_id] = |
| 18018 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 18019 | event_ids[wmi_tsf_meas_report_event_id] = |
| 18020 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 18021 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 18022 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 18023 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 18024 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 18025 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 18026 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 18027 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 18028 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 18029 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 18030 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 18031 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 18032 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 18033 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 18034 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 18035 | |
| 18036 | event_ids[wmi_gtk_offload_status_event_id] = |
| 18037 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 18038 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 18039 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 18040 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 18041 | |
| 18042 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 18043 | |
| 18044 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 18045 | |
| 18046 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 18047 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 18048 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 18049 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 18050 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 18051 | event_ids[wmi_wlan_profile_data_event_id] = |
| 18052 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 18053 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 18054 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 18055 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 18056 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 18057 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 18058 | |
| 18059 | event_ids[wmi_diag_container_event_id] = |
| 18060 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 18061 | |
| 18062 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 18063 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 18064 | |
| 18065 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 18066 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 18067 | |
| 18068 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 18069 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 18070 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 18071 | |
| 18072 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 18073 | |
| 18074 | /** Set OCB Sched Response, deprecated */ |
| 18075 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 18076 | |
| 18077 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 18078 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 18079 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 18080 | |
| 18081 | /* GPIO Event */ |
| 18082 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 18083 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 18084 | |
| 18085 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 18086 | event_ids[wmi_rfkill_state_change_event_id] = |
| 18087 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 18088 | |
| 18089 | /* TDLS Event */ |
| 18090 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 18091 | |
| 18092 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 18093 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 18094 | event_ids[wmi_batch_scan_result_event_id] = |
| 18095 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 18096 | /* OEM Event */ |
| 18097 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 18098 | event_ids[wmi_oem_meas_report_event_id] = |
| 18099 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 18100 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 18101 | |
| 18102 | /* NAN Event */ |
| 18103 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 18104 | |
| 18105 | /* LPI Event */ |
| 18106 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 18107 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 18108 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 18109 | |
| 18110 | /* ExtScan events */ |
| 18111 | event_ids[wmi_extscan_start_stop_event_id] = |
| 18112 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 18113 | event_ids[wmi_extscan_operation_event_id] = |
| 18114 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 18115 | event_ids[wmi_extscan_table_usage_event_id] = |
| 18116 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 18117 | event_ids[wmi_extscan_cached_results_event_id] = |
| 18118 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 18119 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 18120 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 18121 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 18122 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 18123 | event_ids[wmi_extscan_capabilities_event_id] = |
| 18124 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 18125 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 18126 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 18127 | |
| 18128 | /* mDNS offload events */ |
| 18129 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 18130 | |
| 18131 | /* SAP Authentication offload events */ |
| 18132 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 18133 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 18134 | |
| 18135 | /** Out-of-context-of-bss (OCB) events */ |
| 18136 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 18137 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 18138 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 18139 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 18140 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 18141 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 18142 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 18143 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 18144 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 18145 | /* System-On-Chip events */ |
| 18146 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 18147 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 18148 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 18149 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 18150 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 18151 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 18152 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 18153 | event_ids[wmi_pdev_csa_switch_count_status_event_id] = |
| 18154 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID; |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18155 | event_ids[wmi_reg_chan_list_cc_event_id] = WMI_REG_CHAN_LIST_CC_EVENTID; |
Sathish Kumar | f91f5a9 | 2017-03-22 15:37:26 +0530 | [diff] [blame] | 18156 | event_ids[wmi_inst_rssi_stats_event_id] = WMI_INST_RSSI_STATS_EVENTID; |
| 18157 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 18158 | event_ids[wmi_peer_sta_ps_statechg_event_id] = |
| 18159 | WMI_PEER_STA_PS_STATECHG_EVENTID; |
| 18160 | event_ids[wmi_pdev_channel_hopping_event_id] = |
| 18161 | WMI_PDEV_CHANNEL_HOPPING_EVENTID; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 18162 | event_ids[wmi_offchan_data_tx_completion_event] = |
| 18163 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18164 | event_ids[wmi_dfs_cac_complete_id] = WMI_VDEV_DFS_CAC_COMPLETE_EVENTID; |
| 18165 | event_ids[wmi_dfs_radar_detection_event_id] = |
| 18166 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID; |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 18167 | event_ids[wmi_tt_stats_event_id] = WMI_THERM_THROT_STATS_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18168 | } |
| 18169 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 18170 | #ifndef CONFIG_MCL |
| 18171 | /** |
| 18172 | * populate_tlv_service() - populates wmi services |
| 18173 | * |
| 18174 | * @param wmi_service: Pointer to hold wmi_service |
| 18175 | * Return: None |
| 18176 | */ |
| 18177 | static void populate_tlv_service(uint32_t *wmi_service) |
| 18178 | { |
| 18179 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
| 18180 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 18181 | wmi_service[wmi_service_roam_scan_offload] = |
| 18182 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 18183 | wmi_service[wmi_service_bcn_miss_offload] = |
| 18184 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 18185 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 18186 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 18187 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 18188 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 18189 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 18190 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 18191 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 18192 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 18193 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 18194 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 18195 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 18196 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 18197 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 18198 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 18199 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 18200 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 18201 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 18202 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 18203 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 18204 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 18205 | wmi_service[wmi_service_packet_power_save] = |
| 18206 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 18207 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 18208 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 18209 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 18210 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 18211 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 18212 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 18213 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 18214 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 18215 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 18216 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 18217 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 18218 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 18219 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 18220 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 18221 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 18222 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 18223 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 18224 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 18225 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 18226 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 18227 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 18228 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 18229 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 18230 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 18231 | wmi_service[wmi_service_lte_ant_share_support] = |
| 18232 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 18233 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 18234 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 18235 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 18236 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 18237 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 18238 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 18239 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 18240 | wmi_service[wmi_service_bcn_txrate_override] = |
| 18241 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 18242 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 18243 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 18244 | wmi_service[wmi_service_estimate_linkspeed] = |
| 18245 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 18246 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 18247 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 18248 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 18249 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 18250 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 18251 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 18252 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 18253 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 18254 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 18255 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 18256 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 18257 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 18258 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 18259 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 18260 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 18261 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 18262 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 18263 | wmi_service[wmi_service_sap_auth_offload] = |
| 18264 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 18265 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 18266 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 18267 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 18268 | wmi_service[wmi_service_ap_arpns_offload] = |
| 18269 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 18270 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 18271 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 18272 | wmi_service[wmi_service_packet_filter_offload] = |
| 18273 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 18274 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 18275 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 18276 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 18277 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 18278 | wmi_service[wmi_service_multiple_vdev_restart] = |
| 18279 | WMI_SERVICE_MULTIPLE_VDEV_RESTART; |
| 18280 | |
| 18281 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 18282 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 18283 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 18284 | WMI_SERVICE_UNAVAILABLE; |
| 18285 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 18286 | WMI_SERVICE_UNAVAILABLE; |
| 18287 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 18288 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 18289 | wmi_service[wmi_service_atf] = WMI_SERVICE_ATF; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 18290 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 18291 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 18292 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 18293 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 18294 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 18295 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 18296 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 18297 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 18298 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 18299 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 18300 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 18301 | WMI_SERVICE_UNAVAILABLE; |
| 18302 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 18303 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 18304 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 18305 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
| 18306 | wmi_service[wmi_service_4_wire_coex_support] = WMI_SERVICE_UNAVAILABLE; |
| 18307 | wmi_service[wmi_service_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
Kiran Venkatappa | 95c82a6 | 2017-05-10 14:34:17 +0530 | [diff] [blame] | 18308 | wmi_service[wmi_service_peer_assoc_conf] = WMI_SERVICE_PEER_ASSOC_CONF; |
| 18309 | wmi_service[wmi_service_egap] = WMI_SERVICE_EGAP; |
| 18310 | wmi_service[wmi_service_sta_pmf_offload] = WMI_SERVICE_STA_PMF_OFFLOAD; |
| 18311 | wmi_service[wmi_service_unified_wow_capability] = |
| 18312 | WMI_SERVICE_UNIFIED_WOW_CAPABILITY; |
| 18313 | wmi_service[wmi_service_enterprise_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
| 18314 | wmi_service[wmi_service_bpf_offload] = WMI_SERVICE_BPF_OFFLOAD; |
| 18315 | wmi_service[wmi_service_sync_delete_cmds] = |
| 18316 | WMI_SERVICE_SYNC_DELETE_CMDS; |
| 18317 | wmi_service[wmi_service_ratectrl_limit_max_min_rates] = |
| 18318 | WMI_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES; |
| 18319 | wmi_service[wmi_service_nan_data] = WMI_SERVICE_NAN_DATA; |
| 18320 | wmi_service[wmi_service_nan_rtt] = WMI_SERVICE_NAN_RTT; |
| 18321 | wmi_service[wmi_service_11ax] = WMI_SERVICE_11AX; |
| 18322 | wmi_service[wmi_service_deprecated_replace] = |
| 18323 | WMI_SERVICE_DEPRECATED_REPLACE; |
| 18324 | wmi_service[wmi_service_tdls_conn_tracker_in_host_mode] = |
| 18325 | WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE; |
| 18326 | wmi_service[wmi_service_enhanced_mcast_filter] = |
| 18327 | WMI_SERVICE_ENHANCED_MCAST_FILTER; |
| 18328 | wmi_service[wmi_service_half_rate_quarter_rate_support] = |
| 18329 | WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT; |
| 18330 | wmi_service[wmi_service_vdev_rx_filter] = WMI_SERVICE_VDEV_RX_FILTER; |
| 18331 | wmi_service[wmi_service_p2p_listen_offload_support] = |
| 18332 | WMI_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT; |
| 18333 | wmi_service[wmi_service_mark_first_wakeup_packet] = |
| 18334 | WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET; |
| 18335 | wmi_service[wmi_service_multiple_mcast_filter_set] = |
| 18336 | WMI_SERVICE_MULTIPLE_MCAST_FILTER_SET; |
| 18337 | wmi_service[wmi_service_host_managed_rx_reorder] = |
| 18338 | WMI_SERVICE_HOST_MANAGED_RX_REORDER; |
| 18339 | wmi_service[wmi_service_flash_rdwr_support] = |
| 18340 | WMI_SERVICE_FLASH_RDWR_SUPPORT; |
| 18341 | wmi_service[wmi_service_wlan_stats_report] = |
| 18342 | WMI_SERVICE_WLAN_STATS_REPORT; |
| 18343 | wmi_service[wmi_service_tx_msdu_id_new_partition_support] = |
| 18344 | WMI_SERVICE_TX_MSDU_ID_NEW_PARTITION_SUPPORT; |
| 18345 | wmi_service[wmi_service_dfs_phyerr_offload] = |
| 18346 | WMI_SERVICE_DFS_PHYERR_OFFLOAD; |
| 18347 | wmi_service[wmi_service_rcpi_support] = WMI_SERVICE_RCPI_SUPPORT; |
| 18348 | wmi_service[wmi_service_fw_mem_dump_support] = |
| 18349 | WMI_SERVICE_FW_MEM_DUMP_SUPPORT; |
| 18350 | wmi_service[wmi_service_peer_stats_info] = WMI_SERVICE_PEER_STATS_INFO; |
| 18351 | wmi_service[wmi_service_regulatory_db] = WMI_SERVICE_REGULATORY_DB; |
| 18352 | wmi_service[wmi_service_11d_offload] = WMI_SERVICE_11D_OFFLOAD; |
| 18353 | wmi_service[wmi_service_hw_data_filtering] = |
| 18354 | WMI_SERVICE_HW_DATA_FILTERING; |
| 18355 | wmi_service[wmi_service_pkt_routing] = WMI_SERVICE_PKT_ROUTING; |
| 18356 | wmi_service[wmi_service_offchan_tx_wmi] = WMI_SERVICE_OFFCHAN_TX_WMI; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 18357 | } |
| 18358 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18359 | /** |
| 18360 | * populate_pdev_param_tlv() - populates pdev params |
| 18361 | * |
| 18362 | * @param pdev_param: Pointer to hold pdev params |
| 18363 | * Return: None |
| 18364 | */ |
| 18365 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 18366 | { |
| 18367 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 18368 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 18369 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 18370 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 18371 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 18372 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 18373 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 18374 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 18375 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 18376 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 18377 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 18378 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 18379 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 18380 | pdev_param[wmi_pdev_param_protection_mode] = |
| 18381 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 18382 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 18383 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 18384 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 18385 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 18386 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 18387 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 18388 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 18389 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 18390 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 18391 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 18392 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 18393 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 18394 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 18395 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 18396 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 18397 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 18398 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 18399 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 18400 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 18401 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 18402 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 18403 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 18404 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 18405 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 18406 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 18407 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 18408 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 18409 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 18410 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 18411 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 18412 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 18413 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 18414 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 18415 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 18416 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 18417 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 18418 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 18419 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 18420 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 18421 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 18422 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 18423 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 18424 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 18425 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 18426 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 18427 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 18428 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 18429 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 18430 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 18431 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 18432 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 18433 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 18434 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 18435 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 18436 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 18437 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 18438 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 18439 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 18440 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 18441 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 18442 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 18443 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 18444 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 18445 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 18446 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 18447 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 18448 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 18449 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 18450 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 18451 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 18452 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 18453 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 18454 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 18455 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 18456 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 18457 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 18458 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 18459 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 18460 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 18461 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 18462 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 18463 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 18464 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 18465 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 18466 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 18467 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 18468 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 18469 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 18470 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 18471 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 18472 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 18473 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 18474 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 18475 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 18476 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 18477 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 18478 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 18479 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 18480 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 18481 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 18482 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 18483 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 18484 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 18485 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 18486 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 18487 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 18488 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 18489 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 18490 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 18491 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 18492 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 18493 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 18494 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 18495 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 18496 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 18497 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 18498 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
| 18499 | pdev_param[wmi_pdev_param_rx_filter] = WMI_UNAVAILABLE_PARAM; |
| 18500 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = WMI_UNAVAILABLE_PARAM; |
| 18501 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = WMI_UNAVAILABLE_PARAM; |
| 18502 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_UNAVAILABLE_PARAM; |
| 18503 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
| 18504 | WMI_UNAVAILABLE_PARAM; |
| 18505 | pdev_param[wmi_pdev_param_proxy_sta_mode] = WMI_UNAVAILABLE_PARAM; |
| 18506 | pdev_param[wmi_pdev_param_mu_group_policy] = WMI_UNAVAILABLE_PARAM; |
| 18507 | pdev_param[wmi_pdev_param_noise_detection] = WMI_UNAVAILABLE_PARAM; |
| 18508 | pdev_param[wmi_pdev_param_noise_threshold] = WMI_UNAVAILABLE_PARAM; |
| 18509 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_UNAVAILABLE_PARAM; |
| 18510 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = WMI_UNAVAILABLE_PARAM; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 18511 | pdev_param[wmi_pdev_param_atf_strict_sch] = |
| 18512 | WMI_PDEV_PARAM_ATF_STRICT_SCH; |
| 18513 | pdev_param[wmi_pdev_param_atf_sched_duration] = |
| 18514 | WMI_PDEV_PARAM_ATF_SCHED_DURATION; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18515 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_UNAVAILABLE_PARAM; |
| 18516 | pdev_param[wmi_pdev_param_sensitivity_level] = WMI_UNAVAILABLE_PARAM; |
| 18517 | pdev_param[wmi_pdev_param_signed_txpower_2g] = WMI_UNAVAILABLE_PARAM; |
| 18518 | pdev_param[wmi_pdev_param_signed_txpower_5g] = WMI_UNAVAILABLE_PARAM; |
| 18519 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = WMI_UNAVAILABLE_PARAM; |
| 18520 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = WMI_UNAVAILABLE_PARAM; |
| 18521 | pdev_param[wmi_pdev_param_cca_threshold] = WMI_UNAVAILABLE_PARAM; |
| 18522 | pdev_param[wmi_pdev_param_rts_fixed_rate] = WMI_UNAVAILABLE_PARAM; |
| 18523 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
| 18524 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_UNAVAILABLE_PARAM; |
| 18525 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = WMI_UNAVAILABLE_PARAM; |
| 18526 | pdev_param[wmi_pdev_param_arp_srcaddr] = WMI_UNAVAILABLE_PARAM; |
| 18527 | pdev_param[wmi_pdev_param_arp_dstaddr] = WMI_UNAVAILABLE_PARAM; |
| 18528 | pdev_param[wmi_pdev_param_txpower_decr_db] = WMI_UNAVAILABLE_PARAM; |
| 18529 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 18530 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 18531 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = |
| 18532 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCH; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18533 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 18534 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCALING_FACTOR; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18535 | pdev_param[wmi_pdev_param_cust_txpower_scale] = WMI_UNAVAILABLE_PARAM; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 18536 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = |
| 18537 | WMI_PDEV_PARAM_ATF_DYNAMIC_ENABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18538 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 18539 | WMI_UNAVAILABLE_PARAM; |
| 18540 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 18541 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
| 18542 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_UNAVAILABLE_PARAM; |
| 18543 | pdev_param[wmi_pdev_param_block_interbss] = WMI_UNAVAILABLE_PARAM; |
| 18544 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
| 18545 | WMI_UNAVAILABLE_PARAM; |
| 18546 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = WMI_UNAVAILABLE_PARAM; |
| 18547 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
| 18548 | WMI_UNAVAILABLE_PARAM; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 18549 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 18550 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18551 | pdev_param[wmi_pdev_param_en_stats] = WMI_UNAVAILABLE_PARAM; |
Venkateswara Swamy Bandaru | 21cc1ca | 2017-02-24 17:09:46 +0530 | [diff] [blame] | 18552 | pdev_param[wmi_pdev_param_mesh_mcast_enable] = |
| 18553 | WMI_PDEV_PARAM_MESH_MCAST_ENABLE; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 18554 | pdev_param[wmi_pdev_param_set_promisc_mode_cmdid] = |
| 18555 | WMI_PDEV_PARAM_SET_PROMISC_MODE_CMDID; |
| 18556 | pdev_param[wmi_pdev_param_set_ppdu_duration_cmdid] = |
| 18557 | WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID; |
| 18558 | pdev_param[wmi_pdev_param_igmpmld_ac_override] = |
| 18559 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
| 18560 | pdev_param[wmi_pdev_param_remove_mcast2ucast_buffer] = |
| 18561 | WMI_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER; |
| 18562 | pdev_param[wmi_pdev_param_set_mcast2ucast_buffer] = |
| 18563 | WMI_PDEV_PARAM_SET_MCAST2UCAST_BUFFER; |
| 18564 | pdev_param[wmi_pdev_param_set_mcast2ucast_mode] = |
| 18565 | WMI_PDEV_PARAM_SET_MCAST2UCAST_MODE; |
| 18566 | pdev_param[wmi_pdev_param_smart_antenna_default_antenna] = |
| 18567 | WMI_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA; |
| 18568 | pdev_param[wmi_pdev_param_fast_channel_reset] = |
| 18569 | WMI_PDEV_PARAM_FAST_CHANNEL_RESET; |
| 18570 | 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] | 18571 | } |
| 18572 | |
| 18573 | /** |
| 18574 | * populate_vdev_param_tlv() - populates vdev params |
| 18575 | * |
| 18576 | * @param vdev_param: Pointer to hold vdev params |
| 18577 | * Return: None |
| 18578 | */ |
| 18579 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 18580 | { |
| 18581 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 18582 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 18583 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 18584 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 18585 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 18586 | vdev_param[wmi_vdev_param_listen_interval] = |
| 18587 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 18588 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 18589 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 18590 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 18591 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 18592 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 18593 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 18594 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 18595 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 18596 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 18597 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 18598 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 18599 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 18600 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 18601 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 18602 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 18603 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 18604 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 18605 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 18606 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 18607 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 18608 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 18609 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 18610 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 18611 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 18612 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 18613 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 18614 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 18615 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 18616 | vdev_param[wmi_vdev_param_protection_mode] = |
| 18617 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 18618 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 18619 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 18620 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 18621 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 18622 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 18623 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 18624 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 18625 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 18626 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 18627 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 18628 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 18629 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 18630 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 18631 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 18632 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 18633 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 18634 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 18635 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 18636 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 18637 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 18638 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 18639 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 18640 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 18641 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 18642 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 18643 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 18644 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 18645 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 18646 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 18647 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 18648 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 18649 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 18650 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 18651 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 18652 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 18653 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 18654 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 18655 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 18656 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 18657 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 18658 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 18659 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 18660 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 18661 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 18662 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 18663 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 18664 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 18665 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 18666 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 18667 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 18668 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 18669 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 18670 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 18671 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 18672 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 18673 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 18674 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 18675 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 18676 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 18677 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 18678 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 18679 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 18680 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 18681 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 18682 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 18683 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 18684 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 18685 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 18686 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 18687 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 18688 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 18689 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 18690 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 18691 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 18692 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 18693 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 18694 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 18695 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 18696 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 18697 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 18698 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 18699 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 18700 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 18701 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 18702 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 18703 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 18704 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 18705 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 18706 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 18707 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Kalyan Tallapragada | d9a6abd | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 18708 | 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] | 18709 | vdev_param[wmi_vdev_param_he_dcm_enable] = WMI_VDEV_PARAM_HE_DCM; |
| 18710 | vdev_param[wmi_vdev_param_he_range_ext_enable] = |
| 18711 | WMI_VDEV_PARAM_HE_RANGE_EXT; |
| 18712 | vdev_param[wmi_vdev_param_he_bss_color] = WMI_VDEV_PARAM_BSS_COLOR; |
| 18713 | 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] | 18714 | vdev_param[wmi_vdev_param_sensor_ap] = WMI_VDEV_PARAM_SENSOR_AP; |
| 18715 | vdev_param[wmi_vdev_param_dtim_enable_cts] = |
| 18716 | WMI_VDEV_PARAM_DTIM_ENABLE_CTS; |
| 18717 | vdev_param[wmi_vdev_param_atf_ssid_sched_policy] = |
| 18718 | WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY; |
| 18719 | vdev_param[wmi_vdev_param_disable_dyn_bw_rts] = |
| 18720 | WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS; |
Sathish Kumar | 2ac4070 | 2017-03-22 19:18:45 +0530 | [diff] [blame] | 18721 | vdev_param[wmi_vdev_param_mcast2ucast_set] = |
| 18722 | WMI_VDEV_PARAM_MCAST2UCAST_SET; |
| 18723 | vdev_param[wmi_vdev_param_rc_num_retries] = |
| 18724 | WMI_VDEV_PARAM_RC_NUM_RETRIES; |
| 18725 | vdev_param[wmi_vdev_param_cabq_maxdur] = WMI_VDEV_PARAM_CABQ_MAXDUR; |
| 18726 | vdev_param[wmi_vdev_param_mfptest_set] = WMI_VDEV_PARAM_MFPTEST_SET; |
| 18727 | vdev_param[wmi_vdev_param_rts_fixed_rate] = |
| 18728 | WMI_VDEV_PARAM_RTS_FIXED_RATE; |
| 18729 | vdev_param[wmi_vdev_param_vht_sgimask] = WMI_VDEV_PARAM_VHT_SGIMASK; |
| 18730 | vdev_param[wmi_vdev_param_vht80_ratemask] = |
| 18731 | WMI_VDEV_PARAM_VHT80_RATEMASK; |
| 18732 | vdev_param[wmi_vdev_param_proxy_sta] = WMI_VDEV_PARAM_PROXY_STA; |
| 18733 | vdev_param[wmi_vdev_param_bw_nss_ratemask] = |
| 18734 | WMI_VDEV_PARAM_BW_NSS_RATEMASK; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18735 | } |
| 18736 | #endif |
| 18737 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18738 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 18739 | * populate_target_defines_tlv() - Populate target defines and params |
| 18740 | * @wmi_handle: pointer to wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18741 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 18742 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18743 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 18744 | #ifndef CONFIG_MCL |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 18745 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18746 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18747 | populate_tlv_service(wmi_handle->services); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18748 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 18749 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 18750 | } |
| 18751 | #else |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 18752 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
| 18753 | { } |
| 18754 | #endif |
| 18755 | |
| 18756 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18757 | * convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from |
| 18758 | * host to target defines. |
| 18759 | * @param pdev_id: host pdev_id to be converted. |
| 18760 | * Return: target pdev_id after conversion. |
| 18761 | */ |
| 18762 | static uint32_t convert_host_pdev_id_to_target_pdev_id(uint32_t pdev_id) |
| 18763 | { |
| 18764 | switch (pdev_id) { |
| 18765 | case WMI_HOST_PDEV_ID_SOC: |
| 18766 | return WMI_PDEV_ID_SOC; |
| 18767 | case WMI_HOST_PDEV_ID_0: |
| 18768 | return WMI_PDEV_ID_1ST; |
| 18769 | case WMI_HOST_PDEV_ID_1: |
| 18770 | return WMI_PDEV_ID_2ND; |
| 18771 | case WMI_HOST_PDEV_ID_2: |
| 18772 | return WMI_PDEV_ID_3RD; |
| 18773 | } |
| 18774 | |
| 18775 | QDF_ASSERT(0); |
| 18776 | |
| 18777 | return WMI_PDEV_ID_SOC; |
| 18778 | } |
| 18779 | |
| 18780 | /** |
| 18781 | * convert_target_pdev_id_to_host_pdev_id() - Convert pdev_id from |
| 18782 | * target to host defines. |
| 18783 | * @param pdev_id: target pdev_id to be converted. |
| 18784 | * Return: host pdev_id after conversion. |
| 18785 | */ |
| 18786 | static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id) |
| 18787 | { |
| 18788 | switch (pdev_id) { |
| 18789 | case WMI_PDEV_ID_SOC: |
| 18790 | return WMI_HOST_PDEV_ID_SOC; |
| 18791 | case WMI_PDEV_ID_1ST: |
| 18792 | return WMI_HOST_PDEV_ID_0; |
| 18793 | case WMI_PDEV_ID_2ND: |
| 18794 | return WMI_HOST_PDEV_ID_1; |
| 18795 | case WMI_PDEV_ID_3RD: |
| 18796 | return WMI_HOST_PDEV_ID_2; |
| 18797 | } |
| 18798 | |
| 18799 | QDF_ASSERT(0); |
| 18800 | |
| 18801 | return WMI_HOST_PDEV_ID_SOC; |
| 18802 | } |
| 18803 | |
| 18804 | /** |
| 18805 | * wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion |
| 18806 | * |
| 18807 | * Return None. |
| 18808 | */ |
| 18809 | void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle) |
| 18810 | { |
| 18811 | wmi_handle->ops->convert_pdev_id_host_to_target = |
| 18812 | convert_host_pdev_id_to_target_pdev_id; |
| 18813 | wmi_handle->ops->convert_pdev_id_target_to_host = |
| 18814 | convert_target_pdev_id_to_host_pdev_id; |
| 18815 | } |
| 18816 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 18817 | * wmi_tlv_attach() - Attach TLV APIs |
| 18818 | * |
| 18819 | * Return: None |
| 18820 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 18821 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18822 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 18823 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18824 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 18825 | wmi_handle->log_info.buf_offset_command = 2; |
| 18826 | wmi_handle->log_info.buf_offset_event = 4; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18827 | #endif |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 18828 | populate_tlv_events_id(wmi_handle->wmi_events); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 18829 | populate_target_defines_tlv(wmi_handle); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 18830 | } |